[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[tor-commits] [orbot/master] delete by id
commit f742b270e3221c5b1d52713afc798e1c182c24b8
Author: arrase <arrase@xxxxxxxxx>
Date: Mon Nov 28 23:32:35 2016 +0100
delete by id
---
.../android/ui/hiddenservices/HiddenServicesActivity.java | 4 ++++
.../android/ui/hiddenservices/dialogs/HSDeleteDialog.java | 10 +++++++---
2 files changed, 11 insertions(+), 3 deletions(-)
diff --git a/app/src/main/java/org/torproject/android/ui/hiddenservices/HiddenServicesActivity.java b/app/src/main/java/org/torproject/android/ui/hiddenservices/HiddenServicesActivity.java
index 8e0e235..6ee3281 100644
--- a/app/src/main/java/org/torproject/android/ui/hiddenservices/HiddenServicesActivity.java
+++ b/app/src/main/java/org/torproject/android/ui/hiddenservices/HiddenServicesActivity.java
@@ -73,6 +73,10 @@ public class HiddenServicesActivity extends AppCompatActivity {
Cursor item = (Cursor) parent.getItemAtPosition(position);
Bundle arguments = new Bundle();
+ arguments.putInt(
+ "_id", item.getInt(item.getColumnIndex(HSContentProvider.HiddenService._ID))
+ );
+
arguments.putString(
"port", item.getString(item.getColumnIndex(HSContentProvider.HiddenService.PORT))
);
diff --git a/app/src/main/java/org/torproject/android/ui/hiddenservices/dialogs/HSDeleteDialog.java b/app/src/main/java/org/torproject/android/ui/hiddenservices/dialogs/HSDeleteDialog.java
index 3523e85..4e0643e 100644
--- a/app/src/main/java/org/torproject/android/ui/hiddenservices/dialogs/HSDeleteDialog.java
+++ b/app/src/main/java/org/torproject/android/ui/hiddenservices/dialogs/HSDeleteDialog.java
@@ -2,6 +2,7 @@ package org.torproject.android.ui.hiddenservices.dialogs;
import android.app.Dialog;
+import android.content.Context;
import android.content.DialogInterface;
import android.os.Bundle;
import android.support.annotation.NonNull;
@@ -17,14 +18,17 @@ public class HSDeleteDialog extends DialogFragment {
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
final Bundle arguments = getArguments();
+ final Context context = getContext();
DialogInterface.OnClickListener dialogClickListener = new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
switch (which) {
case DialogInterface.BUTTON_POSITIVE:
- getActivity().getContentResolver().delete(
- HSContentProvider.CONTENT_URI, "port=" + arguments.getString("port"), null
+ context.getContentResolver().delete(
+ HSContentProvider.CONTENT_URI,
+ HSContentProvider.HiddenService._ID + "=" + arguments.getInt("_id"),
+ null
);
break;
@@ -35,7 +39,7 @@ public class HSDeleteDialog extends DialogFragment {
}
};
- return new AlertDialog.Builder(getActivity())
+ return new AlertDialog.Builder(context)
.setMessage(R.string.confirm_service_deletion)
.setPositiveButton(R.string.btn_okay, dialogClickListener)
.setNegativeButton(R.string.btn_cancel, dialogClickListener)
_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits