|
|
|
@ -19,6 +19,7 @@ import androidx.compose.ui.Alignment |
|
|
|
|
import androidx.compose.ui.Modifier |
|
|
|
|
import androidx.compose.ui.layout.ContentScale |
|
|
|
|
import androidx.compose.ui.res.painterResource |
|
|
|
|
import androidx.compose.ui.res.stringResource |
|
|
|
|
import androidx.compose.ui.tooling.preview.Preview |
|
|
|
|
import androidx.compose.ui.unit.dp |
|
|
|
|
import androidx.compose.ui.window.PopupProperties |
|
|
|
@ -32,8 +33,6 @@ import com.gyf.csams.association.model.* |
|
|
|
|
import com.gyf.csams.uikit.* |
|
|
|
|
import com.gyf.lib.uikit.* |
|
|
|
|
import com.gyf.lib.util.HistoryActVo |
|
|
|
|
import com.gyf.lib.util.MemberVo |
|
|
|
|
import com.orhanobut.logger.Logger |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
@ -42,7 +41,7 @@ import com.orhanobut.logger.Logger |
|
|
|
|
*/ |
|
|
|
|
class AssociationActivity : ComponentActivity() { |
|
|
|
|
|
|
|
|
|
val associationId: Int |
|
|
|
|
private val associationId: Int |
|
|
|
|
get() { |
|
|
|
|
val id = intent.getIntExtra( |
|
|
|
|
AssociationActivity::javaClass.name, |
|
|
|
@ -218,8 +217,7 @@ class AssociationActivity : ComponentActivity() { |
|
|
|
|
@Composable |
|
|
|
|
private fun Search( |
|
|
|
|
modifier: Modifier = Modifier, |
|
|
|
|
model: MemberViewModel = viewModel(), |
|
|
|
|
scaffoldModel: ScaffoldModel = viewModel() |
|
|
|
|
model: MemberViewModel = viewModel() |
|
|
|
|
) { |
|
|
|
|
Column(modifier = modifier.fillMaxSize()) { |
|
|
|
|
Spacer(modifier = Modifier.weight(0.5F)) |
|
|
|
@ -240,10 +238,14 @@ class AssociationActivity : ComponentActivity() { |
|
|
|
|
) |
|
|
|
|
Spacer(modifier = Modifier.weight(spaceWeight)) |
|
|
|
|
OutlinedButton( |
|
|
|
|
onClick = { model.search { scaffoldModel.update(message = it) } }, |
|
|
|
|
onClick = { |
|
|
|
|
model.load(associationId) { |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
modifier = Modifier.weight(buttonWeight) |
|
|
|
|
) { |
|
|
|
|
Text(text = model.search) |
|
|
|
|
Text(text = stringResource(id = R.string.search_btn)) |
|
|
|
|
} |
|
|
|
|
Spacer(modifier = Modifier.weight(spaceWeight)) |
|
|
|
|
} |
|
|
|
@ -257,13 +259,15 @@ class AssociationActivity : ComponentActivity() { |
|
|
|
|
@Composable |
|
|
|
|
private fun MemberList( |
|
|
|
|
modifier: Modifier = Modifier, |
|
|
|
|
model: MemberViewModel = viewModel(), |
|
|
|
|
scaffoldModel: ScaffoldModel = viewModel() |
|
|
|
|
model: MemberViewModel = viewModel() |
|
|
|
|
) { |
|
|
|
|
val list: MutableList<MemberVo>? by model.memberList.observeAsState() |
|
|
|
|
model.load(associationId) { |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
val data by model.data.observeAsState() |
|
|
|
|
val listState = rememberLazyListState() |
|
|
|
|
LazyColumn(state = listState, modifier = modifier) { |
|
|
|
|
list?.forEach { |
|
|
|
|
data?.forEach { |
|
|
|
|
item { |
|
|
|
|
Column { |
|
|
|
|
Spacer(modifier = Modifier.height(10.dp)) |
|
|
|
@ -289,8 +293,8 @@ class AssociationActivity : ComponentActivity() { |
|
|
|
|
modifier = Modifier.fillMaxWidth() |
|
|
|
|
) { |
|
|
|
|
IconButton(onClick = { |
|
|
|
|
model.loadMore { |
|
|
|
|
scaffoldModel.update(message = it) |
|
|
|
|
model.load(associationId) { |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
}) { |
|
|
|
|
Icon( |
|
|
|
@ -445,12 +449,8 @@ class AssociationActivity : ComponentActivity() { |
|
|
|
|
*/ |
|
|
|
|
@Composable |
|
|
|
|
private fun OngoingActivity( |
|
|
|
|
modifier: Modifier = Modifier, |
|
|
|
|
model: OngoingActViewModel = viewModel() |
|
|
|
|
modifier: Modifier = Modifier |
|
|
|
|
) { |
|
|
|
|
val act by model.act.observeAsState() |
|
|
|
|
// TODO 解决Build Warnning |
|
|
|
|
Logger.i("$act") |
|
|
|
|
Row(modifier = modifier.clickable(onClick = { |
|
|
|
|
startActivity(Intent(this, ActivityDetailActivity::class.java)) |
|
|
|
|
}), horizontalArrangement = Arrangement.Center) { |
|
|
|
@ -471,8 +471,7 @@ class AssociationActivity : ComponentActivity() { |
|
|
|
|
@Composable |
|
|
|
|
private fun HistoryActivityList( |
|
|
|
|
modifier: Modifier, |
|
|
|
|
model: HistoryActViewModel = viewModel(), |
|
|
|
|
scaffoldModel: ScaffoldModel = viewModel() |
|
|
|
|
model: HistoryActViewModel = viewModel() |
|
|
|
|
) { |
|
|
|
|
val listState = rememberLazyListState() |
|
|
|
|
val list by model.data.observeAsState() |
|
|
|
@ -491,7 +490,7 @@ class AssociationActivity : ComponentActivity() { |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
if (listState.layoutInfo.totalItemsCount - listState.firstVisibleItemIndex == model.initSize / 2 - 1) { |
|
|
|
|
model.loadMore { scaffoldModel.update(message = it) } |
|
|
|
|
TODO("加载更多") |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|