Implement detailed settings screen redesign

This commit is contained in:
Niels Andriesse 2020-01-09 14:15:43 +11:00
parent 8a5307000b
commit a55d5b9263
16 changed files with 268 additions and 180 deletions

View File

@ -154,6 +154,12 @@
android:windowSoftInputMode="adjustResize" />
<activity
android:name="org.thoughtcrime.securesms.loki.redesign.activities.SeedActivity" />
<activity
android:name="org.thoughtcrime.securesms.loki.redesign.activities.PrivacySettingsActivity" />
<activity
android:name="org.thoughtcrime.securesms.loki.redesign.activities.NotificationSettingsActivity" />
<activity
android:name="org.thoughtcrime.securesms.loki.redesign.activities.ChatSettingsActivity" />
<!-- Session -->
<activity android:name="org.thoughtcrime.securesms.loki.LinkedDevicesActivity" />
<activity

View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/fragmentContainer"
android:layout_width="match_parent"
android:layout_height="match_parent" />

View File

@ -1,14 +1,12 @@
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:layout_margin="0dp"
android:background="@color/amber_50"
android:padding="0dp">
android:orientation="vertical">
<View
android:layout_width="match_parent"
android:layout_height="10dp"
android:background="?pref_divider"/>
android:layout_height="@dimen/medium_spacing"
android:background="@color/cell_background" />
</LinearLayout>

View File

@ -1,15 +1,16 @@
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
<FrameLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView android:id="@+id/right_summary"
<TextView
android:id="@+id/right_summary"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="right|center_vertical"
android:gravity="right|center_vertical"
android:textSize="16sp"
android:textColor="@color/signal_primary_dark"/>
android:textSize="@dimen/medium_font_size"
android:textColor="@color/accent" />
</FrameLayout>

View File

@ -140,6 +140,12 @@
<item name="android:textColor">@color/text</item>
<item name="android:elevation">20dp</item>
</style>
<style name="Session.SettingsTheme" parent="PreferenceThemeOverlay.v14.Material" >
<item name="android:textColor">@color/text</item>
<item name="android:textColorSecondary">#99FFFFFF</item>
<item name="android:textSize">@dimen/medium_font_size</item>
</style>
<!-- Session -->
<style name="NoAnimation.Theme.BlackScreen" parent="Theme.AppCompat.NoActionBar">
@ -376,7 +382,6 @@
<item name="android:focusable">false</item>
</style>
<style name="PreferenceThemeOverlay.Fix" parent="PreferenceThemeOverlay.v14.Material">
</style>

View File

@ -10,6 +10,8 @@
<item name="android:navigationBarColor">@color/navigation_bar_background</item>
<item name="alertDialogTheme">@style/Session.AlertDialog</item>
<item name="android:windowBackground">@drawable/default_session_background</item>
<item name="preferenceTheme">@style/Session.SettingsTheme</item>
<item name="colorAccent">@color/accent</item>
</style>
<style name="Session.DarkTheme.NoActionBar" parent="@style/Theme.AppCompat.NoActionBar">
@ -19,6 +21,8 @@
<item name="android:navigationBarColor">@color/navigation_bar_background</item>
<item name="alertDialogTheme">@style/Session.AlertDialog</item>
<item name="android:windowBackground">@drawable/default_session_background</item>
<item name="preferenceTheme">@style/Session.SettingsTheme</item>
<item name="colorAccent">@color/accent</item>
</style>
<!-- Session -->

View File

