mirror of
https://github.com/syncthing/syncthing-android.git
synced 2025-01-25 11:26:32 +00:00
Show GetTask progress in log
Conflicts: src/main/java/com/nutomic/syncthingandroid/syncthing/GetTask.java
This commit is contained in:
parent
0c13d8e106
commit
1584754e32
3 changed files with 13 additions and 12 deletions
|
@ -66,9 +66,11 @@ public class LogActivity extends SyncthingActivity {
|
||||||
MenuInflater inflater = getMenuInflater();
|
MenuInflater inflater = getMenuInflater();
|
||||||
inflater.inflate(R.menu.log_list, menu);
|
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
|
// Add the share button
|
||||||
MenuItem shareItem = menu.findItem(R.id.menu_share);
|
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);
|
ShareActionProvider actionProvider = (ShareActionProvider) MenuItemCompat.getActionProvider(shareItem);
|
||||||
mShareIntent = new Intent();
|
mShareIntent = new Intent();
|
||||||
mShareIntent.setAction(Intent.ACTION_SEND);
|
mShareIntent.setAction(Intent.ACTION_SEND);
|
||||||
|
@ -120,9 +122,13 @@ public class LogActivity extends SyncthingActivity {
|
||||||
}.execute();
|
}.execute();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Queries logcat to obtain a log.
|
||||||
|
*
|
||||||
|
* @param syncthingLog Filter on Syncthing's native messages.
|
||||||
|
*/
|
||||||
private String getLog(final boolean syncthingLog) {
|
private String getLog(final boolean syncthingLog) {
|
||||||
Process process = null;
|
Process process = null;
|
||||||
DataOutputStream pOut = null;
|
|
||||||
try {
|
try {
|
||||||
ProcessBuilder pb;
|
ProcessBuilder pb;
|
||||||
if (syncthingLog) {
|
if (syncthingLog) {
|
||||||
|
@ -144,13 +150,6 @@ public class LogActivity extends SyncthingActivity {
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
Log.w(TAG, "Error reading Android log", e);
|
Log.w(TAG, "Error reading Android log", e);
|
||||||
} finally {
|
} finally {
|
||||||
try {
|
|
||||||
if (pOut != null) {
|
|
||||||
pOut.close();
|
|
||||||
}
|
|
||||||
} catch (IOException e) {
|
|
||||||
Log.w(TAG, "Failed to close shell stream", e);
|
|
||||||
}
|
|
||||||
if (process != null) {
|
if (process != null) {
|
||||||
process.destroy();
|
process.destroy();
|
||||||
}
|
}
|
||||||
|
|
|
@ -65,7 +65,7 @@ public class SettingsActivity extends SyncthingActivity {
|
||||||
throw new IllegalArgumentException(
|
throw new IllegalArgumentException(
|
||||||
"You must provide the requested fragment type as an extra.");
|
"You must provide the requested fragment type as an extra.");
|
||||||
}
|
}
|
||||||
} else{
|
} else {
|
||||||
setTitle(R.string.settings_title);
|
setTitle(R.string.settings_title);
|
||||||
mFragment = new SettingsFragment();
|
mFragment = new SettingsFragment();
|
||||||
}
|
}
|
||||||
|
|
|
@ -83,8 +83,10 @@ public class GetTask extends AsyncTask<String, Void, String> {
|
||||||
try {
|
try {
|
||||||
// Don't push the API too hard
|
// Don't push the API too hard
|
||||||
Thread.sleep(500 * i);
|
Thread.sleep(500 * i);
|
||||||
} catch (InterruptedException e) { }
|
} catch (InterruptedException e) {
|
||||||
Log.w(TAG, "Retrying GetTask Rest API call ("+i+")");
|
Log.w(TAG, e);
|
||||||
|
}
|
||||||
|
Log.w(TAG, "Retrying GetTask Rest API call ("+(i+1)+"/10)");
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue