diff --git a/res/drawable/preference_divider.xml b/res/drawable/preference_divider.xml
new file mode 100644
index 0000000000..a7ce0c1b96
--- /dev/null
+++ b/res/drawable/preference_divider.xml
@@ -0,0 +1,19 @@
+
+
+
+ -
+
+
+
+
+
+
+ -
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/res/layout/led_color_preference_widget.xml b/res/layout/led_color_preference_widget.xml
new file mode 100644
index 0000000000..c575131e5a
--- /dev/null
+++ b/res/layout/led_color_preference_widget.xml
@@ -0,0 +1,13 @@
+
+
+
+
+
\ No newline at end of file
diff --git a/res/layout/preference_divider.xml b/res/layout/preference_divider.xml
new file mode 100644
index 0000000000..9456a59401
--- /dev/null
+++ b/res/layout/preference_divider.xml
@@ -0,0 +1,14 @@
+
+
+
+
+
\ No newline at end of file
diff --git a/res/values/strings.xml b/res/values/strings.xml
index d2834c1a5c..c1f7e03a64 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -1187,6 +1187,11 @@
Support for next-generation video and voice calls when enabled by both parties. This feature is in beta.
Relay all calls through the Signal server to avoid revealing your IP address to your contact. Enabling will reduce call quality.
Always relay calls
+ App access
+ Communication
+ Chats
+ Message notifications
+ Events
diff --git a/res/xml/preferences_advanced.xml b/res/xml/preferences_advanced.xml
index dcc6e78fc2..ddd5bb4462 100644
--- a/res/xml/preferences_advanced.xml
+++ b/res/xml/preferences_advanced.xml
@@ -7,24 +7,6 @@
android:title="@string/preferences__signal_messages_and_calls"
android:summary="@string/preferences__free_private_messages_and_calls"/>
-
-
-
-
-
-
diff --git a/res/xml/preferences_app_protection.xml b/res/xml/preferences_app_protection.xml
index 1cde219123..5f1a3b04cf 100644
--- a/res/xml/preferences_app_protection.xml
+++ b/res/xml/preferences_app_protection.xml
@@ -1,39 +1,52 @@
-
+
+
-
+
-
+
-
+
-
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
diff --git a/res/xml/preferences_chats.xml b/res/xml/preferences_chats.xml
index a687d1a794..dfa8d61a0a 100644
--- a/res/xml/preferences_chats.xml
+++ b/res/xml/preferences_chats.xml
@@ -27,6 +27,24 @@
android:entryValues="@array/pref_media_download_entries" />
+
+
+
+
+
+
+
+
+
+
-
-
+
-
+
-
+
-
+
-
-
-
+ android:entries="@array/pref_led_color_entries"
+ android:entryValues="@array/pref_led_color_values" />
-
+
-
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/org/thoughtcrime/securesms/ApplicationPreferencesActivity.java b/src/org/thoughtcrime/securesms/ApplicationPreferencesActivity.java
index 8cb41ced6e..a44edbf62e 100644
--- a/src/org/thoughtcrime/securesms/ApplicationPreferencesActivity.java
+++ b/src/org/thoughtcrime/securesms/ApplicationPreferencesActivity.java
@@ -26,11 +26,13 @@ import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentTransaction;
import android.support.v4.preference.PreferenceFragment;
+import android.view.View;
import org.thoughtcrime.securesms.crypto.MasterSecret;
import org.thoughtcrime.securesms.preferences.AdvancedPreferenceFragment;
import org.thoughtcrime.securesms.preferences.AppProtectionPreferenceFragment;
import org.thoughtcrime.securesms.preferences.AppearancePreferenceFragment;
+import org.thoughtcrime.securesms.preferences.CorrectedPreferenceFragment;
import org.thoughtcrime.securesms.preferences.NotificationsPreferenceFragment;
import org.thoughtcrime.securesms.preferences.SmsMmsPreferenceFragment;
import org.thoughtcrime.securesms.preferences.ChatsPreferenceFragment;
@@ -121,7 +123,8 @@ public class ApplicationPreferencesActivity extends PassphraseRequiredActionBarA
}
}
- public static class ApplicationPreferenceFragment extends PreferenceFragment {
+ public static class ApplicationPreferenceFragment extends CorrectedPreferenceFragment {
+
@Override
public void onCreate(Bundle icicle) {
super.onCreate(icicle);
diff --git a/src/org/thoughtcrime/securesms/preferences/AppProtectionPreferenceFragment.java b/src/org/thoughtcrime/securesms/preferences/AppProtectionPreferenceFragment.java
index dc0a3045dc..4df78f1405 100644
--- a/src/org/thoughtcrime/securesms/preferences/AppProtectionPreferenceFragment.java
+++ b/src/org/thoughtcrime/securesms/preferences/AppProtectionPreferenceFragment.java
@@ -27,7 +27,7 @@ import org.thoughtcrime.securesms.util.TextSecurePreferences;
import java.util.concurrent.TimeUnit;
-public class AppProtectionPreferenceFragment extends PreferenceFragment {
+public class AppProtectionPreferenceFragment extends CorrectedPreferenceFragment {
private static final String PREFERENCE_CATEGORY_BLOCKED = "preference_category_blocked";
diff --git a/src/org/thoughtcrime/securesms/preferences/BooleanListPreference.java b/src/org/thoughtcrime/securesms/preferences/BooleanListPreference.java
deleted file mode 100644
index 6a7ae1e81a..0000000000
--- a/src/org/thoughtcrime/securesms/preferences/BooleanListPreference.java
+++ /dev/null
@@ -1,58 +0,0 @@
-/**
- * Copyright (C) 2017 Whisper Systems
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see .
- */
-package org.thoughtcrime.securesms.preferences;
-
-import android.content.Context;
-import android.preference.ListPreference;
-import android.util.AttributeSet;
-
-import org.thoughtcrime.securesms.R;
-
-/**
- * List preference that disables dependents when set to "none", similar to a CheckBoxPreference.
- *
- * @author Taylor Kline
- */
-
-public class BooleanListPreference extends ListPreference {
-
- public BooleanListPreference(Context context, AttributeSet attrs) {
- super(context, attrs);
- }
-
- public BooleanListPreference(Context context) {
- super(context);
- }
-
- @Override
- public void setValue(String value) {
- CharSequence oldEntry = getEntry();
- super.setValue(value);
- CharSequence newEntry = getEntry();
- if (oldEntry != newEntry) {
- notifyDependencyChange(shouldDisableDependents());
- }
- }
-
- @Override
- public boolean shouldDisableDependents() {
- CharSequence newEntry = getEntry();
- String noneEntry = getContext().getString(R.string.preferences__none);
- boolean shouldDisable = newEntry.equals(noneEntry);
- return shouldDisable || super.shouldDisableDependents();
- }
-}
diff --git a/src/org/thoughtcrime/securesms/preferences/ChatsPreferenceFragment.java b/src/org/thoughtcrime/securesms/preferences/ChatsPreferenceFragment.java
index 3f8d088be0..d84daa9a65 100644
--- a/src/org/thoughtcrime/securesms/preferences/ChatsPreferenceFragment.java
+++ b/src/org/thoughtcrime/securesms/preferences/ChatsPreferenceFragment.java
@@ -10,6 +10,7 @@ import android.support.v4.preference.PreferenceFragment;
import android.support.v7.app.AlertDialog;
import android.text.TextUtils;
import android.util.Log;
+import android.view.View;
import org.thoughtcrime.securesms.ApplicationPreferencesActivity;
import org.thoughtcrime.securesms.R;
@@ -20,7 +21,7 @@ import java.util.ArrayList;
import java.util.List;
import java.util.Set;
-public class ChatsPreferenceFragment extends PreferenceFragment {
+public class ChatsPreferenceFragment extends CorrectedPreferenceFragment {
private static final String TAG = ChatsPreferenceFragment.class.getSimpleName();
@Override
diff --git a/src/org/thoughtcrime/securesms/preferences/CorrectedPreferenceFragment.java b/src/org/thoughtcrime/securesms/preferences/CorrectedPreferenceFragment.java
new file mode 100644
index 0000000000..220aabb757
--- /dev/null
+++ b/src/org/thoughtcrime/securesms/preferences/CorrectedPreferenceFragment.java
@@ -0,0 +1,18 @@
+package org.thoughtcrime.securesms.preferences;
+
+
+import android.os.Bundle;
+import android.support.v4.preference.PreferenceFragment;
+import android.view.View;
+
+public class CorrectedPreferenceFragment extends PreferenceFragment {
+
+ @Override
+ public void onActivityCreated(Bundle savedInstanceState) {
+ super.onActivityCreated(savedInstanceState);
+
+ View lv = getView().findViewById(android.R.id.list);
+ if (lv != null) lv.setPadding(0, 0, 0, 0);
+ }
+
+}
diff --git a/src/org/thoughtcrime/securesms/preferences/LEDColorListPreference.java b/src/org/thoughtcrime/securesms/preferences/LEDColorListPreference.java
new file mode 100644
index 0000000000..774e8bdb8d
--- /dev/null
+++ b/src/org/thoughtcrime/securesms/preferences/LEDColorListPreference.java
@@ -0,0 +1,108 @@
+/**
+ * Copyright (C) 2017 Whisper Systems
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+package org.thoughtcrime.securesms.preferences;
+
+import android.content.Context;
+import android.graphics.drawable.GradientDrawable;
+import android.preference.ListPreference;
+import android.support.annotation.NonNull;
+import android.util.AttributeSet;
+import android.util.Log;
+import android.view.View;
+import android.widget.ImageView;
+
+import org.thoughtcrime.securesms.R;
+
+/**
+ * List preference that disables dependents when set to "none", similar to a CheckBoxPreference.
+ *
+ * @author Taylor Kline
+ */
+
+public class LEDColorListPreference extends ListPreference {
+
+ private static final String TAG = LEDColorListPreference.class.getSimpleName();
+
+ private ImageView colorImageView;
+
+ public LEDColorListPreference(Context context, AttributeSet attrs) {
+ super(context, attrs);
+ setWidgetLayoutResource(R.layout.led_color_preference_widget);
+ }
+
+ public LEDColorListPreference(Context context) {
+ super(context);
+ setWidgetLayoutResource(R.layout.led_color_preference_widget);
+ }
+
+ @Override
+ public void setValue(String value) {
+ CharSequence oldEntry = getEntry();
+ super.setValue(value);
+ CharSequence newEntry = getEntry();
+ if (oldEntry != newEntry) {
+ notifyDependencyChange(shouldDisableDependents());
+ }
+
+ if (value != null) setPreviewColor(value);
+ }
+
+ @Override
+ public boolean shouldDisableDependents() {
+ CharSequence newEntry = getValue();
+ boolean shouldDisable = newEntry.equals("none");
+ return shouldDisable || super.shouldDisableDependents();
+ }
+
+ @Override
+ protected void onBindView(View view) {
+ super.onBindView(view);
+ this.colorImageView = (ImageView)view.findViewById(R.id.color_view);
+ setPreviewColor(getValue());
+ }
+
+ @Override
+ public void setSummary(CharSequence summary) {
+ super.setSummary(null);
+ }
+
+ private void setPreviewColor(@NonNull String value) {
+ int color;
+
+ switch (value) {
+ case "green": color = getContext().getResources().getColor(R.color.green_500); break;
+ case "red": color = getContext().getResources().getColor(R.color.red_500); break;
+ case "blue": color = getContext().getResources().getColor(R.color.blue_500); break;
+ case "yellow": color = getContext().getResources().getColor(R.color.yellow_500); break;
+ case "cyan": color = getContext().getResources().getColor(R.color.cyan_500); break;
+ case "magenta": color = getContext().getResources().getColor(R.color.pink_500); break;
+ case "white": color = getContext().getResources().getColor(R.color.white); break;
+ default: color = getContext().getResources().getColor(R.color.transparent); break;
+ }
+
+ if (colorImageView != null) {
+ GradientDrawable drawable = new GradientDrawable();
+ drawable.setShape(GradientDrawable.OVAL);
+ drawable.setColor(color);
+
+ colorImageView.setImageDrawable(drawable);
+ }
+ }
+
+
+
+}
diff --git a/src/org/thoughtcrime/securesms/preferences/ListSummaryPreferenceFragment.java b/src/org/thoughtcrime/securesms/preferences/ListSummaryPreferenceFragment.java
index d9902a34b5..ebb6375933 100644
--- a/src/org/thoughtcrime/securesms/preferences/ListSummaryPreferenceFragment.java
+++ b/src/org/thoughtcrime/securesms/preferences/ListSummaryPreferenceFragment.java
@@ -8,7 +8,7 @@ import org.thoughtcrime.securesms.R;
import java.util.Arrays;
-public abstract class ListSummaryPreferenceFragment extends PreferenceFragment {
+public abstract class ListSummaryPreferenceFragment extends CorrectedPreferenceFragment {
protected class ListSummaryListener implements Preference.OnPreferenceChangeListener {
@Override
diff --git a/src/org/thoughtcrime/securesms/preferences/SmsMmsPreferenceFragment.java b/src/org/thoughtcrime/securesms/preferences/SmsMmsPreferenceFragment.java
index fa9841b155..5fe97930b1 100644
--- a/src/org/thoughtcrime/securesms/preferences/SmsMmsPreferenceFragment.java
+++ b/src/org/thoughtcrime/securesms/preferences/SmsMmsPreferenceFragment.java
@@ -20,7 +20,7 @@ import org.thoughtcrime.securesms.R;
import org.thoughtcrime.securesms.util.TextSecurePreferences;
import org.thoughtcrime.securesms.util.Util;
-public class SmsMmsPreferenceFragment extends PreferenceFragment {
+public class SmsMmsPreferenceFragment extends CorrectedPreferenceFragment {
private static final String KITKAT_DEFAULT_PREF = "pref_set_default";
private static final String MMS_PREF = "pref_mms_preferences";