Browse Source

Merge branch 'master' into ide-code-completion

pull/653/head
Eric Kok 10 months ago committed by GitHub
parent
commit
9457215b95
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 8
      README.md
  2. 35
      app/build.gradle
  3. 3
      app/proguard-rules.pro
  4. 2
      app/src/full/res/values/bools.xml
  5. 2
      app/src/full/res/values/strings.xml
  6. 2
      app/src/lite/res/values/bools.xml
  7. 2
      app/src/lite/res/values/strings.xml
  8. 19
      app/src/main/AndroidManifest.xml
  9. 2
      app/src/main/java/org/transdroid/core/app/search/SearchHelper.java
  10. 2
      app/src/main/java/org/transdroid/core/app/search/SearchResult.java
  11. 2
      app/src/main/java/org/transdroid/core/app/search/SearchSite.java
  12. 2
      app/src/main/java/org/transdroid/core/app/settings/ApplicationSettings.java
  13. 2
      app/src/main/java/org/transdroid/core/app/settings/NotificationSettings.java
  14. 2
      app/src/main/java/org/transdroid/core/app/settings/RssfeedSetting.java
  15. 2
      app/src/main/java/org/transdroid/core/app/settings/ServerSetting.java
  16. 5
      app/src/main/java/org/transdroid/core/app/settings/SettingsPersistence.java
  17. 2
      app/src/main/java/org/transdroid/core/app/settings/SystemSettings.java
  18. 2
      app/src/main/java/org/transdroid/core/app/settings/WebsearchSetting.java
  19. 3
      app/src/main/java/org/transdroid/core/gui/DetailsActivity.java
  20. 2
      app/src/main/java/org/transdroid/core/gui/DetailsFragment.java
  21. 2
      app/src/main/java/org/transdroid/core/gui/ServerPickerDialog.java
  22. 2
      app/src/main/java/org/transdroid/core/gui/ServerSelectionView.java
  23. 2
      app/src/main/java/org/transdroid/core/gui/ServerStatusView.java
  24. 2
      app/src/main/java/org/transdroid/core/gui/TorrentTasksExecutor.java
  25. 19
      app/src/main/java/org/transdroid/core/gui/TorrentsActivity.java
  26. 2
      app/src/main/java/org/transdroid/core/gui/TorrentsFragment.java
  27. 24
      app/src/main/java/org/transdroid/core/gui/TransdroidApp.java
  28. 2
      app/src/main/java/org/transdroid/core/gui/lists/DetailsAdapter.java
  29. 2
      app/src/main/java/org/transdroid/core/gui/lists/LocalTorrent.java
  30. 2
      app/src/main/java/org/transdroid/core/gui/lists/MergeAdapter.java
  31. 2
      app/src/main/java/org/transdroid/core/gui/lists/SimpleListItem.java
  32. 2
      app/src/main/java/org/transdroid/core/gui/lists/SimpleListItemAdapter.java
  33. 2
      app/src/main/java/org/transdroid/core/gui/lists/SimpleListItemSpinnerAdapter.java
  34. 2
      app/src/main/java/org/transdroid/core/gui/lists/SimpleListItemView.java
  35. 2
      app/src/main/java/org/transdroid/core/gui/lists/SortByListItem.java
  36. 2
      app/src/main/java/org/transdroid/core/gui/lists/TorrentDetailsView.java
  37. 2
      app/src/main/java/org/transdroid/core/gui/lists/TorrentFilePriorityLayout.java
  38. 2
      app/src/main/java/org/transdroid/core/gui/lists/TorrentFileView.java
  39. 2
      app/src/main/java/org/transdroid/core/gui/lists/TorrentProgressBar.java
  40. 2
      app/src/main/java/org/transdroid/core/gui/lists/TorrentStatusLayout.java
  41. 2
      app/src/main/java/org/transdroid/core/gui/lists/TorrentView.java
  42. 2
      app/src/main/java/org/transdroid/core/gui/lists/TorrentsAdapter.java
  43. 2
      app/src/main/java/org/transdroid/core/gui/lists/ViewHolderAdapter.java
  44. 2
      app/src/main/java/org/transdroid/core/gui/log/DatabaseHelper.java
  45. 2
      app/src/main/java/org/transdroid/core/gui/log/ErrorLogEntry.java
  46. 2
      app/src/main/java/org/transdroid/core/gui/log/ErrorLogSender.java
  47. 2
      app/src/main/java/org/transdroid/core/gui/log/Log.java
  48. 2
      app/src/main/java/org/transdroid/core/gui/log/LogUncaughtExceptionHandler.java
  49. 2
      app/src/main/java/org/transdroid/core/gui/navigation/DialogHelper.java
  50. 2
      app/src/main/java/org/transdroid/core/gui/navigation/FilterListAdapter.java
  51. 2
      app/src/main/java/org/transdroid/core/gui/navigation/FilterListItemAdapter.java
  52. 2
      app/src/main/java/org/transdroid/core/gui/navigation/FilterListItemView.java
  53. 2
      app/src/main/java/org/transdroid/core/gui/navigation/FilterSeparatorView.java
  54. 2
      app/src/main/java/org/transdroid/core/gui/navigation/Label.java
  55. 2
      app/src/main/java/org/transdroid/core/gui/navigation/NavigationFilter.java
  56. 56
      app/src/main/java/org/transdroid/core/gui/navigation/NavigationHelper.java
  57. 2
      app/src/main/java/org/transdroid/core/gui/navigation/RefreshableActivity.java
  58. 2
      app/src/main/java/org/transdroid/core/gui/navigation/SelectionManagerMode.java
  59. 2
      app/src/main/java/org/transdroid/core/gui/navigation/SelectionModificationSpinner.java
  60. 2
      app/src/main/java/org/transdroid/core/gui/navigation/SetLabelDialog.java
  61. 2
      app/src/main/java/org/transdroid/core/gui/navigation/SetStorageLocationDialog.java
  62. 2
      app/src/main/java/org/transdroid/core/gui/navigation/SetTrackersDialog.java
  63. 2
      app/src/main/java/org/transdroid/core/gui/navigation/SetTransferRatesDialog.java
  64. 2
      app/src/main/java/org/transdroid/core/gui/navigation/StatusType.java
  65. 2
      app/src/main/java/org/transdroid/core/gui/remoterss/RemoteRssFragment.java
  66. 2
      app/src/main/java/org/transdroid/core/gui/remoterss/RemoteRssItemView.java
  67. 3
      app/src/main/java/org/transdroid/core/gui/rss/RssFeedsActivity.java
  68. 2
      app/src/main/java/org/transdroid/core/gui/rss/RssFeedsFragment.java
  69. 3
      app/src/main/java/org/transdroid/core/gui/rss/RssItemsActivity.java
  70. 2
      app/src/main/java/org/transdroid/core/gui/rss/RssItemsFragment.java
  71. 2
      app/src/main/java/org/transdroid/core/gui/rss/RssfeedLoader.java
  72. 2
      app/src/main/java/org/transdroid/core/gui/rss/RssfeedView.java
  73. 2
      app/src/main/java/org/transdroid/core/gui/rss/RssfeedsAdapter.java
  74. 2
      app/src/main/java/org/transdroid/core/gui/rss/RssitemStatusLayout.java
  75. 2
      app/src/main/java/org/transdroid/core/gui/rss/RssitemView.java
  76. 2
      app/src/main/java/org/transdroid/core/gui/rss/RssitemsAdapter.java
  77. 2
      app/src/main/java/org/transdroid/core/gui/search/BarcodeHelper.java
  78. 2
      app/src/main/java/org/transdroid/core/gui/search/FilePickerHelper.java
  79. 3
      app/src/main/java/org/transdroid/core/gui/search/SearchActivity.java
  80. 2
      app/src/main/java/org/transdroid/core/gui/search/SearchHistoryProvider.java
  81. 2
      app/src/main/java/org/transdroid/core/gui/search/SearchResultView.java
  82. 2
      app/src/main/java/org/transdroid/core/gui/search/SearchResultsAdapter.java
  83. 2
      app/src/main/java/org/transdroid/core/gui/search/SearchResultsFragment.java
  84. 2
      app/src/main/java/org/transdroid/core/gui/search/SearchSetting.java
  85. 2
      app/src/main/java/org/transdroid/core/gui/search/SearchSettingSelectionView.java
  86. 2
      app/src/main/java/org/transdroid/core/gui/search/SearchSettingsDropDownAdapter.java
  87. 2
      app/src/main/java/org/transdroid/core/gui/search/SearchSiteView.java
  88. 2
      app/src/main/java/org/transdroid/core/gui/search/SearchSitesAdapter.java
  89. 2
      app/src/main/java/org/transdroid/core/gui/search/SendIntentHelper.java
  90. 2
      app/src/main/java/org/transdroid/core/gui/search/UrlEntryDialog.java
  91. 2
      app/src/main/java/org/transdroid/core/gui/settings/AboutDialog.java
  92. 2
      app/src/main/java/org/transdroid/core/gui/settings/ChangelogDialog.java
  93. 5
      app/src/main/java/org/transdroid/core/gui/settings/HelpSettingsActivity.java
  94. 2
      app/src/main/java/org/transdroid/core/gui/settings/KeyBoundPreferencesActivity.java
  95. 5
      app/src/main/java/org/transdroid/core/gui/settings/MainSettingsActivity.java
  96. 32
      app/src/main/java/org/transdroid/core/gui/settings/NotificationSettingsActivity.java
  97. 2
      app/src/main/java/org/transdroid/core/gui/settings/RssfeedPreference.java
  98. 5
      app/src/main/java/org/transdroid/core/gui/settings/RssfeedSettingsActivity.java
  99. 2
      app/src/main/java/org/transdroid/core/gui/settings/ServerPreference.java
  100. 6
      app/src/main/java/org/transdroid/core/gui/settings/ServerSettingsActivity.java
  101. Some files were not shown because too many files have changed in this diff Show More

8
README.md

@ -45,8 +45,7 @@ However, larger and new features will be developed in their own branch.
Code structure Code structure
============== ==============
Starting with version 2.3.0, Transdroid is developed in Android Studio, fully integrating with the Gradle build system. Transdroid is (since version 2.5.23) compiled against Android 14 (API level 34) and (since version 2.5.23) supporting Android 5 (API level 21) and up only.
It is (since version 2.5.21) compiled against Android 12 (API level 31) and (since version 2.2.0) supporting Android ICS (API level 15) and up only.
To support lite (Transdrone, specially for the Play Store) and full (Transdroid) versions of the app, build flavours are defined in gradle, which contain version-specific resources. To support lite (Transdrone, specially for the Play Store) and full (Transdroid) versions of the app, build flavours are defined in gradle, which contain version-specific resources.
Dependencies are managed via JCentral et al. in the app's build.gradle file. Dependencies are managed via JCentral et al. in the app's build.gradle file.
@ -59,7 +58,7 @@ Contributions by various others (see commit log).
License License
======= =======
Copyright 2010-2022 Eric Kok et al. Copyright 2010-2024 Eric Kok et al.
Transdroid is free software: you can redistribute it and/or modify Transdroid is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
@ -108,9 +107,6 @@ Some code/libraries/resources are used in the project:
* [Material Dialogs](https://github.com/afollestad/material-dialogs) * [Material Dialogs](https://github.com/afollestad/material-dialogs)
Aidan Follestad Aidan Follestad
Apache License, Version 2.0 Apache License, Version 2.0
* [Android-Job](https://github.com/evernote/android-job)
Evernote Corporation
Apache License, Version 2.0
* [android-ColorPickerPreference](https://github.com/attenzione/android-ColorPickerPreference) * [android-ColorPickerPreference](https://github.com/attenzione/android-ColorPickerPreference)
Daniel Nilsson and Sergey Margaritov Daniel Nilsson and Sergey Margaritov
Apache License, Version 2.0 Apache License, Version 2.0

35
app/build.gradle

@ -1,13 +1,13 @@
apply plugin: 'com.android.application' apply plugin: 'com.android.application'
android { android {
compileSdkVersion 31 compileSdk 34
defaultConfig { defaultConfig {
minSdkVersion 15 minSdkVersion 21
targetSdkVersion 31 targetSdkVersion 34
versionCode 242 versionCode 244
versionName '2.5.22' versionName '2.5.24'
javaCompileOptions { javaCompileOptions {
annotationProcessorOptions { annotationProcessorOptions {
@ -80,31 +80,32 @@ android {
dependencies { dependencies {
// Android support // Android support
implementation 'androidx.appcompat:appcompat:1.2.0' implementation 'androidx.appcompat:appcompat:1.6.1'
implementation 'androidx.preference:preference:1.1.1' implementation 'androidx.preference:preference:1.2.1'
implementation 'androidx.swiperefreshlayout:swiperefreshlayout:1.1.0' implementation 'androidx.swiperefreshlayout:swiperefreshlayout:1.1.0'
implementation 'com.google.android.material:material:1.3.0' implementation 'com.google.android.material:material:1.10.0'
// Other // Other
implementation 'org.androidannotations:androidannotations-api:4.7.0' implementation 'org.androidannotations:androidannotations-api:4.8.0'
implementation 'org.androidannotations:ormlite-api:4.7.0' implementation 'org.androidannotations:ormlite-api:4.8.0'
implementation 'com.j256.ormlite:ormlite-core:5.1' implementation 'com.j256.ormlite:ormlite-android:6.1'
implementation 'com.j256.ormlite:ormlite-android:5.1'
implementation 'com.nostra13.universalimageloader:universal-image-loader:1.9.5' implementation 'com.nostra13.universalimageloader:universal-image-loader:1.9.5'
implementation 'com.getbase:floatingactionbutton:1.10.1' implementation 'com.getbase:floatingactionbutton:1.10.1'
implementation 'com.nispok:snackbar:2.11.0' implementation 'com.nispok:snackbar:2.11.0'
implementation 'org.apache.openjpa:openjpa-lib:3.1.1' implementation 'org.apache.openjpa:openjpa-lib:3.2.2'
implementation 'net.iharder:base64:2.3.9' implementation 'net.iharder:base64:2.3.9'
implementation('com.github.afollestad.material-dialogs:core:0.9.6.0@aar') { implementation('com.github.afollestad.material-dialogs:core:0.9.6.0@aar') {
transitive = true transitive = true
} }
implementation 'com.evernote:android-job:1.2.6' implementation 'androidx.work:work-runtime:2.9.0'
implementation "androidx.lifecycle:lifecycle-viewmodel:2.6.2"
implementation "androidx.lifecycle:lifecycle-viewmodel-ktx:2.6.2"
annotationProcessor 'org.androidannotations:androidannotations:4.8.0'
annotationProcessor 'org.androidannotations:ormlite:4.8.0'
// Copied From androidSdkPath/platforms/android-31/optional/org.apache.http.legacy.jar // Copied From androidSdkPath/platforms/android-31/optional/org.apache.http.legacy.jar
// Using it as a compileOnly so this helps while developing, but is not compiled into the final // Using it as a compileOnly so this helps while developing, but is not compiled into the final
// app, see https://developer.android.com/studio/build/dependencies#dependency_configurations // app, see https://developer.android.com/studio/build/dependencies#dependency_configurations
compileOnly files('libs/org.apache.http.legacy.jar') compileOnly files('libs/org.apache.http.legacy.jar')
annotationProcessor 'org.androidannotations:androidannotations:4.7.0'
annotationProcessor 'org.androidannotations:ormlite:4.7.0'
} }

3
app/proguard-rules.pro vendored

@ -1 +1,4 @@
-dontobfuscate -dontobfuscate
-keep class org.transdroid.core.gui.log.ErrorLogEntry { *; }
-dontwarn javax.persistence.**

2
app/src/full/res/values/bools.xml

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?><!-- <?xml version="1.0" encoding="utf-8"?><!--
Copyright 2010-2018 Eric Kok et al. Copyright 2010-2024 Eric Kok et al.
Transdroid is free software: you can redistribute it and/or modify Transdroid is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by

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

@ -1,5 +1,5 @@
<!-- <!--
Copyright 2010-2018 Eric Kok et al. Copyright 2010-2024 Eric Kok et al.
Transdroid is free software: you can redistribute it and/or modify Transdroid is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by

2
app/src/lite/res/values/bools.xml

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?><!-- <?xml version="1.0" encoding="utf-8"?><!--
Copyright 2010-2018 Eric Kok et al. Copyright 2010-2024 Eric Kok et al.
Transdroid is free software: you can redistribute it and/or modify Transdroid is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by

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

@ -1,5 +1,5 @@
<!-- <!--
Copyright 2010-2018 Eric Kok et al. Copyright 2010-2024 Eric Kok et al.
Transdroid is free software: you can redistribute it and/or modify Transdroid is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by

19
app/src/main/AndroidManifest.xml

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?><!-- <?xml version="1.0" encoding="utf-8"?><!--
Copyright 2010-2018 Eric Kok et al. Copyright 2010-2024 Eric Kok et al.
Transdroid is free software: you can redistribute it and/or modify Transdroid is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
@ -35,8 +35,8 @@
<!-- To start rss and torrents background check services --> <!-- To start rss and torrents background check services -->
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" /> <uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
<uses-permission android:name="android.permission.VIBRATE" /> <uses-permission android:name="android.permission.VIBRATE" />
<!-- To export settings file to external storage --> <!-- To show torrent and app update notifications -->
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /> <uses-permission android:name="android.permission.POST_NOTIFICATIONS"/>
<uses-feature <uses-feature
android:name="android.hardware.touchscreen" android:name="android.hardware.touchscreen"
@ -69,7 +69,6 @@
<activity <activity
android:name="org.transdroid.core.gui.TorrentsActivity_" android:name="org.transdroid.core.gui.TorrentsActivity_"
android:allowTaskReparenting="true" android:allowTaskReparenting="true"
android:label="@string/app_name"
android:launchMode="singleTop" android:launchMode="singleTop"
android:theme="@style/TransdroidTheme" android:theme="@style/TransdroidTheme"
android:windowSoftInputMode="stateHidden" android:windowSoftInputMode="stateHidden"
@ -273,6 +272,18 @@
android:authorities="@string/search_history_authority" android:authorities="@string/search_history_authority"
android:exported="false" /> android:exported="false" />
<!-- allow debug logs for WorkManager -->
<provider
android:name="androidx.startup.InitializationProvider"
android:authorities="${applicationId}.androidx-startup"
android:exported="false"
tools:node="merge">
<meta-data
android:name="androidx.work.WorkManagerInitializer"
android:value="androidx.startup"
tools:node="remove" />
</provider>
<!-- RSS --> <!-- RSS -->
<activity <activity
android:name="org.transdroid.core.gui.rss.RssFeedsActivity_" android:name="org.transdroid.core.gui.rss.RssFeedsActivity_"

2
app/src/main/java/org/transdroid/core/app/search/SearchHelper.java

@ -1,5 +1,5 @@
/* /*
* Copyright 2010-2018 Eric Kok et al. * Copyright 2010-2024 Eric Kok et al.
* *
* Transdroid is free software: you can redistribute it and/or modify * Transdroid is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by

2
app/src/main/java/org/transdroid/core/app/search/SearchResult.java

@ -1,5 +1,5 @@
/* /*
* Copyright 2010-2018 Eric Kok et al. * Copyright 2010-2024 Eric Kok et al.
* *
* Transdroid is free software: you can redistribute it and/or modify * Transdroid is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by

2
app/src/main/java/org/transdroid/core/app/search/SearchSite.java

@ -1,5 +1,5 @@
/* /*
* Copyright 2010-2018 Eric Kok et al. * Copyright 2010-2024 Eric Kok et al.
* *
* Transdroid is free software: you can redistribute it and/or modify * Transdroid is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by

2
app/src/main/java/org/transdroid/core/app/settings/ApplicationSettings.java

@ -1,5 +1,5 @@
/* /*
* Copyright 2010-2018 Eric Kok et al. * Copyright 2010-2024 Eric Kok et al.
* *
* Transdroid is free software: you can redistribute it and/or modify * Transdroid is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by

2
app/src/main/java/org/transdroid/core/app/settings/NotificationSettings.java

@ -1,5 +1,5 @@
/* /*
* Copyright 2010-2018 Eric Kok et al. * Copyright 2010-2024 Eric Kok et al.
* *
* Transdroid is free software: you can redistribute it and/or modify * Transdroid is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by

2
app/src/main/java/org/transdroid/core/app/settings/RssfeedSetting.java

@ -1,5 +1,5 @@
/* /*
* Copyright 2010-2018 Eric Kok et al. * Copyright 2010-2024 Eric Kok et al.
* *
* Transdroid is free software: you can redistribute it and/or modify * Transdroid is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by

2
app/src/main/java/org/transdroid/core/app/settings/ServerSetting.java

@ -1,5 +1,5 @@
/* /*
* Copyright 2010-2018 Eric Kok et al. * Copyright 2010-2024 Eric Kok et al.
* *
* Transdroid is free software: you can redistribute it and/or modify * Transdroid is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by

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

@ -1,5 +1,5 @@
/* /*
* Copyright 2010-2018 Eric Kok et al. * Copyright 2010-2024 Eric Kok et al.
* *
* Transdroid is free software: you can redistribute it and/or modify * Transdroid is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@ -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

2
app/src/main/java/org/transdroid/core/app/settings/SystemSettings.java

@ -1,5 +1,5 @@
/* /*
* Copyright 2010-2018 Eric Kok et al. * Copyright 2010-2024 Eric Kok et al.
* *
* Transdroid is free software: you can redistribute it and/or modify * Transdroid is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by

2
app/src/main/java/org/transdroid/core/app/settings/WebsearchSetting.java

@ -1,5 +1,5 @@
/* /*
* Copyright 2010-2018 Eric Kok et al. * Copyright 2010-2024 Eric Kok et al.
* *
* Transdroid is free software: you can redistribute it and/or modify * Transdroid is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by

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

@ -1,5 +1,5 @@
/* /*
* Copyright 2010-2018 Eric Kok et al. * Copyright 2010-2024 Eric Kok et al.
* *
* Transdroid is free software: you can redistribute it and/or modify * Transdroid is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@ -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();

2
app/src/main/java/org/transdroid/core/gui/DetailsFragment.java

@ -1,5 +1,5 @@
/* /*
* Copyright 2010-2018 Eric Kok et al. * Copyright 2010-2024 Eric Kok et al.
* *
* Transdroid is free software: you can redistribute it and/or modify * Transdroid is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by

2
app/src/main/java/org/transdroid/core/gui/ServerPickerDialog.java

@ -1,5 +1,5 @@
/* /*
* Copyright 2010-2018 Eric Kok et al. * Copyright 2010-2024 Eric Kok et al.
* *
* Transdroid is free software: you can redistribute it and/or modify * Transdroid is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by

2
app/src/main/java/org/transdroid/core/gui/ServerSelectionView.java

@ -1,5 +1,5 @@
/* /*
* Copyright 2010-2018 Eric Kok et al. * Copyright 2010-2024 Eric Kok et al.
* *
* Transdroid is free software: you can redistribute it and/or modify * Transdroid is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by

2
app/src/main/java/org/transdroid/core/gui/ServerStatusView.java

@ -1,5 +1,5 @@
/* /*
* Copyright 2010-2018 Eric Kok et al. * Copyright 2010-2024 Eric Kok et al.
* *
* Transdroid is free software: you can redistribute it and/or modify * Transdroid is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by

2
app/src/main/java/org/transdroid/core/gui/TorrentTasksExecutor.java

@ -1,5 +1,5 @@
/* /*
* Copyright 2010-2018 Eric Kok et al. * Copyright 2010-2024 Eric Kok et al.
* *
* Transdroid is free software: you can redistribute it and/or modify * Transdroid is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by

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

@ -1,5 +1,5 @@
/* /*
* Copyright 2010-2018 Eric Kok et al. * Copyright 2010-2024 Eric Kok et al.
* *
* Transdroid is free software: you can redistribute it and/or modify * Transdroid is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@ -214,8 +214,6 @@ public class TorrentsActivity extends AppCompatActivity implements TorrentTasksE
// Auto refresh task // Auto refresh task
private AsyncTask<Void, Void, Void> autoRefreshTask; private AsyncTask<Void, Void, Void> autoRefreshTask;
private String awaitingAddLocalFile;
private String awaitingAddTitle;
/** /**
* Handles item selections on the dedicated list of filter items * Handles item selections on the dedicated list of filter items
*/ */
@ -395,7 +393,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) {
@ -751,14 +748,6 @@ public class TorrentsActivity extends AppCompatActivity implements TorrentTasksE
return true; return true;
} }
@Override
public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) {
if (awaitingAddLocalFile != null && awaitingAddTitle != null &&
Boolean.TRUE.equals(navigationHelper.handleTorrentReadPermissionResult(requestCode, grantResults))) {
addTorrentByFile(awaitingAddLocalFile, awaitingAddTitle);
}
}
@Click(R.id.addmenu_link_button) @Click(R.id.addmenu_link_button)
protected void startUrlEntryDialog() { protected void startUrlEntryDialog() {
addmenuButton.collapse(); addmenuButton.collapse();
@ -1026,12 +1015,6 @@ 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)) {
// No read permission yet (which we get the result of in onRequestPermissionsResult)
awaitingAddLocalFile = localFile;
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));

2
app/src/main/java/org/transdroid/core/gui/TorrentsFragment.java

@ -1,5 +1,5 @@
/* /*
* Copyright 2010-2018 Eric Kok et al. * Copyright 2010-2024 Eric Kok et al.
* *
* Transdroid is free software: you can redistribute it and/or modify * Transdroid is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by

24
app/src/main/java/org/transdroid/core/gui/TransdroidApp.java

@ -1,5 +1,5 @@
/* /*
* Copyright 2010-2018 Eric Kok et al. * Copyright 2010-2024 Eric Kok et al.
* *
* Transdroid is free software: you can redistribute it and/or modify * Transdroid is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@ -18,27 +18,21 @@ package org.transdroid.core.gui;
import android.app.Application; import android.app.Application;
import com.evernote.android.job.JobConfig; import androidx.annotation.NonNull;
import com.evernote.android.job.JobManager; import androidx.work.Configuration;
import org.androidannotations.annotations.Bean;
import org.androidannotations.annotations.EApplication; import org.androidannotations.annotations.EApplication;
import org.transdroid.core.gui.log.Log; import org.transdroid.core.gui.log.Log;
import org.transdroid.core.service.ScheduledJobCreator;
@EApplication @EApplication
public class TransdroidApp extends Application { public class TransdroidApp extends Application implements Configuration.Provider {
@Bean
protected Log log;
@NonNull
@Override @Override
public void onCreate() { public Configuration getWorkManagerConfiguration() {
super.onCreate(); return new Configuration.Builder()
.setMinimumLoggingLevel(android.util.Log.DEBUG)
// Configure Android-Job .build();
JobConfig.addLogger((priority, tag, message, t) -> log.d(tag, message));
JobManager.create(this).addJobCreator(new ScheduledJobCreator());
} }
} }

2
app/src/main/java/org/transdroid/core/gui/lists/DetailsAdapter.java

@ -1,5 +1,5 @@
/* /*
* Copyright 2010-2018 Eric Kok et al. * Copyright 2010-2024 Eric Kok et al.
* *
* Transdroid is free software: you can redistribute it and/or modify * Transdroid is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by

2
app/src/main/java/org/transdroid/core/gui/lists/LocalTorrent.java

@ -1,5 +1,5 @@
/* /*
* Copyright 2010-2018 Eric Kok et al. * Copyright 2010-2024 Eric Kok et al.
* *
* Transdroid is free software: you can redistribute it and/or modify * Transdroid is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by

2
app/src/main/java/org/transdroid/core/gui/lists/MergeAdapter.java

@ -1,5 +1,5 @@
/* /*
* Copyright 2010-2018 Eric Kok et al. * Copyright 2010-2024 Eric Kok et al.
* *
* Transdroid is free software: you can redistribute it and/or modify * Transdroid is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by

2
app/src/main/java/org/transdroid/core/gui/lists/SimpleListItem.java

@ -1,5 +1,5 @@
/* /*
* Copyright 2010-2018 Eric Kok et al. * Copyright 2010-2024 Eric Kok et al.
* *
* Transdroid is free software: you can redistribute it and/or modify * Transdroid is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by

2
app/src/main/java/org/transdroid/core/gui/lists/SimpleListItemAdapter.java

@ -1,5 +1,5 @@
/* /*
* Copyright 2010-2018 Eric Kok et al. * Copyright 2010-2024 Eric Kok et al.
* *
* Transdroid is free software: you can redistribute it and/or modify * Transdroid is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by

2
app/src/main/java/org/transdroid/core/gui/lists/SimpleListItemSpinnerAdapter.java

@ -1,5 +1,5 @@
/* /*
* Copyright 2010-2018 Eric Kok et al. * Copyright 2010-2024 Eric Kok et al.
* *
* Transdroid is free software: you can redistribute it and/or modify * Transdroid is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by

2
app/src/main/java/org/transdroid/core/gui/lists/SimpleListItemView.java

@ -1,5 +1,5 @@
/* /*
* Copyright 2010-2018 Eric Kok et al. * Copyright 2010-2024 Eric Kok et al.
* *
* Transdroid is free software: you can redistribute it and/or modify * Transdroid is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by

2
app/src/main/java/org/transdroid/core/gui/lists/SortByListItem.java

@ -1,5 +1,5 @@
/* /*
* Copyright 2010-2018 Eric Kok et al. * Copyright 2010-2024 Eric Kok et al.
* *
* Transdroid is free software: you can redistribute it and/or modify * Transdroid is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by

2
app/src/main/java/org/transdroid/core/gui/lists/TorrentDetailsView.java

@ -1,5 +1,5 @@
/* /*
* Copyright 2010-2018 Eric Kok et al. * Copyright 2010-2024 Eric Kok et al.
* *
* Transdroid is free software: you can redistribute it and/or modify * Transdroid is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by

2
app/src/main/java/org/transdroid/core/gui/lists/TorrentFilePriorityLayout.java

@ -1,5 +1,5 @@
/* /*
* Copyright 2010-2018 Eric Kok et al. * Copyright 2010-2024 Eric Kok et al.
* *
* Transdroid is free software: you can redistribute it and/or modify * Transdroid is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by

2
app/src/main/java/org/transdroid/core/gui/lists/TorrentFileView.java

@ -1,5 +1,5 @@
/* /*
* Copyright 2010-2018 Eric Kok et al. * Copyright 2010-2024 Eric Kok et al.
* *
* Transdroid is free software: you can redistribute it and/or modify * Transdroid is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by

2
app/src/main/java/org/transdroid/core/gui/lists/TorrentProgressBar.java

@ -1,5 +1,5 @@
/* /*
* Copyright 2010-2018 Eric Kok et al. * Copyright 2010-2024 Eric Kok et al.
* *
* Transdroid is free software: you can redistribute it and/or modify * Transdroid is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by

2
app/src/main/java/org/transdroid/core/gui/lists/TorrentStatusLayout.java

@ -1,5 +1,5 @@
/* /*
* Copyright 2010-2018 Eric Kok et al. * Copyright 2010-2024 Eric Kok et al.
* *
* Transdroid is free software: you can redistribute it and/or modify * Transdroid is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by

2
app/src/main/java/org/transdroid/core/gui/lists/TorrentView.java

@ -1,5 +1,5 @@
/* /*
* Copyright 2010-2018 Eric Kok et al. * Copyright 2010-2024 Eric Kok et al.
* *
* Transdroid is free software: you can redistribute it and/or modify * Transdroid is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by

2
app/src/main/java/org/transdroid/core/gui/lists/TorrentsAdapter.java

@ -1,5 +1,5 @@
/* /*
* Copyright 2010-2018 Eric Kok et al. * Copyright 2010-2024 Eric Kok et al.
* *
* Transdroid is free software: you can redistribute it and/or modify * Transdroid is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by

2
app/src/main/java/org/transdroid/core/gui/lists/ViewHolderAdapter.java

@ -1,5 +1,5 @@
/* /*
* Copyright 2010-2018 Eric Kok et al. * Copyright 2010-2024 Eric Kok et al.
* *
* Transdroid is free software: you can redistribute it and/or modify * Transdroid is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by

2
app/src/main/java/org/transdroid/core/gui/log/DatabaseHelper.java

@ -1,5 +1,5 @@
/* /*
* Copyright 2010-2018 Eric Kok et al. * Copyright 2010-2024 Eric Kok et al.
* *
* Transdroid is free software: you can redistribute it and/or modify * Transdroid is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by

2
app/src/main/java/org/transdroid/core/gui/log/ErrorLogEntry.java

@ -1,5 +1,5 @@
/* /*
* Copyright 2010-2018 Eric Kok et al. * Copyright 2010-2024 Eric Kok et al.
* *
* Transdroid is free software: you can redistribute it and/or modify * Transdroid is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by

2
app/src/main/java/org/transdroid/core/gui/log/ErrorLogSender.java

@ -1,5 +1,5 @@
/* /*
* Copyright 2010-2018 Eric Kok et al. * Copyright 2010-2024 Eric Kok et al.
* *
* Transdroid is free software: you can redistribute it and/or modify * Transdroid is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by

2
app/src/main/java/org/transdroid/core/gui/log/Log.java

@ -1,5 +1,5 @@
/* /*
* Copyright 2010-2018 Eric Kok et al. * Copyright 2010-2024 Eric Kok et al.
* *
* Transdroid is free software: you can redistribute it and/or modify * Transdroid is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by

2
app/src/main/java/org/transdroid/core/gui/log/LogUncaughtExceptionHandler.java

@ -1,5 +1,5 @@
/* /*
* Copyright 2010-2018 Eric Kok et al. * Copyright 2010-2024 Eric Kok et al.
* *
* Transdroid is free software: you can redistribute it and/or modify * Transdroid is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by

2
app/src/main/java/org/transdroid/core/gui/navigation/DialogHelper.java

@ -1,5 +1,5 @@
/* /*
* Copyright 2010-2018 Eric Kok et al. * Copyright 2010-2024 Eric Kok et al.
* *
* Transdroid is free software: you can redistribute it and/or modify * Transdroid is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by

2
app/src/main/java/org/transdroid/core/gui/navigation/FilterListAdapter.java

@ -1,5 +1,5 @@
/* /*
* Copyright 2010-2018 Eric Kok et al. * Copyright 2010-2024 Eric Kok et al.
* *
* Transdroid is free software: you can redistribute it and/or modify * Transdroid is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by

2
app/src/main/java/org/transdroid/core/gui/navigation/FilterListItemAdapter.java

@ -1,5 +1,5 @@
/* /*
* Copyright 2010-2018 Eric Kok et al. * Copyright 2010-2024 Eric Kok et al.
* *
* Transdroid is free software: you can redistribute it and/or modify * Transdroid is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by

2
app/src/main/java/org/transdroid/core/gui/navigation/FilterListItemView.java

@ -1,5 +1,5 @@
/* /*
* Copyright 2010-2018 Eric Kok et al. * Copyright 2010-2024 Eric Kok et al.
* *
* Transdroid is free software: you can redistribute it and/or modify * Transdroid is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by

2
app/src/main/java/org/transdroid/core/gui/navigation/FilterSeparatorView.java

@ -1,5 +1,5 @@
/* /*
* Copyright 2010-2018 Eric Kok et al. * Copyright 2010-2024 Eric Kok et al.
* *
* Transdroid is free software: you can redistribute it and/or modify * Transdroid is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by

2
app/src/main/java/org/transdroid/core/gui/navigation/Label.java

@ -1,5 +1,5 @@
/* /*
* Copyright 2010-2018 Eric Kok et al. * Copyright 2010-2024 Eric Kok et al.
* *
* Transdroid is free software: you can redistribute it and/or modify * Transdroid is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by

2
app/src/main/java/org/transdroid/core/gui/navigation/NavigationFilter.java

@ -1,5 +1,5 @@
/* /*
* Copyright 2010-2018 Eric Kok et al. * Copyright 2010-2024 Eric Kok et al.
* *
* Transdroid is free software: you can redistribute it and/or modify * Transdroid is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by

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

@ -1,5 +1,5 @@
/* /*
* Copyright 2010-2018 Eric Kok et al. * Copyright 2010-2024 Eric Kok et al.
* *
* Transdroid is free software: you can redistribute it and/or modify * Transdroid is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@ -18,14 +18,12 @@ package org.transdroid.core.gui.navigation;
import android.Manifest; import android.Manifest;
import android.annotation.SuppressLint; import android.annotation.SuppressLint;
import android.annotation.TargetApi;
import android.app.Activity; import android.app.Activity;
import android.content.Context; import android.content.Context;
import android.content.Intent; import android.content.Intent;
import android.content.pm.PackageManager; import android.content.pm.PackageManager;
import android.content.pm.ResolveInfo; import android.content.pm.ResolveInfo;
import android.net.Uri; import android.net.Uri;
import android.os.Build;
import android.text.Spannable; import android.text.Spannable;
import android.text.SpannableString; import android.text.SpannableString;
import android.text.style.TypefaceSpan; import android.text.style.TypefaceSpan;
@ -60,9 +58,7 @@ import java.util.List;
@EBean @EBean
public class NavigationHelper { public class NavigationHelper {
private static final int REQUEST_TORRENT_READ_PERMISSION = 0; private static final int REQUEST_NOTIFICATIONS_PERMISSION = 0;
private static final int REQUEST_SETTINGS_READ_PERMISSION = 1;
private static final int REQUEST_SETTINGS_WRITE_PERMISSION = 2;
private static ImageLoader imageCache; private static ImageLoader imageCache;
@RootContext @RootContext
@ -134,25 +130,11 @@ public class NavigationHelper {
return null; return null;
} }
@TargetApi(Build.VERSION_CODES.JELLY_BEAN) public boolean checkOrRequestNotificationPermission(final Activity activity) {
public boolean checkTorrentReadPermission(final Activity activity) { return checkPermission(activity, Manifest.permission.POST_NOTIFICATIONS, REQUEST_NOTIFICATIONS_PERMISSION, R.string.permission_notifications);
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) private boolean checkPermission(final Activity activity, final String permission, final int requestCode, final int explainer) {
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) {
if (hasPermission(permission)) if (hasPermission(permission))
// Permission already granted // Permission already granted
return true; return true;
@ -160,43 +142,27 @@ public class NavigationHelper {
// Never asked again: show a dialog with an explanation // Never asked again: show a dialog with an explanation
activity.runOnUiThread(() -> activity.runOnUiThread(() ->
new AlertDialog.Builder(context) new AlertDialog.Builder(context)
.setMessage(R.string.permission_readtorrent) .setMessage(explainer)
.setPositiveButton(android.R.string.ok, (dialog, which) -> .setPositiveButton(android.R.string.ok, (dialog, which) ->
ActivityCompat.requestPermissions(activity, new String[]{permission}, requestCode)) ActivityCompat.requestPermissions(activity, new String[]{permission}, requestCode))
.show()); .show());
return false; return false;
} }
// Permission not granted (and we asked for it already before) // Permission not granted (and we asked for it already before)
ActivityCompat.requestPermissions(activity, new String[]{permission}, REQUEST_TORRENT_READ_PERMISSION); ActivityCompat.requestPermissions(activity, new String[]{permission}, requestCode);
return false; return false;
} }
private boolean hasPermission(String requiredPermission) { public boolean hasPermission(String requiredPermission) {
return ContextCompat.checkSelfPermission(context, requiredPermission) == PackageManager.PERMISSION_GRANTED; return ContextCompat.checkSelfPermission(context, requiredPermission) == PackageManager.PERMISSION_GRANTED;
} }
public Boolean handleTorrentReadPermissionResult(int requestCode, int[] grantResults) { public Boolean handleNotificationPermissionResult(int requestCode, int[] grantResults) {
if (requestCode == REQUEST_TORRENT_READ_PERMISSION) { if (requestCode == REQUEST_NOTIFICATIONS_PERMISSION) {
// Return permission granting result
return grantResults.length > 0 && grantResults[0] == PackageManager.PERMISSION_GRANTED;
}
return null;
}
public Boolean handleSettingsReadPermissionResult(int requestCode, int[] grantResults) {
if (requestCode == REQUEST_SETTINGS_READ_PERMISSION) {
// Return permission granting result // Return permission granting result
return grantResults.length > 0 && grantResults[0] == PackageManager.PERMISSION_GRANTED; return grantResults.length > 0 && grantResults[0] == PackageManager.PERMISSION_GRANTED;
} }
return null; return false;
}
public Boolean handleSettingsWritePermissionResult(int requestCode, int[] grantResults) {
if (requestCode == REQUEST_SETTINGS_WRITE_PERMISSION) {
// Return permission granting result
return grantResults.length > 0 && grantResults[0] == PackageManager.PERMISSION_GRANTED;
}
return null;
} }
/** /**

2
app/src/main/java/org/transdroid/core/gui/navigation/RefreshableActivity.java

@ -1,5 +1,5 @@
/* /*
* Copyright 2010-2018 Eric Kok et al. * Copyright 2010-2024 Eric Kok et al.
* *
* Transdroid is free software: you can redistribute it and/or modify * Transdroid is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by

2
app/src/main/java/org/transdroid/core/gui/navigation/SelectionManagerMode.java

@ -1,5 +1,5 @@
/* /*
* Copyright 2010-2018 Eric Kok et al. * Copyright 2010-2024 Eric Kok et al.
* *
* Transdroid is free software: you can redistribute it and/or modify * Transdroid is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by

2
app/src/main/java/org/transdroid/core/gui/navigation/SelectionModificationSpinner.java

@ -1,5 +1,5 @@
/* /*
* Copyright 2010-2018 Eric Kok et al. * Copyright 2010-2024 Eric Kok et al.
* *
* Transdroid is free software: you can redistribute it and/or modify * Transdroid is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by

2
app/src/main/java/org/transdroid/core/gui/navigation/SetLabelDialog.java

@ -1,5 +1,5 @@
/* /*
* Copyright 2010-2018 Eric Kok et al. * Copyright 2010-2024 Eric Kok et al.
* *
* Transdroid is free software: you can redistribute it and/or modify * Transdroid is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by

2
app/src/main/java/org/transdroid/core/gui/navigation/SetStorageLocationDialog.java

@ -1,5 +1,5 @@
/* /*
* Copyright 2010-2018 Eric Kok et al. * Copyright 2010-2024 Eric Kok et al.
* *
* Transdroid is free software: you can redistribute it and/or modify * Transdroid is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by

2
app/src/main/java/org/transdroid/core/gui/navigation/SetTrackersDialog.java

@ -1,5 +1,5 @@
/* /*
* Copyright 2010-2018 Eric Kok et al. * Copyright 2010-2024 Eric Kok et al.
* *
* Transdroid is free software: you can redistribute it and/or modify * Transdroid is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by

2
app/src/main/java/org/transdroid/core/gui/navigation/SetTransferRatesDialog.java

@ -1,5 +1,5 @@
/* /*
* Copyright 2010-2018 Eric Kok et al. * Copyright 2010-2024 Eric Kok et al.
* *
* Transdroid is free software: you can redistribute it and/or modify * Transdroid is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by

2
app/src/main/java/org/transdroid/core/gui/navigation/StatusType.java

@ -1,5 +1,5 @@
/* /*
* Copyright 2010-2018 Eric Kok et al. * Copyright 2010-2024 Eric Kok et al.
* *
* Transdroid is free software: you can redistribute it and/or modify * Transdroid is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by

2
app/src/main/java/org/transdroid/core/gui/remoterss/RemoteRssFragment.java

@ -1,5 +1,5 @@
/* /*
* Copyright 2010-2018 Eric Kok et al. * Copyright 2010-2024 Eric Kok et al.
* *
* Transdroid is free software: you can redistribute it and/or modify * Transdroid is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by

2
app/src/main/java/org/transdroid/core/gui/remoterss/RemoteRssItemView.java

@ -1,5 +1,5 @@
/* /*
* Copyright 2010-2018 Eric Kok et al. * Copyright 2010-2024 Eric Kok et al.
* *
* Transdroid is free software: you can redistribute it and/or modify * Transdroid is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by

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

@ -1,5 +1,5 @@
/* /*
* Copyright 2010-2018 Eric Kok et al. * Copyright 2010-2024 Eric Kok et al.
* *
* Transdroid is free software: you can redistribute it and/or modify * Transdroid is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@ -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();

2
app/src/main/java/org/transdroid/core/gui/rss/RssFeedsFragment.java

@ -1,5 +1,5 @@
/* /*
* Copyright 2010-2018 Eric Kok et al. * Copyright 2010-2024 Eric Kok et al.
* *
* Transdroid is free software: you can redistribute it and/or modify * Transdroid is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by

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

@ -1,5 +1,5 @@
/* /*
* Copyright 2010-2018 Eric Kok et al. * Copyright 2010-2024 Eric Kok et al.
* *
* Transdroid is free software: you can redistribute it and/or modify * Transdroid is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@ -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();

2
app/src/main/java/org/transdroid/core/gui/rss/RssItemsFragment.java

@ -1,5 +1,5 @@
/* /*
* Copyright 2010-2018 Eric Kok et al. * Copyright 2010-2024 Eric Kok et al.
* *
* Transdroid is free software: you can redistribute it and/or modify * Transdroid is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by

2
app/src/main/java/org/transdroid/core/gui/rss/RssfeedLoader.java

@ -1,5 +1,5 @@
/* /*
* Copyright 2010-2018 Eric Kok et al. * Copyright 2010-2024 Eric Kok et al.
* *
* Transdroid is free software: you can redistribute it and/or modify * Transdroid is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by

2
app/src/main/java/org/transdroid/core/gui/rss/RssfeedView.java

@ -1,5 +1,5 @@
/* /*
* Copyright 2010-2018 Eric Kok et al. * Copyright 2010-2024 Eric Kok et al.
* *
* Transdroid is free software: you can redistribute it and/or modify * Transdroid is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by

2
app/src/main/java/org/transdroid/core/gui/rss/RssfeedsAdapter.java

@ -1,5 +1,5 @@
/* /*
* Copyright 2010-2018 Eric Kok et al. * Copyright 2010-2024 Eric Kok et al.
* *
* Transdroid is free software: you can redistribute it and/or modify * Transdroid is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by

2
app/src/main/java/org/transdroid/core/gui/rss/RssitemStatusLayout.java

@ -1,5 +1,5 @@
/* /*
* Copyright 2010-2018 Eric Kok et al. * Copyright 2010-2024 Eric Kok et al.
* *
* Transdroid is free software: you can redistribute it and/or modify * Transdroid is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by

2
app/src/main/java/org/transdroid/core/gui/rss/RssitemView.java

@ -1,5 +1,5 @@
/* /*
* Copyright 2010-2018 Eric Kok et al. * Copyright 2010-2024 Eric Kok et al.
* *
* Transdroid is free software: you can redistribute it and/or modify * Transdroid is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by

2
app/src/main/java/org/transdroid/core/gui/rss/RssitemsAdapter.java

@ -1,5 +1,5 @@
/* /*
* Copyright 2010-2018 Eric Kok et al. * Copyright 2010-2024 Eric Kok et al.
* *
* Transdroid is free software: you can redistribute it and/or modify * Transdroid is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by

2
app/src/main/java/org/transdroid/core/gui/search/BarcodeHelper.java

@ -1,5 +1,5 @@
/* /*
* Copyright 2010-2018 Eric Kok et al. * Copyright 2010-2024 Eric Kok et al.
* *
* Transdroid is free software: you can redistribute it and/or modify * Transdroid is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by

2
app/src/main/java/org/transdroid/core/gui/search/FilePickerHelper.java

@ -1,5 +1,5 @@
/* /*
* Copyright 2010-2018 Eric Kok et al. * Copyright 2010-2024 Eric Kok et al.
* *
* Transdroid is free software: you can redistribute it and/or modify * Transdroid is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by

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

@ -1,5 +1,5 @@
/* /*
* Copyright 2010-2018 Eric Kok et al. * Copyright 2010-2024 Eric Kok et al.
* *
* Transdroid is free software: you can redistribute it and/or modify * Transdroid is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@ -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();

2
app/src/main/java/org/transdroid/core/gui/search/SearchHistoryProvider.java

@ -1,5 +1,5 @@
/* /*
* Copyright 2010-2018 Eric Kok et al. * Copyright 2010-2024 Eric Kok et al.
* *
* Transdroid is free software: you can redistribute it and/or modify * Transdroid is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by

2
app/src/main/java/org/transdroid/core/gui/search/SearchResultView.java

@ -1,5 +1,5 @@
/* /*
* Copyright 2010-2018 Eric Kok et al. * Copyright 2010-2024 Eric Kok et al.
* *
* Transdroid is free software: you can redistribute it and/or modify * Transdroid is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by

2
app/src/main/java/org/transdroid/core/gui/search/SearchResultsAdapter.java

@ -1,5 +1,5 @@
/* /*
* Copyright 2010-2018 Eric Kok et al. * Copyright 2010-2024 Eric Kok et al.
* *
* Transdroid is free software: you can redistribute it and/or modify * Transdroid is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by

2
app/src/main/java/org/transdroid/core/gui/search/SearchResultsFragment.java

@ -1,5 +1,5 @@
/* /*
* Copyright 2010-2018 Eric Kok et al. * Copyright 2010-2024 Eric Kok et al.
* *
* Transdroid is free software: you can redistribute it and/or modify * Transdroid is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by

2
app/src/main/java/org/transdroid/core/gui/search/SearchSetting.java

@ -1,5 +1,5 @@
/* /*
* Copyright 2010-2018 Eric Kok et al. * Copyright 2010-2024 Eric Kok et al.
* *
* Transdroid is free software: you can redistribute it and/or modify * Transdroid is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by

2
app/src/main/java/org/transdroid/core/gui/search/SearchSettingSelectionView.java

@ -1,5 +1,5 @@
/* /*
* Copyright 2010-2018 Eric Kok et al. * Copyright 2010-2024 Eric Kok et al.
* *
* Transdroid is free software: you can redistribute it and/or modify * Transdroid is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by

2
app/src/main/java/org/transdroid/core/gui/search/SearchSettingsDropDownAdapter.java

@ -1,5 +1,5 @@
/* /*
* Copyright 2010-2018 Eric Kok et al. * Copyright 2010-2024 Eric Kok et al.
* *
* Transdroid is free software: you can redistribute it and/or modify * Transdroid is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by

2
app/src/main/java/org/transdroid/core/gui/search/SearchSiteView.java

@ -1,5 +1,5 @@
/* /*
* Copyright 2010-2018 Eric Kok et al. * Copyright 2010-2024 Eric Kok et al.
* *
* Transdroid is free software: you can redistribute it and/or modify * Transdroid is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by

2
app/src/main/java/org/transdroid/core/gui/search/SearchSitesAdapter.java

@ -1,5 +1,5 @@
/* /*
* Copyright 2010-2018 Eric Kok et al. * Copyright 2010-2024 Eric Kok et al.
* *
* Transdroid is free software: you can redistribute it and/or modify * Transdroid is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by

2
app/src/main/java/org/transdroid/core/gui/search/SendIntentHelper.java

@ -1,5 +1,5 @@
/* /*
* Copyright 2010-2018 Eric Kok et al. * Copyright 2010-2024 Eric Kok et al.
* *
* Transdroid is free software: you can redistribute it and/or modify * Transdroid is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by

2
app/src/main/java/org/transdroid/core/gui/search/UrlEntryDialog.java

@ -1,5 +1,5 @@
/* /*
* Copyright 2010-2018 Eric Kok et al. * Copyright 2010-2024 Eric Kok et al.
* *
* Transdroid is free software: you can redistribute it and/or modify * Transdroid is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by

2
app/src/main/java/org/transdroid/core/gui/settings/AboutDialog.java

@ -1,5 +1,5 @@
/* /*
* Copyright 2010-2018 Eric Kok et al. * Copyright 2010-2024 Eric Kok et al.
* *
* Transdroid is free software: you can redistribute it and/or modify * Transdroid is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by

2
app/src/main/java/org/transdroid/core/gui/settings/ChangelogDialog.java

@ -1,5 +1,5 @@
/* /*
* Copyright 2010-2018 Eric Kok et al. * Copyright 2010-2024 Eric Kok et al.
* *
* Transdroid is free software: you can redistribute it and/or modify * Transdroid is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by

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

@ -1,5 +1,5 @@
/* /*
* Copyright 2010-2018 Eric Kok et al. * Copyright 2010-2024 Eric Kok et al.
* *
* Transdroid is free software: you can redistribute it and/or modify * Transdroid is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@ -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();

2
app/src/main/java/org/transdroid/core/gui/settings/KeyBoundPreferencesActivity.java

@ -1,5 +1,5 @@
/* /*
* Copyright 2010-2018 Eric Kok et al. * Copyright 2010-2024 Eric Kok et al.
* *
* Transdroid is free software: you can redistribute it and/or modify * Transdroid is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by

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

@ -1,5 +1,5 @@
/* /*
* Copyright 2010-2018 Eric Kok et al. * Copyright 2010-2024 Eric Kok et al.
* *
* Transdroid is free software: you can redistribute it and/or modify * Transdroid is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@ -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();

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

@ -1,5 +1,5 @@
/* /*
* Copyright 2010-2018 Eric Kok et al. * Copyright 2010-2024 Eric Kok et al.
* *
* Transdroid is free software: you can redistribute it and/or modify * Transdroid is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@ -16,13 +16,12 @@
*/ */
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.NonNull;
import androidx.annotation.Nullable; import androidx.annotation.Nullable;
import org.androidannotations.annotations.Bean; import org.androidannotations.annotations.Bean;
@ -30,12 +29,15 @@ import org.androidannotations.annotations.EActivity;
import org.androidannotations.annotations.OptionsItem; import org.androidannotations.annotations.OptionsItem;
import org.transdroid.R; import org.transdroid.R;
import org.transdroid.core.app.settings.NotificationSettings; import org.transdroid.core.app.settings.NotificationSettings;
import org.transdroid.core.gui.navigation.NavigationHelper;
import org.transdroid.core.service.RssCheckerJob; import org.transdroid.core.service.RssCheckerJob;
import org.transdroid.core.service.ServerCheckerJob; import org.transdroid.core.service.ServerCheckerJob;
@EActivity @EActivity
public class NotificationSettingsActivity extends PreferenceCompatActivity implements OnSharedPreferenceChangeListener { public class NotificationSettingsActivity extends PreferenceCompatActivity implements OnSharedPreferenceChangeListener {
@Bean
protected NavigationHelper navigationHelper;
@Bean @Bean
protected NotificationSettings notificationSettings; protected NotificationSettings notificationSettings;
@ -47,9 +49,19 @@ public class NotificationSettingsActivity extends PreferenceCompatActivity imple
// Load the notification-related preferences from XML and update availability thereof // Load the notification-related preferences from XML and update availability thereof
addPreferencesFromResource(R.xml.pref_notifications); addPreferencesFromResource(R.xml.pref_notifications);
boolean disabled = !notificationSettings.isEnabledForRss() && !notificationSettings.isEnabledForTorrents(); updatePrefsEnabled();
updatePrefsEnabled(disabled);
}
@Override
public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) {
super.onRequestPermissionsResult(requestCode, permissions, grantResults);
if (navigationHelper.handleNotificationPermissionResult(requestCode, grantResults)) {
// Now that we have permission, schedule the jobs
ServerCheckerJob.schedule(getApplicationContext());
RssCheckerJob.schedule(getApplicationContext());
updatePrefsEnabled();
}
} }
@Override @Override
@ -71,7 +83,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();
@ -79,11 +90,18 @@ public class NotificationSettingsActivity extends PreferenceCompatActivity imple
@Override @Override
public void onSharedPreferenceChanged(SharedPreferences sharedPreferences, String key) { public void onSharedPreferenceChanged(SharedPreferences sharedPreferences, String key) {
boolean needsPermission = notificationSettings.isEnabledForRss() || notificationSettings.isEnabledForTorrents();
if (needsPermission && !navigationHelper.checkOrRequestNotificationPermission(this)) {
return;
}
// Already have permission to show notifications, so update the jobs now
ServerCheckerJob.schedule(getApplicationContext()); ServerCheckerJob.schedule(getApplicationContext());
RssCheckerJob.schedule(getApplicationContext()); RssCheckerJob.schedule(getApplicationContext());
updatePrefsEnabled();
} }
private void updatePrefsEnabled(boolean disabled) { private void updatePrefsEnabled() {
boolean disabled = !notificationSettings.isEnabledForRss() && !notificationSettings.isEnabledForTorrents();
findPreference("notifications_interval").setEnabled(!disabled); findPreference("notifications_interval").setEnabled(!disabled);
findPreference("notifications_sound").setEnabled(!disabled); findPreference("notifications_sound").setEnabled(!disabled);
findPreference("notifications_vibrate").setEnabled(!disabled); findPreference("notifications_vibrate").setEnabled(!disabled);

2
app/src/main/java/org/transdroid/core/gui/settings/RssfeedPreference.java

@ -1,5 +1,5 @@
/* /*
* Copyright 2010-2018 Eric Kok et al. * Copyright 2010-2024 Eric Kok et al.
* *
* Transdroid is free software: you can redistribute it and/or modify * Transdroid is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by

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

@ -1,5 +1,5 @@
/* /*
* Copyright 2010-2018 Eric Kok et al. * Copyright 2010-2024 Eric Kok et al.
* *
* Transdroid is free software: you can redistribute it and/or modify * Transdroid is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@ -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();

2
app/src/main/java/org/transdroid/core/gui/settings/ServerPreference.java

@ -1,5 +1,5 @@
/* /*
* Copyright 2010-2018 Eric Kok et al. * Copyright 2010-2024 Eric Kok et al.
* *
* Transdroid is free software: you can redistribute it and/or modify * Transdroid is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by

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

@ -1,5 +1,5 @@
/* /*
* Copyright 2010-2018 Eric Kok et al. * Copyright 2010-2024 Eric Kok et al.
* *
* Transdroid is free software: you can redistribute it and/or modify * Transdroid is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@ -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);
} }

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save