Show GetTask progress in log

Conflicts:
	src/main/java/com/nutomic/syncthingandroid/syncthing/GetTask.java
This commit is contained in:
Lode Hoste 2015-04-13 22:13:44 +02:00
parent 0c13d8e106
commit 1584754e32
3 changed files with 13 additions and 12 deletions

View File

@ -66,9 +66,11 @@ public class LogActivity extends SyncthingActivity {
MenuInflater inflater = getMenuInflater();
inflater.inflate(R.menu.log_list, menu);
MenuItem switchLog = menu.findItem(R.id.switch_logs);
switchLog.setTitle(mSyncthingLog ? R.string.log_android_title : R.string.log_syncthing_title);
// Add the share button
MenuItem shareItem = menu.findItem(R.id.menu_share);
shareItem.setTitle(mSyncthingLog ? R.string.log_android_title : R.string.log_syncthing_title);
ShareActionProvider actionProvider = (ShareActionProvider) MenuItemCompat.getActionProvider(shareItem);
mShareIntent = new Intent();
mShareIntent.setAction(Intent.ACTION_SEND);
@ -120,9 +122,13 @@ public class LogActivity extends SyncthingActivity {
}.execute();
}
/**
* Queries logcat to obtain a log.
*
* @param syncthingLog Filter on Syncthing's native messages.
*/
private String getLog(final boolean syncthingLog) {
Process process = null;
DataOutputStream pOut = null;
try {
ProcessBuilder pb;
if (syncthingLog) {
@ -144,13 +150,6 @@ public class LogActivity extends SyncthingActivity {
} catch (IOException e) {
Log.w(TAG, "Error reading Android log", e);
} finally {
try {
if (pOut != null) {
pOut.close();
}
} catch (IOException e) {
Log.w(TAG, "Failed to close shell stream", e);
}
if (process != null) {
process.destroy();
}

View File

@ -65,7 +65,7 @@ public class SettingsActivity extends SyncthingActivity {
throw new IllegalArgumentException(
"You must provide the requested fragment type as an extra.");
}
} else{
} else {
setTitle(R.string.settings_title);
mFragment = new SettingsFragment();
}

View File

@ -83,8 +83,10 @@ public class GetTask extends AsyncTask<String, Void, String> {
try {
// Don't push the API too hard
Thread.sleep(500 * i);
} catch (InterruptedException e) { }
Log.w(TAG, "Retrying GetTask Rest API call ("+i+")");
} catch (InterruptedException e) {
Log.w(TAG, e);
}
Log.w(TAG, "Retrying GetTask Rest API call ("+(i+1)+"/10)");
}
return null;
}