You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
58 lines
2.1 KiB
58 lines
2.1 KiB
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())
|
|
}
|
|
}
|
|
}
|
|
}
|
|
} |