Browse Source

Merge remote-tracking branch 'origin/develop' into develop

pull/61/merge
oogee 6 years ago
parent
commit
b839ac34ab
  1. 4
      app/build.gradle
  2. 6
      app/src/main/java/gr/thmmy/mthmmy/activities/settings/SettingsFragment.java
  3. 19
      app/src/main/res/xml-v26/app_preferences_guest.xml
  4. 32
      app/src/main/res/xml-v26/app_preferences_user.xml
  5. 32
      app/src/main/res/xml/app_preferences_guest.xml
  6. 44
      app/src/main/res/xml/app_preferences_user.xml

4
app/build.gradle

@ -54,8 +54,8 @@ tasks.whenTaskAdded { task ->
dependencies { dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar']) implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'androidx.appcompat:appcompat:1.0.0' implementation 'androidx.appcompat:appcompat:1.0.1'
implementation 'androidx.preference:preference:1.0.0' implementation 'androidx.preference:preference:1.1.0-alpha01'
implementation 'androidx.legacy:legacy-preference-v14:1.0.0' implementation 'androidx.legacy:legacy-preference-v14:1.0.0'
implementation 'androidx.legacy:legacy-support-v4:1.0.0' implementation 'androidx.legacy:legacy-support-v4:1.0.0'
implementation 'androidx.cardview:cardview:1.0.0' implementation 'androidx.cardview:cardview:1.0.0'

6
app/src/main/java/gr/thmmy/mthmmy/activities/settings/SettingsFragment.java

@ -28,7 +28,7 @@ public class SettingsFragment extends PreferenceFragmentCompat implements Shared
NOT_SET, USER, GUEST NOT_SET, USER, GUEST
} }
public static final String ARG_IS_LOGGED_IN = "selectedRingtoneKey"; private static final String ARG_IS_LOGGED_IN = "selectedRingtoneKey";
//Preferences xml keys //Preferences xml keys
private static final String SELECTED_NOTIFICATIONS_SOUND = "pref_notifications_select_sound_key"; private static final String SELECTED_NOTIFICATIONS_SOUND = "pref_notifications_select_sound_key";
@ -44,7 +44,7 @@ public class SettingsFragment extends PreferenceFragmentCompat implements Shared
private SharedPreferences settingsFile; private SharedPreferences settingsFile;
private PREFS_TYPE prefs_type = PREFS_TYPE.NOT_SET; private PREFS_TYPE prefs_type = PREFS_TYPE.NOT_SET;
private boolean isLoggedIn = false; private boolean isLoggedIn;
private ArrayList<String> defaultHomeTabEntries = new ArrayList<>(); private ArrayList<String> defaultHomeTabEntries = new ArrayList<>();
private ArrayList<String> defaultHomeTabValues = new ArrayList<>(); private ArrayList<String> defaultHomeTabValues = new ArrayList<>();
@ -161,7 +161,7 @@ public class SettingsFragment extends PreferenceFragmentCompat implements Shared
} }
} }
public void updateUserLoginState(boolean isLoggedIn) { void updateUserLoginState(boolean isLoggedIn) {
this.isLoggedIn = isLoggedIn; this.isLoggedIn = isLoggedIn;
updatePreferenceVisibility(); updatePreferenceVisibility();
} }

19
app/src/main/res/xml-v26/app_preferences_guest.xml

@ -1,7 +1,10 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<androidx.preference.PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"> <androidx.preference.PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">
<androidx.preference.PreferenceCategory android:title="@string/pref_category_app"> <androidx.preference.PreferenceCategory
android:title="@string/pref_category_app"
app:iconSpaceReserved="false">
<androidx.preference.ListPreference <androidx.preference.ListPreference
android:defaultValue="0" android:defaultValue="0"
android:dialogTitle="@string/pref_app_main_default_tab_dialog_title" android:dialogTitle="@string/pref_app_main_default_tab_dialog_title"
@ -9,22 +12,26 @@
android:entryValues="@array/pref_app_main_default_tab_values" android:entryValues="@array/pref_app_main_default_tab_values"
android:key="pref_app_main_default_tab_key" android:key="pref_app_main_default_tab_key"
android:title="@string/pref_title_app_main_default_tab" android:title="@string/pref_title_app_main_default_tab"
android:summary="@string/pref_summary_app_main_default_tab" /> android:summary="@string/pref_summary_app_main_default_tab"
app:iconSpaceReserved="false" />
</androidx.preference.PreferenceCategory> </androidx.preference.PreferenceCategory>
<androidx.preference.PreferenceCategory <androidx.preference.PreferenceCategory
android:key="pref_category_privacy_key" android:key="pref_category_privacy_key"
android:title="@string/pref_category_privacy"> android:title="@string/pref_category_privacy"
app:iconSpaceReserved="false">
<androidx.preference.SwitchPreferenceCompat <androidx.preference.SwitchPreferenceCompat
android:defaultValue="false" android:defaultValue="false"
android:key="@string/pref_privacy_crashlytics_enable_key" android:key="@string/pref_privacy_crashlytics_enable_key"
android:title="@string/pref_title_privacy_crashlytics_enable" android:title="@string/pref_title_privacy_crashlytics_enable"
android:summary="@string/pref_summary_privacy_crashlytics_enable" /> android:summary="@string/pref_summary_privacy_crashlytics_enable"
app:iconSpaceReserved="false" />
<androidx.preference.SwitchPreferenceCompat <androidx.preference.SwitchPreferenceCompat
android:defaultValue="false" android:defaultValue="false"
android:key="@string/pref_privacy_analytics_enable_key" android:key="@string/pref_privacy_analytics_enable_key"
android:title="@string/pref_title_privacy_analytics_enable" android:title="@string/pref_title_privacy_analytics_enable"
android:summary="@string/pref_summary_privacy_analytics_enable" /> android:summary="@string/pref_summary_privacy_analytics_enable"
app:iconSpaceReserved="false" />
</androidx.preference.PreferenceCategory> </androidx.preference.PreferenceCategory>
</androidx.preference.PreferenceScreen> </androidx.preference.PreferenceScreen>

32
app/src/main/res/xml-v26/app_preferences_user.xml

@ -1,7 +1,10 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<androidx.preference.PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"> <androidx.preference.PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">
<androidx.preference.PreferenceCategory android:title="@string/pref_category_app"> <androidx.preference.PreferenceCategory
android:title="@string/pref_category_app"
app:iconSpaceReserved="false">
<androidx.preference.ListPreference <androidx.preference.ListPreference
android:defaultValue="0" android:defaultValue="0"
android:dialogTitle="@string/pref_app_main_default_tab_dialog_title" android:dialogTitle="@string/pref_app_main_default_tab_dialog_title"
@ -9,42 +12,49 @@
android:entryValues="@array/pref_app_main_default_tab_values" android:entryValues="@array/pref_app_main_default_tab_values"
android:key="pref_app_main_default_tab_key" android:key="pref_app_main_default_tab_key"
android:title="@string/pref_title_app_main_default_tab" android:title="@string/pref_title_app_main_default_tab"
android:summary="@string/pref_summary_app_main_default_tab" /> android:summary="@string/pref_summary_app_main_default_tab"
app:iconSpaceReserved="false" />
</androidx.preference.PreferenceCategory> </androidx.preference.PreferenceCategory>
<androidx.preference.PreferenceCategory <androidx.preference.PreferenceCategory
android:key="pref_category_posting_key" android:key="pref_category_posting_key"
android:title="@string/pref_category_posting"> android:title="@string/pref_category_posting"
app:iconSpaceReserved="false">
<androidx.preference.SwitchPreferenceCompat <androidx.preference.SwitchPreferenceCompat
android:defaultValue="true" android:defaultValue="true"
android:key="pref_posting_app_signature_enable_key" android:key="pref_posting_app_signature_enable_key"
android:title="@string/pref_title_posting_app_signature_enable" android:title="@string/pref_title_posting_app_signature_enable"
android:summary="@string/pref_summary_posting_app_signature_enable" /> android:summary="@string/pref_summary_posting_app_signature_enable"
app:iconSpaceReserved="false" />
</androidx.preference.PreferenceCategory> </androidx.preference.PreferenceCategory>
<!--<androidx.preference.PreferenceCategory <!--<androidx.preference.PreferenceCategory
android:key="pref_category_uploading_key" android:key="pref_category_uploading_key"
android:title="@string/pref_category_uploading"> android:title="@string/pref_category_uploading"
app:iconSpaceReserved="false">
<androidx.preference.SwitchPreferenceCompat <androidx.preference.SwitchPreferenceCompat
android:defaultValue="true" android:defaultValue="true"
android:key="pref_uploading_app_signature_enable_key" android:key="pref_uploading_app_signature_enable_key"
android:title="@string/pref_title_uploading_app_signature_enable" android:title="@string/pref_title_uploading_app_signature_enable"
android:summary="@string/pref_summary_uploading_app_signature_enable" /> android:summary="@string/pref_summary_uploading_app_signature_enable"
app:iconSpaceReserved="false" />
</androidx.preference.PreferenceCategory>--> </androidx.preference.PreferenceCategory>-->
<androidx.preference.PreferenceCategory <androidx.preference.PreferenceCategory
android:key="pref_category_privacy_key" android:key="pref_category_privacy_key"
android:title="@string/pref_category_privacy"> android:title="@string/pref_category_privacy"
app:iconSpaceReserved="false">
<androidx.preference.SwitchPreferenceCompat <androidx.preference.SwitchPreferenceCompat
android:defaultValue="false" android:defaultValue="false"
android:key="@string/pref_privacy_crashlytics_enable_key" android:key="@string/pref_privacy_crashlytics_enable_key"
android:title="@string/pref_title_privacy_crashlytics_enable" android:title="@string/pref_title_privacy_crashlytics_enable"
android:summary="@string/pref_summary_privacy_crashlytics_enable" /> android:summary="@string/pref_summary_privacy_crashlytics_enable"
app:iconSpaceReserved="false" />
<androidx.preference.SwitchPreferenceCompat <androidx.preference.SwitchPreferenceCompat
android:defaultValue="false" android:defaultValue="false"
android:key="@string/pref_privacy_analytics_enable_key" android:key="@string/pref_privacy_analytics_enable_key"
android:title="@string/pref_title_privacy_analytics_enable" android:title="@string/pref_title_privacy_analytics_enable"
android:summary="@string/pref_summary_privacy_analytics_enable" /> android:summary="@string/pref_summary_privacy_analytics_enable"
app:iconSpaceReserved="false" />
</androidx.preference.PreferenceCategory> </androidx.preference.PreferenceCategory>
</androidx.preference.PreferenceScreen> </androidx.preference.PreferenceScreen>

