From f8f0fa42b628464d2d93673b5c89e48959eedbad Mon Sep 17 00:00:00 2001 From: Eric Kok Date: Mon, 14 Oct 2013 21:40:35 +0200 Subject: [PATCH] Modifications for the lite version of Transdroid (now called Transdrone :). --- core/AndroidManifest.xml | 4 ++-- core/res/layout/fragment_torrents.xml | 1 - core/res/values/changelog.xml | 4 ++++ core/res/values/strings.xml | 11 +++++------ core/res/xml/pref_system.xml | 3 +-- .../core/app/settings/SystemSettings.java | 9 +++++++++ .../org/transdroid/core/gui/TorrentsFragment.java | 1 + .../core/gui/navigation/NavigationHelper.java | 10 +++++----- .../core/gui/settings/SystemSettingsActivity.java | 15 +++++++++++---- .../org/transdroid/core/service/BootReceiver.java | 2 +- full/AndroidManifest.xml | 6 +++--- lite/AndroidManifest.xml | 12 +++--------- lite/res/values/strings.xml | 2 +- 13 files changed, 46 insertions(+), 34 deletions(-) diff --git a/core/AndroidManifest.xml b/core/AndroidManifest.xml index 80c57969..742ead80 100644 --- a/core/AndroidManifest.xml +++ b/core/AndroidManifest.xml @@ -17,8 +17,8 @@ --> + android:versionCode="7" + android:versionName="2.0.1" > diff --git a/core/res/values/changelog.xml b/core/res/values/changelog.xml index b4483df1..a12c9d53 100644 --- a/core/res/values/changelog.xml +++ b/core/res/values/changelog.xml @@ -17,6 +17,10 @@ --> +Transdroid 2.0.1\n +- First Google Play release of the lite version as Transdrone\n +- First release as auto-update (now checked only once a day)\n +\n Transdroid 2.0.0\n - Scrollable home screen widget (Android 3+)\n - Allow changing of storage location (Deluge and Transmission)\n diff --git a/core/res/values/strings.xml b/core/res/values/strings.xml index 0218ba37..af4e4c31 100644 --- a/core/res/values/strings.xml +++ b/core/res/values/strings.xml @@ -59,7 +59,7 @@ Remove settings Visit transdroid.org - Transdroid allows you to monitor and manage the torrent client you run at home or on your seedbox. Setting things up can be a bit tricky, but we offer step-by-step guides and promise it\'ll be worth it! + %1$s allows you to monitor and manage the torrent client you run at home or on your seedbox. Setting things up can be a bit tricky, but we offer step-by-step guides and promise it\'ll be worth it! Connected, but no torrent are active within the current filter Select a torrent to view its details SERVERS @@ -270,17 +270,17 @@ Use dark UI theme Requires a restart to take effect Import settings - Transdroid will try to import server, web search, RSS and system settings from: %1$s + %1$s will try to import server, web search, RSS and system settings from: %2$s Settings successfully imported Export settings - Transdroid will export server (including passwords), web search, RSS and system settings to the following plain text JSON file: %1$s + %1$s will export server (including passwords), web search, RSS and system settings to the following plain text JSON file: %2$s Settings successfully exported Send error log Get support or report a bug View install guides Available at transdroid.org/download Recent changes - About Transdroid + About %1$s BitComet Bitflu 1.2+ @@ -359,7 +359,7 @@ The RSS feed item does not provide a link to browse to URL is not a (valid) RSS feed SD card not available to read/write - File does not seem to contain Transdroid settings + File does not seem to contain %1$s settings The settings file could not be found Can\'t write to the settings file Please enter a positive number @@ -371,7 +371,6 @@ New Transdroid search module available You can now update to %1$s - Transdroid \u00A9 Eric Kok, 2312 development Published under GNU General Public License v3 Some code/libraries are used in the project: diff --git a/core/res/xml/pref_system.xml b/core/res/xml/pref_system.xml index edf5cb54..d46c8d94 100644 --- a/core/res/xml/pref_system.xml +++ b/core/res/xml/pref_system.xml @@ -52,7 +52,6 @@ android:title="@string/pref_changelog" /> + android:key="system_about" /> diff --git a/core/src/org/transdroid/core/app/settings/SystemSettings.java b/core/src/org/transdroid/core/app/settings/SystemSettings.java index 3264d375..f5762d80 100644 --- a/core/src/org/transdroid/core/app/settings/SystemSettings.java +++ b/core/src/org/transdroid/core/app/settings/SystemSettings.java @@ -67,4 +67,13 @@ public class SystemSettings { prefs.edit().putLong("system_lastappupdatecheck", lastChecked == null ? -1L : lastChecked.getTime()).commit(); } + /** + * Whether the custom app update checker should be used to check for new app and search module versions. + * @return True if it should be checked against transdroid.org if there are app updates (as opposed to using the + * Play Store for updates), false otherwise + */ + public static boolean enableUpdateChecker(Context context) { + return !context.getPackageName().equals("org.transdroid.lite"); + } + } diff --git a/core/src/org/transdroid/core/gui/TorrentsFragment.java b/core/src/org/transdroid/core/gui/TorrentsFragment.java index de78df42..5a9333a0 100644 --- a/core/src/org/transdroid/core/gui/TorrentsFragment.java +++ b/core/src/org/transdroid/core/gui/TorrentsFragment.java @@ -114,6 +114,7 @@ public class TorrentsFragment extends SherlockFragment implements OnLabelPickedL torrentsList.setFastScrollEnabled(true); if (torrents != null) updateTorrents(torrents, currentLabels); + nosettingsText.setText(getString(R.string.navigation_nosettings, getString(R.string.app_name))); } diff --git a/core/src/org/transdroid/core/gui/navigation/NavigationHelper.java b/core/src/org/transdroid/core/gui/navigation/NavigationHelper.java index 6c3736ae..a36221bf 100644 --- a/core/src/org/transdroid/core/gui/navigation/NavigationHelper.java +++ b/core/src/org/transdroid/core/gui/navigation/NavigationHelper.java @@ -173,12 +173,12 @@ public class NavigationHelper { * @return A best-guess, reasonably long name for the linked torrent */ public static String extractNameFromUri(Uri rawTorrentUri) { - + if (rawTorrentUri.getScheme() == null) { // Probably an incorrect URI; just return the whole thing return rawTorrentUri.toString(); } - + if (rawTorrentUri.getScheme().equals("magnet")) { // Magnet links might have a dn (display name) parameter String dn = getQueryParameter(rawTorrentUri, "dn"); @@ -198,7 +198,7 @@ public class NavigationHelper { return path; } } - + // No idea what to do with this; return as is return rawTorrentUri.toString(); } @@ -208,9 +208,9 @@ public class NavigationHelper { if (start >= 0) { int begin = start + (parameter + "=").length(); int end = uri.toString().indexOf("&", begin); - return uri.toString().substring(begin, end >= 0? end: uri.toString().length()); + return uri.toString().substring(begin, end >= 0 ? end : uri.toString().length()); } return null; } - + } diff --git a/core/src/org/transdroid/core/gui/settings/SystemSettingsActivity.java b/core/src/org/transdroid/core/gui/settings/SystemSettingsActivity.java index 2ed02f2a..30aae1f1 100644 --- a/core/src/org/transdroid/core/gui/settings/SystemSettingsActivity.java +++ b/core/src/org/transdroid/core/gui/settings/SystemSettingsActivity.java @@ -26,6 +26,7 @@ import org.json.JSONException; import org.transdroid.core.R; import org.transdroid.core.app.settings.ApplicationSettings; import org.transdroid.core.app.settings.SettingsPersistence; +import org.transdroid.core.app.settings.SystemSettings; import org.transdroid.core.gui.log.ErrorLogSender; import org.transdroid.core.gui.navigation.DialogHelper; import org.transdroid.core.gui.navigation.NavigationHelper; @@ -77,12 +78,17 @@ public class SystemSettingsActivity extends SherlockPreferenceActivity { addPreferencesFromResource(R.xml.pref_system); // Handle outgoing links and preference changes - findPreference("system_checkupdates").setOnPreferenceClickListener(onCheckUpdatesClick); + if (SystemSettings.enableUpdateChecker(this)) { + findPreference("system_checkupdates").setOnPreferenceClickListener(onCheckUpdatesClick); + } else { + getPreferenceScreen().removePreference(findPreference("system_checkupdates")); + } findPreference("system_sendlog").setOnPreferenceClickListener(onSendLogClick); findPreference("system_installhelp").setOnPreferenceClickListener(onInstallHelpClick); findPreference("system_changelog").setOnPreferenceClickListener(onChangeLogClick); findPreference("system_importsettings").setOnPreferenceClickListener(onImportSettingsClick); findPreference("system_exportsettings").setOnPreferenceClickListener(onExportSettingsClick); + findPreference("system_about").setTitle(getString(R.string.pref_about, getString(R.string.app_name))); findPreference("system_about").setOnPreferenceClickListener(onAboutClick); } @@ -165,7 +171,7 @@ public class SystemSettingsActivity extends SherlockPreferenceActivity { // @formatter:off return new AlertDialog.Builder(this) .setMessage( - getString(R.string.pref_import_dialog, SettingsPersistence.DEFAULT_SETTINGS_FILE.toString())) + getString(R.string.pref_import_dialog, getString(R.string.app_name), SettingsPersistence.DEFAULT_SETTINGS_FILE.toString())) .setPositiveButton(android.R.string.ok, importSettings) .setNegativeButton(android.R.string.cancel, null).create(); // @formatter:on @@ -173,7 +179,7 @@ public class SystemSettingsActivity extends SherlockPreferenceActivity { // @formatter:off return new AlertDialog.Builder(this) .setMessage( - getString(R.string.pref_export_dialog, SettingsPersistence.DEFAULT_SETTINGS_FILE.toString())) + getString(R.string.pref_export_dialog, getString(R.string.app_name), SettingsPersistence.DEFAULT_SETTINGS_FILE.toString())) .setPositiveButton(android.R.string.ok, exportSettings) .setNegativeButton(android.R.string.cancel, null).create(); // @formatter:on @@ -193,7 +199,8 @@ public class SystemSettingsActivity extends SherlockPreferenceActivity { Crouton.showText(SystemSettingsActivity.this, R.string.error_file_not_found, NavigationHelper.CROUTON_ERROR_STYLE); } catch (JSONException e) { - Crouton.showText(SystemSettingsActivity.this, R.string.error_no_valid_settings_file, + Crouton.showText(SystemSettingsActivity.this, + getString(R.string.error_no_valid_settings_file, getString(R.string.app_name)), NavigationHelper.CROUTON_ERROR_STYLE); } } diff --git a/core/src/org/transdroid/core/service/BootReceiver.java b/core/src/org/transdroid/core/service/BootReceiver.java index 4b40f795..1cfa6b1e 100644 --- a/core/src/org/transdroid/core/service/BootReceiver.java +++ b/core/src/org/transdroid/core/service/BootReceiver.java @@ -69,7 +69,7 @@ public class BootReceiver extends BroadcastReceiver { public static void startAppUpdatesService(Context context) { SystemSettings systemSettings = SystemSettings_.getInstance_(context); AlarmManager alarms = (AlarmManager) context.getSystemService(Context.ALARM_SERVICE); - if (systemSettings.checkForUpdates() && piAppUpdates == null) { + if (SystemSettings.enableUpdateChecker(context) && systemSettings.checkForUpdates() && piAppUpdates == null) { Log.d(context, "Boot signal received, starting app update checker service"); // Schedule a daily, with the first being (somewhat) in 1 second from now diff --git a/full/AndroidManifest.xml b/full/AndroidManifest.xml index a777240f..e5dcf51a 100644 --- a/full/AndroidManifest.xml +++ b/full/AndroidManifest.xml @@ -17,8 +17,8 @@ --> + android:versionCode="7" + android:versionName="2.0.1" > diff --git a/lite/AndroidManifest.xml b/lite/AndroidManifest.xml index 18fa9c1a..cb255547 100644 --- a/lite/AndroidManifest.xml +++ b/lite/AndroidManifest.xml @@ -17,8 +17,8 @@ --> + android:versionCode="7" + android:versionName="2.0.1" > @@ -61,9 +61,6 @@ - - - @@ -180,15 +177,12 @@ - - - diff --git a/lite/res/values/strings.xml b/lite/res/values/strings.xml index ac9d60da..59d4806e 100644 --- a/lite/res/values/strings.xml +++ b/lite/res/values/strings.xml @@ -16,6 +16,6 @@ --> - Transdroid Lite + Transdrone