1
0
Fork 0
mirror of https://github.com/syncthing/syncthing-android.git synced 2024-11-26 14:21:16 +00:00

Fix loading text (#1101)

This commit is contained in:
Catfriend1 2018-05-26 17:44:45 +02:00 committed by Audrius Butkevicius
parent b14a1aa177
commit ec626cd9fe
4 changed files with 6 additions and 5 deletions

View file

@ -62,7 +62,7 @@ public class FirstStartActivity extends Activity implements Button.OnClickListen
// In case start_into_web_gui option is enabled, start both activities so that back // In case start_into_web_gui option is enabled, start both activities so that back
// navigation works as expected. // navigation works as expected.
Intent mainIntent = new Intent(this, MainActivity.class); Intent mainIntent = new Intent(this, MainActivity.class);
mainIntent.putExtra(MainActivity.EXTRA_FIRST_START, isFirstStart); mainIntent.putExtra(MainActivity.EXTRA_KEY_GENERATION_IN_PROGRESS, isFirstStart);
Intent webIntent = new Intent(this, WebGuiActivity.class); Intent webIntent = new Intent(this, WebGuiActivity.class);
if (mPreferences.getBoolean("start_into_web_gui", false)) { if (mPreferences.getBoolean("start_into_web_gui", false)) {
startActivities(new Intent[] {mainIntent, webIntent}); startActivities(new Intent[] {mainIntent, webIntent});

View file

@ -105,6 +105,7 @@ public class MainActivity extends StateDialogActivity
case STARTING: case STARTING:
break; break;
case ACTIVE: case ACTIVE:
getIntent().putExtra(this.EXTRA_KEY_GENERATION_IN_PROGRESS, false);
showBatteryOptimizationDialogIfNecessary(); showBatteryOptimizationDialogIfNecessary();
mDrawerLayout.setDrawerLockMode(DrawerLayout.LOCK_MODE_UNLOCKED); mDrawerLayout.setDrawerLockMode(DrawerLayout.LOCK_MODE_UNLOCKED);
mDrawerFragment.requestGuiUpdate(); mDrawerFragment.requestGuiUpdate();

View file

@ -111,8 +111,8 @@ public abstract class StateDialogActivity extends SyncthingActivity {
DialogLoadingBinding binding = DataBindingUtil.inflate( DialogLoadingBinding binding = DataBindingUtil.inflate(
getLayoutInflater(), R.layout.dialog_loading, null, false); getLayoutInflater(), R.layout.dialog_loading, null, false);
boolean isFirstStart = getIntent().getBooleanExtra(EXTRA_FIRST_START, false); boolean isGeneratingKeys = getIntent().getBooleanExtra(EXTRA_KEY_GENERATION_IN_PROGRESS, false);
binding.loadingText.setText((isFirstStart) binding.loadingText.setText((isGeneratingKeys)
? R.string.web_gui_creating_key ? R.string.web_gui_creating_key
: R.string.api_loading); : R.string.api_loading);
@ -121,7 +121,7 @@ public abstract class StateDialogActivity extends SyncthingActivity {
.setView(binding.getRoot()) .setView(binding.getRoot())
.show(); .show();
if (!isFirstStart) { if (!isGeneratingKeys) {
new Handler().postDelayed(() -> { new Handler().postDelayed(() -> {
if (isFinishing() || mLoadingDialog == null) if (isFinishing() || mLoadingDialog == null)
return; return;

View file

@ -22,7 +22,7 @@ import java.util.LinkedList;
*/ */
public abstract class SyncthingActivity extends AppCompatActivity implements ServiceConnection { public abstract class SyncthingActivity extends AppCompatActivity implements ServiceConnection {
public static final String EXTRA_FIRST_START = "com.nutomic.syncthing-android.SyncthingActivity.FIRST_START"; public static final String EXTRA_KEY_GENERATION_IN_PROGRESS = "com.nutomic.syncthing-android.SyncthingActivity.KEY_GENERATION_IN_PROGRESS";
private SyncthingService mSyncthingService; private SyncthingService mSyncthingService;