@ -1,39 +1,43 @@
<?xml version="1.0" encoding="utf-8"?>
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android">
<PreferenceCategory android:title="@string/preferences_app_protection__app_access">
<org.thoughtcrime.securesms.components.SwitchPreferenceCompat
android:key="pref_android_screen_lock"
android:defaultValue="false"
android:title="@string/preferences_app_protection__screen_lock"
android:summary="@string/preferences_app_protection__lock_signal_access_with_android_screen_lock_or_fingerprint"/>
android:summary="@string/preferences_app_protection__lock_signal_access_with_android_screen_lock_or_fingerprint" />
<Preference android:title="@string/preferences_app_protection__screen_lock_inactivity_timeout"
<Preference
android:title="@string/preferences_app_protection__screen_lock_inactivity_timeout"
android:key="pref_android_screen_lock_timeout"
android:dependency="pref_android_screen_lock"/>
android:dependency="pref_android_screen_lock" />
<org.thoughtcrime.securesms.components.SwitchPreferenceCompat
android:key="pref_enable_passphrase_temporary"
android:defaultValue="true"
android:title="@string/preferences__enable_passphrase"
android:summary="@string/preferences__lock_signal_and_message_notifications_with_a_passphrase"/>
android:summary="@string/preferences__lock_signal_and_message_notifications_with_a_passphrase" />
<Preference android:key="pref_change_passphrase"
<Preference
android:key="pref_change_passphrase"
android:title="@string/preferences__change_passphrase"
android:summary="@string/preferences__change_your_passphrase"
android:dependency="pref_enable_passphrase_temporary"/>
android:dependency="pref_enable_passphrase_temporary" />
<org.thoughtcrime.securesms.components.SwitchPreferenceCompat
android:defaultValue="false"
android:key="pref_timeout_passphrase"
android:title="@string/preferences__inactivity_timeout_passphrase"
android:summary="@string/preferences__auto_lock_signal_after_a_specified_time_interval_of_inactivity"
android:dependency="pref_enable_passphrase_temporary"/>
android:dependency="pref_enable_passphrase_temporary" />
<Preference android:title="@string/preferences__inactivity_timeout_interval"
<Preference
android:title="@string/preferences__inactivity_timeout_interval"
android:key="pref_timeout_interval"
android:dependency="pref_timeout_passphrase"/>
android:dependency="pref_timeout_passphrase" />
<org.thoughtcrime.securesms.components.SwitchPreferenceCompat
android:defaultValue="false"
@ -46,9 +50,10 @@
android:key="pref_incognito_keyboard"
android:title="@string/preferences__incognito_keyboard"
android:summary="@string/preferences__request_keyboard_to_disable_personalized_learning"/>
</PreferenceCategory>
<PreferenceCategory android:layout="@layout/preference_divider"/>
<PreferenceCategory android:layout="@layout/preference_divider" />
<PreferenceCategory android:title="@string/preferences_app_protection__communication">

View File

