From 8f498b35e5701ea78b528fe2b6b7f5466d1cdfe5 Mon Sep 17 00:00:00 2001 From: Eric Kok Date: Thu, 9 Jul 2020 12:57:15 +0200 Subject: [PATCH] Rework preference screens to use AndroidX This brings proper theming to these screens (fixes #521) and finally solves the issue of the title base now showing up in sub-screens (#491 and many, many others) --- app/src/main/AndroidManifest.xml | 52 +++- .../app/settings/ApplicationSettings.java | 3 +- .../app/settings/NotificationSettings.java | 14 +- .../core/app/settings/SystemSettings.java | 12 +- .../gui/settings/HelpSettingsActivity.java | 21 +- .../InterceptableEditTextPreference.java | 5 +- .../settings/KeyBoundPreferencesActivity.java | 44 +-- .../gui/settings/MainSettingsActivity.java | 20 +- .../NotificationSettingsActivity.java | 21 +- .../settings/PreferenceCompatActivity.java | 132 ++++---- .../core/gui/settings/RingtonePreference.java | 68 +++++ .../core/gui/settings/RssfeedPreference.java | 10 +- .../core/gui/settings/ServerPreference.java | 24 +- .../gui/settings/ServerSettingsActivity.java | 8 +- .../gui/settings/SystemSettingsActivity.java | 10 +- .../gui/settings/WebsearchPreference.java | 4 +- .../core/seedbox/DediseedboxSettings.java | 3 - .../seedbox/DediseedboxSettingsActivity.java | 6 +- .../core/seedbox/SeedboxPreference.java | 11 +- .../core/seedbox/SeedstuffSettings.java | 11 +- .../seedbox/SeedstuffSettingsActivity.java | 18 +- .../seedbox/XirvikDediSettingsActivity.java | 18 +- .../seedbox/XirvikSemiSettingsActivity.java | 18 +- .../seedbox/XirvikSharedSettingsActivity.java | 6 +- .../res/values-night/styles_transdroid.xml | 37 --- app/src/main/res/values/changelog.xml | 5 + app/src/main/res/values/styles.xml | 25 +- app/src/main/res/values/styles_transdroid.xml | 40 --- app/src/main/res/xml/pref_help.xml | 42 +-- app/src/main/res/xml/pref_main.xml | 143 +++++---- app/src/main/res/xml/pref_notifications.xml | 100 +++--- app/src/main/res/xml/pref_rssfeed.xml | 70 +++-- .../main/res/xml/pref_seedbox_dediseedbox.xml | 96 +++--- .../main/res/xml/pref_seedbox_seedstuff.xml | 96 +++--- .../main/res/xml/pref_seedbox_xirvikdedi.xml | 109 ++++--- .../main/res/xml/pref_seedbox_xirviksemi.xml | 96 +++--- .../res/xml/pref_seedbox_xirvikshared.xml | 105 ++++--- app/src/main/res/xml/pref_server.xml | 288 ++++++++++-------- app/src/main/res/xml/pref_system.xml | 11 +- app/src/main/res/xml/pref_websearch.xml | 6 +- 40 files changed, 991 insertions(+), 817 deletions(-) create mode 100644 app/src/main/java/org/transdroid/core/gui/settings/RingtonePreference.java delete mode 100644 app/src/main/res/values-night/styles_transdroid.xml delete mode 100644 app/src/main/res/values/styles_transdroid.xml diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index b1ec99be..1fae5479 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -197,21 +197,47 @@ - - - - - - - - + + + + + + + + - - - - - + + + + + . */ package org.transdroid.core.gui.settings; -import java.util.HashMap; -import java.util.Map; +import android.content.SharedPreferences; +import android.content.SharedPreferences.OnSharedPreferenceChangeListener; +import android.text.TextUtils; + +import androidx.preference.CheckBoxPreference; +import androidx.preference.EditTextPreference; +import androidx.preference.ListPreference; +import androidx.preference.Preference; +import androidx.preference.PreferenceManager; +import androidx.preference.PreferenceScreen; import org.androidannotations.annotations.EActivity; import org.androidannotations.annotations.Extra; -import android.content.SharedPreferences; -import android.content.SharedPreferences.OnSharedPreferenceChangeListener; -import android.preference.CheckBoxPreference; -import android.preference.EditTextPreference; -import android.preference.ListPreference; -import android.preference.Preference; -import android.preference.PreferenceManager; -import android.preference.PreferenceScreen; -import android.text.TextUtils; -import android.text.method.PasswordTransformationMethod; +import java.util.HashMap; +import java.util.Map; /** * Abstract activity that helps implement a preference screen for key-bound settings, i.e. settings of which there can @@ -59,7 +59,6 @@ public abstract class KeyBoundPreferencesActivity extends PreferenceCompatActivi * @param currentMaxKey The value of what is currently the last defined settings object, or -1 of no settings were * defined so far at all */ - @SuppressWarnings("deprecation") protected final void init(int preferencesResId, int currentMaxKey) { // Load the raw preferences to show in this screen @@ -132,7 +131,6 @@ public abstract class KeyBoundPreferencesActivity extends PreferenceCompatActivi * @param dependency The base name of the preference to which this preference depends * @return The concrete {@link EditTextPreference} that is bound to this preference */ - @SuppressWarnings("deprecation") protected final EditTextPreference initTextPreference(String baseName, String defValue, String dependency) { // Update the loaded Preference with the actual preference key to load/store with EditTextPreference pref = (EditTextPreference) findPreference(baseName); @@ -175,7 +173,6 @@ public abstract class KeyBoundPreferencesActivity extends PreferenceCompatActivi * @param dependency The base name of the preference to which this preference depends * @return The concrete {@link CheckBoxPreference} that is bound to this preference */ - @SuppressWarnings("deprecation") protected final CheckBoxPreference initBooleanPreference(String baseName, boolean defValue, String dependency) { // Update the loaded Preference with the actual preference key to load/store with CheckBoxPreference pref = (CheckBoxPreference) findPreference(baseName); @@ -203,7 +200,6 @@ public abstract class KeyBoundPreferencesActivity extends PreferenceCompatActivi * @param defValue The default value for this preference, as shown when no value was yet stored * @return The concrete {@link ListPreference} that is bound to this preference */ - @SuppressWarnings("deprecation") protected final ListPreference initListPreference(String baseName, String defValue) { // Update the loaded Preference with the actual preference key to load/store with ListPreference pref = (ListPreference) findPreference(baseName); @@ -216,13 +212,12 @@ public abstract class KeyBoundPreferencesActivity extends PreferenceCompatActivi return pref; } - @SuppressWarnings("deprecation") protected void showValueOnSummary(String prefKey) { Preference pref = findPreference(prefKey); if (sharedPrefs.contains(prefKey) && pref instanceof EditTextPreference && !TextUtils.isEmpty(sharedPrefs.getString(prefKey, "")) - && !(((EditTextPreference) pref).getEditText().getTransformationMethod() instanceof PasswordTransformationMethod)) { + && !isPasswordPref((EditTextPreference) pref)) { // Non-password edit preferences show the user-entered value pref.setSummary(sharedPrefs.getString(prefKey, "")); return; @@ -237,4 +232,9 @@ public abstract class KeyBoundPreferencesActivity extends PreferenceCompatActivi pref.setSummary(originalSummaries.get(prefKey)); } + protected boolean isPasswordPref(EditTextPreference preference) { + return preference.getKey().startsWith("server_pass_") || preference.getKey().startsWith("server_extrapass") + || preference.getKey().startsWith("server_ftppass"); + } + } diff --git a/app/src/main/java/org/transdroid/core/gui/settings/MainSettingsActivity.java b/app/src/main/java/org/transdroid/core/gui/settings/MainSettingsActivity.java index 7d803716..f8add38d 100644 --- a/app/src/main/java/org/transdroid/core/gui/settings/MainSettingsActivity.java +++ b/app/src/main/java/org/transdroid/core/gui/settings/MainSettingsActivity.java @@ -26,9 +26,9 @@ import android.content.SharedPreferences; import android.net.Uri; import android.os.Build; import android.os.Bundle; -import android.preference.ListPreference; -import android.preference.Preference; -import android.preference.Preference.OnPreferenceClickListener; +import androidx.preference.ListPreference; +import androidx.preference.Preference; +import androidx.preference.Preference.OnPreferenceClickListener; import org.androidannotations.annotations.Bean; import org.androidannotations.annotations.EActivity; @@ -69,7 +69,6 @@ public class MainSettingsActivity extends PreferenceCompatActivity { protected SearchHelper searchHelper; protected SharedPreferences prefs; private OnPreferenceClickListener onAddServer = new OnPreferenceClickListener() { - @SuppressWarnings("deprecation") @Override public boolean onPreferenceClick(Preference preference) { if (navigationHelper.enableSeedboxes()) @@ -164,24 +163,19 @@ public class MainSettingsActivity extends PreferenceCompatActivity { // Note: Settings are loaded in onResume() } - @SuppressWarnings("deprecation") @Override protected void onResume() { super.onResume(); getSupportActionBar().setDisplayHomeAsUpEnabled(true); - prefs = getPreferenceManager().getSharedPreferences(); - if (getPreferenceScreen() != null) { - getPreferenceScreen().removeAll(); - } - boolean enableSearchUi = navigationHelper.enableSearchUi(); boolean enableRssUi = navigationHelper.enableRssUi(); boolean enableDonateLink = !getString(R.string.donate_url).isEmpty(); // Load the preference menu and attach actions addPreferencesFromResource(R.xml.pref_main); + prefs = getPreferenceManager().getSharedPreferences(); findPreference("header_addserver").setOnPreferenceClickListener(onAddServer); if (enableSearchUi) { findPreference("header_addwebsearch").setOnPreferenceClickListener(onAddWebsearch); @@ -291,12 +285,6 @@ public class MainSettingsActivity extends PreferenceCompatActivity { TorrentsActivity_.intent(this).flags(Intent.FLAG_ACTIVITY_CLEAR_TOP).start(); } - @Override - public void onBuildHeaders(List
target) { - // TODO: Add two-pane support in settings - super.onBuildHeaders(target); - } - @Override protected Dialog onCreateDialog(int id) { switch (id) { diff --git a/app/src/main/java/org/transdroid/core/gui/settings/NotificationSettingsActivity.java b/app/src/main/java/org/transdroid/core/gui/settings/NotificationSettingsActivity.java index 205c2c40..093cefb7 100644 --- a/app/src/main/java/org/transdroid/core/gui/settings/NotificationSettingsActivity.java +++ b/app/src/main/java/org/transdroid/core/gui/settings/NotificationSettingsActivity.java @@ -1,16 +1,16 @@ -/* +/* * Copyright 2010-2018 Eric Kok et al. - * + * * Transdroid 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. - * + * * Transdroid 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 Transdroid. If not, see . */ @@ -23,12 +23,13 @@ import android.content.SharedPreferences.OnSharedPreferenceChangeListener; import android.os.Build; import android.os.Bundle; +import androidx.annotation.Nullable; + import org.androidannotations.annotations.Bean; import org.androidannotations.annotations.EActivity; import org.androidannotations.annotations.OptionsItem; import org.transdroid.R; import org.transdroid.core.app.settings.NotificationSettings; -import org.transdroid.core.service.BootReceiver; import org.transdroid.core.service.RssCheckerJob; import org.transdroid.core.service.ServerCheckerJob; @@ -38,7 +39,6 @@ public class NotificationSettingsActivity extends PreferenceCompatActivity imple @Bean protected NotificationSettings notificationSettings; - @SuppressWarnings("deprecation") @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); @@ -52,7 +52,12 @@ public class NotificationSettingsActivity extends PreferenceCompatActivity imple } - @SuppressWarnings("deprecation") + @Override + protected void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) { + super.onActivityResult(requestCode, resultCode, data); + ((RingtonePreference) findPreference("notifications_sound")).onActivityResult(requestCode, resultCode, data); + } + @Override protected void onResume() { super.onResume(); @@ -60,7 +65,6 @@ public class NotificationSettingsActivity extends PreferenceCompatActivity imple getPreferenceScreen().getSharedPreferences().registerOnSharedPreferenceChangeListener(this); } - @SuppressWarnings("deprecation") @Override protected void onPause() { super.onPause(); @@ -79,7 +83,6 @@ public class NotificationSettingsActivity extends PreferenceCompatActivity imple RssCheckerJob.schedule(getApplicationContext()); } - @SuppressWarnings("deprecation") private void updatePrefsEnabled(boolean disabled) { findPreference("notifications_interval").setEnabled(!disabled); findPreference("notifications_sound").setEnabled(!disabled); diff --git a/app/src/main/java/org/transdroid/core/gui/settings/PreferenceCompatActivity.java b/app/src/main/java/org/transdroid/core/gui/settings/PreferenceCompatActivity.java index 8cd67c2d..627e20bc 100644 --- a/app/src/main/java/org/transdroid/core/gui/settings/PreferenceCompatActivity.java +++ b/app/src/main/java/org/transdroid/core/gui/settings/PreferenceCompatActivity.java @@ -1,66 +1,74 @@ package org.transdroid.core.gui.settings; -import android.content.res.Configuration; import android.os.Bundle; -import android.preference.PreferenceActivity; -import androidx.annotation.Nullable; -import androidx.appcompat.app.ActionBar; + +import androidx.annotation.XmlRes; +import androidx.appcompat.app.AppCompatActivity; import androidx.appcompat.app.AppCompatCallback; -import androidx.appcompat.app.AppCompatDelegate; -import androidx.appcompat.view.ActionMode; - -public class PreferenceCompatActivity extends PreferenceActivity implements AppCompatCallback { - - private AppCompatDelegate acd; - - @Override - protected void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - acd = AppCompatDelegate.create(this, this); - acd.onCreate(savedInstanceState); - } - - @Override - protected void onPostCreate(Bundle savedInstanceState) { - super.onPostCreate(savedInstanceState); - acd.onPostCreate(savedInstanceState); - } - - @Override - public void onConfigurationChanged(Configuration newConfig) { - super.onConfigurationChanged(newConfig); - acd.onConfigurationChanged(newConfig); - } - - @Override - protected void onStop() { - super.onStop(); - acd.onStop(); - } - - @Override - protected void onDestroy() { - super.onDestroy(); - acd.onDestroy(); - } - - public ActionBar getSupportActionBar() { - return acd.getSupportActionBar(); - } - - @Override - public void onSupportActionModeStarted(ActionMode actionMode) { - - } - - @Override - public void onSupportActionModeFinished(ActionMode actionMode) { - - } - - @Nullable - @Override - public ActionMode onWindowStartingSupportActionMode(ActionMode.Callback callback) { - return acd.startSupportActionMode(callback); - } -} +import androidx.preference.Preference; +import androidx.preference.PreferenceFragmentCompat; +import androidx.preference.PreferenceManager; +import androidx.preference.PreferenceScreen; + + public class PreferenceCompatActivity extends AppCompatActivity implements AppCompatCallback, PreferenceFragmentCompat.OnPreferenceStartScreenCallback { + + private PreferenceFragmentCompat fragment; + + public void addPreferencesFromResource(@XmlRes int preferencesResId) { + fragment = new RootPreferencesFragment(preferencesResId); + getSupportFragmentManager().beginTransaction().replace(android.R.id.content, fragment).commitNow(); + } + + public PreferenceManager getPreferenceManager() { + return fragment.getPreferenceManager(); + } + + public PreferenceScreen getPreferenceScreen() { + return fragment.getPreferenceScreen(); + } + + public Preference findPreference(CharSequence key) { + return fragment.findPreference(key); + } + + @Override + public boolean onPreferenceStartScreen(PreferenceFragmentCompat caller, PreferenceScreen pref) { + LowerPreferencesFragment lowerFragment = new LowerPreferencesFragment(pref); + getSupportFragmentManager().beginTransaction().replace(android.R.id.content, lowerFragment).addToBackStack("lower").commit(); + return true; + } + + public static class RootPreferencesFragment extends PreferenceFragmentCompat { + + private int preferencesResId; + + public RootPreferencesFragment(int preferencesResId) { + this.preferencesResId = preferencesResId; + } + + @Override + public void onCreatePreferences(Bundle savedInstanceState, String rootKey) { + addPreferencesFromResource(preferencesResId); + } + } + + public static class LowerPreferencesFragment extends PreferenceFragmentCompat { + + private PreferenceScreen prefs; + + public LowerPreferencesFragment() { + } + + public LowerPreferencesFragment(PreferenceScreen prefs) { + this.prefs = prefs; + } + + @Override + public void onCreatePreferences(Bundle savedInstanceState, String rootKey) { + if (prefs != null) { + setPreferenceScreen(prefs); + prefs = null; + } + } + } + } diff --git a/app/src/main/java/org/transdroid/core/gui/settings/RingtonePreference.java b/app/src/main/java/org/transdroid/core/gui/settings/RingtonePreference.java new file mode 100644 index 00000000..9d343809 --- /dev/null +++ b/app/src/main/java/org/transdroid/core/gui/settings/RingtonePreference.java @@ -0,0 +1,68 @@ +package org.transdroid.core.gui.settings; + +import android.app.Activity; +import android.content.Context; +import android.content.Intent; +import android.media.RingtoneManager; +import android.net.Uri; +import android.provider.Settings; +import android.util.AttributeSet; + +import androidx.preference.Preference; + +@SuppressWarnings("unused") // Constructors for XML inflation +public class RingtonePreference extends Preference { + + private static final int REQUEST_RINGTONE = 0; + + public RingtonePreference(Context context) { + super(context); + } + + public RingtonePreference(Context context, AttributeSet attrs) { + super(context, attrs); + } + + public RingtonePreference(Context context, AttributeSet attrs, int defStyleAttr) { + super(context, attrs, defStyleAttr); + } + + public RingtonePreference(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) { + super(context, attrs, defStyleAttr, defStyleRes); + } + + @Override + protected void onClick() { + if (!(getContext() instanceof Activity)) { + return; + } + + Intent intent = new Intent(RingtoneManager.ACTION_RINGTONE_PICKER); + intent.putExtra(RingtoneManager.EXTRA_RINGTONE_TYPE, RingtoneManager.TYPE_NOTIFICATION); + intent.putExtra(RingtoneManager.EXTRA_RINGTONE_SHOW_DEFAULT, true); + intent.putExtra(RingtoneManager.EXTRA_RINGTONE_SHOW_SILENT, true); + intent.putExtra(RingtoneManager.EXTRA_RINGTONE_DEFAULT_URI, Settings.System.DEFAULT_NOTIFICATION_URI); + + String existingValue = getSharedPreferences().getString(getKey(), null); + if (existingValue != null) { + if (existingValue.isEmpty()) { + // Select "Silent" + intent.putExtra(RingtoneManager.EXTRA_RINGTONE_EXISTING_URI, (Uri) null); + } else { + intent.putExtra(RingtoneManager.EXTRA_RINGTONE_EXISTING_URI, Uri.parse(existingValue)); + } + } else { + // No ringtone has been selected, set to the default + intent.putExtra(RingtoneManager.EXTRA_RINGTONE_EXISTING_URI, Settings.System.DEFAULT_NOTIFICATION_URI); + } + + ((Activity) getContext()).startActivityForResult(intent, REQUEST_RINGTONE); + } + + public void onActivityResult(int requestCode, int resultCode, Intent data) { + if (requestCode == REQUEST_RINGTONE && resultCode == Activity.RESULT_OK && data != null && data.getExtras() != null) { + Uri ringtone = (Uri) data.getExtras().get(RingtoneManager.EXTRA_RINGTONE_PICKED_URI); + getSharedPreferences().edit().putString(getKey(), ringtone == null? "": ringtone.toString()).apply(); + } + } +} diff --git a/app/src/main/java/org/transdroid/core/gui/settings/RssfeedPreference.java b/app/src/main/java/org/transdroid/core/gui/settings/RssfeedPreference.java index e574f735..821a9c62 100644 --- a/app/src/main/java/org/transdroid/core/gui/settings/RssfeedPreference.java +++ b/app/src/main/java/org/transdroid/core/gui/settings/RssfeedPreference.java @@ -16,10 +16,11 @@ */ package org.transdroid.core.gui.settings; -import org.transdroid.core.app.settings.RssfeedSetting; - import android.content.Context; -import android.preference.Preference; + +import androidx.preference.Preference; + +import org.transdroid.core.app.settings.RssfeedSetting; /** * Represents a {@link RssfeedSetting} in a preferences screen. @@ -35,6 +36,7 @@ public class RssfeedPreference extends Preference { public RssfeedPreference(Context context) { super(context); setOnPreferenceClickListener(onPreferenceClicked); + setIconSpaceReserved(false); } /** @@ -70,7 +72,7 @@ public class RssfeedPreference extends Preference { }; public interface OnRssfeedClickedListener { - public void onRssfeedClicked(RssfeedSetting rssfeedSetting); + void onRssfeedClicked(RssfeedSetting rssfeedSetting); } } diff --git a/app/src/main/java/org/transdroid/core/gui/settings/ServerPreference.java b/app/src/main/java/org/transdroid/core/gui/settings/ServerPreference.java index f4b91922..ef50430a 100644 --- a/app/src/main/java/org/transdroid/core/gui/settings/ServerPreference.java +++ b/app/src/main/java/org/transdroid/core/gui/settings/ServerPreference.java @@ -1,25 +1,26 @@ -/* +/* * Copyright 2010-2018 Eric Kok et al. - * + * * Transdroid 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. - * + * * Transdroid 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 Transdroid. If not, see . */ package org.transdroid.core.gui.settings; -import org.transdroid.core.app.settings.ServerSetting; - import android.content.Context; -import android.preference.Preference; + +import androidx.preference.Preference; + +import org.transdroid.core.app.settings.ServerSetting; /** * Represents a {@link ServerSetting} in a preferences screen. @@ -31,10 +32,11 @@ public class ServerPreference extends Preference { protected ServerSetting serverSetting; private OnServerClickedListener onServerClickedListener = null; - + public ServerPreference(Context context) { super(context); setOnPreferenceClickListener(onPreferenceClicked); + setIconSpaceReserved(false); } /** @@ -49,7 +51,7 @@ public class ServerPreference extends Preference { setOrder(ORDER_START + serverSetting.getOrder()); return this; } - + /** * Set a listener that will be notified of click events on this preference * @param onServerClickedListener The click listener to register @@ -68,9 +70,9 @@ public class ServerPreference extends Preference { return true; } }; - + public interface OnServerClickedListener { public void onServerClicked(ServerSetting serverSetting); } - + } diff --git a/app/src/main/java/org/transdroid/core/gui/settings/ServerSettingsActivity.java b/app/src/main/java/org/transdroid/core/gui/settings/ServerSettingsActivity.java index e8b85992..5bc3b32c 100644 --- a/app/src/main/java/org/transdroid/core/gui/settings/ServerSettingsActivity.java +++ b/app/src/main/java/org/transdroid/core/gui/settings/ServerSettingsActivity.java @@ -25,10 +25,12 @@ import android.content.Intent; import android.content.SharedPreferences; import android.os.Build; import android.os.Bundle; -import android.preference.EditTextPreference; -import android.preference.Preference; -import android.preference.PreferenceManager; + import androidx.annotation.NonNull; +import androidx.preference.EditTextPreference; +import androidx.preference.Preference; +import androidx.preference.PreferenceManager; + import org.androidannotations.annotations.Bean; import org.androidannotations.annotations.EActivity; import org.androidannotations.annotations.OptionsItem; diff --git a/app/src/main/java/org/transdroid/core/gui/settings/SystemSettingsActivity.java b/app/src/main/java/org/transdroid/core/gui/settings/SystemSettingsActivity.java index 2995086d..cfe9bca2 100644 --- a/app/src/main/java/org/transdroid/core/gui/settings/SystemSettingsActivity.java +++ b/app/src/main/java/org/transdroid/core/gui/settings/SystemSettingsActivity.java @@ -25,12 +25,13 @@ import android.content.Intent; import android.content.SharedPreferences; import android.os.Build; import android.os.Bundle; -import android.preference.Preference; -import android.preference.Preference.OnPreferenceClickListener; -import android.preference.PreferenceManager; -import androidx.annotation.NonNull; import android.text.TextUtils; +import androidx.annotation.NonNull; +import androidx.preference.Preference; +import androidx.preference.Preference.OnPreferenceClickListener; +import androidx.preference.PreferenceManager; + import com.nispok.snackbar.Snackbar; import com.nispok.snackbar.SnackbarManager; @@ -141,7 +142,6 @@ public class SystemSettingsActivity extends PreferenceCompatActivity { } }; - @SuppressWarnings("deprecation") @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); diff --git a/app/src/main/java/org/transdroid/core/gui/settings/WebsearchPreference.java b/app/src/main/java/org/transdroid/core/gui/settings/WebsearchPreference.java index 13bb2a9b..05ba24e4 100644 --- a/app/src/main/java/org/transdroid/core/gui/settings/WebsearchPreference.java +++ b/app/src/main/java/org/transdroid/core/gui/settings/WebsearchPreference.java @@ -17,7 +17,8 @@ package org.transdroid.core.gui.settings; import android.content.Context; -import android.preference.Preference; + +import androidx.preference.Preference; import org.transdroid.core.app.settings.WebsearchSetting; @@ -35,6 +36,7 @@ public class WebsearchPreference extends Preference { public WebsearchPreference(Context context) { super(context); setOnPreferenceClickListener(onPreferenceClicked); + setIconSpaceReserved(false); } /** diff --git a/app/src/main/java/org/transdroid/core/seedbox/DediseedboxSettings.java b/app/src/main/java/org/transdroid/core/seedbox/DediseedboxSettings.java index e9b682c8..28809f71 100644 --- a/app/src/main/java/org/transdroid/core/seedbox/DediseedboxSettings.java +++ b/app/src/main/java/org/transdroid/core/seedbox/DediseedboxSettings.java @@ -19,7 +19,6 @@ package org.transdroid.core.seedbox; import android.content.Context; import android.content.Intent; import android.content.SharedPreferences; -import android.preference.EditTextPreference; import org.transdroid.core.app.settings.ServerSetting; import org.transdroid.daemon.Daemon; @@ -31,8 +30,6 @@ import org.transdroid.daemon.OS; */ public class DediseedboxSettings extends SeedboxSettingsImpl implements SeedboxSettings { - private EditTextPreference excludeFilter, includeFilter; - @Override public String getName() { return "Dediseedbox"; diff --git a/app/src/main/java/org/transdroid/core/seedbox/DediseedboxSettingsActivity.java b/app/src/main/java/org/transdroid/core/seedbox/DediseedboxSettingsActivity.java index de3526b6..6e5e2f06 100644 --- a/app/src/main/java/org/transdroid/core/seedbox/DediseedboxSettingsActivity.java +++ b/app/src/main/java/org/transdroid/core/seedbox/DediseedboxSettingsActivity.java @@ -21,8 +21,9 @@ import android.content.Intent; import android.content.SharedPreferences; import android.os.Build; import android.os.Bundle; -import android.preference.EditTextPreference; -import android.preference.PreferenceManager; + +import androidx.preference.EditTextPreference; +import androidx.preference.PreferenceManager; import org.androidannotations.annotations.EActivity; import org.androidannotations.annotations.OptionsItem; @@ -30,7 +31,6 @@ import org.androidannotations.annotations.OptionsMenu; import org.transdroid.R; import org.transdroid.core.gui.settings.KeyBoundPreferencesActivity; import org.transdroid.core.gui.settings.MainSettingsActivity_; -import org.transdroid.daemon.Daemon; /** * Activity that allows for the configuration of a Dediseedbox seedbox. The key can be supplied to update an diff --git a/app/src/main/java/org/transdroid/core/seedbox/SeedboxPreference.java b/app/src/main/java/org/transdroid/core/seedbox/SeedboxPreference.java index 2a66d2ca..460f9293 100644 --- a/app/src/main/java/org/transdroid/core/seedbox/SeedboxPreference.java +++ b/app/src/main/java/org/transdroid/core/seedbox/SeedboxPreference.java @@ -16,12 +16,13 @@ */ package org.transdroid.core.seedbox; +import android.content.Context; + +import androidx.preference.Preference; + import org.transdroid.core.app.settings.ServerSetting; import org.transdroid.core.gui.settings.ServerPreference; -import android.content.Context; -import android.preference.Preference; - /** * Represents a {@link ServerSetting} in a preferences screen, as constructed for a specific {@link SeedboxProvider}. * @author Eric Kok @@ -91,8 +92,8 @@ public class SeedboxPreference extends ServerPreference { } public interface OnSeedboxClickedListener { - public void onSeedboxClicked(ServerSetting serverSetting, SeedboxProvider provider, - int onSeedboxClickedListenerOffset); + void onSeedboxClicked(ServerSetting serverSetting, SeedboxProvider provider, + int onSeedboxClickedListenerOffset); } } diff --git a/app/src/main/java/org/transdroid/core/seedbox/SeedstuffSettings.java b/app/src/main/java/org/transdroid/core/seedbox/SeedstuffSettings.java index c7cce016..67358c29 100644 --- a/app/src/main/java/org/transdroid/core/seedbox/SeedstuffSettings.java +++ b/app/src/main/java/org/transdroid/core/seedbox/SeedstuffSettings.java @@ -16,14 +16,13 @@ */ package org.transdroid.core.seedbox; -import org.transdroid.core.app.settings.ServerSetting; -import org.transdroid.daemon.Daemon; -import org.transdroid.daemon.OS; - import android.content.Context; import android.content.Intent; import android.content.SharedPreferences; -import android.preference.EditTextPreference; + +import org.transdroid.core.app.settings.ServerSetting; +import org.transdroid.daemon.Daemon; +import org.transdroid.daemon.OS; /** * Implementation of {@link SeedboxSettings} for Seedstuff seedboxes. @@ -31,8 +30,6 @@ import android.preference.EditTextPreference; */ public class SeedstuffSettings extends SeedboxSettingsImpl implements SeedboxSettings { - private EditTextPreference excludeFilter, includeFilter; - @Override public String getName() { return "Seedstuff"; diff --git a/app/src/main/java/org/transdroid/core/seedbox/SeedstuffSettingsActivity.java b/app/src/main/java/org/transdroid/core/seedbox/SeedstuffSettingsActivity.java index 62032fdc..f709ccc6 100644 --- a/app/src/main/java/org/transdroid/core/seedbox/SeedstuffSettingsActivity.java +++ b/app/src/main/java/org/transdroid/core/seedbox/SeedstuffSettingsActivity.java @@ -16,19 +16,21 @@ */ package org.transdroid.core.seedbox; -import org.androidannotations.annotations.EActivity; -import org.androidannotations.annotations.OptionsItem; -import org.androidannotations.annotations.OptionsMenu; -import org.transdroid.R; -import org.transdroid.core.gui.settings.*; - import android.annotation.TargetApi; import android.content.Intent; import android.content.SharedPreferences; import android.os.Build; import android.os.Bundle; -import android.preference.EditTextPreference; -import android.preference.PreferenceManager; + +import androidx.preference.EditTextPreference; +import androidx.preference.PreferenceManager; + +import org.androidannotations.annotations.EActivity; +import org.androidannotations.annotations.OptionsItem; +import org.androidannotations.annotations.OptionsMenu; +import org.transdroid.R; +import org.transdroid.core.gui.settings.KeyBoundPreferencesActivity; +import org.transdroid.core.gui.settings.MainSettingsActivity_; /** * Activity that allows for the configuration of a Seedstuff seedbox. The key can be supplied to update an diff --git a/app/src/main/java/org/transdroid/core/seedbox/XirvikDediSettingsActivity.java b/app/src/main/java/org/transdroid/core/seedbox/XirvikDediSettingsActivity.java index fd9c93f5..d2353d7a 100644 --- a/app/src/main/java/org/transdroid/core/seedbox/XirvikDediSettingsActivity.java +++ b/app/src/main/java/org/transdroid/core/seedbox/XirvikDediSettingsActivity.java @@ -16,19 +16,21 @@ */ package org.transdroid.core.seedbox; -import org.androidannotations.annotations.EActivity; -import org.androidannotations.annotations.OptionsItem; -import org.androidannotations.annotations.OptionsMenu; -import org.transdroid.R; -import org.transdroid.core.gui.settings.*; - import android.annotation.TargetApi; import android.content.Intent; import android.content.SharedPreferences; import android.os.Build; import android.os.Bundle; -import android.preference.EditTextPreference; -import android.preference.PreferenceManager; + +import androidx.preference.EditTextPreference; +import androidx.preference.PreferenceManager; + +import org.androidannotations.annotations.EActivity; +import org.androidannotations.annotations.OptionsItem; +import org.androidannotations.annotations.OptionsMenu; +import org.transdroid.R; +import org.transdroid.core.gui.settings.KeyBoundPreferencesActivity; +import org.transdroid.core.gui.settings.MainSettingsActivity_; /** * Activity that allows for the configuration of a Xirvik dedicated seedbox. The key can be supplied to update an diff --git a/app/src/main/java/org/transdroid/core/seedbox/XirvikSemiSettingsActivity.java b/app/src/main/java/org/transdroid/core/seedbox/XirvikSemiSettingsActivity.java index 4f826d96..02d85a98 100644 --- a/app/src/main/java/org/transdroid/core/seedbox/XirvikSemiSettingsActivity.java +++ b/app/src/main/java/org/transdroid/core/seedbox/XirvikSemiSettingsActivity.java @@ -16,19 +16,21 @@ */ package org.transdroid.core.seedbox; -import org.androidannotations.annotations.EActivity; -import org.androidannotations.annotations.OptionsItem; -import org.androidannotations.annotations.OptionsMenu; -import org.transdroid.R; -import org.transdroid.core.gui.settings.*; - import android.annotation.TargetApi; import android.content.Intent; import android.content.SharedPreferences; import android.os.Build; import android.os.Bundle; -import android.preference.EditTextPreference; -import android.preference.PreferenceManager; + +import androidx.preference.EditTextPreference; +import androidx.preference.PreferenceManager; + +import org.androidannotations.annotations.EActivity; +import org.androidannotations.annotations.OptionsItem; +import org.androidannotations.annotations.OptionsMenu; +import org.transdroid.R; +import org.transdroid.core.gui.settings.KeyBoundPreferencesActivity; +import org.transdroid.core.gui.settings.MainSettingsActivity_; /** * Activity that allows for the configuration of a Xirvik semi-dedicated seedbox. The key can be supplied to update an diff --git a/app/src/main/java/org/transdroid/core/seedbox/XirvikSharedSettingsActivity.java b/app/src/main/java/org/transdroid/core/seedbox/XirvikSharedSettingsActivity.java index 469c8daa..59aab68a 100644 --- a/app/src/main/java/org/transdroid/core/seedbox/XirvikSharedSettingsActivity.java +++ b/app/src/main/java/org/transdroid/core/seedbox/XirvikSharedSettingsActivity.java @@ -23,8 +23,9 @@ import android.content.SharedPreferences.Editor; import android.os.AsyncTask; import android.os.Build; import android.os.Bundle; -import android.preference.EditTextPreference; -import android.preference.PreferenceManager; + +import androidx.preference.EditTextPreference; +import androidx.preference.PreferenceManager; import com.nispok.snackbar.Snackbar; import com.nispok.snackbar.SnackbarManager; @@ -129,7 +130,6 @@ public class XirvikSharedSettingsActivity extends KeyBoundPreferencesActivity { } - @SuppressWarnings("deprecation") protected void storeScgiMountFolder(String result) { Editor edit = PreferenceManager.getDefaultSharedPreferences(XirvikSharedSettingsActivity.this).edit(); EditTextPreference pref = (EditTextPreference) findPreference("seedbox_xirvikshared_rpc_" + key); diff --git a/app/src/main/res/values-night/styles_transdroid.xml b/app/src/main/res/values-night/styles_transdroid.xml deleted file mode 100644 index 18f295bb..00000000 --- a/app/src/main/res/values-night/styles_transdroid.xml +++ /dev/null @@ -1,37 +0,0 @@ - - - - - - - - \ No newline at end of file diff --git a/app/src/main/res/values/changelog.xml b/app/src/main/res/values/changelog.xml index 88bb0f27..aeb587cf 100644 --- a/app/src/main/res/values/changelog.xml +++ b/app/src/main/res/values/changelog.xml @@ -17,6 +17,11 @@ --> +Transdroid 2.5.19\n +- \n +- Dark theme to use black background\n +- Reinstated black widget\n +\n Transdroid 2.5.18\n - BitComet details fixes\n - Settings import/export on Android 10+\n diff --git a/app/src/main/res/values/styles.xml b/app/src/main/res/values/styles.xml index 7a450d3b..f2990f3a 100644 --- a/app/src/main/res/values/styles.xml +++ b/app/src/main/res/values/styles.xml @@ -16,7 +16,30 @@ --> - + + diff --git a/app/src/main/res/values/styles_transdroid.xml b/app/src/main/res/values/styles_transdroid.xml deleted file mode 100644 index 6abb1aca..00000000 --- a/app/src/main/res/values/styles_transdroid.xml +++ /dev/null @@ -1,40 +0,0 @@ - - - - - - - - \ No newline at end of file diff --git a/app/src/main/res/xml/pref_help.xml b/app/src/main/res/xml/pref_help.xml index 1a2a5f0f..560086e0 100644 --- a/app/src/main/res/xml/pref_help.xml +++ b/app/src/main/res/xml/pref_help.xml @@ -1,5 +1,4 @@ - - - - - + - - - - - + + + + + + + diff --git a/app/src/main/res/xml/pref_main.xml b/app/src/main/res/xml/pref_main.xml index b698f9dd..e0fd72c3 100644 --- a/app/src/main/res/xml/pref_main.xml +++ b/app/src/main/res/xml/pref_main.xml @@ -1,5 +1,4 @@ - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + diff --git a/app/src/main/res/xml/pref_notifications.xml b/app/src/main/res/xml/pref_notifications.xml index a06e7ae2..59333c17 100644 --- a/app/src/main/res/xml/pref_notifications.xml +++ b/app/src/main/res/xml/pref_notifications.xml @@ -1,5 +1,4 @@ - - - - - - - - - + + + + + + + + + + + + + + + - - - - - - - - diff --git a/app/src/main/res/xml/pref_rssfeed.xml b/app/src/main/res/xml/pref_rssfeed.xml index 2534582e..fd9d50bc 100644 --- a/app/src/main/res/xml/pref_rssfeed.xml +++ b/app/src/main/res/xml/pref_rssfeed.xml @@ -1,5 +1,4 @@ - - - + - + - + - + - + - + - + diff --git a/app/src/main/res/xml/pref_seedbox_dediseedbox.xml b/app/src/main/res/xml/pref_seedbox_dediseedbox.xml index 20cd0d3b..77ffdb76 100644 --- a/app/src/main/res/xml/pref_seedbox_dediseedbox.xml +++ b/app/src/main/res/xml/pref_seedbox_dediseedbox.xml @@ -1,5 +1,4 @@ - - - + - - - - + + + + - - - - - - + + + + + + diff --git a/app/src/main/res/xml/pref_seedbox_seedstuff.xml b/app/src/main/res/xml/pref_seedbox_seedstuff.xml index 62bb0053..221a494a 100644 --- a/app/src/main/res/xml/pref_seedbox_seedstuff.xml +++ b/app/src/main/res/xml/pref_seedbox_seedstuff.xml @@ -1,5 +1,4 @@ - - - + - - - - + + + + - - - - - - + + + + + + diff --git a/app/src/main/res/xml/pref_seedbox_xirvikdedi.xml b/app/src/main/res/xml/pref_seedbox_xirvikdedi.xml index 5af699d6..bd7274e9 100644 --- a/app/src/main/res/xml/pref_seedbox_xirvikdedi.xml +++ b/app/src/main/res/xml/pref_seedbox_xirvikdedi.xml @@ -1,5 +1,4 @@ - - - + - - - - - + + + + + - - - - - - + + + + + + diff --git a/app/src/main/res/xml/pref_seedbox_xirviksemi.xml b/app/src/main/res/xml/pref_seedbox_xirviksemi.xml index 52f574f0..809f9b79 100644 --- a/app/src/main/res/xml/pref_seedbox_xirviksemi.xml +++ b/app/src/main/res/xml/pref_seedbox_xirviksemi.xml @@ -1,5 +1,4 @@ - - - + - - - - + + + + - - - - - - + + + + + + diff --git a/app/src/main/res/xml/pref_seedbox_xirvikshared.xml b/app/src/main/res/xml/pref_seedbox_xirvikshared.xml index b0e0a4d8..b59e21f4 100644 --- a/app/src/main/res/xml/pref_seedbox_xirvikshared.xml +++ b/app/src/main/res/xml/pref_seedbox_xirvikshared.xml @@ -1,5 +1,4 @@ - - - + - - - - - + + + + + - - - - - - + + + + + + diff --git a/app/src/main/res/xml/pref_server.xml b/app/src/main/res/xml/pref_server.xml index c524db0b..44416d8d 100644 --- a/app/src/main/res/xml/pref_server.xml +++ b/app/src/main/res/xml/pref_server.xml @@ -1,5 +1,4 @@ - - + xmlns:app="http://schemas.android.com/apk/res-auto"> - - - - - - + + + + + + - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - diff --git a/app/src/main/res/xml/pref_system.xml b/app/src/main/res/xml/pref_system.xml index 234400a2..1b2b66b2 100644 --- a/app/src/main/res/xml/pref_system.xml +++ b/app/src/main/res/xml/pref_system.xml @@ -15,16 +15,19 @@ You should have received a copy of the GNU General Public License along with Transdroid. If not, see . --> - + diff --git a/app/src/main/res/xml/pref_websearch.xml b/app/src/main/res/xml/pref_websearch.xml index bad5931b..2ad0f4fd 100644 --- a/app/src/main/res/xml/pref_websearch.xml +++ b/app/src/main/res/xml/pref_websearch.xml @@ -15,22 +15,26 @@ You should have received a copy of the GNU General Public License along with Transdroid. If not, see . --> - +