1
0
Fork 0
mirror of https://github.com/syncthing/syncthing-android.git synced 2024-12-23 03:11:30 +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
// navigation works as expected.
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);
if (mPreferences.getBoolean("start_into_web_gui", false)) {
startActivities(new Intent[] {mainIntent, webIntent});

View file

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

View file

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

View file

@ -22,7 +22,7 @@ import java.util.LinkedList;
*/
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;