From 8b5b07e71cf3751b3d812780c26ca18f47f782a5 Mon Sep 17 00:00:00 2001 From: Meghdad Date: Wed, 6 May 2026 07:46:14 +0330 Subject: [PATCH] implement dark mode, force app to LTR --- app/src/main/AndroidManifest.xml | 2 +- .../java/net/rodakot/posthub/MainActivity.kt | 79 +++++++++++++------ app/src/main/res/drawable/widget_bg.xml | 4 +- app/src/main/res/drawable/widget_pill_bg.xml | 2 +- .../main/res/drawable/widget_refresh_bg.xml | 2 +- app/src/main/res/layout/widget_flow.xml | 14 ++-- app/src/main/res/values-night-v31/themes.xml | 16 ++++ app/src/main/res/values-night/colors.xml | 16 ++++ app/src/main/res/values-night/themes.xml | 21 +++++ app/src/main/res/values/colors.xml | 6 ++ 10 files changed, 126 insertions(+), 36 deletions(-) create mode 100644 app/src/main/res/values-night-v31/themes.xml create mode 100644 app/src/main/res/values-night/colors.xml create mode 100644 app/src/main/res/values-night/themes.xml diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index ece1bf5..61d09d3 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -11,7 +11,7 @@ android:icon="@mipmap/ic_launcher" android:label="@string/app_name" android:roundIcon="@mipmap/ic_launcher_round" - android:supportsRtl="true" + android:supportsRtl="false" android:theme="@style/Theme.PostHUB"> Unit ) { + val sections = appSections() + PanelSurface { Column(verticalArrangement = Arrangement.spacedBy(14.dp)) { Row( @@ -630,8 +654,8 @@ private fun AppHomeHeader( ) { Surface( shape = RoundedCornerShape(8.dp), - color = AppColors.Ink, - contentColor = Color.White + color = AppColors.Primary, + contentColor = AppColors.OnPrimary ) { Text( text = "PH", @@ -648,7 +672,7 @@ private fun AppHomeHeader( fontWeight = FontWeight.Black ) Text( - text = AppSections.firstOrNull { it.key == activeSection }?.meta ?: "Request client", + text = sections.firstOrNull { it.key == activeSection }?.meta ?: "Request client", color = AppColors.Muted, style = MaterialTheme.typography.bodySmall ) @@ -675,7 +699,7 @@ private fun AppHomeHeader( .horizontalScroll(rememberScrollState()), horizontalArrangement = Arrangement.spacedBy(8.dp) ) { - AppSections.forEach { section -> + sections.forEach { section -> AppSectionChip( section = section, selected = activeSection == section.key, @@ -942,7 +966,7 @@ private fun SendButton( shape = RoundedCornerShape(8.dp), colors = ButtonDefaults.buttonColors( containerColor = AppColors.Primary, - contentColor = Color.White, + contentColor = AppColors.OnPrimary, disabledContainerColor = AppColors.Border, disabledContentColor = AppColors.Muted ) @@ -951,7 +975,7 @@ private fun SendButton( CircularProgressIndicator( modifier = Modifier.size(18.dp), strokeWidth = 2.dp, - color = Color.White + color = AppColors.OnPrimary ) Spacer(Modifier.width(8.dp)) Text("Sending") @@ -1167,13 +1191,18 @@ private fun FlowPanel( onClick = onRun, enabled = steps.isNotEmpty() && !isRunning, shape = RoundedCornerShape(8.dp), - colors = ButtonDefaults.buttonColors(containerColor = AppColors.Primary) + colors = ButtonDefaults.buttonColors( + containerColor = AppColors.Primary, + contentColor = AppColors.OnPrimary, + disabledContainerColor = AppColors.Border, + disabledContentColor = AppColors.Muted + ) ) { if (isRunning) { CircularProgressIndicator( modifier = Modifier.size(16.dp), strokeWidth = 2.dp, - color = Color.White + color = AppColors.OnPrimary ) Spacer(Modifier.width(8.dp)) } diff --git a/app/src/main/res/drawable/widget_bg.xml b/app/src/main/res/drawable/widget_bg.xml index b64e473..19d78ab 100644 --- a/app/src/main/res/drawable/widget_bg.xml +++ b/app/src/main/res/drawable/widget_bg.xml @@ -1,8 +1,8 @@ - + + android:color="@color/posthub_border" /> diff --git a/app/src/main/res/drawable/widget_pill_bg.xml b/app/src/main/res/drawable/widget_pill_bg.xml index 056f0e6..b494d5c 100644 --- a/app/src/main/res/drawable/widget_pill_bg.xml +++ b/app/src/main/res/drawable/widget_pill_bg.xml @@ -1,5 +1,5 @@ - + diff --git a/app/src/main/res/drawable/widget_refresh_bg.xml b/app/src/main/res/drawable/widget_refresh_bg.xml index ed333d4..442c868 100644 --- a/app/src/main/res/drawable/widget_refresh_bg.xml +++ b/app/src/main/res/drawable/widget_refresh_bg.xml @@ -1,5 +1,5 @@ - + diff --git a/app/src/main/res/layout/widget_flow.xml b/app/src/main/res/layout/widget_flow.xml index bf63d00..df16c8d 100644 --- a/app/src/main/res/layout/widget_flow.xml +++ b/app/src/main/res/layout/widget_flow.xml @@ -5,8 +5,10 @@ android:layout_height="match_parent" android:background="@drawable/widget_bg" android:gravity="center_vertical" + android:layoutDirection="ltr" android:orientation="vertical" - android:padding="16dp"> + android:padding="16dp" + android:textDirection="ltr"> @@ -39,7 +41,7 @@ android:ellipsize="end" android:maxLines="1" android:text="@string/widget_ready" - android:textColor="#66736D" + android:textColor="@color/posthub_widget_subtitle" android:textSize="12sp" /> @@ -76,7 +78,7 @@ android:paddingBottom="5dp" android:text="@string/widget_idle" android:textAlignment="center" - android:textColor="#006B5B" + android:textColor="@color/posthub_widget_status" android:textSize="11sp" android:textStyle="bold" /> @@ -89,7 +91,7 @@ android:ellipsize="end" android:maxLines="1" android:text="@string/widget_no_run" - android:textColor="#66736D" + android:textColor="@color/posthub_widget_subtitle" android:textSize="12sp" /> @@ -104,7 +106,7 @@ android:gravity="top" android:maxLines="4" android:text="@string/widget_empty_state" - android:textColor="#17201C" + android:textColor="@color/posthub_widget_title" android:textSize="13sp" /> diff --git a/app/src/main/res/values-night-v31/themes.xml b/app/src/main/res/values-night-v31/themes.xml new file mode 100644 index 0000000..1bb73de --- /dev/null +++ b/app/src/main/res/values-night-v31/themes.xml @@ -0,0 +1,16 @@ + + + + + diff --git a/app/src/main/res/values-night/colors.xml b/app/src/main/res/values-night/colors.xml new file mode 100644 index 0000000..b983fbc --- /dev/null +++ b/app/src/main/res/values-night/colors.xml @@ -0,0 +1,16 @@ + + + #5FE0C5 + #14382F + #0E1513 + #151D1A + #2E3B36 + #FF9A83 + #E8B660 + #151D1A + #5FE0C5 + #14382F + #EAF3EF + #A2B2AB + #5FE0C5 + diff --git a/app/src/main/res/values-night/themes.xml b/app/src/main/res/values-night/themes.xml new file mode 100644 index 0000000..68f6573 --- /dev/null +++ b/app/src/main/res/values-night/themes.xml @@ -0,0 +1,21 @@ + + + + + + + diff --git a/app/src/main/res/values/colors.xml b/app/src/main/res/values/colors.xml index 5845b5c..c5fb7ce 100644 --- a/app/src/main/res/values/colors.xml +++ b/app/src/main/res/values/colors.xml @@ -7,4 +7,10 @@ #DDE4DF #D84B35 #C47A12 + #F7FAF7 + #006B5B + #E3F4EF + #17201C + #66736D + #006B5B