1
0
Fork 0
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:
Felix Ableitner 2016-08-03 00:58:41 +02:00
parent c4d858e8f9
commit dd7966a228
2 changed files with 15 additions and 2 deletions

View file

@ -1,5 +1,7 @@
package com.nutomic.syncthingandroid.fragments; package com.nutomic.syncthingandroid.fragments;
import android.app.AlertDialog;
import android.content.DialogInterface;
import android.content.Intent; import android.content.Intent;
import android.os.Bundle; import android.os.Bundle;
import android.support.v4.app.Fragment; import android.support.v4.app.Fragment;
@ -212,9 +214,18 @@ public class DrawerFragment extends Fragment implements RestApi.OnReceiveSystemI
mActivity.closeDrawer(); mActivity.closeDrawer();
break; break;
case R.id.drawerActionRestart: 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) getContext().startService(new Intent(getContext(), SyncthingService.class)
.setAction(SyncthingService.ACTION_RESTART)); .setAction(SyncthingService.ACTION_RESTART));
mActivity.closeDrawer(); }
})
.setNegativeButton(android.R.string.no, null)
.show();
break; break;
case R.id.drawerActionExit: case R.id.drawerActionExit:
mActivity.stopService(new Intent(mActivity, SyncthingService.class)); mActivity.stopService(new Intent(mActivity, SyncthingService.class));

View file

@ -92,6 +92,8 @@
<string name="restart">Restart</string> <string name="restart">Restart</string>
<string name="dialog_confirm_restart">Do you want to restart Syncthing?</string>
<!-- FolderSettingsFragment --> <!-- FolderSettingsFragment -->