confirm_service_deletion
This commit is contained in:
parent
a0b3d72fa8
commit
07044f7748
|
@ -15,7 +15,6 @@ import android.view.MenuItem;
|
|||
import android.view.View;
|
||||
import android.widget.AdapterView;
|
||||
import android.widget.ListView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import org.torproject.android.R;
|
||||
import org.torproject.android.ui.hiddenservices.adapters.OnionListAdapter;
|
||||
|
@ -79,7 +78,7 @@ public class HiddenServicesActivity extends AppCompatActivity {
|
|||
);
|
||||
|
||||
arguments.putString(
|
||||
"onion",item.getString(item.getColumnIndex(HSContentProvider.HiddenService.DOMAIN))
|
||||
"onion", item.getString(item.getColumnIndex(HSContentProvider.HiddenService.DOMAIN))
|
||||
);
|
||||
|
||||
HSActionsDialog dialog = new HSActionsDialog();
|
||||
|
|
|
@ -17,7 +17,6 @@ import android.widget.Toast;
|
|||
|
||||
import org.torproject.android.R;
|
||||
import org.torproject.android.ui.hiddenservices.backup.BackupUtils;
|
||||
import org.torproject.android.ui.hiddenservices.providers.HSContentProvider;
|
||||
import org.torproject.android.ui.hiddenservices.storage.PermissionManager;
|
||||
|
||||
public class HSActionsDialog extends DialogFragment {
|
||||
|
@ -87,9 +86,9 @@ public class HSActionsDialog extends DialogFragment {
|
|||
Button delete = (Button) dialog_view.findViewById(R.id.btn_hs_delete);
|
||||
delete.setOnClickListener(new View.OnClickListener() {
|
||||
public void onClick(View v) {
|
||||
v.getContext().getContentResolver().delete(
|
||||
HSContentProvider.CONTENT_URI, "port=" + arguments.getString("port"), null
|
||||
);
|
||||
HSDeleteDialog dialog = new HSDeleteDialog();
|
||||
dialog.setArguments(arguments);
|
||||
dialog.show(getFragmentManager(), "HSDeleteDialog");
|
||||
actionDialog.dismiss();
|
||||
}
|
||||
});
|
||||
|
|
|
@ -0,0 +1,44 @@
|
|||
package org.torproject.android.ui.hiddenservices.dialogs;
|
||||
|
||||
|
||||
import android.app.Dialog;
|
||||
import android.content.DialogInterface;
|
||||
import android.os.Bundle;
|
||||
import android.support.annotation.NonNull;
|
||||
import android.support.v4.app.DialogFragment;
|
||||
import android.support.v7.app.AlertDialog;
|
||||
|
||||
import org.torproject.android.R;
|
||||
import org.torproject.android.ui.hiddenservices.providers.HSContentProvider;
|
||||
|
||||
public class HSDeleteDialog extends DialogFragment {
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public Dialog onCreateDialog(Bundle savedInstanceState) {
|
||||
final Bundle arguments = getArguments();
|
||||
|
||||
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
|
||||
);
|
||||
break;
|
||||
|
||||
case DialogInterface.BUTTON_NEGATIVE:
|
||||
// Do nothing
|
||||
break;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
return new AlertDialog.Builder(getActivity())
|
||||
.setMessage(R.string.confirm_service_deletion)
|
||||
.setPositiveButton(R.string.btn_okay, dialogClickListener)
|
||||
.setNegativeButton(R.string.btn_cancel, dialogClickListener)
|
||||
.create();
|
||||
}
|
||||
}
|
|
@ -352,4 +352,5 @@
|
|||
<string name="create_a_backup_first">Create a backup first</string>
|
||||
<string name="name_can_t_be_empty">Name can\'t be empty</string>
|
||||
<string name="start_tor_again_for_finish_the_process">Start Tor again for finish the process</string>
|
||||
<string name="confirm_service_deletion">Confirm service deletion</string>
|
||||
</resources>
|
||||
|
|
Loading…
Reference in New Issue