Skip to content

Commit

Permalink
Override changes: Show confirmation dialog (fixes #397)
Browse files Browse the repository at this point in the history
  • Loading branch information
Catfriend1 committed Jul 11, 2019
1 parent 8824349 commit a87c540
Showing 1 changed file with 13 additions and 5 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.nutomic.syncthingandroid.views;

import android.app.AlertDialog;
import android.content.Context;
import android.content.Intent;
import android.databinding.DataBindingUtil;
Expand Down Expand Up @@ -189,11 +190,18 @@ private void setTextOrHide(TextView view, String text) {
}

private void onClickOverride(View view, Folder folder) {
// Send "Override changes" through our service to the REST API.
Intent intent = new Intent(mContext, SyncthingService.class)
.putExtra(SyncthingService.EXTRA_FOLDER_ID, folder.id);
intent.setAction(SyncthingService.ACTION_OVERRIDE_CHANGES);
mContext.startService(intent);
AlertDialog.Builder confirmDialog = new AlertDialog.Builder(mContext)
.setTitle(R.string.override_changes)
.setMessage(R.string.override_changes_question)
.setPositiveButton(android.R.string.ok, (dialogInterface, i) -> {
// Send "Override changes" through our service to the REST API.
Intent intent = new Intent(mContext, SyncthingService.class)
.putExtra(SyncthingService.EXTRA_FOLDER_ID, folder.id);
intent.setAction(SyncthingService.ACTION_OVERRIDE_CHANGES);
mContext.startService(intent);
})
.setNegativeButton(android.R.string.no, (dialogInterface, i) -> {});
confirmDialog.show();
}

}

0 comments on commit a87c540

Please sign in to comment.