mirror of
https://github.com/oxen-io/session-android.git
synced 2024-12-22 07:57:30 +00:00
Add button downstates to appearance settings screen (#1224)
This commit is contained in:
parent
92a6447b8a
commit
b9f24bc4bd
@ -78,8 +78,6 @@ class AppearanceSettingsActivity: PassphraseRequiredActionBarActivity(), View.On
|
||||
viewModel.setNewAccent(R.style.PrimaryGreen)
|
||||
}
|
||||
}
|
||||
} else if (v == binding.systemSettingsSwitch) {
|
||||
viewModel.setNewFollowSystemSettings((v as SwitchCompat).isChecked)
|
||||
}
|
||||
}
|
||||
|
||||
@ -115,12 +113,8 @@ class AppearanceSettingsActivity: PassphraseRequiredActionBarActivity(), View.On
|
||||
super.onCreate(savedInstanceState, ready)
|
||||
binding = ActivityAppearanceSettingsBinding.inflate(layoutInflater)
|
||||
setContentView(binding.root)
|
||||
savedInstanceState?.let { bundle ->
|
||||
val scrollStateParcel = bundle.getSparseParcelableArray<Parcelable>(SCROLL_PARCEL)
|
||||
if (scrollStateParcel != null) {
|
||||
binding.scrollView.restoreHierarchyState(scrollStateParcel)
|
||||
}
|
||||
}
|
||||
savedInstanceState?.getSparseParcelableArray<Parcelable>(SCROLL_PARCEL)
|
||||
?.let(binding.scrollView::restoreHierarchyState)
|
||||
supportActionBar!!.title = getString(R.string.activity_settings_message_appearance_button_title)
|
||||
with (binding) {
|
||||
// accent toggles
|
||||
@ -132,7 +126,8 @@ class AppearanceSettingsActivity: PassphraseRequiredActionBarActivity(), View.On
|
||||
it.setOnClickListener(this@AppearanceSettingsActivity)
|
||||
}
|
||||
// system settings toggle
|
||||
systemSettingsSwitch.setOnClickListener(this@AppearanceSettingsActivity)
|
||||
systemSettingsSwitch.setOnCheckedChangeListener { _, isChecked -> viewModel.setNewFollowSystemSettings(isChecked) }
|
||||
systemSettingsSwitchHolder.setOnClickListener { systemSettingsSwitch.toggle() }
|
||||
}
|
||||
|
||||
lifecycleScope.launchWhenResumed {
|
||||
@ -148,6 +143,5 @@ class AppearanceSettingsActivity: PassphraseRequiredActionBarActivity(), View.On
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,5 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<ripple xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:color="?colorControlHighlight">
|
||||
<item android:left="@dimen/medium_spacing"
|
||||
android:right="@dimen/medium_spacing"
|
||||
android:bottom="@dimen/small_spacing"
|
||||
@ -10,4 +11,4 @@
|
||||
android:bottomRightRadius="?preferenceCornerRadius"/>
|
||||
</shape>
|
||||
</item>
|
||||
</layer-list>
|
||||
</ripple>
|
@ -1,5 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<ripple xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:color="?colorControlHighlight">
|
||||
<item android:left="@dimen/medium_spacing"
|
||||
android:right="@dimen/medium_spacing">
|
||||
<shape android:shape="rectangle">
|
||||
@ -14,4 +15,4 @@
|
||||
<solid android:color="@color/transparent_white_15"/>
|
||||
</shape>
|
||||
</item>
|
||||
</layer-list>
|
||||
</ripple>
|
@ -1,5 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<ripple xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:color="?colorControlHighlight">
|
||||
<item android:left="@dimen/medium_spacing"
|
||||
android:top="@dimen/small_spacing"
|
||||
android:right="@dimen/medium_spacing"
|
||||
@ -9,4 +10,4 @@
|
||||
<corners android:radius="?preferenceCornerRadius"/>
|
||||
</shape>
|
||||
</item>
|
||||
</layer-list>
|
||||
</ripple>
|
@ -1,5 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<ripple xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:color="?colorControlHighlight">
|
||||
<item android:left="@dimen/medium_spacing"
|
||||
android:right="@dimen/medium_spacing"
|
||||
android:top="@dimen/small_spacing"
|
||||
@ -18,4 +19,4 @@
|
||||
<solid android:color="@color/transparent_white_15"/>
|
||||
</shape>
|
||||
</item>
|
||||
</layer-list>
|
||||
</ripple>
|
||||
|
@ -1,12 +1,21 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:state_selected="true">
|
||||
<ripple xmlns:android="http://schemas.android.com/apk/res/android" android:color="?colorControlHighlight">
|
||||
<item>
|
||||
<selector>
|
||||
<item android:state_selected="true">
|
||||
<shape android:shape="oval">
|
||||
<stroke android:width="1dp" android:color="?android:textColorPrimary"/>
|
||||
</shape>
|
||||
</item>
|
||||
<item android:state_selected="false">
|
||||
<shape android:shape="oval">
|
||||
</shape>
|
||||
</item>
|
||||
</selector>
|
||||
</item>
|
||||
<item android:id="@android:id/mask">
|
||||
<shape android:shape="oval">
|
||||
<stroke android:width="1dp" android:color="?android:textColorPrimary"/>
|
||||
<solid android:color="@color/black"/>
|
||||
</shape>
|
||||
</item>
|
||||
<item android:state_selected="false">
|
||||
<shape android:shape="oval">
|
||||
</shape>
|
||||
</item>
|
||||
</selector>
|
||||
</ripple>
|
||||
|
@ -11,6 +11,7 @@
|
||||
android:orientation="vertical"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<TextView
|
||||
android:textColor="?android:textColorTertiary"
|
||||
android:textSize="@dimen/medium_font_size"
|
||||
@ -20,127 +21,170 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/activity_appearance_themes_category"/>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/theme_option_classic_dark"
|
||||
android:background="@drawable/preference_top"
|
||||
<androidx.cardview.widget.CardView
|
||||
app:cardElevation="0dp"
|
||||
app:cardCornerRadius="@dimen/dialog_corner_radius"
|
||||
android:layout_marginHorizontal="@dimen/medium_spacing"
|
||||
app:cardBackgroundColor="?colorSettingsBackground"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingHorizontal="@dimen/large_spacing"
|
||||
android:paddingVertical="@dimen/medium_spacing"
|
||||
android:orientation="horizontal">
|
||||
<ImageView
|
||||
android:theme="@style/Classic.Dark"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:src="@drawable/ic_themepreview"/>
|
||||
<TextView
|
||||
android:textAppearance="@android:style/TextAppearance.DeviceDefault.Medium"
|
||||
android:lines="1"
|
||||
android:textSize="16sp"
|
||||
android:text="@string/classic_dark_theme_name"
|
||||
android:padding="@dimen/medium_spacing"
|
||||
android:layout_gravity="center"
|
||||
android:layout_width="0dp"
|
||||
android:layout_weight="1"
|
||||
android:layout_height="wrap_content"/>
|
||||
<RadioButton
|
||||
android:id="@+id/theme_radio_classic_dark"
|
||||
android:layout_gravity="center"
|
||||
android:layout_margin="@dimen/small_spacing"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"/>
|
||||
</LinearLayout>
|
||||
<LinearLayout
|
||||
android:id="@+id/theme_option_classic_light"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@drawable/preference_middle"
|
||||
android:paddingHorizontal="@dimen/large_spacing"
|
||||
android:paddingVertical="@dimen/small_spacing"
|
||||
android:orientation="horizontal">
|
||||
<ImageView
|
||||
android:theme="@style/Classic.Light"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:src="@drawable/ic_themepreview"/>
|
||||
<TextView
|
||||
android:textAppearance="@android:style/TextAppearance.DeviceDefault.Medium"
|
||||
android:textSize="16sp"
|
||||
android:lines="1"
|
||||
android:text="@string/classic_light_theme_name"
|
||||
android:padding="@dimen/medium_spacing"
|
||||
android:layout_gravity="center"
|
||||
android:layout_width="0dp"
|
||||
android:layout_weight="1"
|
||||
android:layout_height="wrap_content"/>
|
||||
<RadioButton
|
||||
android:id="@+id/theme_radio_classic_light"
|
||||
android:layout_gravity="center"
|
||||
android:layout_margin="@dimen/small_spacing"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"/>
|
||||
</LinearLayout>
|
||||
<LinearLayout
|
||||
android:id="@+id/theme_option_ocean_dark"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@drawable/preference_middle"
|
||||
android:paddingHorizontal="@dimen/large_spacing"
|
||||
android:paddingVertical="@dimen/medium_spacing"
|
||||
android:orientation="horizontal">
|
||||
<ImageView
|
||||
android:theme="@style/Ocean.Dark"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:src="@drawable/ic_themepreview"/>
|
||||
<TextView
|
||||
android:textAppearance="@android:style/TextAppearance.DeviceDefault.Medium"
|
||||
android:textSize="16sp"
|
||||
android:lines="1"
|
||||
android:text="@string/ocean_dark_theme_name"
|
||||
android:padding="@dimen/medium_spacing"
|
||||
android:layout_gravity="center"
|
||||
android:layout_width="0dp"
|
||||
android:layout_weight="1"
|
||||
android:layout_height="wrap_content"/>
|
||||
<RadioButton
|
||||
android:id="@+id/theme_radio_ocean_dark"
|
||||
android:layout_gravity="center"
|
||||
android:layout_margin="@dimen/small_spacing"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"/>
|
||||
</LinearLayout>
|
||||
<LinearLayout
|
||||
android:id="@+id/theme_option_ocean_light"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@drawable/preference_bottom"
|
||||
android:paddingHorizontal="@dimen/large_spacing"
|
||||
android:paddingTop="@dimen/medium_spacing"
|
||||
android:paddingBottom="@dimen/large_spacing"
|
||||
android:orientation="horizontal">
|
||||
<ImageView
|
||||
android:theme="@style/Ocean.Light"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:src="@drawable/ic_themepreview"/>
|
||||
<TextView
|
||||
android:textAppearance="@android:style/TextAppearance.DeviceDefault.Medium"
|
||||
android:textSize="16sp"
|
||||
android:lines="1"
|
||||
android:text="@string/ocean_light_theme_name"
|
||||
android:padding="@dimen/medium_spacing"
|
||||
android:layout_gravity="center"
|
||||
android:layout_width="0dp"
|
||||
android:layout_weight="1"
|
||||
android:layout_height="wrap_content"/>
|
||||
<RadioButton
|
||||
android:id="@+id/theme_radio_ocean_light"
|
||||
android:layout_gravity="center"
|
||||
android:layout_margin="@dimen/small_spacing"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"/>
|
||||
</LinearLayout>
|
||||
android:layout_height="wrap_content">
|
||||
<LinearLayout
|
||||
android:orientation="vertical"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
<LinearLayout
|
||||
android:id="@+id/theme_option_classic_dark"
|
||||
android:addStatesFromChildren="true"
|
||||
android:background="?selectableItemBackground"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingHorizontal="@dimen/small_spacing"
|
||||
android:paddingVertical="@dimen/small_spacing"
|
||||
android:orientation="horizontal">
|
||||
<ImageView
|
||||
android:theme="@style/Classic.Dark"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:src="@drawable/ic_themepreview"/>
|
||||
<TextView
|
||||
android:textAppearance="@android:style/TextAppearance.DeviceDefault.Medium"
|
||||
android:lines="1"
|
||||
android:textSize="16sp"
|
||||
android:text="@string/classic_dark_theme_name"
|
||||
android:padding="@dimen/medium_spacing"
|
||||
android:layout_gravity="center"
|
||||
android:layout_width="0dp"
|
||||
android:layout_weight="1"
|
||||
android:layout_height="wrap_content"/>
|
||||
<RadioButton
|
||||
android:id="@+id/theme_radio_classic_dark"
|
||||
android:layout_gravity="center"
|
||||
android:layout_margin="@dimen/small_spacing"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"/>
|
||||
</LinearLayout>
|
||||
|
||||
<View
|
||||
android:alpha="0.15"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dp"
|
||||
android:background="?android:textColorPrimary"/>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/theme_option_classic_light"
|
||||
android:addStatesFromChildren="true"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="?selectableItemBackground"
|
||||
android:paddingHorizontal="@dimen/small_spacing"
|
||||
android:paddingVertical="@dimen/small_spacing"
|
||||
android:orientation="horizontal">
|
||||
<ImageView
|
||||
android:theme="@style/Classic.Light"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:src="@drawable/ic_themepreview"/>
|
||||
<TextView
|
||||
android:textAppearance="@android:style/TextAppearance.DeviceDefault.Medium"
|
||||
android:textSize="16sp"
|
||||
android:lines="1"
|
||||
android:text="@string/classic_light_theme_name"
|
||||
android:padding="@dimen/medium_spacing"
|
||||
android:layout_gravity="center"
|
||||
android:layout_width="0dp"
|
||||
android:layout_weight="1"
|
||||
android:layout_height="wrap_content"/>
|
||||
<RadioButton
|
||||
android:id="@+id/theme_radio_classic_light"
|
||||
android:layout_gravity="center"
|
||||
android:layout_margin="@dimen/small_spacing"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"/>
|
||||
</LinearLayout>
|
||||
|
||||
<View
|
||||
android:alpha="0.15"
|
||||
android:layout_marginHorizontal="@dimen/medium_spacing"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dp"
|
||||
android:background="?android:textColorPrimary"/>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/theme_option_ocean_dark"
|
||||
android:addStatesFromChildren="true"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="?selectableItemBackground"
|
||||
android:paddingHorizontal="@dimen/small_spacing"
|
||||
android:paddingVertical="@dimen/small_spacing"
|
||||
android:orientation="horizontal">
|
||||
<ImageView
|
||||
android:theme="@style/Ocean.Dark"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:src="@drawable/ic_themepreview"/>
|
||||
<TextView
|
||||
android:textAppearance="@android:style/TextAppearance.DeviceDefault.Medium"
|
||||
android:textSize="16sp"
|
||||
android:lines="1"
|
||||
android:text="@string/ocean_dark_theme_name"
|
||||
android:padding="@dimen/medium_spacing"
|
||||
android:layout_gravity="center"
|
||||
android:layout_width="0dp"
|
||||
android:layout_weight="1"
|
||||
android:layout_height="wrap_content"/>
|
||||
<RadioButton
|
||||
android:id="@+id/theme_radio_ocean_dark"
|
||||
android:layout_gravity="center"
|
||||
android:layout_margin="@dimen/small_spacing"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"/>
|
||||
</LinearLayout>
|
||||
|
||||
<View
|
||||
android:alpha="0.15"
|
||||
android:layout_marginHorizontal="@dimen/medium_spacing"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dp"
|
||||
android:background="?android:textColorPrimary"/>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/theme_option_ocean_light"
|
||||
android:addStatesFromChildren="true"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="?selectableItemBackground"
|
||||
android:paddingHorizontal="@dimen/small_spacing"
|
||||
android:paddingVertical="@dimen/small_spacing"
|
||||
android:orientation="horizontal">
|
||||
<ImageView
|
||||
android:theme="@style/Ocean.Light"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:src="@drawable/ic_themepreview"/>
|
||||
<TextView
|
||||
android:textAppearance="@android:style/TextAppearance.DeviceDefault.Medium"
|
||||
android:textSize="16sp"
|
||||
android:lines="1"
|
||||
android:text="@string/ocean_light_theme_name"
|
||||
android:padding="@dimen/medium_spacing"
|
||||
android:layout_gravity="center"
|
||||
android:layout_width="0dp"
|
||||
android:layout_weight="1"
|
||||
android:layout_height="wrap_content"/>
|
||||
<RadioButton
|
||||
android:id="@+id/theme_radio_ocean_light"
|
||||
android:layout_gravity="center"
|
||||
android:layout_margin="@dimen/small_spacing"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"/>
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
</androidx.cardview.widget.CardView>
|
||||
|
||||
|
||||
|
||||
<TextView
|
||||
android:textColor="?android:textColorTertiary"
|
||||
android:textSize="@dimen/medium_font_size"
|
||||
@ -208,8 +252,8 @@
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
android:layout_marginVertical="@dimen/medium_spacing"
|
||||
android:layout_marginHorizontal="@dimen/large_spacing">
|
||||
android:layout_marginVertical="@dimen/small_spacing"
|
||||
android:layout_marginHorizontal="@dimen/small_spacing">
|
||||
<View
|
||||
android:id="@+id/accent_green"
|
||||
android:background="@drawable/padded_circle_tintable"
|
||||
@ -270,29 +314,39 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/activity_appearance_follow_system_category"/>
|
||||
|
||||
<LinearLayout
|
||||
android:padding="@dimen/medium_spacing"
|
||||
<androidx.cardview.widget.CardView
|
||||
app:cardElevation="0dp"
|
||||
android:elevation="0dp"
|
||||
app:cardBackgroundColor="?colorSettingsBackground"
|
||||
app:cardCornerRadius="@dimen/dialog_corner_radius"
|
||||
android:layout_margin="@dimen/medium_spacing"
|
||||
android:layout_marginBottom="@dimen/massive_spacing"
|
||||
android:background="@drawable/preference_single"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center">
|
||||
<TextView
|
||||
android:textColor="?android:textColorPrimary"
|
||||
android:textStyle="bold"
|
||||
android:textSize="@dimen/medium_font_size"
|
||||
android:paddingHorizontal="@dimen/large_spacing"
|
||||
android:paddingVertical="@dimen/small_spacing"
|
||||
android:text="@string/activity_appearance_follow_system_explanation"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content">
|
||||
<LinearLayout
|
||||
android:id="@+id/system_settings_switch_holder"
|
||||
android:background="?selectableItemBackground"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"/>
|
||||
<androidx.appcompat.widget.SwitchCompat
|
||||
android:id="@+id/system_settings_switch"
|
||||
android:paddingHorizontal="@dimen/large_spacing"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"/>
|
||||
</LinearLayout>
|
||||
android:addStatesFromChildren="true"
|
||||
android:gravity="center">
|
||||
<TextView
|
||||
android:textColor="?android:textColorPrimary"
|
||||
android:textStyle="bold"
|
||||
android:textSize="@dimen/medium_font_size"
|
||||
android:paddingHorizontal="@dimen/large_spacing"
|
||||
android:paddingVertical="@dimen/small_spacing"
|
||||
android:text="@string/activity_appearance_follow_system_explanation"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"/>
|
||||
<com.google.android.material.switchmaterial.SwitchMaterial
|
||||
android:id="@+id/system_settings_switch"
|
||||
android:paddingHorizontal="@dimen/large_spacing"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"/>
|
||||
</LinearLayout>
|
||||
</androidx.cardview.widget.CardView>
|
||||
|
||||
</LinearLayout>
|
||||
</ScrollView>
|
Loading…
x
Reference in New Issue
Block a user