32
app/src/main/res/xml/app_preferences_guest.xml

@ -1,7 +1,10 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<androidx.preference.preference.PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"> <androidx.preference.preference.PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">
<androidx.preference.PreferenceCategory android:title="@string/pref_category_app"> <androidx.preference.PreferenceCategory
android:title="@string/pref_category_app"
app:iconSpaceReserved="false">
<androidx.preference.ListPreference <androidx.preference.ListPreference
android:defaultValue="0" android:defaultValue="0"
android:dialogTitle="@string/pref_app_main_default_tab_dialog_title" android:dialogTitle="@string/pref_app_main_default_tab_dialog_title"
@ -9,38 +12,47 @@
android:entryValues="@array/pref_app_main_default_tab_values" android:entryValues="@array/pref_app_main_default_tab_values"
android:key="pref_app_main_default_tab_key" android:key="pref_app_main_default_tab_key"
android:title="@string/pref_title_app_main_default_tab" android:title="@string/pref_title_app_main_default_tab"
android:summary="@string/pref_summary_app_main_default_tab" /> android:summary="@string/pref_summary_app_main_default_tab"
app:iconSpaceReserved="false" />
</androidx.preference.PreferenceCategory> </androidx.preference.PreferenceCategory>
<androidx.preference.PreferenceCategory android:title="@string/pref_category_notifications"> <androidx.preference.PreferenceCategory
android:title="@string/pref_category_notifications"
app:iconSpaceReserved="false">
<androidx.preference.SwitchPreferenceCompat <androidx.preference.SwitchPreferenceCompat
android:defaultValue="true" android:defaultValue="true"
android:key="pref_notification_vibration_enable_key" android:key="pref_notification_vibration_enable_key"
android:title="@string/pref_title_notification_vibration_enable" /> android:title="@string/pref_title_notification_vibration_enable"
app:iconSpaceReserved="false" />
<androidx.preference.SwitchPreferenceCompat <androidx.preference.SwitchPreferenceCompat
android:defaultValue="true" android:defaultValue="true"
android:key="pref_notification_led_enable_key" android:key="pref_notification_led_enable_key"
android:title="@string/pref_title_notification_led_enable" android:title="@string/pref_title_notification_led_enable"
android:summary="@string/pref_summary_notification_led_enable" /> android:summary="@string/pref_summary_notification_led_enable"
app:iconSpaceReserved="false" />
<Preference <Preference
android:key="pref_notifications_select_sound_key" android:key="pref_notifications_select_sound_key"
android:title="@string/pref_title_notifications_sound" android:title="@string/pref_title_notifications_sound"
android:summary="@string/pref_summary_notifications_sound" /> android:summary="@string/pref_summary_notifications_sound"
app:iconSpaceReserved="false" />
</androidx.preference.PreferenceCategory> </androidx.preference.PreferenceCategory>
<androidx.preference.PreferenceCategory <androidx.preference.PreferenceCategory
android:key="pref_category_privacy_key" android:key="pref_category_privacy_key"
android:title="@string/pref_category_privacy"> android:title="@string/pref_category_privacy"
app:iconSpaceReserved="false">
<androidx.preference.SwitchPreferenceCompat <androidx.preference.SwitchPreferenceCompat
android:defaultValue="false" android:defaultValue="false"
android:key="@string/pref_privacy_crashlytics_enable_key" android:key="@string/pref_privacy_crashlytics_enable_key"
android:title="@string/pref_title_privacy_crashlytics_enable" android:title="@string/pref_title_privacy_crashlytics_enable"
android:summary="@string/pref_summary_privacy_crashlytics_enable" /> android:summary="@string/pref_summary_privacy_crashlytics_enable"
app:iconSpaceReserved="false" />
<androidx.preference.SwitchPreferenceCompat <androidx.preference.SwitchPreferenceCompat
android:defaultValue="false" android:defaultValue="false"
android:key="@string/pref_privacy_analytics_enable_key" android:key="@string/pref_privacy_analytics_enable_key"
android:title="@string/pref_title_privacy_analytics_enable" android:title="@string/pref_title_privacy_analytics_enable"
android:summary="@string/pref_summary_privacy_analytics_enable" /> android:summary="@string/pref_summary_privacy_analytics_enable"
app:iconSpaceReserved="false" />
</androidx.preference.PreferenceCategory> </androidx.preference.PreferenceCategory>
</androidx.preference.preference.PreferenceScreen> </androidx.preference.preference.PreferenceScreen>

