mirror of
https://github.com/syncthing/syncthing-android.git
synced 2024-12-23 11:21:29 +00:00
Added confirm dialog to restart button (fixes #716)
This commit is contained in:
parent
c4d858e8f9
commit
dd7966a228
2 changed files with 15 additions and 2 deletions
|
@ -1,5 +1,7 @@
|
|||
package com.nutomic.syncthingandroid.fragments;
|
||||
|
||||
import android.app.AlertDialog;
|
||||
import android.content.DialogInterface;
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.support.v4.app.Fragment;
|
||||
|
@ -212,9 +214,18 @@ public class DrawerFragment extends Fragment implements RestApi.OnReceiveSystemI
|
|||
mActivity.closeDrawer();
|
||||
break;
|
||||
case R.id.drawerActionRestart:
|
||||
mActivity.closeDrawer();
|
||||
new AlertDialog.Builder(getContext())
|
||||
.setMessage(R.string.dialog_confirm_restart)
|
||||
.setPositiveButton(android.R.string.yes, new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialogInterface, int i) {
|
||||
getContext().startService(new Intent(getContext(), SyncthingService.class)
|
||||
.setAction(SyncthingService.ACTION_RESTART));
|
||||
mActivity.closeDrawer();
|
||||
}
|
||||
})
|
||||
.setNegativeButton(android.R.string.no, null)
|
||||
.show();
|
||||
break;
|
||||
case R.id.drawerActionExit:
|
||||
mActivity.stopService(new Intent(mActivity, SyncthingService.class));
|
||||
|
|
|
@ -92,6 +92,8 @@
|
|||
|
||||
<string name="restart">Restart</string>
|
||||
|
||||
<string name="dialog_confirm_restart">Do you want to restart Syncthing?</string>
|
||||
|
||||
<!-- FolderSettingsFragment -->
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue