Browse Source

Fix settings import/export to use document provider

pull/667/head
Eric Kok 10 months ago
parent
commit
25ba61e283
  1. 3
      app/src/main/java/org/transdroid/core/app/settings/SettingsPersistence.java
  2. 1
      app/src/main/java/org/transdroid/core/gui/DetailsActivity.java
  3. 14
      app/src/main/java/org/transdroid/core/gui/TorrentsActivity.java
  4. 18
      app/src/main/java/org/transdroid/core/gui/navigation/NavigationHelper.java
  5. 1
      app/src/main/java/org/transdroid/core/gui/rss/RssFeedsActivity.java
  6. 1
      app/src/main/java/org/transdroid/core/gui/rss/RssItemsActivity.java
  7. 1
      app/src/main/java/org/transdroid/core/gui/search/SearchActivity.java
  8. 3
      app/src/main/java/org/transdroid/core/gui/settings/HelpSettingsActivity.java
  9. 3
      app/src/main/java/org/transdroid/core/gui/settings/MainSettingsActivity.java
  10. 3
      app/src/main/java/org/transdroid/core/gui/settings/NotificationSettingsActivity.java
  11. 3
      app/src/main/java/org/transdroid/core/gui/settings/RssfeedSettingsActivity.java
  12. 4
      app/src/main/java/org/transdroid/core/gui/settings/ServerSettingsActivity.java
  13. 77
      app/src/main/java/org/transdroid/core/gui/settings/SystemSettingsActivity.java
  14. 3
      app/src/main/java/org/transdroid/core/gui/settings/WebsearchSettingsActivity.java
  15. 1
      app/src/main/java/org/transdroid/core/seedbox/DediseedboxSettingsActivity.java
  16. 1
      app/src/main/java/org/transdroid/core/seedbox/XirvikDediSettingsActivity.java
  17. 1
      app/src/main/java/org/transdroid/core/seedbox/XirvikSemiSettingsActivity.java
  18. 1
      app/src/main/java/org/transdroid/core/seedbox/XirvikSettingsActivity.java
  19. 1
      app/src/main/java/org/transdroid/core/widget/ListWidgetConfigActivity.java
  20. 1
      app/src/main/java/org/transdroid/core/widget/ListWidgetProvider.java
  21. 2
      app/src/main/java/org/transdroid/core/widget/ListWidgetViewsService.java
  22. 1
      app/src/main/java/org/transdroid/daemon/util/TlsSniSocketFactory.java
  23. 2
      app/src/main/res/values/strings.xml
  24. 2
      build.gradle
  25. 2
      gradle/wrapper/gradle-wrapper.properties

3
app/src/main/java/org/transdroid/core/app/settings/SettingsPersistence.java

@ -44,10 +44,7 @@ import java.io.OutputStream;
@EBean(scope = Scope.Singleton) @EBean(scope = Scope.Singleton)
public class SettingsPersistence { public class SettingsPersistence {
public static final String DEFAULT_SETTINGS_DIR = Environment.getExternalStorageDirectory().toString()
+ "/Transdroid/";
public static final String DEFAULT_SETTINGS_FILENAME = "settings.json"; public static final String DEFAULT_SETTINGS_FILENAME = "settings.json";
public static final File DEFAULT_SETTINGS_FILE = new File(DEFAULT_SETTINGS_DIR + DEFAULT_SETTINGS_FILENAME);
@Bean @Bean
protected ApplicationSettings applicationSettings; protected ApplicationSettings applicationSettings;
@Bean @Bean

1
app/src/main/java/org/transdroid/core/gui/DetailsActivity.java

@ -141,7 +141,6 @@ public class DetailsActivity extends AppCompatActivity implements TorrentTasksEx
} }
@TargetApi(Build.VERSION_CODES.HONEYCOMB)
@OptionsItem(android.R.id.home) @OptionsItem(android.R.id.home)
protected void navigateUp() { protected void navigateUp() {
TorrentsActivity_.intent(this).flags(Intent.FLAG_ACTIVITY_CLEAR_TOP).start(); TorrentsActivity_.intent(this).flags(Intent.FLAG_ACTIVITY_CLEAR_TOP).start();

14
app/src/main/java/org/transdroid/core/gui/TorrentsActivity.java

@ -395,7 +395,6 @@ public class TorrentsActivity extends AppCompatActivity implements TorrentTasksE
} }
} }
@TargetApi(Build.VERSION_CODES.HONEYCOMB)
public void startAutoRefresh() { public void startAutoRefresh() {
// Check if already running // Check if already running
if (autoRefreshTask != null || stopRefresh || systemSettings.getRefreshIntervalMilliseconds() == 0) { if (autoRefreshTask != null || stopRefresh || systemSettings.getRefreshIntervalMilliseconds() == 0) {
@ -1026,12 +1025,13 @@ public class TorrentsActivity extends AppCompatActivity implements TorrentTasksE
@Background @Background
protected void addTorrentByFile(String localFile, String title) { protected void addTorrentByFile(String localFile, String title) {
if (!navigationHelper.checkTorrentReadPermission(this)) { // TODO EKO
// No read permission yet (which we get the result of in onRequestPermissionsResult) // if (!navigationHelper.checkTorrentReadPermission(this)) {
awaitingAddLocalFile = localFile; // // No read permission yet (which we get the result of in onRequestPermissionsResult)
awaitingAddTitle = title; // awaitingAddLocalFile = localFile;
return; // awaitingAddTitle = title;
} // return;
// }
DaemonTaskResult result = AddByFileTask.create(currentConnection, localFile).execute(log); DaemonTaskResult result = AddByFileTask.create(currentConnection, localFile).execute(log);
if (result instanceof DaemonTaskSuccessResult) { if (result instanceof DaemonTaskSuccessResult) {
onTaskSucceeded((DaemonTaskSuccessResult) result, getString(R.string.result_added, title)); onTaskSucceeded((DaemonTaskSuccessResult) result, getString(R.string.result_added, title));

18
app/src/main/java/org/transdroid/core/gui/navigation/NavigationHelper.java

@ -134,24 +134,6 @@ public class NavigationHelper {
return null; return null;
} }
@TargetApi(Build.VERSION_CODES.JELLY_BEAN)
public boolean checkTorrentReadPermission(final Activity activity) {
return Build.VERSION.SDK_INT <= Build.VERSION_CODES.KITKAT ||
checkPermission(activity, Manifest.permission.READ_EXTERNAL_STORAGE, REQUEST_TORRENT_READ_PERMISSION);
}
@TargetApi(Build.VERSION_CODES.JELLY_BEAN)
public boolean checkSettingsReadPermission(final Activity activity) {
return Build.VERSION.SDK_INT <= Build.VERSION_CODES.KITKAT ||
checkPermission(activity, Manifest.permission.READ_EXTERNAL_STORAGE, REQUEST_SETTINGS_READ_PERMISSION);
}
@TargetApi(Build.VERSION_CODES.JELLY_BEAN)
public boolean checkSettingsWritePermission(final Activity activity) {
return Build.VERSION.SDK_INT <= Build.VERSION_CODES.KITKAT ||
checkPermission(activity, Manifest.permission.WRITE_EXTERNAL_STORAGE, REQUEST_SETTINGS_WRITE_PERMISSION);
}
private boolean checkPermission(final Activity activity, final String permission, final int requestCode) { private boolean checkPermission(final Activity activity, final String permission, final int requestCode) {
if (hasPermission(permission)) if (hasPermission(permission))
// Permission already granted // Permission already granted

1
app/src/main/java/org/transdroid/core/gui/rss/RssFeedsActivity.java

@ -150,7 +150,6 @@ public class RssFeedsActivity extends AppCompatActivity {
} }
} }
@TargetApi(Build.VERSION_CODES.HONEYCOMB)
@OptionsItem(android.R.id.home) @OptionsItem(android.R.id.home)
protected void navigateUp() { protected void navigateUp() {
TorrentsActivity_.intent(this).flags(Intent.FLAG_ACTIVITY_CLEAR_TOP).start(); TorrentsActivity_.intent(this).flags(Intent.FLAG_ACTIVITY_CLEAR_TOP).start();

1
app/src/main/java/org/transdroid/core/gui/rss/RssItemsActivity.java

@ -74,7 +74,6 @@ public class RssItemsActivity extends AppCompatActivity {
fragmentItems.update(rssfeed, false, requiresExternalAuthentication); fragmentItems.update(rssfeed, false, requiresExternalAuthentication);
} }
@TargetApi(Build.VERSION_CODES.HONEYCOMB)
@OptionsItem(android.R.id.home) @OptionsItem(android.R.id.home)
protected void navigateUp() { protected void navigateUp() {
TorrentsActivity_.intent(this).flags(Intent.FLAG_ACTIVITY_CLEAR_TOP).start(); TorrentsActivity_.intent(this).flags(Intent.FLAG_ACTIVITY_CLEAR_TOP).start();

1
app/src/main/java/org/transdroid/core/gui/search/SearchActivity.java

@ -277,7 +277,6 @@ public class SearchActivity extends AppCompatActivity {
} }
@TargetApi(Build.VERSION_CODES.HONEYCOMB)
@OptionsItem(android.R.id.home) @OptionsItem(android.R.id.home)
protected void navigateUp() { protected void navigateUp() {
TorrentsActivity_.intent(this).flags(Intent.FLAG_ACTIVITY_CLEAR_TOP).start(); TorrentsActivity_.intent(this).flags(Intent.FLAG_ACTIVITY_CLEAR_TOP).start();

3
app/src/main/java/org/transdroid/core/gui/settings/HelpSettingsActivity.java

@ -16,11 +16,9 @@
*/ */
package org.transdroid.core.gui.settings; package org.transdroid.core.gui.settings;
import android.annotation.TargetApi;
import android.app.Dialog; import android.app.Dialog;
import android.content.Intent; import android.content.Intent;
import android.net.Uri; import android.net.Uri;
import android.os.Build;
import android.os.Bundle; import android.os.Bundle;
import androidx.preference.Preference; import androidx.preference.Preference;
@ -88,7 +86,6 @@ public class HelpSettingsActivity extends PreferenceCompatActivity {
findPreference("system_about").setOnPreferenceClickListener(onAboutClick); findPreference("system_about").setOnPreferenceClickListener(onAboutClick);
} }
@TargetApi(Build.VERSION_CODES.HONEYCOMB)
@OptionsItem(android.R.id.home) @OptionsItem(android.R.id.home)
protected void navigateUp() { protected void navigateUp() {
MainSettingsActivity_.intent(this).flags(Intent.FLAG_ACTIVITY_CLEAR_TOP).start(); MainSettingsActivity_.intent(this).flags(Intent.FLAG_ACTIVITY_CLEAR_TOP).start();

3
app/src/main/java/org/transdroid/core/gui/settings/MainSettingsActivity.java

@ -16,13 +16,11 @@
*/ */
package org.transdroid.core.gui.settings; package org.transdroid.core.gui.settings;
import android.annotation.TargetApi;
import android.app.Dialog; import android.app.Dialog;
import android.content.DialogInterface.OnClickListener; import android.content.DialogInterface.OnClickListener;
import android.content.Intent; import android.content.Intent;
import android.content.SharedPreferences; import android.content.SharedPreferences;
import android.net.Uri; import android.net.Uri;
import android.os.Build;
import android.os.Bundle; import android.os.Bundle;
import androidx.appcompat.app.AlertDialog; import androidx.appcompat.app.AlertDialog;
@ -256,7 +254,6 @@ public class MainSettingsActivity extends PreferenceCompatActivity {
} }
@TargetApi(Build.VERSION_CODES.HONEYCOMB)
@OptionsItem(android.R.id.home) @OptionsItem(android.R.id.home)
protected void navigateUp() { protected void navigateUp() {
TorrentsActivity_.intent(this).flags(Intent.FLAG_ACTIVITY_CLEAR_TOP).start(); TorrentsActivity_.intent(this).flags(Intent.FLAG_ACTIVITY_CLEAR_TOP).start();

3
app/src/main/java/org/transdroid/core/gui/settings/NotificationSettingsActivity.java

@ -16,11 +16,9 @@
*/ */
package org.transdroid.core.gui.settings; package org.transdroid.core.gui.settings;
import android.annotation.TargetApi;
import android.content.Intent; import android.content.Intent;
import android.content.SharedPreferences; import android.content.SharedPreferences;
import android.content.SharedPreferences.OnSharedPreferenceChangeListener; import android.content.SharedPreferences.OnSharedPreferenceChangeListener;
import android.os.Build;
import android.os.Bundle; import android.os.Bundle;
import androidx.annotation.Nullable; import androidx.annotation.Nullable;
@ -71,7 +69,6 @@ public class NotificationSettingsActivity extends PreferenceCompatActivity imple
getPreferenceScreen().getSharedPreferences().unregisterOnSharedPreferenceChangeListener(this); getPreferenceScreen().getSharedPreferences().unregisterOnSharedPreferenceChangeListener(this);
} }
@TargetApi(Build.VERSION_CODES.HONEYCOMB)
@OptionsItem(android.R.id.home) @OptionsItem(android.R.id.home)
protected void navigateUp() { protected void navigateUp() {
MainSettingsActivity_.intent(this).flags(Intent.FLAG_ACTIVITY_CLEAR_TOP).start(); MainSettingsActivity_.intent(this).flags(Intent.FLAG_ACTIVITY_CLEAR_TOP).start();

3
app/src/main/java/org/transdroid/core/gui/settings/RssfeedSettingsActivity.java

@ -16,10 +16,8 @@
*/ */
package org.transdroid.core.gui.settings; package org.transdroid.core.gui.settings;
import android.annotation.TargetApi;
import android.app.Dialog; import android.app.Dialog;
import android.content.Intent; import android.content.Intent;
import android.os.Build;
import android.os.Bundle; import android.os.Bundle;
import androidx.appcompat.app.AlertDialog; import androidx.appcompat.app.AlertDialog;
@ -60,7 +58,6 @@ public class RssfeedSettingsActivity extends KeyBoundPreferencesActivity {
} }
@TargetApi(Build.VERSION_CODES.HONEYCOMB)
@OptionsItem(android.R.id.home) @OptionsItem(android.R.id.home)
protected void navigateUp() { protected void navigateUp() {
MainSettingsActivity_.intent(this).flags(Intent.FLAG_ACTIVITY_CLEAR_TOP).start(); MainSettingsActivity_.intent(this).flags(Intent.FLAG_ACTIVITY_CLEAR_TOP).start();

4
app/src/main/java/org/transdroid/core/gui/settings/ServerSettingsActivity.java

@ -16,11 +16,9 @@
*/ */
package org.transdroid.core.gui.settings; package org.transdroid.core.gui.settings;
import android.annotation.TargetApi;
import android.app.Dialog; import android.app.Dialog;
import android.content.Intent; import android.content.Intent;
import android.content.SharedPreferences; import android.content.SharedPreferences;
import android.os.Build;
import android.os.Bundle; import android.os.Bundle;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
@ -95,7 +93,6 @@ public class ServerSettingsActivity extends KeyBoundPreferencesActivity {
}); });
} }
@TargetApi(Build.VERSION_CODES.HONEYCOMB)
@OptionsItem(android.R.id.home) @OptionsItem(android.R.id.home)
protected void navigateUp() { protected void navigateUp() {
MainSettingsActivity_.intent(this).flags(Intent.FLAG_ACTIVITY_CLEAR_TOP).start(); MainSettingsActivity_.intent(this).flags(Intent.FLAG_ACTIVITY_CLEAR_TOP).start();
@ -123,6 +120,7 @@ public class ServerSettingsActivity extends KeyBoundPreferencesActivity {
@Override @Override
public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) { public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) {
super.onRequestPermissionsResult(requestCode, permissions, grantResults);
if (connectivityHelper.requestedPermissionWasGranted(requestCode, permissions, grantResults)) { if (connectivityHelper.requestedPermissionWasGranted(requestCode, permissions, grantResults)) {
localNetworkPreference.getOnPreferenceClickListener().onPreferenceClick(localNetworkPreference); localNetworkPreference.getOnPreferenceClickListener().onPreferenceClick(localNetworkPreference);
} }

77
app/src/main/java/org/transdroid/core/gui/settings/SystemSettingsActivity.java

@ -16,17 +16,14 @@
*/ */
package org.transdroid.core.gui.settings; package org.transdroid.core.gui.settings;
import android.annotation.TargetApi;
import android.app.Dialog; import android.app.Dialog;
import android.content.DialogInterface; import android.content.DialogInterface;
import android.content.DialogInterface.OnClickListener; import android.content.DialogInterface.OnClickListener;
import android.content.Intent; import android.content.Intent;
import android.content.SharedPreferences; import android.content.SharedPreferences;
import android.os.Build;
import android.os.Bundle; import android.os.Bundle;
import android.text.TextUtils; import android.text.TextUtils;
import androidx.annotation.NonNull;
import androidx.appcompat.app.AlertDialog; import androidx.appcompat.app.AlertDialog;
import androidx.preference.Preference.OnPreferenceClickListener; import androidx.preference.Preference.OnPreferenceClickListener;
import androidx.preference.PreferenceManager; import androidx.preference.PreferenceManager;
@ -48,7 +45,6 @@ import org.transdroid.core.gui.search.BarcodeHelper;
import org.transdroid.core.gui.search.SearchHistoryProvider; import org.transdroid.core.gui.search.SearchHistoryProvider;
import org.transdroid.core.service.AppUpdateJob; import org.transdroid.core.service.AppUpdateJob;
import java.io.FileNotFoundException;
import java.io.IOException; import java.io.IOException;
import java.io.InputStream; import java.io.InputStream;
import java.io.OutputStream; import java.io.OutputStream;
@ -88,9 +84,6 @@ public class SystemSettingsActivity extends PreferenceCompatActivity {
private OnClickListener importSettingsFromFile = new OnClickListener() { private OnClickListener importSettingsFromFile = new OnClickListener() {
@Override @Override
public void onClick(DialogInterface dialog, int which) { public void onClick(DialogInterface dialog, int which) {
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.KITKAT
&& !navigationHelper.checkSettingsReadPermission(SystemSettingsActivity.this))
return; // We are requesting permission to access file storage
importSettingsFromFile(); importSettingsFromFile();
} }
}; };
@ -101,9 +94,6 @@ public class SystemSettingsActivity extends PreferenceCompatActivity {
private OnClickListener exportSettingsToFile = new OnClickListener() { private OnClickListener exportSettingsToFile = new OnClickListener() {
@Override @Override
public void onClick(DialogInterface dialog, int which) { public void onClick(DialogInterface dialog, int which) {
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.KITKAT
&& !navigationHelper.checkSettingsWritePermission(SystemSettingsActivity.this))
return; // We are requesting permission to access file storage
exportSettingsToFile(); exportSettingsToFile();
} }
}; };
@ -142,40 +132,16 @@ public class SystemSettingsActivity extends PreferenceCompatActivity {
findPreference("system_exportsettings").setOnPreferenceClickListener(onExportSettingsClick); findPreference("system_exportsettings").setOnPreferenceClickListener(onExportSettingsClick);
} }
@TargetApi(Build.VERSION_CODES.HONEYCOMB)
@OptionsItem(android.R.id.home) @OptionsItem(android.R.id.home)
protected void navigateUp() { protected void navigateUp() {
MainSettingsActivity_.intent(this).flags(Intent.FLAG_ACTIVITY_CLEAR_TOP).start(); MainSettingsActivity_.intent(this).flags(Intent.FLAG_ACTIVITY_CLEAR_TOP).start();
} }
@Override
public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) {
if (Boolean.TRUE.equals(navigationHelper.handleSettingsReadPermissionResult(requestCode, grantResults))) {
importSettingsFromFile();
} else if (Boolean.TRUE.equals(navigationHelper.handleSettingsWritePermissionResult(requestCode, grantResults))) {
exportSettingsToFile();
}
}
private void importSettingsFromFile() { private void importSettingsFromFile() {
try { Intent intent = new Intent(Intent.ACTION_OPEN_DOCUMENT);
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.KITKAT) { intent.addCategory(Intent.CATEGORY_OPENABLE);
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(SystemSettingsActivity.this); intent.setType("application/json");
settingsPersistence.importSettingsFromFile(prefs, SettingsPersistence.DEFAULT_SETTINGS_FILE); startActivityForResult(intent, ACTIVITY_IMPORT_SETTINGS);
SnackbarManager.show(Snackbar.with(SystemSettingsActivity.this).text(R.string.pref_import_success));
} else {
Intent intent = new Intent(Intent.ACTION_OPEN_DOCUMENT);
intent.addCategory(Intent.CATEGORY_OPENABLE);
intent.setType("application/json");
startActivityForResult(intent, ACTIVITY_IMPORT_SETTINGS);
}
} catch (FileNotFoundException e) {
SnackbarManager
.show(Snackbar.with(SystemSettingsActivity.this).text(R.string.error_file_not_found).colorResource(R.color.red));
} catch (JSONException e) {
SnackbarManager.show(Snackbar.with(SystemSettingsActivity.this)
.text(getString(R.string.error_no_valid_settings_file, getString(R.string.app_name))).colorResource(R.color.red));
}
} }
@OnActivityResult(ACTIVITY_IMPORT_SETTINGS) @OnActivityResult(ACTIVITY_IMPORT_SETTINGS)
@ -196,22 +162,11 @@ public class SystemSettingsActivity extends PreferenceCompatActivity {
} }
private void exportSettingsToFile() { private void exportSettingsToFile() {
try { Intent intent = new Intent(Intent.ACTION_CREATE_DOCUMENT);
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.KITKAT) { intent.addCategory(Intent.CATEGORY_OPENABLE);
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(SystemSettingsActivity.this); intent.setType("application/json");
settingsPersistence.exportSettingsToFile(prefs, SettingsPersistence.DEFAULT_SETTINGS_FILE); intent.putExtra(Intent.EXTRA_TITLE, SettingsPersistence.DEFAULT_SETTINGS_FILENAME);
SnackbarManager.show(Snackbar.with(SystemSettingsActivity.this).text(R.string.pref_export_success)); startActivityForResult(intent, ACTIVITY_EXPORT_SETTINGS);
} else {
Intent intent = new Intent(Intent.ACTION_CREATE_DOCUMENT);
intent.addCategory(Intent.CATEGORY_OPENABLE);
intent.setType("application/json");
intent.putExtra(Intent.EXTRA_TITLE, SettingsPersistence.DEFAULT_SETTINGS_FILENAME);
startActivityForResult(intent, ACTIVITY_EXPORT_SETTINGS);
}
} catch (JSONException | IOException e) {
SnackbarManager.show(Snackbar.with(SystemSettingsActivity.this).text(R.string.error_cant_write_settings_file)
.colorResource(R.color.red));
}
} }
@OnActivityResult(ACTIVITY_EXPORT_SETTINGS) @OnActivityResult(ACTIVITY_EXPORT_SETTINGS)
@ -255,12 +210,7 @@ public class SystemSettingsActivity extends PreferenceCompatActivity {
case DIALOG_IMPORTSETTINGS: case DIALOG_IMPORTSETTINGS:
// @formatter:off // @formatter:off
return new AlertDialog.Builder(this) return new AlertDialog.Builder(this)
.setMessage( .setMessage(getString(R.string.pref_import_dialog_android10))
getString(
Build.VERSION.SDK_INT < Build.VERSION_CODES.KITKAT
? R.string.pref_import_dialog : R.string.pref_import_dialog_android10,
getString(R.string.app_name),
SettingsPersistence.DEFAULT_SETTINGS_FILE.toString()))
.setPositiveButton(R.string.pref_import_fromfile, importSettingsFromFile) .setPositiveButton(R.string.pref_import_fromfile, importSettingsFromFile)
.setNeutralButton(R.string.pref_import_fromqr, importSettingsFromQr) .setNeutralButton(R.string.pref_import_fromqr, importSettingsFromQr)
.setNegativeButton(android.R.string.cancel, null) .setNegativeButton(android.R.string.cancel, null)
@ -269,12 +219,7 @@ public class SystemSettingsActivity extends PreferenceCompatActivity {
case DIALOG_EXPORTSETTINGS: case DIALOG_EXPORTSETTINGS:
// @formatter:off // @formatter:off
return new AlertDialog.Builder(this) return new AlertDialog.Builder(this)
.setMessage( .setMessage(getString(R.string.pref_export_dialog_android10))
getString(
Build.VERSION.SDK_INT < Build.VERSION_CODES.KITKAT
? R.string.pref_export_dialog : R.string.pref_export_dialog_android10,
getString(R.string.app_name),
SettingsPersistence.DEFAULT_SETTINGS_FILE.toString()))
.setPositiveButton(R.string.pref_export_tofile, exportSettingsToFile) .setPositiveButton(R.string.pref_export_tofile, exportSettingsToFile)
.setNeutralButton(R.string.pref_export_toqr, exportSettingsToQr) .setNeutralButton(R.string.pref_export_toqr, exportSettingsToQr)
.setNegativeButton(android.R.string.cancel, null) .setNegativeButton(android.R.string.cancel, null)

3
app/src/main/java/org/transdroid/core/gui/settings/WebsearchSettingsActivity.java

@ -16,10 +16,8 @@
*/ */
package org.transdroid.core.gui.settings; package org.transdroid.core.gui.settings;
import android.annotation.TargetApi;
import android.app.Dialog; import android.app.Dialog;
import android.content.Intent; import android.content.Intent;
import android.os.Build;
import android.os.Bundle; import android.os.Bundle;
import androidx.appcompat.app.AlertDialog; import androidx.appcompat.app.AlertDialog;
@ -56,7 +54,6 @@ public class WebsearchSettingsActivity extends KeyBoundPreferencesActivity {
} }
@TargetApi(Build.VERSION_CODES.HONEYCOMB)
@OptionsItem(android.R.id.home) @OptionsItem(android.R.id.home)
protected void navigateUp() { protected void navigateUp() {
MainSettingsActivity_.intent(this).flags(Intent.FLAG_ACTIVITY_CLEAR_TOP).start(); MainSettingsActivity_.intent(this).flags(Intent.FLAG_ACTIVITY_CLEAR_TOP).start();

1
app/src/main/java/org/transdroid/core/seedbox/DediseedboxSettingsActivity.java

@ -65,7 +65,6 @@ public class DediseedboxSettingsActivity extends KeyBoundPreferencesActivity {
} }
@TargetApi(Build.VERSION_CODES.HONEYCOMB)
@OptionsItem(android.R.id.home) @OptionsItem(android.R.id.home)
protected void navigateUp() { protected void navigateUp() {
MainSettingsActivity_.intent(this).flags(Intent.FLAG_ACTIVITY_CLEAR_TOP).start(); MainSettingsActivity_.intent(this).flags(Intent.FLAG_ACTIVITY_CLEAR_TOP).start();

1
app/src/main/java/org/transdroid/core/seedbox/XirvikDediSettingsActivity.java

@ -66,7 +66,6 @@ public class XirvikDediSettingsActivity extends KeyBoundPreferencesActivity {
} }
@TargetApi(Build.VERSION_CODES.HONEYCOMB)
@OptionsItem(android.R.id.home) @OptionsItem(android.R.id.home)
protected void navigateUp() { protected void navigateUp() {
MainSettingsActivity_.intent(this).flags(Intent.FLAG_ACTIVITY_CLEAR_TOP).start(); MainSettingsActivity_.intent(this).flags(Intent.FLAG_ACTIVITY_CLEAR_TOP).start();

1
app/src/main/java/org/transdroid/core/seedbox/XirvikSemiSettingsActivity.java

@ -65,7 +65,6 @@ public class XirvikSemiSettingsActivity extends KeyBoundPreferencesActivity {
} }
@TargetApi(Build.VERSION_CODES.HONEYCOMB)
@OptionsItem(android.R.id.home) @OptionsItem(android.R.id.home)
protected void navigateUp() { protected void navigateUp() {
MainSettingsActivity_.intent(this).flags(Intent.FLAG_ACTIVITY_CLEAR_TOP).start(); MainSettingsActivity_.intent(this).flags(Intent.FLAG_ACTIVITY_CLEAR_TOP).start();

1
app/src/main/java/org/transdroid/core/seedbox/XirvikSettingsActivity.java

@ -120,7 +120,6 @@ public class XirvikSettingsActivity extends KeyBoundPreferencesActivity {
edit.apply(); edit.apply();
} }
@TargetApi(Build.VERSION_CODES.HONEYCOMB)
@OptionsItem(android.R.id.home) @OptionsItem(android.R.id.home)
protected void navigateUp() { protected void navigateUp() {
MainSettingsActivity_.intent(this).flags(Intent.FLAG_ACTIVITY_CLEAR_TOP).start(); MainSettingsActivity_.intent(this).flags(Intent.FLAG_ACTIVITY_CLEAR_TOP).start();

1
app/src/main/java/org/transdroid/core/widget/ListWidgetConfigActivity.java

@ -64,7 +64,6 @@ import java.util.ArrayList;
import java.util.Collections; import java.util.Collections;
import java.util.List; import java.util.List;
@TargetApi(Build.VERSION_CODES.HONEYCOMB)
@EActivity(resName = "activity_widgetconfig") @EActivity(resName = "activity_widgetconfig")
public class ListWidgetConfigActivity extends AppCompatActivity { public class ListWidgetConfigActivity extends AppCompatActivity {

1
app/src/main/java/org/transdroid/core/widget/ListWidgetProvider.java

@ -45,7 +45,6 @@ import org.transdroid.core.service.ControlService_;
* *
* @author Eric Kok * @author Eric Kok
*/ */
@TargetApi(Build.VERSION_CODES.HONEYCOMB)
@EReceiver @EReceiver
public class ListWidgetProvider extends AppWidgetProvider { public class ListWidgetProvider extends AppWidgetProvider {

2
app/src/main/java/org/transdroid/core/widget/ListWidgetViewsService.java

@ -54,7 +54,6 @@ import java.util.List;
* *
* @author Eric Kok * @author Eric Kok
*/ */
@TargetApi(Build.VERSION_CODES.HONEYCOMB)
@EService @EService
public class ListWidgetViewsService extends RemoteViewsService { public class ListWidgetViewsService extends RemoteViewsService {
@ -65,7 +64,6 @@ public class ListWidgetViewsService extends RemoteViewsService {
} }
@TargetApi(Build.VERSION_CODES.HONEYCOMB)
class WidgetViewsFactory implements RemoteViewsService.RemoteViewsFactory { class WidgetViewsFactory implements RemoteViewsService.RemoteViewsFactory {
private final Context context; private final Context context;

1
app/src/main/java/org/transdroid/daemon/util/TlsSniSocketFactory.java

@ -100,7 +100,6 @@ public class TlsSniSocketFactory implements LayeredSocketFactory {
// TLS layer // TLS layer
@Override @Override
@TargetApi(Build.VERSION_CODES.JELLY_BEAN_MR1)
public Socket createSocket(Socket plainSocket, String host, int port, boolean autoClose) throws IOException { public Socket createSocket(Socket plainSocket, String host, int port, boolean autoClose) throws IOException {
if (autoClose) { if (autoClose) {
// we don't need the plainSocket // we don't need the plainSocket

2
app/src/main/res/values/strings.xml

@ -355,13 +355,11 @@
<string name="pref_clearsearch">Clear search history</string> <string name="pref_clearsearch">Clear search history</string>
<string name="pref_clearsearch_success">Search history is cleared</string> <string name="pref_clearsearch_success">Search history is cleared</string>
<string name="pref_import">Import settings</string> <string name="pref_import">Import settings</string>
<string name="pref_import_dialog">%1$s will try to import server, web search, RSS and system settings from: %2$s</string>
<string name="pref_import_dialog_android10">%1$s will try to import server, web search, RSS and system settings</string> <string name="pref_import_dialog_android10">%1$s will try to import server, web search, RSS and system settings</string>
<string name="pref_import_fromfile">Use file</string> <string name="pref_import_fromfile">Use file</string>
<string name="pref_import_fromqr">Use QR code</string> <string name="pref_import_fromqr">Use QR code</string>
<string name="pref_import_success">Settings successfully imported</string> <string name="pref_import_success">Settings successfully imported</string>
<string name="pref_export">Export settings</string> <string name="pref_export">Export settings</string>
<string name="pref_export_dialog">%1$s will export server (including passwords), web search, RSS and system settings to the following plain text JSON file: %2$s</string>
<string name="pref_export_dialog_android10">%1$s will export server (including passwords), web search, RSS and system settings</string> <string name="pref_export_dialog_android10">%1$s will export server (including passwords), web search, RSS and system settings</string>
<string name="pref_export_tofile">To file</string> <string name="pref_export_tofile">To file</string>
<string name="pref_export_toqr">To QR code</string> <string name="pref_export_toqr">To QR code</string>

2
build.gradle

@ -6,7 +6,7 @@ buildscript {
} }
dependencies { dependencies {
classpath 'com.android.tools.build:gradle:8.1.4' classpath 'com.android.tools.build:gradle:8.2.1'
} }
} }

2
gradle/wrapper/gradle-wrapper.properties vendored

@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.0-all.zip distributionUrl=https\://services.gradle.org/distributions/gradle-8.2-all.zip
zipStoreBase=GRADLE_USER_HOME zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists zipStorePath=wrapper/dists

Loading…
Cancel
Save