UI: disable landscape mode; prevent duplicated benchmark running

This commit is contained in:
Han Yin 2025-05-15 11:28:04 -07:00
parent a4c66c4baf
commit 512fe1be4e
3 changed files with 8 additions and 4 deletions

View File

@ -28,6 +28,7 @@
<activity
android:name=".revamp.MainActivity"
android:exported="true"
android:screenOrientation="portrait"
android:theme="@style/Theme.LlamaAndroid">
<intent-filter>
<action android:name="android.intent.action.MAIN" />

View File

@ -15,9 +15,7 @@ import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.size
import androidx.compose.foundation.lazy.LazyColumn
import androidx.compose.foundation.lazy.items
import androidx.compose.foundation.rememberScrollState
import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.foundation.verticalScroll
import androidx.compose.material3.Card
import androidx.compose.material3.CardDefaults
import androidx.compose.material3.CircularProgressIndicator
@ -30,6 +28,7 @@ import androidx.compose.runtime.collectAsState
import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
import androidx.compose.runtime.saveable.rememberSaveable
import androidx.compose.runtime.setValue
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
@ -63,10 +62,14 @@ fun BenchmarkScreen(
// UI states
var isModelCardExpanded by remember { mutableStateOf(false) }
var isInitialBenchmarkRun by rememberSaveable { mutableStateOf(false) }
// Run benchmark when entering the screen
LaunchedEffect(selectedModel) {
viewModel.runBenchmark()
if (!isInitialBenchmarkRun) {
isInitialBenchmarkRun = true
viewModel.runBenchmark()
}
}
// Handle back button press

View File

@ -119,7 +119,7 @@ val Typography = Typography(
val MonospacedTextStyle = TextStyle(
fontFamily = FontFamily.Monospace,
fontWeight = FontWeight.Normal,
fontSize = 14.sp,
fontSize = 12.sp,
lineHeight = 20.sp,
letterSpacing = 0.sp
)