mirror of
https://github.com/syncthing/syncthing-android.git
synced 2024-11-29 15:51:17 +00:00
Fix android.view.ViewRootImpl$CalledFromWrongThreadException (#56)
This commit is contained in:
parent
6e3899f7e0
commit
cc0a35dc4e
3 changed files with 17 additions and 5 deletions
|
@ -462,7 +462,7 @@ public class FirstStartActivity extends Activity {
|
||||||
/**
|
/**
|
||||||
* Sets up the initial configuration and generates secure keys.
|
* Sets up the initial configuration and generates secure keys.
|
||||||
*/
|
*/
|
||||||
private static class KeyGenerationTask extends AsyncTask<Void, Void, Void> {
|
private static class KeyGenerationTask extends AsyncTask<Void, String, Void> {
|
||||||
private WeakReference<FirstStartActivity> refFirstStartActivity;
|
private WeakReference<FirstStartActivity> refFirstStartActivity;
|
||||||
ConfigXml configXml;
|
ConfigXml configXml;
|
||||||
|
|
||||||
|
@ -480,13 +480,25 @@ public class FirstStartActivity extends Activity {
|
||||||
try {
|
try {
|
||||||
configXml = new ConfigXml(firstStartActivity);
|
configXml = new ConfigXml(firstStartActivity);
|
||||||
} catch (ConfigXml.OpenConfigException e) {
|
} catch (ConfigXml.OpenConfigException e) {
|
||||||
TextView keygenStatus = firstStartActivity.findViewById(R.id.key_generation_status);
|
publishProgress(firstStartActivity.getString(R.string.config_create_failed));
|
||||||
keygenStatus.setText(firstStartActivity.getString(R.string.config_create_failed));
|
|
||||||
cancel(true);
|
cancel(true);
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onProgressUpdate(String... values) {
|
||||||
|
super.onProgressUpdate(values);
|
||||||
|
if (values != null && values.length > 0) {
|
||||||
|
FirstStartActivity firstStartActivity = refFirstStartActivity.get();
|
||||||
|
if (firstStartActivity == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
TextView keygenStatus = firstStartActivity.findViewById(R.id.key_generation_status);
|
||||||
|
keygenStatus.setText(values[0]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onPostExecute(Void aVoid) {
|
protected void onPostExecute(Void aVoid) {
|
||||||
// Get a reference to the activity if it is still there.
|
// Get a reference to the activity if it is still there.
|
||||||
|
|
|
@ -641,7 +641,7 @@ Bitte melden Sie auftretende Probleme via GitHub.</string>
|
||||||
<string name="syncthing_terminated">Syncthing wurde beendet</string>
|
<string name="syncthing_terminated">Syncthing wurde beendet</string>
|
||||||
|
|
||||||
<!-- Toast shown if syncthing failed to create or read the config -->
|
<!-- Toast shown if syncthing failed to create or read the config -->
|
||||||
<string name="config_create_failed">Erstellen der Konfigurationsdatei fehlgeschalgen</string>
|
<string name="config_create_failed">Erstellen der Konfiguration fehlgeschlagen. Pruefe die logcat-Ausgabe!</string>
|
||||||
<string name="config_read_failed">Fehler beim Lesen der Konfiguration. Sichere gegebenenfalls Daten aus deinen Sync-Ordnern zu sichern, lösche über die Android-Einstellungen die App-Daten und starte von vorn.</string>
|
<string name="config_read_failed">Fehler beim Lesen der Konfiguration. Sichere gegebenenfalls Daten aus deinen Sync-Ordnern zu sichern, lösche über die Android-Einstellungen die App-Daten und starte von vorn.</string>
|
||||||
|
|
||||||
<!-- Toast shown if a config file crucial to operation is missing -->
|
<!-- Toast shown if a config file crucial to operation is missing -->
|
||||||
|
|
|
@ -649,7 +649,7 @@ Please report any problems you encounter via Github.</string>
|
||||||
<string name="syncthing_terminated">Syncthing was terminated</string>
|
<string name="syncthing_terminated">Syncthing was terminated</string>
|
||||||
|
|
||||||
<!-- Toast shown if syncthing failed to create or read the config -->
|
<!-- Toast shown if syncthing failed to create or read the config -->
|
||||||
<string name="config_create_failed">Failed to create configuration.</string>
|
<string name="config_create_failed">Failed to create configuration. Check logcat output.</string>
|
||||||
<string name="config_read_failed">Failed to read configuration. Consider backing up data from your sync folders, then clear this app\'s data from Android settings and launch it again.</string>
|
<string name="config_read_failed">Failed to read configuration. Consider backing up data from your sync folders, then clear this app\'s data from Android settings and launch it again.</string>
|
||||||
|
|
||||||
<!-- Toast shown if a config file crucial to operation is missing -->
|
<!-- Toast shown if a config file crucial to operation is missing -->
|
||||||
|
|
Loading…
Reference in a new issue