@ -1,8 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
<PreferenceScreen
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools">
<!-- <PreferenceCategory android:key="media_download" android:title="@string/preferences_chats__media_auto_download">
<MultiSelectListPreference
android:title="@string/preferences_chats__when_using_mobile_data"
android:key="pref_media_download_mobile"
@ -26,18 +29,19 @@
android:persistent="true"
android:entries="@array/pref_media_download_values"
android:entryValues="@array/pref_media_download_entries" />
</PreferenceCategory>
<PreferenceCategory android:layout="@layout/preference_divider"/> -->
<PreferenceCategory android:title="@string/preferences_chats__chats">
<org.thoughtcrime.securesms.preferences.widgets.SignalListPreference
<!-- <org.thoughtcrime.securesms.preferences.widgets.SignalListPreference
android:key="pref_message_body_text_size"
android:title="@string/preferences_chats__message_text_size"
android:entries="@array/pref_message_font_size_entries"
android:entryValues="@array/pref_message_font_size_values"
android:defaultValue="16">
</org.thoughtcrime.securesms.preferences.widgets.SignalListPreference>
android:defaultValue="16" /> -->
<!-- <org.thoughtcrime.securesms.components.SwitchPreferenceCompat
android:defaultValue="true"
@ -55,34 +59,39 @@
android:defaultValue="false"
android:key="pref_enter_sends"
android:summary="@string/preferences__pressing_the_enter_key_will_send_text_messages"
android:title="@string/preferences__pref_enter_sends_title"/>
android:title="@string/preferences__pref_enter_sends_title" />
</PreferenceCategory>
<PreferenceCategory android:layout="@layout/preference_divider"/>
<PreferenceCategory android:key="message_trimming" android:title="@string/preferences_chats__message_trimming">
<org.thoughtcrime.securesms.components.SwitchPreferenceCompat
android:defaultValue="false"
android:key="pref_trim_threads"
android:summary="@string/preferences__automatically_delete_older_messages_once_a_conversation_exceeds_a_specified_length"
android:title="@string/preferences__delete_old_messages" />
<EditTextPreference android:defaultValue="500"
<EditTextPreference
android:defaultValue="500"
android:key="pref_trim_length"
android:title="@string/preferences__conversation_length_limit"
android:inputType="number"
android:dependency="pref_trim_threads" />
<Preference android:key="pref_trim_now"
<Preference
android:key="pref_trim_now"
android:title="@string/preferences__trim_all_conversations_now"
android:summary="@string/preferences__scan_through_all_conversations_and_enforce_conversation_length_limits"
android:dependency="pref_trim_threads" />
</PreferenceCategory>
<PreferenceCategory android:layout="@layout/preference_divider"/>
<PreferenceCategory android:layout="@layout/preference_divider" />
<PreferenceCategory android:key="backup_category" android:title="@string/preferences_chats__backups">
<org.thoughtcrime.securesms.components.SwitchPreferenceCompat
android:defaultValue="false"
android:key="pref_backup_enabled"
@ -94,7 +103,7 @@
android:title="@string/preferences_chats__create_backup"
android:persistent="false"
android:dependency="pref_backup_enabled"
tools:summary="Last backup: 3 days ago"/>
tools:summary="Last backup: 3 days ago" />
</PreferenceCategory>

View File

@ -2,7 +2,7 @@
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android">
<!-- <PreferenceCategory android:title="@string/preferences_notifications__messages"> -->
<PreferenceCategory android:title="@string/preferences_notifications__messages">
<org.thoughtcrime.securesms.components.SwitchPreferenceCompat
android:key="pref_key_enable_notifications"
@ -15,9 +15,11 @@
android:dependency="pref_key_enable_notifications"
android:defaultValue="1"
android:entries="@array/pref_notification_priority_entries"
android:entryValues="@array/pref_notification_priority_values"/>
android:entryValues="@array/pref_notification_priority_values" />
<PreferenceCategory android:layout="@layout/preference_divider"/>
</PreferenceCategory>
<PreferenceCategory android:layout="@layout/preference_divider" />
<PreferenceCategory android:title="@string/activity_notification_settings_style_section_title">
@ -32,7 +34,7 @@
android:dependency="pref_key_enable_notifications"
android:key="pref_key_vibrate"
android:defaultValue="true"
android:title="@string/preferences__vibrate"/>
android:title="@string/preferences__vibrate" />
<org.thoughtcrime.securesms.preferences.widgets.LEDColorListPreference
android:key="pref_led_color"
@ -66,7 +68,7 @@
</PreferenceCategory>
<PreferenceCategory android:layout="@layout/preference_divider"/>
<PreferenceCategory android:layout="@layout/preference_divider" />
<PreferenceCategory android:title="@string/activity_notification_settings_content_section_title">
@ -76,7 +78,7 @@
android:dependency="pref_key_enable_notifications"
android:defaultValue="all"
android:entries="@array/pref_notification_privacy_entries"
android:entryValues="@array/pref_notification_privacy_values"/>
android:entryValues="@array/pref_notification_privacy_values" />
</PreferenceCategory>

View File

