|
|
@ -19,7 +19,6 @@ import androidx.compose.ui.Modifier |
|
|
|
import androidx.compose.ui.platform.LocalContext |
|
|
|
import androidx.compose.ui.platform.LocalContext |
|
|
|
import androidx.compose.ui.res.painterResource |
|
|
|
import androidx.compose.ui.res.painterResource |
|
|
|
import androidx.compose.ui.text.style.TextOverflow |
|
|
|
import androidx.compose.ui.text.style.TextOverflow |
|
|
|
import androidx.compose.ui.tooling.preview.Preview |
|
|
|
|
|
|
|
import androidx.compose.ui.unit.dp |
|
|
|
import androidx.compose.ui.unit.dp |
|
|
|
import androidx.lifecycle.viewmodel.compose.viewModel |
|
|
|
import androidx.lifecycle.viewmodel.compose.viewModel |
|
|
|
import androidx.navigation.NavHostController |
|
|
|
import androidx.navigation.NavHostController |
|
|
@ -34,7 +33,6 @@ import com.gyf.csams.association.ui.RegAssociationActivity |
|
|
|
import com.gyf.csams.main.model.* |
|
|
|
import com.gyf.csams.main.model.* |
|
|
|
import com.gyf.csams.message.ui.MessageActivity |
|
|
|
import com.gyf.csams.message.ui.MessageActivity |
|
|
|
import com.gyf.csams.uikit.* |
|
|
|
import com.gyf.csams.uikit.* |
|
|
|
import com.gyf.csams.uikit.theme.CSAMSTheme |
|
|
|
|
|
|
|
import com.gyf.csams.util.randomChinese |
|
|
|
import com.gyf.csams.util.randomChinese |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -52,7 +50,7 @@ class MainActivity : ComponentActivity() { |
|
|
|
imageModel = ImageModel(application = application, Api.buildUrl(MainApi.HotActivity)) |
|
|
|
imageModel = ImageModel(application = application, Api.buildUrl(MainApi.HotActivity)) |
|
|
|
|
|
|
|
|
|
|
|
setContent { |
|
|
|
setContent { |
|
|
|
CSAMSTheme { |
|
|
|
|
|
|
|
Body { nav, scaffoldState -> |
|
|
|
Body { nav, scaffoldState -> |
|
|
|
NavHost(navController = nav, startDestination = MainMenu.Main.name) { |
|
|
|
NavHost(navController = nav, startDestination = MainMenu.Main.name) { |
|
|
|
composable(MainMenu.Main.name) { |
|
|
|
composable(MainMenu.Main.name) { |
|
|
@ -70,15 +68,10 @@ class MainActivity : ComponentActivity() { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
override fun onStart() { |
|
|
|
|
|
|
|
super.onStart() |
|
|
|
|
|
|
|
imageModel.start() |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
override fun onResume() { |
|
|
|
override fun onResume() { |
|
|
@ -490,9 +483,14 @@ class MainActivity : ComponentActivity() { |
|
|
|
* |
|
|
|
* |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
@Composable |
|
|
|
@Composable |
|
|
|
private fun PosterWithDesc() { |
|
|
|
private fun PosterWithDesc(scaffoldModel: ScaffoldModel = viewModel()) { |
|
|
|
|
|
|
|
|
|
|
|
val context = LocalContext.current as MainActivity |
|
|
|
val context = LocalContext.current as MainActivity |
|
|
|
|
|
|
|
val error by context.imageModel.error.observeAsState() |
|
|
|
|
|
|
|
error?.let { |
|
|
|
|
|
|
|
scaffoldModel.update(message = it) |
|
|
|
|
|
|
|
context.imageModel.clearError() |
|
|
|
|
|
|
|
} |
|
|
|
Carousel(imageBitmap = context.imageModel.image) { |
|
|
|
Carousel(imageBitmap = context.imageModel.image) { |
|
|
|
Column(modifier = Modifier.clickable(onClick = { |
|
|
|
Column(modifier = Modifier.clickable(onClick = { |
|
|
|
context.startActivity(Intent(context, ActivityDetailActivity::class.java)) |
|
|
|
context.startActivity(Intent(context, ActivityDetailActivity::class.java)) |
|
|
@ -513,14 +511,6 @@ class MainActivity : ComponentActivity() { |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Preview(showBackground = true) |
|
|
|
|
|
|
|
@Composable |
|
|
|
|
|
|
|
fun DefaultPreview() { |
|
|
|
|
|
|
|
CSAMSTheme { |
|
|
|
|
|
|
|
Text(text = "666") |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|