44
app/src/main/res/xml/app_preferences_user.xml

@ -1,7 +1,10 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<androidx.preference.PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"> <androidx.preference.PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">
<androidx.preference.PreferenceCategory android:title="@string/pref_category_app"> <androidx.preference.PreferenceCategory
android:title="@string/pref_category_app"
app:iconSpaceReserved="false">
<androidx.preference.ListPreference <androidx.preference.ListPreference
android:defaultValue="0" android:defaultValue="0"
android:dialogTitle="@string/pref_app_main_default_tab_dialog_title" android:dialogTitle="@string/pref_app_main_default_tab_dialog_title"
@ -9,58 +12,71 @@
android:entryValues="@array/pref_app_main_default_tab_values" android:entryValues="@array/pref_app_main_default_tab_values"
android:key="pref_app_main_default_tab_key" android:key="pref_app_main_default_tab_key"
android:title="@string/pref_title_app_main_default_tab" android:title="@string/pref_title_app_main_default_tab"
android:summary="@string/pref_summary_app_main_default_tab" /> android:summary="@string/pref_summary_app_main_default_tab"
app:iconSpaceReserved="false" />
</androidx.preference.PreferenceCategory> </androidx.preference.PreferenceCategory>
<androidx.preference.PreferenceCategory android:title="@string/pref_category_notifications"> <androidx.preference.PreferenceCategory
android:title="@string/pref_category_notifications"
app:iconSpaceReserved="false">
<androidx.preference.SwitchPreferenceCompat <androidx.preference.SwitchPreferenceCompat
android:defaultValue="true" android:defaultValue="true"
android:key="pref_notification_vibration_enable_key" android:key="pref_notification_vibration_enable_key"
android:title="@string/pref_title_notification_vibration_enable" /> android:title="@string/pref_title_notification_vibration_enable"
app:iconSpaceReserved="false" />
<androidx.preference.SwitchPreferenceCompat <androidx.preference.SwitchPreferenceCompat
android:defaultValue="true" android:defaultValue="true"
android:key="pref_notification_led_enable_key" android:key="pref_notification_led_enable_key"
android:title="@string/pref_title_notification_led_enable" android:title="@string/pref_title_notification_led_enable"
android:summary="@string/pref_summary_notification_led_enable" /> android:summary="@string/pref_summary_notification_led_enable"
app:iconSpaceReserved="false" />
<Preference <Preference
android:key="pref_notifications_select_sound_key" android:key="pref_notifications_select_sound_key"
android:title="@string/pref_title_notifications_sound" android:title="@string/pref_title_notifications_sound"
android:summary="@string/pref_summary_notifications_sound" /> android:summary="@string/pref_summary_notifications_sound"
app:iconSpaceReserved="false" />
</androidx.preference.PreferenceCategory> </androidx.preference.PreferenceCategory>
<androidx.preference.PreferenceCategory <androidx.preference.PreferenceCategory
android:key="pref_category_posting_key" android:key="pref_category_posting_key"
android:title="@string/pref_category_posting"> android:title="@string/pref_category_posting"
app:iconSpaceReserved="false">
<androidx.preference.SwitchPreferenceCompat <androidx.preference.SwitchPreferenceCompat
android:defaultValue="true" android:defaultValue="true"
android:key="pref_posting_app_signature_enable_key" android:key="pref_posting_app_signature_enable_key"
android:title="@string/pref_title_posting_app_signature_enable" android:title="@string/pref_title_posting_app_signature_enable"
android:summary="@string/pref_summary_posting_app_signature_enable" /> android:summary="@string/pref_summary_posting_app_signature_enable"
app:iconSpaceReserved="false" />
</androidx.preference.PreferenceCategory> </androidx.preference.PreferenceCategory>
<!--<androidx.preference.PreferenceCategory <!--<androidx.preference.PreferenceCategory
android:key="pref_category_uploading_key" android:key="pref_category_uploading_key"
android:title="@string/pref_category_uploading"> android:title="@string/pref_category_uploading"
app:iconSpaceReserved="false">
<androidx.preference.SwitchPreferenceCompat <androidx.preference.SwitchPreferenceCompat
android:defaultValue="true" android:defaultValue="true"
android:key="pref_uploading_app_signature_enable_key" android:key="pref_uploading_app_signature_enable_key"
android:title="@string/pref_title_uploading_app_signature_enable" android:title="@string/pref_title_uploading_app_signature_enable"
android:summary="@string/pref_summary_uploading_app_signature_enable" /> android:summary="@string/pref_summary_uploading_app_signature_enable"
app:iconSpaceReserved="false" />
</androidx.preference.PreferenceCategory>--> </androidx.preference.PreferenceCategory>-->
<androidx.preference.PreferenceCategory <androidx.preference.PreferenceCategory
android:key="pref_category_privacy_key" android:key="pref_category_privacy_key"
android:title="@string/pref_category_privacy"> android:title="@string/pref_category_privacy"
app:iconSpaceReserved="false">
<androidx.preference.SwitchPreferenceCompat <androidx.preference.SwitchPreferenceCompat
android:defaultValue="false" android:defaultValue="false"
android:key="@string/pref_privacy_crashlytics_enable_key" android:key="@string/pref_privacy_crashlytics_enable_key"
android:title="@string/pref_title_privacy_crashlytics_enable" android:title="@string/pref_title_privacy_crashlytics_enable"
android:summary="@string/pref_summary_privacy_crashlytics_enable" /> android:summary="@string/pref_summary_privacy_crashlytics_enable"
app:iconSpaceReserved="false" />
<androidx.preference.SwitchPreferenceCompat <androidx.preference.SwitchPreferenceCompat
android:defaultValue="false" android:defaultValue="false"
android:key="@string/pref_privacy_analytics_enable_key" android:key="@string/pref_privacy_analytics_enable_key"
android:title="@string/pref_title_privacy_analytics_enable" android:title="@string/pref_title_privacy_analytics_enable"
android:summary="@string/pref_summary_privacy_analytics_enable" /> android:summary="@string/pref_summary_privacy_analytics_enable"
app:iconSpaceReserved="false"/>
</androidx.preference.PreferenceCategory> </androidx.preference.PreferenceCategory>
</androidx.preference.PreferenceScreen> </androidx.preference.PreferenceScreen>
Loading…
Cancel
Save