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)
|
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)
|
super.onCreate(savedInstanceState, ready)
|
||||||
binding = ActivityAppearanceSettingsBinding.inflate(layoutInflater)
|
binding = ActivityAppearanceSettingsBinding.inflate(layoutInflater)
|
||||||
setContentView(binding.root)
|
setContentView(binding.root)
|
||||||
savedInstanceState?.let { bundle ->
|
savedInstanceState?.getSparseParcelableArray<Parcelable>(SCROLL_PARCEL)
|
||||||
val scrollStateParcel = bundle.getSparseParcelableArray<Parcelable>(SCROLL_PARCEL)
|
?.let(binding.scrollView::restoreHierarchyState)
|
||||||
if (scrollStateParcel != null) {
|
|
||||||
binding.scrollView.restoreHierarchyState(scrollStateParcel)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
supportActionBar!!.title = getString(R.string.activity_settings_message_appearance_button_title)
|
supportActionBar!!.title = getString(R.string.activity_settings_message_appearance_button_title)
|
||||||
with (binding) {
|
with (binding) {
|
||||||
// accent toggles
|
// accent toggles
|
||||||
@ -132,7 +126,8 @@ class AppearanceSettingsActivity: PassphraseRequiredActionBarActivity(), View.On
|
|||||||
it.setOnClickListener(this@AppearanceSettingsActivity)
|
it.setOnClickListener(this@AppearanceSettingsActivity)
|
||||||
}
|
}
|
||||||
// system settings toggle
|
// system settings toggle
|
||||||
systemSettingsSwitch.setOnClickListener(this@AppearanceSettingsActivity)
|
systemSettingsSwitch.setOnCheckedChangeListener { _, isChecked -> viewModel.setNewFollowSystemSettings(isChecked) }
|
||||||
|
systemSettingsSwitchHolder.setOnClickListener { systemSettingsSwitch.toggle() }
|
||||||
}
|
}
|
||||||
|
|
||||||
lifecycleScope.launchWhenResumed {
|
lifecycleScope.launchWhenResumed {
|
||||||
@ -148,6 +143,5 @@ class AppearanceSettingsActivity: PassphraseRequiredActionBarActivity(), View.On
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -1,5 +1,6 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?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"
|
<item android:left="@dimen/medium_spacing"
|
||||||
android:right="@dimen/medium_spacing"
|
android:right="@dimen/medium_spacing"
|
||||||
android:bottom="@dimen/small_spacing"
|
android:bottom="@dimen/small_spacing"
|
||||||
@ -10,4 +11,4 @@
|
|||||||
android:bottomRightRadius="?preferenceCornerRadius"/>
|
android:bottomRightRadius="?preferenceCornerRadius"/>
|
||||||
</shape>
|
</shape>
|
||||||
</item>
|
</item>
|
||||||
</layer-list>
|
</ripple>
|
@ -1,5 +1,6 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?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"
|
<item android:left="@dimen/medium_spacing"
|
||||||
android:right="@dimen/medium_spacing">
|
android:right="@dimen/medium_spacing">
|
||||||
<shape android:shape="rectangle">
|
<shape android:shape="rectangle">
|
||||||
@ -14,4 +15,4 @@
|
|||||||
<solid android:color="@color/transparent_white_15"/>
|
<solid android:color="@color/transparent_white_15"/>
|
||||||
</shape>
|
</shape>
|
||||||
</item>
|
</item>
|
||||||
</layer-list>
|
</ripple>
|
@ -1,5 +1,6 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?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"
|
<item android:left="@dimen/medium_spacing"
|
||||||
android:top="@dimen/small_spacing"
|
android:top="@dimen/small_spacing"
|
||||||
android:right="@dimen/medium_spacing"
|
android:right="@dimen/medium_spacing"
|
||||||
@ -9,4 +10,4 @@
|
|||||||
<corners android:radius="?preferenceCornerRadius"/>
|
<corners android:radius="?preferenceCornerRadius"/>
|
||||||
</shape>
|
</shape>
|
||||||
</item>
|
</item>
|
||||||
</layer-list>
|
</ripple>
|
@ -1,5 +1,6 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?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"
|
<item android:left="@dimen/medium_spacing"
|
||||||
android:right="@dimen/medium_spacing"
|
android:right="@dimen/medium_spacing"
|
||||||
android:top="@dimen/small_spacing"
|
android:top="@dimen/small_spacing"
|
||||||
@ -18,4 +19,4 @@
|
|||||||
<solid android:color="@color/transparent_white_15"/>
|
<solid android:color="@color/transparent_white_15"/>
|
||||||
</shape>
|
</shape>
|
||||||
</item>
|
</item>
|
||||||
</layer-list>
|
</ripple>
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
<ripple xmlns:android="http://schemas.android.com/apk/res/android" android:color="?colorControlHighlight">
|
||||||
|
<item>
|
||||||
|
<selector>
|
||||||
<item android:state_selected="true">
|
<item android:state_selected="true">
|
||||||
<shape android:shape="oval">
|
<shape android:shape="oval">
|
||||||
<stroke android:width="1dp" android:color="?android:textColorPrimary"/>
|
<stroke android:width="1dp" android:color="?android:textColorPrimary"/>
|
||||||
@ -10,3 +12,10 @@
|
|||||||
</shape>
|
</shape>
|
||||||
</item>
|
</item>
|
||||||
</selector>
|
</selector>
|
||||||
|
</item>
|
||||||
|
<item android:id="@android:id/mask">
|
||||||
|
<shape android:shape="oval">
|
||||||
|
<solid android:color="@color/black"/>
|
||||||
|
</shape>
|
||||||
|
</item>
|
||||||
|
</ripple>
|
||||||
|
@ -11,6 +11,7 @@
|
|||||||
android:orientation="vertical"
|
android:orientation="vertical"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content">
|
android:layout_height="wrap_content">
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:textColor="?android:textColorTertiary"
|
android:textColor="?android:textColorTertiary"
|
||||||
android:textSize="@dimen/medium_font_size"
|
android:textSize="@dimen/medium_font_size"
|
||||||
@ -20,13 +21,25 @@
|
|||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:text="@string/activity_appearance_themes_category"/>
|
android:text="@string/activity_appearance_themes_category"/>
|
||||||
|
|
||||||
|
<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">
|
||||||
|
<LinearLayout
|
||||||
|
android:orientation="vertical"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content">
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:id="@+id/theme_option_classic_dark"
|
android:id="@+id/theme_option_classic_dark"
|
||||||
android:background="@drawable/preference_top"
|
android:addStatesFromChildren="true"
|
||||||
|
android:background="?selectableItemBackground"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:paddingHorizontal="@dimen/large_spacing"
|
android:paddingHorizontal="@dimen/small_spacing"
|
||||||
android:paddingVertical="@dimen/medium_spacing"
|
android:paddingVertical="@dimen/small_spacing"
|
||||||
android:orientation="horizontal">
|
android:orientation="horizontal">
|
||||||
<ImageView
|
<ImageView
|
||||||
android:theme="@style/Classic.Dark"
|
android:theme="@style/Classic.Dark"
|
||||||
@ -50,12 +63,20 @@
|
|||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"/>
|
android:layout_height="wrap_content"/>
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
|
<View
|
||||||
|
android:alpha="0.15"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="1dp"
|
||||||
|
android:background="?android:textColorPrimary"/>
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:id="@+id/theme_option_classic_light"
|
android:id="@+id/theme_option_classic_light"
|
||||||
|
android:addStatesFromChildren="true"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:background="@drawable/preference_middle"
|
android:background="?selectableItemBackground"
|
||||||
android:paddingHorizontal="@dimen/large_spacing"
|
android:paddingHorizontal="@dimen/small_spacing"
|
||||||
android:paddingVertical="@dimen/small_spacing"
|
android:paddingVertical="@dimen/small_spacing"
|
||||||
android:orientation="horizontal">
|
android:orientation="horizontal">
|
||||||
<ImageView
|
<ImageView
|
||||||
@ -80,13 +101,22 @@
|
|||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"/>
|
android:layout_height="wrap_content"/>
|
||||||
</LinearLayout>
|
</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
|
<LinearLayout
|
||||||
android:id="@+id/theme_option_ocean_dark"
|
android:id="@+id/theme_option_ocean_dark"
|
||||||
|
android:addStatesFromChildren="true"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:background="@drawable/preference_middle"
|
android:background="?selectableItemBackground"
|
||||||
android:paddingHorizontal="@dimen/large_spacing"
|
android:paddingHorizontal="@dimen/small_spacing"
|
||||||
android:paddingVertical="@dimen/medium_spacing"
|
android:paddingVertical="@dimen/small_spacing"
|
||||||
android:orientation="horizontal">
|
android:orientation="horizontal">
|
||||||
<ImageView
|
<ImageView
|
||||||
android:theme="@style/Ocean.Dark"
|
android:theme="@style/Ocean.Dark"
|
||||||
@ -110,14 +140,22 @@
|
|||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"/>
|
android:layout_height="wrap_content"/>
|
||||||
</LinearLayout>
|
</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
|
<LinearLayout
|
||||||
android:id="@+id/theme_option_ocean_light"
|
android:id="@+id/theme_option_ocean_light"
|
||||||
|
android:addStatesFromChildren="true"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:background="@drawable/preference_bottom"
|
android:background="?selectableItemBackground"
|
||||||
android:paddingHorizontal="@dimen/large_spacing"
|
android:paddingHorizontal="@dimen/small_spacing"
|
||||||
android:paddingTop="@dimen/medium_spacing"
|
android:paddingVertical="@dimen/small_spacing"
|
||||||
android:paddingBottom="@dimen/large_spacing"
|
|
||||||
android:orientation="horizontal">
|
android:orientation="horizontal">
|
||||||
<ImageView
|
<ImageView
|
||||||
android:theme="@style/Ocean.Light"
|
android:theme="@style/Ocean.Light"
|
||||||
@ -141,6 +179,12 @@
|
|||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"/>
|
android:layout_height="wrap_content"/>
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
</androidx.cardview.widget.CardView>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:textColor="?android:textColorTertiary"
|
android:textColor="?android:textColorTertiary"
|
||||||
android:textSize="@dimen/medium_font_size"
|
android:textSize="@dimen/medium_font_size"
|
||||||
@ -208,8 +252,8 @@
|
|||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:orientation="horizontal"
|
android:orientation="horizontal"
|
||||||
android:layout_marginVertical="@dimen/medium_spacing"
|
android:layout_marginVertical="@dimen/small_spacing"
|
||||||
android:layout_marginHorizontal="@dimen/large_spacing">
|
android:layout_marginHorizontal="@dimen/small_spacing">
|
||||||
<View
|
<View
|
||||||
android:id="@+id/accent_green"
|
android:id="@+id/accent_green"
|
||||||
android:background="@drawable/padded_circle_tintable"
|
android:background="@drawable/padded_circle_tintable"
|
||||||
@ -270,12 +314,21 @@
|
|||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:text="@string/activity_appearance_follow_system_category"/>
|
android:text="@string/activity_appearance_follow_system_category"/>
|
||||||
|
|
||||||
<LinearLayout
|
<androidx.cardview.widget.CardView
|
||||||
android:padding="@dimen/medium_spacing"
|
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:layout_marginBottom="@dimen/massive_spacing"
|
||||||
android:background="@drawable/preference_single"
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content">
|
||||||
|
<LinearLayout
|
||||||
|
android:id="@+id/system_settings_switch_holder"
|
||||||
|
android:background="?selectableItemBackground"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
|
android:addStatesFromChildren="true"
|
||||||
android:gravity="center">
|
android:gravity="center">
|
||||||
<TextView
|
<TextView
|
||||||
android:textColor="?android:textColorPrimary"
|
android:textColor="?android:textColorPrimary"
|
||||||
@ -287,12 +340,13 @@
|
|||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_weight="1"/>
|
android:layout_weight="1"/>
|
||||||
<androidx.appcompat.widget.SwitchCompat
|
<com.google.android.material.switchmaterial.SwitchMaterial
|
||||||
android:id="@+id/system_settings_switch"
|
android:id="@+id/system_settings_switch"
|
||||||
android:paddingHorizontal="@dimen/large_spacing"
|
android:paddingHorizontal="@dimen/large_spacing"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"/>
|
android:layout_height="wrap_content"/>
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
</androidx.cardview.widget.CardView>
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
</ScrollView>
|
</ScrollView>
|
Loading…
x
Reference in New Issue
Block a user