Skip to content
Snippets Groups Projects
Verified Commit 2189bb26 authored by Réthelyi Bálint's avatar Réthelyi Bálint :no_mouth:
Browse files

disable Xiaomi MIUI force darkmode

parent 43022f71
No related branches found
No related tags found
No related merge requests found
Pipeline #18955 passed
Showing
with 161 additions and 10 deletions
...@@ -12,8 +12,8 @@ android { ...@@ -12,8 +12,8 @@ android {
applicationId "space.rethelyi.mosogepsch" applicationId "space.rethelyi.mosogepsch"
minSdk 21 minSdk 21
targetSdk 31 targetSdk 31
versionCode 11 versionCode 12
versionName "2.5.3" versionName "2.5.4"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
vectorDrawables { vectorDrawables {
......
...@@ -11,6 +11,12 @@ ...@@ -11,6 +11,12 @@
android:roundIcon="@mipmap/ic_launcher_round" android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true" android:supportsRtl="true"
android:theme="@style/Theme.MosogepSCH"> android:theme="@style/Theme.MosogepSCH">
<activity
android:name=".view.OptionViewActivity"
android:exported="false"
android:label="@string/title_activity_option_view"
android:theme="@style/Theme.MosogepSCH.NoActionBar" />
<service <service
android:name=".notification.PushNotificationService" android:name=".notification.PushNotificationService"
android:enabled="true" android:enabled="true"
...@@ -23,18 +29,19 @@ ...@@ -23,18 +29,19 @@
<meta-data <meta-data
android:name="com.google.firebase.messaging.default_notification_channel_id" android:name="com.google.firebase.messaging.default_notification_channel_id"
android:value="@string/noti_channel" /> android:value="@string/noti_channel" />
<activity <activity
android:name=".view.MachineViewActivity" android:name=".view.MachineViewActivity"
android:configChanges="keyboardHidden|orientation|screenSize|screenLayout"
android:exported="false" android:exported="false"
android:label="@string/title_activity_machine_view" android:label="@string/title_activity_machine_view"
android:theme="@style/Theme.MosogepSCH.NoActionBar" android:theme="@style/Theme.MosogepSCH.NoActionBar" />
android:configChanges="keyboardHidden|orientation|screenSize|screenLayout"/>
<activity <activity
android:name=".MainActivity" android:name=".MainActivity"
android:configChanges="keyboardHidden|orientation|screenSize|screenLayout"
android:exported="true" android:exported="true"
android:label="@string/app_name" android:label="@string/app_name"
android:theme="@style/Theme.MosogepSCH.NoActionBar" android:theme="@style/Theme.MosogepSCH.NoActionBar">
android:configChanges="keyboardHidden|orientation|screenSize|screenLayout">
<intent-filter> <intent-filter>
<action android:name="android.intent.action.MAIN" /> <action android:name="android.intent.action.MAIN" />
......
...@@ -28,8 +28,8 @@ val format = SimpleDateFormat.getDateTimeInstance() ...@@ -28,8 +28,8 @@ val format = SimpleDateFormat.getDateTimeInstance()
@Composable @Composable
@OptIn(ExperimentalMaterial3Api::class) @OptIn(ExperimentalMaterial3Api::class)
fun MachineScreen(machine: Machine, lastRequestTime: Date?, onUpdate: (Boolean) -> Unit) { fun MachineScreen(machine: Machine, lastRequestTime: Date?, onUpdate: (Boolean) -> Unit) {
val modifier = Modifier.fillMaxWidth()
val ctx = LocalContext.current val ctx = LocalContext.current
val modifier = Modifier.fillMaxWidth()
Scaffold( Scaffold(
topBar = { topBar = {
SmallTopAppBar( SmallTopAppBar(
......
...@@ -16,6 +16,7 @@ import androidx.compose.ui.unit.dp ...@@ -16,6 +16,7 @@ import androidx.compose.ui.unit.dp
import com.google.accompanist.swiperefresh.SwipeRefresh import com.google.accompanist.swiperefresh.SwipeRefresh
import com.google.accompanist.swiperefresh.SwipeRefreshState import com.google.accompanist.swiperefresh.SwipeRefreshState
import space.rethelyi.mosogepsch.model.LaundryRoom import space.rethelyi.mosogepsch.model.LaundryRoom
import space.rethelyi.mosogepsch.view.helpers.AppBar
import java.util.* import java.util.*
@Composable @Composable
......
package space.rethelyi.mosogepsch.view
import android.app.Activity
import android.os.Bundle
import androidx.activity.ComponentActivity
import androidx.activity.compose.setContent
import androidx.compose.foundation.layout.*
import androidx.compose.material3.*
import androidx.compose.runtime.*
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.res.painterResource
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.unit.dp
import space.rethelyi.mosogepsch.R
import space.rethelyi.mosogepsch.ui.theme.MosogepSCHTheme
import space.rethelyi.mosogepsch.view.helpers.Switch
class OptionViewActivity : ComponentActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContent {
MosogepSCHTheme {
// A surface container using the 'background' color from the theme
Surface(color = MaterialTheme.colorScheme.background) {
OptionView()
}
}
}
}
}
@Composable
@OptIn(ExperimentalMaterial3Api::class)
fun OptionView() {
val ctx = LocalContext.current
val modifier = Modifier.fillMaxWidth()
Scaffold(
topBar = {
SmallTopAppBar(
title = {
Row(
verticalAlignment = Alignment.CenterVertically
) {
TextButton(onClick = {
(ctx as Activity).finish()
}) {
Icon(
painter = painterResource(R.drawable.back_arrow),
contentDescription = "back"
)
}
Text(
text = stringResource(R.string.settings)
)
}
}
)
}
) {
Column(
Modifier
.fillMaxSize()
.padding(16.dp)
) {
Card(
modifier = modifier,
color = MaterialTheme.colorScheme.surfaceVariant
) {
Row(
modifier = modifier
.fillMaxWidth()
.padding(8.dp),
horizontalArrangement = Arrangement.SpaceBetween,
verticalAlignment = Alignment.CenterVertically
) {
var checkedState by remember { mutableStateOf(false) }
Text(
modifier = Modifier
.padding(8.dp),
text = stringResource(R.string.xiaomi)
)
Switch(
state = checkedState,
setState = { checkedState = it }
)
}
}
}
}
}
package space.rethelyi.mosogepsch.view package space.rethelyi.mosogepsch.view.helpers
import android.content.Intent
import androidx.compose.foundation.layout.Arrangement import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Row import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.padding import androidx.compose.foundation.layout.padding
import androidx.compose.material.DropdownMenu
import androidx.compose.material3.Icon import androidx.compose.material3.Icon
import androidx.compose.material3.IconButton
import androidx.compose.material3.Text import androidx.compose.material3.Text
import androidx.compose.material3.SmallTopAppBar import androidx.compose.material3.SmallTopAppBar
import androidx.compose.runtime.Composable import androidx.compose.runtime.Composable
import androidx.compose.ui.Alignment import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier import androidx.compose.ui.Modifier
import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.res.painterResource import androidx.compose.ui.res.painterResource
import androidx.compose.ui.res.stringResource import androidx.compose.ui.res.stringResource
import androidx.compose.ui.unit.dp import androidx.compose.ui.unit.dp
import space.rethelyi.mosogepsch.R import space.rethelyi.mosogepsch.R
import space.rethelyi.mosogepsch.view.OptionViewActivity
@Composable @Composable
fun AppBar(internet: Boolean) { fun AppBar(internet: Boolean) {
val context = LocalContext.current
SmallTopAppBar( SmallTopAppBar(
title = { title = {
Row( Row(
...@@ -38,6 +41,15 @@ fun AppBar(internet: Boolean) { ...@@ -38,6 +41,15 @@ fun AppBar(internet: Boolean) {
contentDescription = stringResource(R.string.no_internet) contentDescription = stringResource(R.string.no_internet)
) )
} }
// IconButton(onClick = {
// val intent = Intent(context, OptionViewActivity::class.java)
// context.startActivity(intent)
// }) {
// Icon(painter = painterResource(R.drawable.settings),
// contentDescription = stringResource(R.string.settings)
// )
// }
}, },
) )
} }
\ No newline at end of file
package space.rethelyi.mosogepsch.view.helpers
import androidx.compose.material.SwitchDefaults
import androidx.compose.material3.MaterialTheme
import androidx.compose.runtime.Composable
@Composable
fun Switch(state: Boolean, setState: (Boolean) -> Unit) {
androidx.compose.material.Switch(
checked = state,
onCheckedChange = setState,
colors = SwitchDefaults.colors(
checkedThumbColor = MaterialTheme.colorScheme.primary,
checkedTrackColor = MaterialTheme.colorScheme.onPrimary,
checkedTrackAlpha = 1f,
uncheckedThumbColor = MaterialTheme.colorScheme.secondary,
uncheckedTrackColor = MaterialTheme.colorScheme.onSecondary,
uncheckedTrackAlpha = 1f,
)
)
}
\ No newline at end of file
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24"
android:tint="?attr/colorControlNormal">
<path
android:fillColor="@android:color/white"
android:pathData="M19.14,12.94c0.04,-0.3 0.06,-0.61 0.06,-0.94c0,-0.32 -0.02,-0.64 -0.07,-0.94l2.03,-1.58c0.18,-0.14 0.23,-0.41 0.12,-0.61l-1.92,-3.32c-0.12,-0.22 -0.37,-0.29 -0.59,-0.22l-2.39,0.96c-0.5,-0.38 -1.03,-0.7 -1.62,-0.94L14.4,2.81c-0.04,-0.24 -0.24,-0.41 -0.48,-0.41h-3.84c-0.24,0 -0.43,0.17 -0.47,0.41L9.25,5.35C8.66,5.59 8.12,5.92 7.63,6.29L5.24,5.33c-0.22,-0.08 -0.47,0 -0.59,0.22L2.74,8.87C2.62,9.08 2.66,9.34 2.86,9.48l2.03,1.58C4.84,11.36 4.8,11.69 4.8,12s0.02,0.64 0.07,0.94l-2.03,1.58c-0.18,0.14 -0.23,0.41 -0.12,0.61l1.92,3.32c0.12,0.22 0.37,0.29 0.59,0.22l2.39,-0.96c0.5,0.38 1.03,0.7 1.62,0.94l0.36,2.54c0.05,0.24 0.24,0.41 0.48,0.41h3.84c0.24,0 0.44,-0.17 0.47,-0.41l0.36,-2.54c0.59,-0.24 1.13,-0.56 1.62,-0.94l2.39,0.96c0.22,0.08 0.47,0 0.59,-0.22l1.92,-3.32c0.12,-0.22 0.07,-0.47 -0.12,-0.61L19.14,12.94zM12,15.6c-1.98,0 -3.6,-1.62 -3.6,-3.6s1.62,-3.6 3.6,-3.6s3.6,1.62 3.6,3.6S13.98,15.6 12,15.6z"/>
</vector>
...@@ -18,4 +18,6 @@ ...@@ -18,4 +18,6 @@
<string name="notification_msg">A %1$s. emeleti %2$s %3$s lett.</string> <string name="notification_msg">A %1$s. emeleti %2$s %3$s lett.</string>
<string name="no_internet">nincs internet kapcsolat</string> <string name="no_internet">nincs internet kapcsolat</string>
<string name="lost_in_space">elveszett (az űrben)</string> <string name="lost_in_space">elveszett (az űrben)</string>
<string name="settings">Beállítások</string>
<string name="xiaomi">Xiaomi MIUI-t használok</string>
</resources> </resources>
\ No newline at end of file
...@@ -12,5 +12,6 @@ ...@@ -12,5 +12,6 @@
<!-- Status bar color. --> <!-- Status bar color. -->
<item name="android:statusBarColor" tools:targetApi="l">?attr/colorPrimaryVariant</item> <item name="android:statusBarColor" tools:targetApi="l">?attr/colorPrimaryVariant</item>
<!-- Customize your theme here. --> <!-- Customize your theme here. -->
<item name="android:forceDarkAllowed" tools:targetApi="q">false</item>
</style> </style>
</resources> </resources>
\ No newline at end of file
...@@ -20,4 +20,7 @@ ...@@ -20,4 +20,7 @@
<string name="notification_msg">The %2$s on floor %1$s became %3$s</string> <string name="notification_msg">The %2$s on floor %1$s became %3$s</string>
<string name="no_internet">no internet connection</string> <string name="no_internet">no internet connection</string>
<string name="lost_in_space">lost in space</string> <string name="lost_in_space">lost in space</string>
<string name="title_activity_option_view">OptionViewActivity</string>
<string name="settings">Settings</string>
<string name="xiaomi">I use Xiaomi MIUI</string>
</resources> </resources>
\ No newline at end of file
...@@ -12,6 +12,7 @@ ...@@ -12,6 +12,7 @@
<!-- Status bar color. --> <!-- Status bar color. -->
<item name="android:statusBarColor" tools:targetApi="l">?attr/colorPrimaryVariant</item> <item name="android:statusBarColor" tools:targetApi="l">?attr/colorPrimaryVariant</item>
<!-- Customize your theme here. --> <!-- Customize your theme here. -->
<item name="android:forceDarkAllowed" tools:targetApi="q">false</item>
</style> </style>
<style name="Theme.MosogepSCH.NoActionBar"> <style name="Theme.MosogepSCH.NoActionBar">
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment