From 9b12cef29cfe161db84fbd774edacc55477570b0 Mon Sep 17 00:00:00 2001 From: pan <1029559041@qq.com> Date: Thu, 10 Jun 2021 14:42:00 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B4=BB=E5=8A=A8=E7=82=B9=E8=B5=9E=E4=B8=8E?= =?UTF-8?q?=E6=94=B6=E8=97=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Former-commit-id: 0655cd2c64fc5eb347a410194933059dd64e410b --- .../com/gyf/csams/main/model/MenuViewModel.kt | 2 +- .../java/com/gyf/csams/uikit/CheckForm.kt | 8 +- build.gradle.kts | 2 +- .../debug/background-debug.aab.REMOVED.git-id | 1 + .../debug/foreground-debug.aab.REMOVED.git-id | 1 + .../libs/BaiduLBS_Android.jar.REMOVED.git-id | 1 + .../background-release.aab.REMOVED.git-id | 1 + .../foreground-release.aab.REMOVED.git-id | 1 + foreground/src/main/AndroidManifest.xml | 4 + .../activity/model/ActivityDetailViewModel.kt | 41 ++++-- .../csams/activity/model/TendencyViewModel.kt | 32 +++++ .../activity/ui/ActivityDetailActivity.kt | 57 ++++---- .../gyf/csams/activity/ui/TendencyActivity.kt | 58 ++++++++ .../association/model/AssociationViewModel.kt | 2 +- .../association/ui/AssociationActivity.kt | 67 +--------- .../csams/association/ui/RenameActivity.kt | 1 - .../com/gyf/csams/main/ui/MainActivity.kt | 25 +++- .../main/java/com/gyf/csams/uikit/Activies.kt | 72 ++++++++++ .../main/java/com/gyf/csams/uikit/BaseView.kt | 3 +- .../main/java/com/gyf/csams/util/GsonUtil.kt | 125 ------------------ .../java/com/gyf/csams/util/HttpCallback.kt | 28 ---- ...ibBaiduMapSDK_map_v7_3_0.so.REMOVED.git-id | 1 + .../libgnustl_shared.so.REMOVED.git-id | 1 + ...ibBaiduMapSDK_map_v7_3_0.so.REMOVED.git-id | 1 + ...ibBaiduMapSDK_map_v7_3_0.so.REMOVED.git-id | 1 + ...ibBaiduMapSDK_map_v7_3_0.so.REMOVED.git-id | 1 + .../x86/libgnustl_shared.so.REMOVED.git-id | 1 + ...ibBaiduMapSDK_map_v7_3_0.so.REMOVED.git-id | 1 + .../x86_64/libgnustl_shared.so.REMOVED.git-id | 1 + .../drawable/mb_bg_fb_01.png.REMOVED.git-id | 1 + .../drawable/mb_bg_fb_02.png.REMOVED.git-id | 1 + .../drawable/mb_bg_fb_03.png.REMOVED.git-id | 1 + .../drawable/mb_bg_fb_04.png.REMOVED.git-id | 1 + .../drawable/mb_bg_fb_06.png.REMOVED.git-id | 1 + .../drawable/mb_bg_fb_07.png.REMOVED.git-id | 1 + .../drawable/mb_bg_fb_08.png.REMOVED.git-id | 1 + .../drawable/mb_bg_fb_09.png.REMOVED.git-id | 1 + .../drawable/mb_bg_fb_25.png.REMOVED.git-id | 1 + .../mb_bg_fb_25_180.png.REMOVED.git-id | 1 + .../drawable/mb_bg_fb_26.png.REMOVED.git-id | 1 + .../drawable/mb_bg_fb_27.png.REMOVED.git-id | 1 + .../drawable/mb_bg_fb_28.png.REMOVED.git-id | 1 + foreground/src/main/res/values-en/strings.xml | 2 + foreground/src/main/res/values-zh/strings.xml | 2 + foreground/src/main/res/values/strings.xml | 2 + .../com/gyf/lib/model/SysMessageViewModel.kt | 4 +- lib/src/main/java/com/gyf/lib/util/Api.kt | 11 +- 47 files changed, 303 insertions(+), 271 deletions(-) create mode 100644 foreground/debug/background-debug.aab.REMOVED.git-id create mode 100644 foreground/debug/foreground-debug.aab.REMOVED.git-id create mode 100644 foreground/libs/BaiduLBS_Android.jar.REMOVED.git-id create mode 100644 foreground/release/background-release.aab.REMOVED.git-id create mode 100644 foreground/release/foreground-release.aab.REMOVED.git-id create mode 100644 foreground/src/main/java/com/gyf/csams/activity/model/TendencyViewModel.kt create mode 100644 foreground/src/main/java/com/gyf/csams/activity/ui/TendencyActivity.kt create mode 100644 foreground/src/main/java/com/gyf/csams/uikit/Activies.kt delete mode 100644 foreground/src/main/java/com/gyf/csams/util/GsonUtil.kt delete mode 100644 foreground/src/main/java/com/gyf/csams/util/HttpCallback.kt create mode 100644 foreground/src/main/jniLibs/arm64-v8a/libBaiduMapSDK_map_v7_3_0.so.REMOVED.git-id create mode 100644 foreground/src/main/jniLibs/arm64-v8a/libgnustl_shared.so.REMOVED.git-id create mode 100644 foreground/src/main/jniLibs/armeabi-v7a/libBaiduMapSDK_map_v7_3_0.so.REMOVED.git-id create mode 100644 foreground/src/main/jniLibs/armeabi/libBaiduMapSDK_map_v7_3_0.so.REMOVED.git-id create mode 100644 foreground/src/main/jniLibs/x86/libBaiduMapSDK_map_v7_3_0.so.REMOVED.git-id create mode 100644 foreground/src/main/jniLibs/x86/libgnustl_shared.so.REMOVED.git-id create mode 100644 foreground/src/main/jniLibs/x86_64/libBaiduMapSDK_map_v7_3_0.so.REMOVED.git-id create mode 100644 foreground/src/main/jniLibs/x86_64/libgnustl_shared.so.REMOVED.git-id create mode 100644 foreground/src/main/res/drawable/mb_bg_fb_01.png.REMOVED.git-id create mode 100644 foreground/src/main/res/drawable/mb_bg_fb_02.png.REMOVED.git-id create mode 100644 foreground/src/main/res/drawable/mb_bg_fb_03.png.REMOVED.git-id create mode 100644 foreground/src/main/res/drawable/mb_bg_fb_04.png.REMOVED.git-id create mode 100644 foreground/src/main/res/drawable/mb_bg_fb_06.png.REMOVED.git-id create mode 100644 foreground/src/main/res/drawable/mb_bg_fb_07.png.REMOVED.git-id create mode 100644 foreground/src/main/res/drawable/mb_bg_fb_08.png.REMOVED.git-id create mode 100644 foreground/src/main/res/drawable/mb_bg_fb_09.png.REMOVED.git-id create mode 100644 foreground/src/main/res/drawable/mb_bg_fb_25.png.REMOVED.git-id create mode 100644 foreground/src/main/res/drawable/mb_bg_fb_25_180.png.REMOVED.git-id create mode 100644 foreground/src/main/res/drawable/mb_bg_fb_26.png.REMOVED.git-id create mode 100644 foreground/src/main/res/drawable/mb_bg_fb_27.png.REMOVED.git-id create mode 100644 foreground/src/main/res/drawable/mb_bg_fb_28.png.REMOVED.git-id diff --git a/background/src/main/java/com/gyf/csams/main/model/MenuViewModel.kt b/background/src/main/java/com/gyf/csams/main/model/MenuViewModel.kt index 1a1cb5a..1f892c7 100644 --- a/background/src/main/java/com/gyf/csams/main/model/MenuViewModel.kt +++ b/background/src/main/java/com/gyf/csams/main/model/MenuViewModel.kt @@ -15,7 +15,7 @@ enum class MenuType(val desc: String, val clazz: Map Act( "活动管理", mapOf( "审核社团活动" to AuditActActivity::class.java, - "审核质量报告单" to CheckQualityReportActivity::class.java, + "审核活动报告" to CheckQualityReportActivity::class.java, "查看社团活动" to ManagerActActivity::class.java ) ) diff --git a/background/src/main/java/com/gyf/csams/uikit/CheckForm.kt b/background/src/main/java/com/gyf/csams/uikit/CheckForm.kt index 0f39d3d..24f427f 100644 --- a/background/src/main/java/com/gyf/csams/uikit/CheckForm.kt +++ b/background/src/main/java/com/gyf/csams/uikit/CheckForm.kt @@ -93,9 +93,7 @@ inline fun > CheckForm( result = result, cause = cause.getValue() ) { - scaffoldModel.update(message = it, actionLabel = "刷新") { - model.load() - } + model.load() } } } @@ -106,9 +104,7 @@ inline fun > CheckForm( model.accept( auditId = vo.audit.id ) { - scaffoldModel.update(message = it, actionLabel = "刷新") { - model.load() - } + model.load() } } } diff --git a/build.gradle.kts b/build.gradle.kts index efa3f6e..c33f4ab 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -16,7 +16,7 @@ buildscript { mavenCentral() } dependencies { - classpath("com.android.tools.build:gradle:7.1.0-alpha01") + classpath("com.android.tools.build:gradle:7.1.0-alpha02") classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:${kotlin_version}") // NOTE: Do not place your application dependencies here; they belong diff --git a/foreground/debug/background-debug.aab.REMOVED.git-id b/foreground/debug/background-debug.aab.REMOVED.git-id new file mode 100644 index 0000000..57d1349 --- /dev/null +++ b/foreground/debug/background-debug.aab.REMOVED.git-id @@ -0,0 +1 @@ +336c59a7cdc6f9b18fecb981ae5b14f6b7366d90 \ No newline at end of file diff --git a/foreground/debug/foreground-debug.aab.REMOVED.git-id b/foreground/debug/foreground-debug.aab.REMOVED.git-id new file mode 100644 index 0000000..0d3ae83 --- /dev/null +++ b/foreground/debug/foreground-debug.aab.REMOVED.git-id @@ -0,0 +1 @@ +a30262664371040b970f72f5089d69a476fed40b \ No newline at end of file diff --git a/foreground/libs/BaiduLBS_Android.jar.REMOVED.git-id b/foreground/libs/BaiduLBS_Android.jar.REMOVED.git-id new file mode 100644 index 0000000..28b111c --- /dev/null +++ b/foreground/libs/BaiduLBS_Android.jar.REMOVED.git-id @@ -0,0 +1 @@ +a524dd25e1d96e659662021decd71ed8bfce7a78 \ No newline at end of file diff --git a/foreground/release/background-release.aab.REMOVED.git-id b/foreground/release/background-release.aab.REMOVED.git-id new file mode 100644 index 0000000..f3aff03 --- /dev/null +++ b/foreground/release/background-release.aab.REMOVED.git-id @@ -0,0 +1 @@ +27a39082c3e76250c3bed8df065a0febcc36c901 \ No newline at end of file diff --git a/foreground/release/foreground-release.aab.REMOVED.git-id b/foreground/release/foreground-release.aab.REMOVED.git-id new file mode 100644 index 0000000..2c76410 --- /dev/null +++ b/foreground/release/foreground-release.aab.REMOVED.git-id @@ -0,0 +1 @@ +95c6b9f9e380ae08145d3219b820d65a3a7b268b \ No newline at end of file diff --git a/foreground/src/main/AndroidManifest.xml b/foreground/src/main/AndroidManifest.xml index c44cc94..693b5d4 100644 --- a/foreground/src/main/AndroidManifest.xml +++ b/foreground/src/main/AndroidManifest.xml @@ -89,7 +89,11 @@ + + + + \ No newline at end of file diff --git a/foreground/src/main/java/com/gyf/csams/activity/model/ActivityDetailViewModel.kt b/foreground/src/main/java/com/gyf/csams/activity/model/ActivityDetailViewModel.kt index a4b298b..64506d2 100644 --- a/foreground/src/main/java/com/gyf/csams/activity/model/ActivityDetailViewModel.kt +++ b/foreground/src/main/java/com/gyf/csams/activity/model/ActivityDetailViewModel.kt @@ -36,26 +36,41 @@ class ActivityInfoViewModel : ViewModel() { private val _activityDetailVo = MutableLiveData() val activityDetailVo: LiveData = _activityDetailVo - val like = "点赞" - val collect = "收藏" + val tendency = MutableLiveData() - - /** - * TODO 点赞 - * - * @param callback - */ - fun like(callback: (message: String) -> Unit) { - callback(NOT_IMPL_TIP) + fun checkTendency(activityId: Int) { + viewModelScope.launch { + HttpClient.post(url = Api.buildUrl(ActivityApi.CheckTendency), + callback = HttpCallback(action = "检查用户倾向", + onSuccess = { + it.body?.apply { tendency.postValue(this) } + }, typeToken = object : TypeToken>() {}.type + ), + jsonParam = + CheckTendencyVo(activityId = activityId, token = TokenManager.getToken()) + ) + } } /** - * TODO 收藏 + * 记录用户倾向 * + * @param type + * @param activityId * @param callback */ - fun collect(callback: (message: String) -> Unit) { - callback(NOT_IMPL_TIP) + fun tendency(type: TendencyType, activityId: Int, callback: (flag: Boolean) -> Unit) { + viewModelScope.launch { + HttpClient.post(url = Api.buildUrl(ActivityApi.Tendency), + callback = HttpCallback(action = "记录用户倾向", + onSuccess = { + it.body?.let(callback) + }, typeToken = object : TypeToken>() {}.type + ), + jsonParam = + TendencyVo(activityId = activityId, type = type, token = TokenManager.getToken()) + ) + } } /** diff --git a/foreground/src/main/java/com/gyf/csams/activity/model/TendencyViewModel.kt b/foreground/src/main/java/com/gyf/csams/activity/model/TendencyViewModel.kt new file mode 100644 index 0000000..f62c230 --- /dev/null +++ b/foreground/src/main/java/com/gyf/csams/activity/model/TendencyViewModel.kt @@ -0,0 +1,32 @@ +package com.gyf.csams.activity.model + +import android.app.Application +import androidx.lifecycle.viewModelScope +import com.google.gson.reflect.TypeToken +import com.gyf.csams.module.ActivityVo +import com.gyf.csams.module.ApiResponse +import com.gyf.csams.module.FindTendencyVo +import com.gyf.csams.module.TendencyType +import com.gyf.lib.model.ScrollViewModel +import com.gyf.lib.util.* +import kotlinx.coroutines.launch + +class TendencyViewModel(application: Application) : + ScrollViewModel(application = application) { + + fun load(type: TendencyType) { + viewModelScope.launch { + HttpClient.post( + url = Api.buildUrl(ActivityApi.FindTendency), + callback = HttpCallback>( + action = "加载${type.desc}活动", + onSuccess = { + it.body?.apply { _data.postValue(this) } + }, + typeToken = object : TypeToken>>() {}.type + ), + jsonParam = FindTendencyVo(type = type, token = TokenManager.getToken()) + ) + } + } +} \ No newline at end of file diff --git a/foreground/src/main/java/com/gyf/csams/activity/ui/ActivityDetailActivity.kt b/foreground/src/main/java/com/gyf/csams/activity/ui/ActivityDetailActivity.kt index a31fea2..cd34c52 100644 --- a/foreground/src/main/java/com/gyf/csams/activity/ui/ActivityDetailActivity.kt +++ b/foreground/src/main/java/com/gyf/csams/activity/ui/ActivityDetailActivity.kt @@ -32,9 +32,9 @@ import com.google.accompanist.insets.ExperimentalAnimatedInsets import com.google.accompanist.insets.navigationBarsWithImePadding import com.gyf.csams.R import com.gyf.csams.activity.model.* -import com.gyf.csams.association.ui.AssociationActivity import com.gyf.csams.module.ActivityPhotoVo import com.gyf.csams.module.BBSVo +import com.gyf.csams.module.TendencyType import com.gyf.csams.module.UserInfoVo import com.gyf.csams.uikit.* import com.gyf.lib.uikit.* @@ -53,14 +53,6 @@ val PHOTO_HEIGHT = 200.dp */ class ActivityDetailActivity : ComponentActivity() { - private val associationId: Int - get() { - val id = intent.getIntExtra( - AssociationActivity::class.java.name, - 0 - ) - return if (id == 0) throw IllegalArgumentException("社团id:${id}不合法,初始化失败") else id - } private val activityId: Int get() { @@ -127,6 +119,7 @@ class ActivityDetailActivity : ComponentActivity() { ) { LaunchedEffect(activityId) { model.load(activityId = activityId) + model.checkTendency(activityId = activityId) } MainColumnFrame(background = { Background( @@ -137,16 +130,34 @@ class ActivityDetailActivity : ComponentActivity() { RectList(modifier = Modifier.weight(0.4F)) ActivityDesc(modifier = Modifier.weight(0.4F)) Spacer(modifier = Modifier.weight(0.05F)) - BottomButton( - modifier = Modifier.fillMaxWidth(), - confirmDesc = R.string.like_btn, - backDesc = R.string.collect_btn, - onConfirm = { - model.like { scaffoldModel.update(message = it) } - }, - onBack = { - model.collect { scaffoldModel.update(message = it) } - }) + val checkTendency by model.tendency.observeAsState() + checkTendency?.apply { + val confirmDesc = if (hasLike) R.string.cancel_like else R.string.like_btn + val backDesc = if (hasCollect) R.string.cancel_collect else R.string.collect_btn + BottomButton( + modifier = Modifier.fillMaxWidth(), + confirmDesc = confirmDesc, + backDesc = backDesc, + onConfirm = { + model.tendency(type = TendencyType.Like, activityId = activityId) { + scaffoldModel.update( + message = "${getString(confirmDesc)}${if (it) "成功" else "失败"}", + "确认" + ) + model.checkTendency(activityId = activityId) + } + }, + onBack = { + model.tendency(type = TendencyType.Collect, activityId = activityId) { + scaffoldModel.update( + message = "${getString(backDesc)}${if (it) "成功" else "失败"}", + "确认" + ) + model.checkTendency(activityId = activityId) + } + }) + } + Spacer(modifier = Modifier.weight(0.05F)) } @@ -228,6 +239,7 @@ class ActivityDetailActivity : ComponentActivity() { @Composable private fun Photo( model: ActivityPhotoViewModel = viewModel(), + infoModel: ActivityInfoViewModel = viewModel(), scaffoldModel: ScaffoldModel = viewModel(), nav: NavHostController ) { @@ -241,8 +253,8 @@ class ActivityDetailActivity : ComponentActivity() { alpha = 0.7F ) }) { - - if (TokenManager.getUserInfo()?.associationVo?.associationId == associationId && TokenManager.getUserInfo()?.isHead == true) { + val activityDetailVo by infoModel.activityDetailVo.observeAsState() + if (TokenManager.getUserInfo()?.associationVo?.associationId == activityDetailVo?.associationVo?.associationId && TokenManager.getUserInfo()?.isHead == true) { var photoUri: Uri? by remember { mutableStateOf(null) } @@ -397,8 +409,7 @@ class ActivityDetailActivity : ComponentActivity() { */ @Composable private fun Member( - model: ActivityMemberViewModel = viewModel(), - scaffoldModel: ScaffoldModel = viewModel() + model: ActivityMemberViewModel = viewModel() ) { MainColumnFrame(background = { Background( diff --git a/foreground/src/main/java/com/gyf/csams/activity/ui/TendencyActivity.kt b/foreground/src/main/java/com/gyf/csams/activity/ui/TendencyActivity.kt new file mode 100644 index 0000000..58a5943 --- /dev/null +++ b/foreground/src/main/java/com/gyf/csams/activity/ui/TendencyActivity.kt @@ -0,0 +1,58 @@ +package com.gyf.csams.activity.ui + +import android.os.Bundle +import androidx.activity.ComponentActivity +import androidx.activity.compose.setContent +import androidx.compose.foundation.layout.Arrangement +import androidx.compose.foundation.layout.Row +import androidx.compose.foundation.layout.fillMaxWidth +import androidx.compose.material.MaterialTheme +import androidx.compose.material.Text +import androidx.compose.runtime.LaunchedEffect +import androidx.compose.runtime.getValue +import androidx.compose.runtime.livedata.observeAsState +import androidx.compose.ui.Modifier +import androidx.lifecycle.viewmodel.compose.viewModel +import com.gyf.csams.activity.model.TendencyViewModel +import com.gyf.csams.module.TendencyType +import com.gyf.csams.uikit.Activities +import com.gyf.csams.uikit.Background +import com.gyf.csams.uikit.BackgroundImage +import com.gyf.lib.uikit.Body +import com.gyf.lib.uikit.MainColumnFrame + +class TendencyActivity : ComponentActivity() { + + private val type: TendencyType + get() { + return intent.getSerializableExtra(TendencyType::class.java.name) as TendencyType + } + + override fun onCreate(savedInstanceState: Bundle?) { + super.onCreate(savedInstanceState) + + setContent { + Body { + MainColumnFrame(background = { + Background( + image = BackgroundImage.AssociationMain, + alpha = 07F + ) + }) { + val model: TendencyViewModel = viewModel() + LaunchedEffect(type) { + model.load(type = type) + } + val data by model.data.observeAsState() + Row( + modifier = Modifier.fillMaxWidth(), + horizontalArrangement = Arrangement.Center + ) { + Text(text = "我的${type.desc}", style = MaterialTheme.typography.h4) + } + Activities(list = data, modifier = Modifier.fillMaxWidth()) + } + } + } + } +} \ No newline at end of file diff --git a/foreground/src/main/java/com/gyf/csams/association/model/AssociationViewModel.kt b/foreground/src/main/java/com/gyf/csams/association/model/AssociationViewModel.kt index 154b313..6b19e22 100644 --- a/foreground/src/main/java/com/gyf/csams/association/model/AssociationViewModel.kt +++ b/foreground/src/main/java/com/gyf/csams/association/model/AssociationViewModel.kt @@ -110,7 +110,7 @@ class MemberViewModel(application: Application) : ScrollViewModel(ap * 加载社团成员 * */ - fun load(id: Int, callback: (message: String) -> Unit) { + fun load(id: Int) { viewModelScope.launch { HttpClient.post( Api.buildUrl(AssociationApi.LoadMember), HttpCallback>( diff --git a/foreground/src/main/java/com/gyf/csams/association/ui/AssociationActivity.kt b/foreground/src/main/java/com/gyf/csams/association/ui/AssociationActivity.kt index b6fb0c4..9c90dd0 100644 --- a/foreground/src/main/java/com/gyf/csams/association/ui/AssociationActivity.kt +++ b/foreground/src/main/java/com/gyf/csams/association/ui/AssociationActivity.kt @@ -9,7 +9,6 @@ import androidx.activity.compose.setContent import androidx.activity.result.contract.ActivityResultContracts import androidx.compose.foundation.Image import androidx.compose.foundation.border -import androidx.compose.foundation.clickable import androidx.compose.foundation.layout.* import androidx.compose.foundation.lazy.LazyColumn import androidx.compose.foundation.lazy.rememberLazyListState @@ -28,10 +27,8 @@ import androidx.lifecycle.viewmodel.compose.viewModel import androidx.navigation.compose.NavHost import androidx.navigation.compose.composable import com.gyf.csams.R -import com.gyf.csams.activity.ui.ActivityDetailActivity import com.gyf.csams.activity.ui.ApplyActActivity import com.gyf.csams.association.model.* -import com.gyf.csams.module.ActivityVo import com.gyf.csams.uikit.* import com.gyf.lib.uikit.* import com.gyf.lib.util.TokenManager @@ -373,9 +370,7 @@ class AssociationActivity : ComponentActivity() { Spacer(modifier = Modifier.weight(spaceWeight)) OutlinedButton( onClick = { - model.load(associationId) { - - } + model.load(associationId) }, modifier = Modifier.weight(buttonWeight) ) { @@ -395,9 +390,7 @@ class AssociationActivity : ComponentActivity() { modifier: Modifier = Modifier, model: MemberViewModel = viewModel() ) { - model.load(associationId) { - - } + model.load(associationId) val data by model.data.observeAsState() val listState = rememberLazyListState() LazyColumn( @@ -532,12 +525,6 @@ class AssociationActivity : ComponentActivity() { alpha = 07F ) }) { -// val onGoWeight = 0.3F -// OngoingActivity( -// modifier = Modifier -// .weight(onGoWeight) -// .fillMaxWidth() -// ) HistoryActivityList( modifier = Modifier .fillMaxWidth() @@ -554,7 +541,7 @@ class AssociationActivity : ComponentActivity() { private fun OngoingActivity( modifier: Modifier = Modifier ) { - Row(horizontalArrangement = Arrangement.Center) { + Row(modifier = modifier, horizontalArrangement = Arrangement.Center) { val weight = 0.5F val spaceWeight = (1 - 0.5F) / 2 Spacer(modifier = Modifier.weight(spaceWeight)) @@ -578,62 +565,17 @@ class AssociationActivity : ComponentActivity() { model.load(associationId = associationId) } - val listState = rememberLazyListState() val list by model.data.observeAsState() if (list?.size == 0) { Row(modifier = Modifier.fillMaxWidth()) { Text(text = "目前社团没有任何活动") } } else { - LazyColumn(state = listState, modifier = modifier) { - list?.chunked(2)?.forEach { - item { - Row(modifier = Modifier.fillMaxWidth()) { - HistoryActivity(modifier = Modifier.weight(0.4F), it[0]) - Spacer(modifier = Modifier.weight(0.2F)) - if (it.size == 2) HistoryActivity( - modifier = Modifier.weight(0.4F), - it[1] - ) - else Box(modifier = Modifier.weight(0.4F)) - } - Spacer(modifier = Modifier.height(10.dp)) - Divider(color = MaterialTheme.colors.background) - } - } - } + Activities(list = list, modifier = modifier) } } - /** - * 历史活动 - * - * @param modifier - */ - @Composable - private fun HistoryActivity(modifier: Modifier, historyActVo: ActivityVo) { - Box(modifier = modifier.clickable(onClick = { - startActivity(Intent(this, ActivityDetailActivity::class.java).apply { - putExtra(ActivityDetailActivity::class.java.name, historyActVo.activityId) - putExtra(AssociationActivity::class.java.name, associationId) - }) - }), contentAlignment = Alignment.Center) { - Image( - painter = painterResource(id = R.drawable.history_activity_border), - contentDescription = null, - modifier = Modifier.fillMaxSize() - ) - Image( - painter = painterResource(id = R.drawable.ic_launcher_foreground), - contentDescription = null, - modifier = Modifier.fillMaxSize() - ) - Text(text = historyActVo.activityName) - - } - } - @Preview @Composable fun NamePreview() { @@ -644,3 +586,4 @@ class AssociationActivity : ComponentActivity() { + diff --git a/foreground/src/main/java/com/gyf/csams/association/ui/RenameActivity.kt b/foreground/src/main/java/com/gyf/csams/association/ui/RenameActivity.kt index 60f00c9..f058cfd 100644 --- a/foreground/src/main/java/com/gyf/csams/association/ui/RenameActivity.kt +++ b/foreground/src/main/java/com/gyf/csams/association/ui/RenameActivity.kt @@ -70,7 +70,6 @@ class RenameActivity : ComponentActivity() { Spacer(modifier = Modifier.height(10.dp)) - val oldNameStatus by model.oldName.statusForm.observeAsState() val newNameStatus by model.newName.statusForm.observeAsState() diff --git a/foreground/src/main/java/com/gyf/csams/main/ui/MainActivity.kt b/foreground/src/main/java/com/gyf/csams/main/ui/MainActivity.kt index 56fbe8a..b6ad0b4 100644 --- a/foreground/src/main/java/com/gyf/csams/main/ui/MainActivity.kt +++ b/foreground/src/main/java/com/gyf/csams/main/ui/MainActivity.kt @@ -34,6 +34,7 @@ import com.google.accompanist.pager.rememberPagerState import com.gyf.csams.R import com.gyf.csams.account.model.AccountViewModel import com.gyf.csams.activity.ui.ActivityDetailActivity +import com.gyf.csams.activity.ui.TendencyActivity import com.gyf.csams.association.ui.AssociationActivity import com.gyf.csams.association.ui.RegAssociationActivity import com.gyf.csams.main.model.* @@ -141,9 +142,25 @@ class MainActivity : BaseActivity() { putExtra(AssociationActivity::class.java.name, it) }) } -// CenterMenuItem(text = model.myJoinActivity) - CenterMenuItem(text = model.myLikeActivity) - CenterMenuItem(text = model.myCollectActivity) + + CenterMenuItem(text = model.myLikeActivity) { + startActivity( + Intent( + this@MainActivity, + TendencyActivity::class.java + ).apply { + putExtra(TendencyType::class.java.name, TendencyType.Like) + }) + } + CenterMenuItem(text = model.myCollectActivity) { + startActivity( + Intent( + this@MainActivity, + TendencyActivity::class.java + ).apply { + putExtra(TendencyType::class.java.name, TendencyType.Collect) + }) + } } CenterMenuItem(text = "退出登录") { @@ -245,8 +262,6 @@ class MainActivity : BaseActivity() { */ @Composable private fun RegisterAssociation( - model: AssociationListViewModel = viewModel(), - scaffoldModel: ScaffoldModel = viewModel(), navController: NavHostController ) { val launch = diff --git a/foreground/src/main/java/com/gyf/csams/uikit/Activies.kt b/foreground/src/main/java/com/gyf/csams/uikit/Activies.kt new file mode 100644 index 0000000..8423ae3 --- /dev/null +++ b/foreground/src/main/java/com/gyf/csams/uikit/Activies.kt @@ -0,0 +1,72 @@ +package com.gyf.csams.uikit + +import android.content.Intent +import androidx.compose.foundation.Image +import androidx.compose.foundation.clickable +import androidx.compose.foundation.layout.* +import androidx.compose.foundation.lazy.LazyColumn +import androidx.compose.foundation.lazy.rememberLazyListState +import androidx.compose.material.Divider +import androidx.compose.material.MaterialTheme +import androidx.compose.material.Text +import androidx.compose.runtime.Composable +import androidx.compose.ui.Alignment +import androidx.compose.ui.Modifier +import androidx.compose.ui.platform.LocalContext +import androidx.compose.ui.res.painterResource +import androidx.compose.ui.unit.dp +import com.gyf.csams.R +import com.gyf.csams.activity.ui.ActivityDetailActivity +import com.gyf.csams.module.ActivityVo + + +/** + * 历史活动 + * + * @param modifier + */ +@Composable +private fun HistoryActivity(modifier: Modifier, activityVo: ActivityVo) { + val context = LocalContext.current + Box(modifier = modifier.clickable(onClick = { + context.startActivity(Intent(context, ActivityDetailActivity::class.java).apply { + putExtra(ActivityDetailActivity::class.java.name, activityVo.activityId) + }) + }), contentAlignment = Alignment.Center) { + Image( + painter = painterResource(id = R.drawable.history_activity_border), + contentDescription = null, + modifier = Modifier.fillMaxSize() + ) + Image( + painter = painterResource(id = R.drawable.ic_launcher_foreground), + contentDescription = null, + modifier = Modifier.fillMaxSize() + ) + Text(text = activityVo.activityName) + + } +} + + +@Composable +fun Activities(modifier: Modifier = Modifier, list: List?) { + val listState = rememberLazyListState() + LazyColumn(state = listState, modifier = modifier) { + list?.chunked(2)?.forEach { + item { + Row(modifier = Modifier.fillMaxWidth()) { + HistoryActivity(modifier = Modifier.weight(0.4F), it[0]) + Spacer(modifier = Modifier.weight(0.2F)) + if (it.size == 2) HistoryActivity( + modifier = Modifier.weight(0.4F), + it[1] + ) + else Box(modifier = Modifier.weight(0.4F)) + } + Spacer(modifier = Modifier.height(10.dp)) + Divider(color = MaterialTheme.colors.background) + } + } + } +} \ No newline at end of file diff --git a/foreground/src/main/java/com/gyf/csams/uikit/BaseView.kt b/foreground/src/main/java/com/gyf/csams/uikit/BaseView.kt index c794d80..2f96006 100644 --- a/foreground/src/main/java/com/gyf/csams/uikit/BaseView.kt +++ b/foreground/src/main/java/com/gyf/csams/uikit/BaseView.kt @@ -447,9 +447,8 @@ enum class BackgroundImage(@DrawableRes val id: Int) { */ @Composable fun Background(image: BackgroundImage, alpha: Float = DefaultAlpha) { - val app = LocalContext.current.applicationContext as MainApplication + LocalContext.current.applicationContext as MainApplication -// val img=app.getImage(image = image) val backgroundImage = rememberCoilPainter(request = image.id) Image( diff --git a/foreground/src/main/java/com/gyf/csams/util/GsonUtil.kt b/foreground/src/main/java/com/gyf/csams/util/GsonUtil.kt deleted file mode 100644 index f8d0df6..0000000 --- a/foreground/src/main/java/com/gyf/csams/util/GsonUtil.kt +++ /dev/null @@ -1,125 +0,0 @@ -package com.gyf.csams.util - -import com.google.gson.* -import com.google.gson.reflect.TypeToken -import com.gyf.csams.association.model.* - -import com.gyf.lib.uikit.StringForm -import java.lang.reflect.Type - -class OpenQuestionsVoSerializer : JsonSerializer { - override fun serialize( - vo: OpenQuestionsVo?, - p1: Type?, - p2: JsonSerializationContext? - ): JsonElement { - val gson = Gson() - val c = JsonObject() - c.add("examType", gson.toJsonTree(vo?.examType?.name)) -// c.add("question", gson.toJsonTree(vo?.question?.formValue?.value)) - return c - } -} - -class OpenQuestionsVoDeserializer : JsonDeserializer { - override fun deserialize( - json: JsonElement?, - p1: Type?, - p2: JsonDeserializationContext? - ): OpenQuestionsVo { - val root = json?.asJsonObject - val value = root?.get("question")?.asString - val question = StringForm(formDesc = "问题", textLength = QUESTION_TEXT_LENGTH) - if (value != null) { - question.onChange(value) - TODO() -// return OpenQuestionsVo(question = question) - } else { - throw NullPointerException("问题无法解析!!!!") - } - } -} - -class ChoiceQuestionVoSerializer : JsonSerializer { - override fun serialize( - vo: ChoiceQuestionVo?, - p1: Type?, - p2: JsonSerializationContext? - ): JsonElement { - val gson = Gson() - val c = JsonObject() - c.add("examType", gson.toJsonTree(vo?.examType?.name)) -// c.add("question", gson.toJsonTree(vo?.question?.formValue?.value)) -// c.add("answers", gson.toJsonTree(vo?.answers)) - c.add("rightAnswer", gson.toJsonTree(vo?.rightAnswer)) - return c - } -} - -class ChoiceQuestionVoDeserializer : JsonDeserializer { - override fun deserialize( - json: JsonElement?, - p1: Type?, - p2: JsonDeserializationContext? - ): ChoiceQuestionVo { - val root = json?.asJsonObject - val value = root?.get("question")?.asString - val question = StringForm(formDesc = "问题", textLength = QUESTION_TEXT_LENGTH) - if (value != null) { - question.onChange(value) - val gson = Gson() - val answers: List = - gson.fromJson(root.get("answers"), object : TypeToken>() {}.type) - if (answers.size != ANSWER_SIZE) { - throw IllegalArgumentException("选项数量!=$QUESTION_TEXT_LENGTH") - } - val rightAnswer = root.get("rightAnswer").asInt - TODO() -// return ChoiceQuestionVo( -// question = question, -// answers = answers.map { -// StringForm( -// formDesc = "选项", -// textLength = ANSWER_TEXT_LENGTH, -// value = it -// ) -// }, -// rightAnswer = rightAnswer -// ) - } else { - throw NullPointerException("问题无法解析!!!!") - } - } -} - -/** - * 题目反序列化 - * - */ -class ExamDeserializer : JsonDeserializer { - companion object { - val gson: Gson = GsonBuilder() - .registerTypeAdapter(OpenQuestionsVo::class.java, OpenQuestionsVoDeserializer()) - .registerTypeAdapter(ChoiceQuestionVo::class.java, ChoiceQuestionVoDeserializer()) - .create() - } - - override fun deserialize(json: JsonElement?, p1: Type?, p2: JsonDeserializationContext?): Exam { - val root = json?.asJsonObject - - val type = root?.get("examType")?.asString - - return when (gson.fromJson(type, ExamType::class.java)) { - ExamType.CQ -> gson.fromJson( - json, - object : TypeToken() {}.type - ) - ExamType.OQ -> gson.fromJson( - json, - object : TypeToken() {}.type - ) - null -> throw NullPointerException("无法识别题目类型!") - } - - } -} \ No newline at end of file diff --git a/foreground/src/main/java/com/gyf/csams/util/HttpCallback.kt b/foreground/src/main/java/com/gyf/csams/util/HttpCallback.kt deleted file mode 100644 index d274fb9..0000000 --- a/foreground/src/main/java/com/gyf/csams/util/HttpCallback.kt +++ /dev/null @@ -1,28 +0,0 @@ -package com.gyf.csams.util - -import com.google.gson.Gson -import com.google.gson.GsonBuilder -import com.gyf.csams.association.model.Exam -import com.gyf.csams.module.ApiResponse -import com.gyf.lib.util.HttpCallback -import java.lang.reflect.Type - -/** - * http请求回调 - * - * @param T - * @property action - * @property onSuccess - * @property onFail - - */ -class ExamCallback( - private val action: String, - private val onSuccess: (res: ApiResponse) -> Unit, - private val onFail: (error: String) -> Unit, - private val type: Type -) : HttpCallback(action, onSuccess, onFail, type) { - override val gson: Gson = GsonBuilder() - .registerTypeAdapter(Exam::class.java, ExamDeserializer()) - .create() -} \ No newline at end of file diff --git a/foreground/src/main/jniLibs/arm64-v8a/libBaiduMapSDK_map_v7_3_0.so.REMOVED.git-id b/foreground/src/main/jniLibs/arm64-v8a/libBaiduMapSDK_map_v7_3_0.so.REMOVED.git-id new file mode 100644 index 0000000..6f4d291 --- /dev/null +++ b/foreground/src/main/jniLibs/arm64-v8a/libBaiduMapSDK_map_v7_3_0.so.REMOVED.git-id @@ -0,0 +1 @@ +eae2136da161924597d752b7575d0f33e2638267 \ No newline at end of file diff --git a/foreground/src/main/jniLibs/arm64-v8a/libgnustl_shared.so.REMOVED.git-id b/foreground/src/main/jniLibs/arm64-v8a/libgnustl_shared.so.REMOVED.git-id new file mode 100644 index 0000000..157bddb --- /dev/null +++ b/foreground/src/main/jniLibs/arm64-v8a/libgnustl_shared.so.REMOVED.git-id @@ -0,0 +1 @@ +be99b75ae53194a79345f0278d9c17ce543ade81 \ No newline at end of file diff --git a/foreground/src/main/jniLibs/armeabi-v7a/libBaiduMapSDK_map_v7_3_0.so.REMOVED.git-id b/foreground/src/main/jniLibs/armeabi-v7a/libBaiduMapSDK_map_v7_3_0.so.REMOVED.git-id new file mode 100644 index 0000000..e915e9b --- /dev/null +++ b/foreground/src/main/jniLibs/armeabi-v7a/libBaiduMapSDK_map_v7_3_0.so.REMOVED.git-id @@ -0,0 +1 @@ +165cccf559b817f7b0d4c102ba53ff6beb5369c6 \ No newline at end of file diff --git a/foreground/src/main/jniLibs/armeabi/libBaiduMapSDK_map_v7_3_0.so.REMOVED.git-id b/foreground/src/main/jniLibs/armeabi/libBaiduMapSDK_map_v7_3_0.so.REMOVED.git-id new file mode 100644 index 0000000..af512a8 --- /dev/null +++ b/foreground/src/main/jniLibs/armeabi/libBaiduMapSDK_map_v7_3_0.so.REMOVED.git-id @@ -0,0 +1 @@ +7373621983602f41e9c55827a7e62c78ff6899b8 \ No newline at end of file diff --git a/foreground/src/main/jniLibs/x86/libBaiduMapSDK_map_v7_3_0.so.REMOVED.git-id b/foreground/src/main/jniLibs/x86/libBaiduMapSDK_map_v7_3_0.so.REMOVED.git-id new file mode 100644 index 0000000..a01ef92 --- /dev/null +++ b/foreground/src/main/jniLibs/x86/libBaiduMapSDK_map_v7_3_0.so.REMOVED.git-id @@ -0,0 +1 @@ +0a6f90b1de328db428af6dbea2322a79a104c562 \ No newline at end of file diff --git a/foreground/src/main/jniLibs/x86/libgnustl_shared.so.REMOVED.git-id b/foreground/src/main/jniLibs/x86/libgnustl_shared.so.REMOVED.git-id new file mode 100644 index 0000000..4568663 --- /dev/null +++ b/foreground/src/main/jniLibs/x86/libgnustl_shared.so.REMOVED.git-id @@ -0,0 +1 @@ +1eae31cbbcf67f843d39243caf7df8c569c13b77 \ No newline at end of file diff --git a/foreground/src/main/jniLibs/x86_64/libBaiduMapSDK_map_v7_3_0.so.REMOVED.git-id b/foreground/src/main/jniLibs/x86_64/libBaiduMapSDK_map_v7_3_0.so.REMOVED.git-id new file mode 100644 index 0000000..6edad09 --- /dev/null +++ b/foreground/src/main/jniLibs/x86_64/libBaiduMapSDK_map_v7_3_0.so.REMOVED.git-id @@ -0,0 +1 @@ +4d806e13be16ad9726fa260878473f041f153a58 \ No newline at end of file diff --git a/foreground/src/main/jniLibs/x86_64/libgnustl_shared.so.REMOVED.git-id b/foreground/src/main/jniLibs/x86_64/libgnustl_shared.so.REMOVED.git-id new file mode 100644 index 0000000..221d157 --- /dev/null +++ b/foreground/src/main/jniLibs/x86_64/libgnustl_shared.so.REMOVED.git-id @@ -0,0 +1 @@ +0149273fe46069663a6c9ff375bab6e81aaae9d8 \ No newline at end of file diff --git a/foreground/src/main/res/drawable/mb_bg_fb_01.png.REMOVED.git-id b/foreground/src/main/res/drawable/mb_bg_fb_01.png.REMOVED.git-id new file mode 100644 index 0000000..568562f --- /dev/null +++ b/foreground/src/main/res/drawable/mb_bg_fb_01.png.REMOVED.git-id @@ -0,0 +1 @@ +4e6cdc0a5379ae11e7ecd9862df219a2e8e30966 \ No newline at end of file diff --git a/foreground/src/main/res/drawable/mb_bg_fb_02.png.REMOVED.git-id b/foreground/src/main/res/drawable/mb_bg_fb_02.png.REMOVED.git-id new file mode 100644 index 0000000..c6714cd --- /dev/null +++ b/foreground/src/main/res/drawable/mb_bg_fb_02.png.REMOVED.git-id @@ -0,0 +1 @@ +7758a1ac02f112f2cc4b9a770e6e503b51123cb7 \ No newline at end of file diff --git a/foreground/src/main/res/drawable/mb_bg_fb_03.png.REMOVED.git-id b/foreground/src/main/res/drawable/mb_bg_fb_03.png.REMOVED.git-id new file mode 100644 index 0000000..f04b4cc --- /dev/null +++ b/foreground/src/main/res/drawable/mb_bg_fb_03.png.REMOVED.git-id @@ -0,0 +1 @@ +24b3200ded1804dbeede2ad13209502ecb694a94 \ No newline at end of file diff --git a/foreground/src/main/res/drawable/mb_bg_fb_04.png.REMOVED.git-id b/foreground/src/main/res/drawable/mb_bg_fb_04.png.REMOVED.git-id new file mode 100644 index 0000000..9a227d0 --- /dev/null +++ b/foreground/src/main/res/drawable/mb_bg_fb_04.png.REMOVED.git-id @@ -0,0 +1 @@ +17a3a14f87bc6dfaa5222edd157e546f8c3d3b71 \ No newline at end of file diff --git a/foreground/src/main/res/drawable/mb_bg_fb_06.png.REMOVED.git-id b/foreground/src/main/res/drawable/mb_bg_fb_06.png.REMOVED.git-id new file mode 100644 index 0000000..8120988 --- /dev/null +++ b/foreground/src/main/res/drawable/mb_bg_fb_06.png.REMOVED.git-id @@ -0,0 +1 @@ +40c3c72f459198c56917d4cf2dd095c14e98727f \ No newline at end of file diff --git a/foreground/src/main/res/drawable/mb_bg_fb_07.png.REMOVED.git-id b/foreground/src/main/res/drawable/mb_bg_fb_07.png.REMOVED.git-id new file mode 100644 index 0000000..47ba342 --- /dev/null +++ b/foreground/src/main/res/drawable/mb_bg_fb_07.png.REMOVED.git-id @@ -0,0 +1 @@ +1ee13a1678f539bc50c1a6cf8c2a4cd3ad66d643 \ No newline at end of file diff --git a/foreground/src/main/res/drawable/mb_bg_fb_08.png.REMOVED.git-id b/foreground/src/main/res/drawable/mb_bg_fb_08.png.REMOVED.git-id new file mode 100644 index 0000000..d2935ea --- /dev/null +++ b/foreground/src/main/res/drawable/mb_bg_fb_08.png.REMOVED.git-id @@ -0,0 +1 @@ +6a42e4773be7fccb574c6021c78f8ff16c38268b \ No newline at end of file diff --git a/foreground/src/main/res/drawable/mb_bg_fb_09.png.REMOVED.git-id b/foreground/src/main/res/drawable/mb_bg_fb_09.png.REMOVED.git-id new file mode 100644 index 0000000..c9bbcf4 --- /dev/null +++ b/foreground/src/main/res/drawable/mb_bg_fb_09.png.REMOVED.git-id @@ -0,0 +1 @@ +0e6b6965957df34b335709e70db54ec18f85eb83 \ No newline at end of file diff --git a/foreground/src/main/res/drawable/mb_bg_fb_25.png.REMOVED.git-id b/foreground/src/main/res/drawable/mb_bg_fb_25.png.REMOVED.git-id new file mode 100644 index 0000000..c7c14ff --- /dev/null +++ b/foreground/src/main/res/drawable/mb_bg_fb_25.png.REMOVED.git-id @@ -0,0 +1 @@ +a530f977cd4e84c53f98dc954e03290cf35cc443 \ No newline at end of file diff --git a/foreground/src/main/res/drawable/mb_bg_fb_25_180.png.REMOVED.git-id b/foreground/src/main/res/drawable/mb_bg_fb_25_180.png.REMOVED.git-id new file mode 100644 index 0000000..bca27c2 --- /dev/null +++ b/foreground/src/main/res/drawable/mb_bg_fb_25_180.png.REMOVED.git-id @@ -0,0 +1 @@ +bba77fabcbaea7c81c93497dc15a5bd35f373f5e \ No newline at end of file diff --git a/foreground/src/main/res/drawable/mb_bg_fb_26.png.REMOVED.git-id b/foreground/src/main/res/drawable/mb_bg_fb_26.png.REMOVED.git-id new file mode 100644 index 0000000..4c91d58 --- /dev/null +++ b/foreground/src/main/res/drawable/mb_bg_fb_26.png.REMOVED.git-id @@ -0,0 +1 @@ +35980a5473e21920506edcbe0a31e75d9263e978 \ No newline at end of file diff --git a/foreground/src/main/res/drawable/mb_bg_fb_27.png.REMOVED.git-id b/foreground/src/main/res/drawable/mb_bg_fb_27.png.REMOVED.git-id new file mode 100644 index 0000000..aa70a4e --- /dev/null +++ b/foreground/src/main/res/drawable/mb_bg_fb_27.png.REMOVED.git-id @@ -0,0 +1 @@ +d9686761bcd5d3992c8a1135838400ac61bb7e47 \ No newline at end of file diff --git a/foreground/src/main/res/drawable/mb_bg_fb_28.png.REMOVED.git-id b/foreground/src/main/res/drawable/mb_bg_fb_28.png.REMOVED.git-id new file mode 100644 index 0000000..7950ca3 --- /dev/null +++ b/foreground/src/main/res/drawable/mb_bg_fb_28.png.REMOVED.git-id @@ -0,0 +1 @@ +110603101ef93e9ceca51de555a93b5e3d2de994 \ No newline at end of file diff --git a/foreground/src/main/res/values-en/strings.xml b/foreground/src/main/res/values-en/strings.xml index 474a3cc..f6a3c88 100644 --- a/foreground/src/main/res/values-en/strings.xml +++ b/foreground/src/main/res/values-en/strings.xml @@ -20,4 +20,6 @@ 上传 关闭 放弃申请 + 取消点赞 + 取消收藏 \ No newline at end of file diff --git a/foreground/src/main/res/values-zh/strings.xml b/foreground/src/main/res/values-zh/strings.xml index 474a3cc..f6a3c88 100644 --- a/foreground/src/main/res/values-zh/strings.xml +++ b/foreground/src/main/res/values-zh/strings.xml @@ -20,4 +20,6 @@ 上传 关闭 放弃申请 + 取消点赞 + 取消收藏 \ No newline at end of file diff --git a/foreground/src/main/res/values/strings.xml b/foreground/src/main/res/values/strings.xml index dc7e3ad..a589dbc 100644 --- a/foreground/src/main/res/values/strings.xml +++ b/foreground/src/main/res/values/strings.xml @@ -20,4 +20,6 @@ 上传 关闭 放弃申请 + 取消点赞 + 取消收藏 \ No newline at end of file diff --git a/lib/src/main/java/com/gyf/lib/model/SysMessageViewModel.kt b/lib/src/main/java/com/gyf/lib/model/SysMessageViewModel.kt index 8886358..5463a4a 100644 --- a/lib/src/main/java/com/gyf/lib/model/SysMessageViewModel.kt +++ b/lib/src/main/java/com/gyf/lib/model/SysMessageViewModel.kt @@ -94,7 +94,7 @@ abstract class SysMessageViewModel(application: Application) : abstract fun clientType(): ClientType init { - load {} + load() } @@ -102,7 +102,7 @@ abstract class SysMessageViewModel(application: Application) : *加载通知列表 * */ - fun load(callback: (message: String) -> Unit) { + fun load() { viewModelScope.launch { HttpClient.post( Api.buildUrl(NotificationApi.List), diff --git a/lib/src/main/java/com/gyf/lib/util/Api.kt b/lib/src/main/java/com/gyf/lib/util/Api.kt index 7a5b389..1c737f4 100644 --- a/lib/src/main/java/com/gyf/lib/util/Api.kt +++ b/lib/src/main/java/com/gyf/lib/util/Api.kt @@ -204,8 +204,17 @@ enum class ActivityApi(val path: String) : UrlPath { SendComment("${Comment.path}/send"), //后台活动查看 - ListAll("/list/all"); + ListAll("/list/all"), + //修改活动倾向 + Tendency("/tendency"), + + //检查活动倾向 + CheckTendency("${Tendency.path}/check"), + + //查询活动倾向 + FindTendency("${Tendency.path}/find") + ; override fun build(): String { return "/api/activity${this.path}"