Browse Source

Fixed crash on logging and correct search history provider authority to fix search suggestions.

pull/177/head
Eric Kok 10 years ago
parent
commit
ecf1d8833a
  1. 1
      README.md
  2. 3
      app/build.gradle
  3. 6
      app/src/main/java/org/transdroid/core/gui/TorrentsActivity.java
  4. 3
      app/src/main/java/org/transdroid/core/gui/log/Log.java
  5. 18
      app/src/main/java/org/transdroid/core/gui/navigation/NavigationHelper.java

1
README.md

@ -3,6 +3,7 @@ Transdroid
[www.transdroid.org](http://www.transdroid.org) [www.transdroid.org](http://www.transdroid.org)
[Google+](https://plus.google.com/u/0/b/106240944422491053650/106240944422491053650) - [Twitter](https://twitter.com/transdroid) - [transdroid@2312.nl](transdroid@2312.nl) - [Transdrone in Play Store](https://play.google.com/store/apps/details?id=org.transdroid.lite) [Google+](https://plus.google.com/u/0/b/106240944422491053650/106240944422491053650) - [Twitter](https://twitter.com/transdroid) - [transdroid@2312.nl](transdroid@2312.nl) - [Transdrone in Play Store](https://play.google.com/store/apps/details?id=org.transdroid.lite)
"Manage your torrents from your Android device" "Manage your torrents from your Android device"
![Screen shot of the main torretnts listing screen](http://2312.nl/img/portfolio-transdroid/240x400-transdroid-main.png) ![Screen shot of the main torretnts listing screen](http://2312.nl/img/portfolio-transdroid/240x400-transdroid-main.png)

3
app/build.gradle

@ -11,7 +11,6 @@ android {
targetSdkVersion 19 targetSdkVersion 19
versionCode 216 versionCode 216
versionName '2.3.0' versionName '2.3.0'
resValue "string", "search_history_authority", applicationId + ".search.SearchHistoryProvider"
} }
signingConfigs { signingConfigs {
release { release {
@ -30,9 +29,11 @@ android {
productFlavors { productFlavors {
full { full {
applicationId 'org.transdroid.full' applicationId 'org.transdroid.full'
resValue "string", "search_history_authority", applicationId + ".search.SearchHistoryProvider"
} }
lite { lite {
applicationId 'org.transdroid.lite' applicationId 'org.transdroid.lite'
resValue "string", "search_history_authority", applicationId + ".search.SearchHistoryProvider"
} }
} }
lintOptions { lintOptions {

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

@ -647,7 +647,7 @@ public class TorrentsActivity extends Activity implements OnNavigationListener,
if (match != null && match.getCookies() != null) { if (match != null && match.getCookies() != null) {
addTorrentFromWeb(data, match, title); addTorrentFromWeb(data, match, title);
} else if (privateSource != null) { } else if (privateSource != null) {
addTorrentFromPrivateSource(data.toString(), title, privateSource); addTorrentFromPrivateSource(data, title, privateSource);
} else { } else {
// Normally send the URL to the torrent client // Normally send the URL to the torrent client
addTorrentByUrl(data, title); addTorrentByUrl(data, title);
@ -699,7 +699,7 @@ public class TorrentsActivity extends Activity implements OnNavigationListener,
@OnActivityResult(FilePickerHelper.ACTIVITY_FILEPICKER) @OnActivityResult(FilePickerHelper.ACTIVITY_FILEPICKER)
public void onFilePicked(int resultCode, Intent data) { public void onFilePicked(int resultCode, Intent data) {
// We should have received an Intent with a local torrent's Uri as data from the file picker // We should have received an Intent with a local torrent's Uri as data from the file picker
if (data != null && data.getData() != null && !data.getData().equals("")) { if (data != null && data.getData() != null && !data.getData().toString().equals("")) {
String url = data.getData().getPath(); String url = data.getData().getPath();
addTorrentByFile(data.getData().toString(), url.substring(url.lastIndexOf("/"))); addTorrentByFile(data.getData().toString(), url.substring(url.lastIndexOf("/")));
} }
@ -715,7 +715,7 @@ public class TorrentsActivity extends Activity implements OnNavigationListener,
public void onBarcodeScanned(int resultCode, Intent data) { public void onBarcodeScanned(int resultCode, Intent data) {
// We receive from the helper either a URL (as string) or a query we can start a search for // We receive from the helper either a URL (as string) or a query we can start a search for
String query = BarcodeHelper.handleScanResult(resultCode, data); String query = BarcodeHelper.handleScanResult(resultCode, data);
if (query.startsWith("http")) if (query.startsWith("http") || query.startsWith("https"))
addTorrentByUrl(query, "QR code result"); // No torrent title known addTorrentByUrl(query, "QR code result"); // No torrent title known
else else
startSearch(query, false, null, false); startSearch(query, false, null, false);

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

@ -23,6 +23,7 @@ import org.androidannotations.annotations.Bean;
import org.androidannotations.annotations.EBean; import org.androidannotations.annotations.EBean;
import org.androidannotations.annotations.EBean.Scope; import org.androidannotations.annotations.EBean.Scope;
import org.androidannotations.annotations.OrmLiteDao; import org.androidannotations.annotations.OrmLiteDao;
import org.transdroid.BuildConfig;
import org.transdroid.core.gui.navigation.NavigationHelper; import org.transdroid.core.gui.navigation.NavigationHelper;
import org.transdroid.daemon.util.ITLogger; import org.transdroid.daemon.util.ITLogger;
@ -53,7 +54,7 @@ public class Log implements ITLogger {
} }
protected void log(String logName, int priority, String message) { protected void log(String logName, int priority, String message) {
if (navigationHelper.inDebugMode()) if (BuildConfig.DEBUG)
android.util.Log.println(priority, LOG_NAME, message); android.util.Log.println(priority, LOG_NAME, message);
try { try {
// Store this log message to the database // Store this log message to the database

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

@ -36,6 +36,7 @@ import com.nostra13.universalimageloader.core.assist.ImageScaleType;
import org.androidannotations.annotations.EBean; import org.androidannotations.annotations.EBean;
import org.androidannotations.annotations.RootContext; import org.androidannotations.annotations.RootContext;
import org.transdroid.BuildConfig;
import org.transdroid.R; import org.transdroid.R;
import java.io.IOException; import java.io.IOException;
@ -113,23 +114,6 @@ public class NavigationHelper {
} }
} }
/**
* Returns whether the application is running in debug mode, as opposed to release mode. Use to show/hide features
* in the ui based on the build mode.
* @return True if the app is compiled in/running as debug mode, false otherwise
*/
public boolean inDebugMode() {
try {
if (inDebugMode == null) {
PackageInfo pi = context.getPackageManager().getPackageInfo(context.getPackageName(), 0);
inDebugMode = (pi.applicationInfo.flags & ApplicationInfo.FLAG_DEBUGGABLE) != 0;
}
return inDebugMode;
} catch (NameNotFoundException e) {
return false;
}
}
/** /**
* Returns whether the device is considered small (i.e. a phone) rather than large (i.e. a tablet). Can, for * Returns whether the device is considered small (i.e. a phone) rather than large (i.e. a tablet). Can, for
* example, be used to determine if a dialog should be shown full screen. Currently is true if the device's smallest * example, be used to determine if a dialog should be shown full screen. Currently is true if the device's smallest

Loading…
Cancel
Save