소스 검색

Increment version to 1.2, add debug build type with suffixes, and enhance ProGuard rules. Update UI components in MainActivity and DashboardContent for improved layout and padding. Refactor BottomTabs and Wallet/Workers screens for consistent padding adjustments.

Carles Sentis 1 주 전
부모
커밋
6ce052fe05

+ 12 - 3
app/build.gradle.kts

@@ -15,8 +15,8 @@ android {
         applicationId = "com.codeskraps.publicpool"
         minSdk = 26
         targetSdk = 35
-        versionCode = 2
-        versionName = "1.1"
+        versionCode = 3
+        versionName = "1.2"
 
         testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
         vectorDrawables {
@@ -25,13 +25,22 @@ android {
     }
 
     buildTypes {
-        release {
+        debug {
+            applicationIdSuffix = ".debug"
+            versionNameSuffix = "-debug"
             isMinifyEnabled = false
             proguardFiles(
                 getDefaultProguardFile("proguard-android-optimize.txt"),
                 "proguard-rules.pro"
             )
         }
+        release {
+            isMinifyEnabled = true
+            proguardFiles(
+                getDefaultProguardFile("proguard-android-optimize.txt"),
+                "proguard-rules.pro"
+            )
+        }
     }
     compileOptions {
         sourceCompatibility = JavaVersion.VERSION_19

+ 27 - 1
app/proguard-rules.pro

@@ -18,4 +18,30 @@
 
 # If you keep the line number information, uncomment this to
 # hide the original source file name.
-#-renamesourcefileattribute SourceFile
+#-renamesourcefileattribute SourceFile
+
+# Rules from missing_rules.txt
+-dontwarn javax.servlet.ServletContainerInitializer
+
+# Keep rules for libraries
+# AnyChart
+-keep class com.anychart.** { *; }
+-dontwarn com.anychart.**
+
+# Kotlinx Serialization
+-keepattributes *Annotation*, InnerClasses
+-dontnote kotlinx.serialization.AnnotationsKt
+
+# Ktor
+-keepattributes Signature, InnerClasses, EnclosingMethod
+-keepattributes RuntimeVisibleAnnotations, RuntimeVisibleParameterAnnotations
+-keepattributes AnnotationDefault
+
+# Coil
+-dontwarn okhttp3.internal.**
+-dontwarn okio.**
+
+# General Android
+-keepattributes SourceFile,LineNumberTable
+-keepattributes Signature
+-keepattributes *Annotation*

+ 15 - 4
app/src/main/java/com/codeskraps/publicpool/MainActivity.kt

@@ -7,16 +7,21 @@ import androidx.activity.ComponentActivity
 import androidx.activity.compose.setContent
 import androidx.activity.enableEdgeToEdge
 import androidx.compose.foundation.layout.Box
+import androidx.compose.foundation.layout.Column
 import androidx.compose.foundation.layout.RowScope
 import androidx.compose.foundation.layout.fillMaxSize
+import androidx.compose.foundation.layout.fillMaxWidth
 import androidx.compose.foundation.layout.padding
+import androidx.compose.material3.HorizontalDivider
 import androidx.compose.material3.Icon
+import androidx.compose.material3.MaterialTheme
 import androidx.compose.material3.NavigationBar
 import androidx.compose.material3.NavigationBarItem
 import androidx.compose.material3.Scaffold
 import androidx.compose.material3.Text
 import androidx.compose.runtime.Composable
 import androidx.compose.ui.Modifier
+import androidx.compose.ui.unit.dp
 import androidx.core.splashscreen.SplashScreen.Companion.installSplashScreen
 import cafe.adriel.voyager.core.screen.Screen
 import cafe.adriel.voyager.navigator.CurrentScreen
@@ -78,10 +83,16 @@ class HomeScreen : Screen {
         TabNavigator(DashboardTab) { tabNavigator ->
             Scaffold(
                 bottomBar = {
-                    NavigationBar {
-                        TabNavigationItem(DashboardTab)
-                        TabNavigationItem(WorkersTab)
-                        TabNavigationItem(WalletTab)
+                    Column {
+                        HorizontalDivider(
+                            thickness = 1.dp,
+                            color = MaterialTheme.colorScheme.outline.copy(alpha = 0.7f)
+                        )
+                        NavigationBar {
+                            TabNavigationItem(DashboardTab)
+                            TabNavigationItem(WorkersTab)
+                            TabNavigationItem(WalletTab)
+                        }
                     }
                 }
             ) { innerPadding ->

+ 41 - 21
app/src/main/java/com/codeskraps/publicpool/presentation/dashboard/DashboardContent.kt

@@ -34,6 +34,7 @@ import androidx.compose.material3.TextButton
 import androidx.compose.material3.TopAppBar
 import androidx.compose.runtime.Composable
 import androidx.compose.runtime.LaunchedEffect
+import androidx.compose.runtime.MutableState
 import androidx.compose.runtime.collectAsState
 import androidx.compose.runtime.getValue
 import androidx.compose.runtime.mutableStateOf
@@ -42,6 +43,8 @@ import androidx.compose.ui.Alignment
 import androidx.compose.ui.Modifier
 import androidx.compose.ui.graphics.Color
 import androidx.compose.ui.graphics.toArgb
+import androidx.compose.ui.layout.onGloballyPositioned
+import androidx.compose.ui.platform.LocalDensity
 import androidx.compose.ui.res.stringResource
 import androidx.compose.ui.text.font.FontWeight
 import androidx.compose.ui.unit.dp
@@ -126,13 +129,18 @@ fun DashboardContent(screenModel: DashboardScreenModel) {
             onRefresh = { screenModel.handleEvent(DashboardEvent.RefreshData) },
             modifier = Modifier
                 .fillMaxSize()
-                .padding(paddingValues)
+                .padding(
+                    top = paddingValues.calculateTopPadding(),
+                    start = 0.dp,
+                    end = 0.dp,
+                    bottom = 0.dp
+                )
         ) {
             Column(
                 modifier = Modifier
                     .fillMaxSize()
-                    .padding(horizontal = 16.dp) // Add horizontal padding
-                    .verticalScroll(rememberScrollState()) // Make column scrollable
+                    .padding(horizontal = 16.dp)
+                    .verticalScroll(rememberScrollState())
             ) {
                 // Add padding between TopAppBar and first card row
                 Spacer(modifier = Modifier.height(16.dp))
@@ -159,7 +167,8 @@ fun DashboardContent(screenModel: DashboardScreenModel) {
                 // Chart Section
                 ChartSection(state = state)
 
-                Spacer(modifier = Modifier.height(16.dp)) // Bottom padding
+                // Bottom padding that won't extend beyond the visible area
+                Spacer(modifier = Modifier.height(16.dp))
             }
         }
     }
@@ -177,7 +186,7 @@ fun TopInfoCards(state: DashboardState) {
             secondaryValue = state.clientInfo?.bestDifficulty?.toDoubleOrNull()?.let { numberFormat.format(it) },
             isLoading = state.isClientInfoLoading,
             modifier = Modifier.weight(1f),
-            showInfoIcon = true
+            showInfoIcon = true,
         )
         Spacer(modifier = Modifier.width(8.dp))
         InfoCard(
@@ -185,7 +194,7 @@ fun TopInfoCards(state: DashboardState) {
             value = formatLargeNumber(state.networkInfo?.networkDifficulty ?: 0.0),
             secondaryValue = numberFormat.format(state.networkInfo?.networkDifficulty ?: 0.0),
             isLoading = state.isNetworkLoading,
-            modifier = Modifier.weight(1f)
+            modifier = Modifier.weight(1f),
         )
     }
     Spacer(modifier = Modifier.height(8.dp))
@@ -194,7 +203,7 @@ fun TopInfoCards(state: DashboardState) {
             label = stringResource(R.string.dashboard_card_label_network_hash_rate),
             value = formatHashRate(state.networkInfo?.networkHashRate ?: 0.0),
             isLoading = state.isNetworkLoading,
-            modifier = Modifier.weight(1f)
+            modifier = Modifier.weight(1f),
         )
         Spacer(modifier = Modifier.width(8.dp))
         InfoCard(
@@ -202,7 +211,7 @@ fun TopInfoCards(state: DashboardState) {
             value = numberFormat.format(state.networkInfo?.blockHeight ?: 0L),
             secondaryValue = "${stringResource(R.string.dashboard_card_secondary_block_weight_prefix)} ${numberFormat.format(state.networkInfo?.blockWeight ?: 0L)}",
             isLoading = state.isNetworkLoading,
-            modifier = Modifier.weight(1f)
+            modifier = Modifier.weight(1f),
         )
     }
 }
@@ -214,7 +223,7 @@ fun InfoCard(
     isLoading: Boolean,
     modifier: Modifier = Modifier,
     secondaryValue: String? = null,
-    showInfoIcon: Boolean = false
+    showInfoIcon: Boolean = false,
 ) {
     val showDialog = remember { mutableStateOf(false) }
     
@@ -235,17 +244,19 @@ fun InfoCard(
         Column(
             modifier = Modifier
                 .fillMaxWidth()
-                .defaultMinSize(minHeight = 90.dp)
+                .defaultMinSize(minHeight = 100.dp)
                 .padding(12.dp),
-             verticalArrangement = Arrangement.SpaceBetween
+            verticalArrangement = Arrangement.SpaceBetween
         ) {
             Row(
-                verticalAlignment = Alignment.CenterVertically
+                verticalAlignment = Alignment.Top,
+                modifier = Modifier.fillMaxWidth()
             ) {
                 Text(
                     text = label, 
                     style = MaterialTheme.typography.labelMedium, 
-                    color = MaterialTheme.colorScheme.onSurfaceVariant
+                    color = MaterialTheme.colorScheme.onSurfaceVariant,
+                    modifier = Modifier.weight(1f)
                 )
                 if (showInfoIcon) {
                     Spacer(modifier = Modifier.width(4.dp))
@@ -253,13 +264,20 @@ fun InfoCard(
                         imageVector = Icons.Default.Info,
                         contentDescription = stringResource(R.string.info_icon_description),
                         modifier = Modifier
-                            .size(16.dp)
-                            .clickable { showDialog.value = true },
-                        tint = MaterialTheme.colorScheme.onSurfaceVariant
+                            .size(20.dp)
+                            .clickable(
+                                onClick = { showDialog.value = true },
+                                indication = null,
+                                interactionSource = remember { androidx.compose.foundation.interaction.MutableInteractionSource() }
+                            )
+                            .padding(2.dp),
+                        tint = MaterialTheme.colorScheme.primary
                     )
                 }
             }
             
+            Spacer(modifier = Modifier.height(8.dp))
+            
             Box(modifier = Modifier.align(Alignment.End)) {
                 if (isLoading) {
                     CircularProgressIndicator(modifier = Modifier.size(20.dp))
@@ -271,11 +289,13 @@ fun InfoCard(
                             fontWeight = FontWeight.Bold,
                             color = MaterialTheme.colorScheme.onSurface
                         )
-                        Text(
-                            text = secondaryValue ?: "",
-                            style = MaterialTheme.typography.bodySmall,
-                            color = if (secondaryValue != null) PositiveGreen else Color.Transparent
-                        )
+                        if (secondaryValue != null && secondaryValue.isNotEmpty()) {
+                            Text(
+                                text = secondaryValue,
+                                style = MaterialTheme.typography.bodySmall,
+                                color = PositiveGreen
+                            )
+                        }
                     }
                 }
             }

+ 21 - 3
app/src/main/java/com/codeskraps/publicpool/presentation/navigation/BottomTabs.kt

@@ -20,7 +20,13 @@ internal data object DashboardTab : Tab {
         get() {
             val title = stringResource(id = R.string.tab_title_dashboard)
             val icon = rememberVectorPainter(Icons.Default.Home)
-            return remember { TabOptions(index = 0u, title = title, icon = icon) }
+            return remember { 
+                TabOptions(
+                    index = 0u, 
+                    title = title, 
+                    icon = icon
+                ) 
+            }
         }
 
     @Composable
@@ -36,7 +42,13 @@ internal data object WorkersTab : Tab {
         get() {
             val title = stringResource(id = R.string.tab_title_workers)
             val icon = painterResource(id = R.drawable.device_hub)
-            return remember { TabOptions(index = 1u, title = title, icon = icon) }
+            return remember { 
+                TabOptions(
+                    index = 1u, 
+                    title = title, 
+                    icon = icon
+                ) 
+            }
         }
 
     @Composable
@@ -52,7 +64,13 @@ internal data object WalletTab : Tab {
         get() {
             val title = stringResource(id = R.string.tab_title_wallet)
             val icon = painterResource(id = R.drawable.wallet)
-            return remember { TabOptions(index = 2u, title = title, icon = icon) }
+            return remember { 
+                TabOptions(
+                    index = 2u, 
+                    title = title, 
+                    icon = icon
+                ) 
+            }
         }
 
     @Composable

+ 6 - 1
app/src/main/java/com/codeskraps/publicpool/presentation/wallet/WalletScreen.kt

@@ -84,7 +84,12 @@ data object WalletScreen : Screen, Parcelable {
                 onRefresh = { screenModel.handleEvent(WalletEvent.LoadWalletDetails) },
                 modifier = Modifier
                     .fillMaxSize()
-                    .padding(paddingValues)
+                    .padding(
+                        top = paddingValues.calculateTopPadding(),
+                        start = 0.dp,
+                        end = 0.dp,
+                        bottom = 0.dp
+                    )
             ) {
                 Box(
                     modifier = Modifier.fillMaxSize()

+ 6 - 1
app/src/main/java/com/codeskraps/publicpool/presentation/workers/WorkersScreen.kt

@@ -85,7 +85,12 @@ data object WorkersScreen : Screen, Parcelable {
                 onRefresh = { screenModel.handleEvent(WorkersEvent.LoadWorkers) },
                 modifier = Modifier
                     .fillMaxSize()
-                    .padding(paddingValues)
+                    .padding(
+                        top = paddingValues.calculateTopPadding(),
+                        start = 0.dp,
+                        end = 0.dp,
+                        bottom = 0.dp
+                    )
             ) {
                 Box(
                     modifier = Modifier.fillMaxSize()