@ -0,0 +1,19 @@
package org.thoughtcrime.securesms.loki.redesign.activities
import android.os.Bundle
import network.loki.messenger.R
import org.thoughtcrime.securesms.PassphraseRequiredActionBarActivity
import org.thoughtcrime.securesms.preferences.ChatsPreferenceFragment
class ChatSettingsActivity : PassphraseRequiredActionBarActivity() {
override fun onCreate(savedInstanceState: Bundle?, isReady: Boolean) {
super.onCreate(savedInstanceState, isReady)
setContentView(R.layout.activity_fragment_wrapper)
supportActionBar!!.title = "Chats"
val fragment = ChatsPreferenceFragment()
val transaction = supportFragmentManager.beginTransaction()
transaction.replace(R.id.fragmentContainer, fragment)
transaction.commit()
}
}

View File

@ -0,0 +1,19 @@
package org.thoughtcrime.securesms.loki.redesign.activities
import android.os.Bundle
import network.loki.messenger.R
import org.thoughtcrime.securesms.PassphraseRequiredActionBarActivity
import org.thoughtcrime.securesms.preferences.NotificationsPreferenceFragment
class NotificationSettingsActivity : PassphraseRequiredActionBarActivity() {
override fun onCreate(savedInstanceState: Bundle?, isReady: Boolean) {
super.onCreate(savedInstanceState, isReady)
setContentView(R.layout.activity_fragment_wrapper)
supportActionBar!!.title = "Notifications"
val fragment = NotificationsPreferenceFragment()
val transaction = supportFragmentManager.beginTransaction()
transaction.replace(R.id.fragmentContainer, fragment)
transaction.commit()
}
}

View File

@ -0,0 +1,19 @@
package org.thoughtcrime.securesms.loki.redesign.activities
import android.os.Bundle
import network.loki.messenger.R
import org.thoughtcrime.securesms.PassphraseRequiredActionBarActivity
import org.thoughtcrime.securesms.preferences.AppProtectionPreferenceFragment
class PrivacySettingsActivity : PassphraseRequiredActionBarActivity() {
override fun onCreate(savedInstanceState: Bundle?, isReady: Boolean) {
super.onCreate(savedInstanceState, isReady)
setContentView(R.layout.activity_fragment_wrapper)
supportActionBar!!.title = "Privacy"
val fragment = AppProtectionPreferenceFragment()
val transaction = supportFragmentManager.beginTransaction()
transaction.replace(R.id.fragmentContainer, fragment)
transaction.commit()
}
}

View File

@ -23,7 +23,6 @@ import nl.komponents.kovenant.all
import nl.komponents.kovenant.deferred
import nl.komponents.kovenant.ui.alwaysUi
import org.thoughtcrime.securesms.ApplicationContext
import org.thoughtcrime.securesms.ApplicationPreferencesActivity
import org.thoughtcrime.securesms.PassphraseRequiredActionBarActivity
import org.thoughtcrime.securesms.avatar.AvatarSelection
import org.thoughtcrime.securesms.crypto.ProfileKeyUtil
@ -89,6 +88,8 @@ class SettingsActivity : PassphraseRequiredActionBarActivity() {
seedButton.visibility = View.GONE
}
privacyButton.setOnClickListener { showPrivacySettings() }
notificationsButton.setOnClickListener { showNotificationSettings() }
chatsButton.setOnClickListener { showChatSettings() }
seedButton.setOnClickListener { showSeed() }
clearAllDataButton.setOnClickListener { clearAllData() }
}
@ -250,7 +251,17 @@ class SettingsActivity : PassphraseRequiredActionBarActivity() {
}
private fun showPrivacySettings() {
val intent = Intent(this, ApplicationPreferencesActivity::class.java)
val intent = Intent(this, PrivacySettingsActivity::class.java)
push(intent)
}
private fun showNotificationSettings() {
val intent = Intent(this, NotificationSettingsActivity::class.java)
push(intent)
}
private fun showChatSettings() {
val intent = Intent(this, ChatSettingsActivity::class.java)
push(intent)
}

View File

