mirror of
https://github.com/oxen-io/session-android.git
synced 2024-11-24 02:25:19 +00:00
Dynamic UI mode menu icon.
This commit is contained in:
parent
471d3b6353
commit
d89074c694
13
res/drawable/ic_baseline_night_mode_24.xml
Normal file
13
res/drawable/ic_baseline_night_mode_24.xml
Normal file
@ -0,0 +1,13 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:viewportWidth="24"
|
||||
android:viewportHeight="24"
|
||||
android:tint="?android:colorControlNormal">
|
||||
<path
|
||||
android:fillColor="#FF000000"
|
||||
android:strokeColor="#FF000000"
|
||||
android:pathData="m11.6367,2.0156c-5.3859,0.1852 -9.6563,4.6051 -9.6563,9.9941 0,5.5228 4.4772,10 10,10 3.3578,-0.0007 6.4911,-1.6866 8.3418,-4.4883C12.136,17.7514 7.2211,8.8651 11.6367,2.0156Z"
|
||||
android:strokeWidth="1.5"
|
||||
android:strokeLineCap="round"/>
|
||||
</vector>
|
@ -1,10 +0,0 @@
|
||||
<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="M12,3c-4.97,0 -9,4.03 -9,9s4.03,9 9,9c0.83,0 1.5,-0.67 1.5,-1.5 0,-0.39 -0.15,-0.74 -0.39,-1.01 -0.23,-0.26 -0.38,-0.61 -0.38,-0.99 0,-0.83 0.67,-1.5 1.5,-1.5L16,16c2.76,0 5,-2.24 5,-5 0,-4.42 -4.03,-8 -9,-8zM6.5,12c-0.83,0 -1.5,-0.67 -1.5,-1.5S5.67,9 6.5,9 8,9.67 8,10.5 7.33,12 6.5,12zM9.5,8C8.67,8 8,7.33 8,6.5S8.67,5 9.5,5s1.5,0.67 1.5,1.5S10.33,8 9.5,8zM14.5,8c-0.83,0 -1.5,-0.67 -1.5,-1.5S13.67,5 14.5,5s1.5,0.67 1.5,1.5S15.33,8 14.5,8zM17.5,12c-0.83,0 -1.5,-0.67 -1.5,-1.5S16.67,9 17.5,9s1.5,0.67 1.5,1.5 -0.67,1.5 -1.5,1.5z"/>
|
||||
</vector>
|
12
res/drawable/ic_outline_night_mode_24.xml
Normal file
12
res/drawable/ic_outline_night_mode_24.xml
Normal file
@ -0,0 +1,12 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:viewportWidth="24"
|
||||
android:viewportHeight="24"
|
||||
android:tint="?android:colorControlNormal">
|
||||
<path
|
||||
android:strokeColor="#FF000000"
|
||||
android:strokeWidth="1.5"
|
||||
android:pathData="m11.6367,2.0156c-5.3859,0.1852 -9.6563,4.6051 -9.6563,9.9941 0,5.5228 4.4772,10 10,10 3.3578,-0.0007 6.4911,-1.6866 8.3418,-4.4883C12.136,17.7514 7.2211,8.8651 11.6367,2.0156Z"
|
||||
android:strokeLineCap="round"/>
|
||||
</vector>
|
15
res/drawable/ic_outline_night_mode_auto_24.xml
Normal file
15
res/drawable/ic_outline_night_mode_auto_24.xml
Normal file
@ -0,0 +1,15 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:viewportWidth="24"
|
||||
android:viewportHeight="24"
|
||||
android:tint="?android:colorControlNormal">
|
||||
<path
|
||||
android:fillColor="#FF000000"
|
||||
android:pathData="M17,2L13.8008,11L15.6992,11L16.4004,9L19.5996,9L20.3008,11L22.1992,11L19,2L17,2zM18,4L19.1504,7.6504L16.8496,7.6504L18,4z"/>
|
||||
<path
|
||||
android:strokeColor="#FF000000"
|
||||
android:strokeWidth="1.5"
|
||||
android:pathData="m11.6367,2.0156c-5.3859,0.1852 -9.6563,4.6051 -9.6563,9.9941 0,5.5228 4.4772,10 10,10 3.3578,-0.0007 6.4911,-1.6866 8.3418,-4.4883C12.136,17.7514 7.2211,8.8651 11.6367,2.0156Z"
|
||||
android:strokeLineCap="round"/>
|
||||
</vector>
|
6
res/drawable/ic_ui_mode_24.xml
Normal file
6
res/drawable/ic_ui_mode_24.xml
Normal file
@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<level-list xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:maxLevel="0" android:drawable="@drawable/ic_outline_night_mode_24"/>
|
||||
<item android:maxLevel="1" android:drawable="@drawable/ic_baseline_night_mode_24"/>
|
||||
<item android:maxLevel="2" android:drawable="@drawable/ic_outline_night_mode_auto_24"/>
|
||||
</level-list>
|
@ -6,7 +6,7 @@
|
||||
<item
|
||||
android:id="@+id/action_change_theme"
|
||||
android:title=""
|
||||
android:icon="@drawable/ic_baseline_palette_24"
|
||||
android:icon="@drawable/ic_ui_mode_24"
|
||||
app:showAsAction="always" />
|
||||
|
||||
<item
|
||||
|
@ -32,6 +32,7 @@ import org.thoughtcrime.securesms.database.DatabaseFactory
|
||||
import org.thoughtcrime.securesms.loki.dialogs.ChangeUiModeDialog
|
||||
import org.thoughtcrime.securesms.loki.dialogs.ClearAllDataDialog
|
||||
import org.thoughtcrime.securesms.loki.dialogs.SeedDialog
|
||||
import org.thoughtcrime.securesms.loki.utilities.UiModeUtilities
|
||||
import org.thoughtcrime.securesms.loki.utilities.fadeIn
|
||||
import org.thoughtcrime.securesms.loki.utilities.fadeOut
|
||||
import org.thoughtcrime.securesms.loki.utilities.push
|
||||
@ -102,6 +103,12 @@ class SettingsActivity : PassphraseRequiredActionBarActivity() {
|
||||
|
||||
override fun onCreateOptionsMenu(menu: Menu): Boolean {
|
||||
menuInflater.inflate(R.menu.settings_general, menu)
|
||||
|
||||
// Update UI mode menu icon.
|
||||
// It uses three-level selector where each level corresponds to the related UiMode ordinal value.
|
||||
val uiMode = UiModeUtilities.getUserSelectedUiMode(this)
|
||||
menu.findItem(R.id.action_change_theme).icon!!.level = uiMode.ordinal
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user