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