@ -12,7 +12,6 @@ import android.support.v7.preference.Preference;
import android.widget.Toast;
import org.thoughtcrime.securesms.ApplicationContext;
import org.thoughtcrime.securesms.ApplicationPreferencesActivity;
import org.thoughtcrime.securesms.BlockedContactsActivity;
import org.thoughtcrime.securesms.PassphraseChangeActivity;
import org.thoughtcrime.securesms.components.SwitchPreferenceCompat;
@ -72,8 +71,6 @@ public class AppProtectionPreferenceFragment extends CorrectedPreferenceFragment
disablePassphrase.setOnPreferenceChangeListener(new DisablePassphraseClickListener());
initializeVisibility();
Analytics.Companion.getShared().track("Privacy Settings Opened");
}
@Override
@ -84,8 +81,6 @@ public class AppProtectionPreferenceFragment extends CorrectedPreferenceFragment
@Override
public void onResume() {
super.onResume();
((ApplicationPreferencesActivity) getActivity()).getSupportActionBar().setTitle(R.string.preferences__privacy);
if (!TextSecurePreferences.isPasswordDisabled(getContext())) initializePassphraseTimeoutSummary();
else initializeScreenLockTimeoutSummary();

View File

@ -17,8 +17,6 @@ import org.greenrobot.eventbus.EventBus;
import org.greenrobot.eventbus.Subscribe;
import org.greenrobot.eventbus.ThreadMode;
import org.thoughtcrime.securesms.ApplicationContext;
import org.thoughtcrime.securesms.ApplicationPreferencesActivity;
import network.loki.messenger.R;
import org.thoughtcrime.securesms.backup.BackupDialog;
import org.thoughtcrime.securesms.backup.FullBackupBase.BackupEvent;
import org.thoughtcrime.securesms.components.SwitchPreferenceCompat;
@ -35,6 +33,8 @@ import java.util.List;
import java.util.Locale;
import java.util.Set;
import network.loki.messenger.R;
public class ChatsPreferenceFragment extends ListSummaryPreferenceFragment {
private static final String TAG = ChatsPreferenceFragment.class.getSimpleName();
@ -76,7 +76,6 @@ public class ChatsPreferenceFragment extends ListSummaryPreferenceFragment {
@Override
public void onResume() {
super.onResume();
((ApplicationPreferencesActivity)getActivity()).getSupportActionBar().setTitle(R.string.preferences__chats);
setMediaDownloadSummaries();
setBackupSummary();
}

View File

@ -14,12 +14,10 @@ import android.support.v7.preference.ListPreference;
import android.support.v7.preference.Preference;
import android.text.TextUtils;
import org.thoughtcrime.securesms.ApplicationPreferencesActivity;
import org.thoughtcrime.securesms.components.SwitchPreferenceCompat;
import org.thoughtcrime.securesms.notifications.MessageNotifier;
import org.thoughtcrime.securesms.notifications.NotificationChannels;
import org.thoughtcrime.securesms.util.TextSecurePreferences;
import org.whispersystems.signalservice.loki.utilities.Analytics;
import network.loki.messenger.R;
@ -121,8 +119,6 @@ public class NotificationsPreferenceFragment extends ListSummaryPreferenceFragme
// initializeCallRingtoneSummary(findPreference(TextSecurePreferences.CALL_RINGTONE_PREF));
initializeMessageVibrateSummary((SwitchPreferenceCompat)findPreference(TextSecurePreferences.VIBRATE_PREF));
// initializeCallVibrateSummary((SwitchPreferenceCompat)findPreference(TextSecurePreferences.CALL_VIBRATE_PREF));
Analytics.Companion.getShared().track("Notification Settings Opened");
}
@Override
@ -130,12 +126,6 @@ public class NotificationsPreferenceFragment extends ListSummaryPreferenceFragme
addPreferencesFromResource(R.xml.preferences_notifications);
}
@Override
public void onResume() {
super.onResume();
((ApplicationPreferencesActivity) getActivity()).getSupportActionBar().setTitle(R.string.preferences__notifications);
}
@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
if (requestCode == 1 && resultCode == RESULT_OK && data != null) {