mirror of
https://github.com/syncthing/syncthing-android.git
synced 2024-12-26 12:51:28 +00:00
Dismiss "disabled" dialog when syncthing is available again (ref #127).
This commit is contained in:
parent
9ea8af4774
commit
879616a715
2 changed files with 11 additions and 5 deletions
|
@ -42,6 +42,8 @@ public class MainActivity extends SyncthingActivity
|
|||
|
||||
private AlertDialog mLoadingDialog;
|
||||
|
||||
private AlertDialog mDisabledDialog;
|
||||
|
||||
/**
|
||||
* Causes population of repo and node lists, unlocks info drawer.
|
||||
*/
|
||||
|
@ -53,7 +55,7 @@ public class MainActivity extends SyncthingActivity
|
|||
if (mLoadingDialog != null) {
|
||||
mLoadingDialog.dismiss();
|
||||
}
|
||||
SyncthingService.showDisabledDialog(this);
|
||||
mDisabledDialog = SyncthingService.showDisabledDialog(this);
|
||||
} else if (mLoadingDialog == null) {
|
||||
final SharedPreferences prefs =
|
||||
PreferenceManager.getDefaultSharedPreferences(MainActivity.this);
|
||||
|
@ -90,6 +92,9 @@ public class MainActivity extends SyncthingActivity
|
|||
if (mLoadingDialog != null) {
|
||||
mLoadingDialog.dismiss();
|
||||
}
|
||||
if (mDisabledDialog != null) {
|
||||
mDisabledDialog.dismiss();
|
||||
}
|
||||
mDrawerLayout.setDrawerLockMode(DrawerLayout.LOCK_MODE_UNLOCKED);
|
||||
mDrawerLayout.setDrawerListener(mDrawerToggle);
|
||||
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
||||
|
|
|
@ -357,8 +357,8 @@ public class SyncthingService extends Service {
|
|||
* Dialog to be shown when attempting to start syncthing while it is disabled according
|
||||
* to settings (because the device is not charging or wifi is disconnected).
|
||||
*/
|
||||
public static void showDisabledDialog(final Activity activity) {
|
||||
new AlertDialog.Builder(activity)
|
||||
public static AlertDialog showDisabledDialog(final Activity activity) {
|
||||
AlertDialog dialog = new AlertDialog.Builder(activity)
|
||||
.setTitle(R.string.syncthing_disabled_title)
|
||||
.setMessage(R.string.syncthing_disabled_message)
|
||||
.setPositiveButton(R.string.syncthing_disabled_change_settings,
|
||||
|
@ -380,8 +380,9 @@ public class SyncthingService extends Service {
|
|||
}
|
||||
}
|
||||
)
|
||||
.show()
|
||||
.setCancelable(false);
|
||||
.show();
|
||||
dialog.setCancelable(false);
|
||||
return dialog;
|
||||
}
|
||||
|
||||
public String getWebGuiUrl() {
|
||||
|
|
Loading…
Reference in a new issue