package net.ktnx.mobileledger.ui.profiles;
import android.app.Activity;
+import android.app.AlertDialog;
+import android.content.DialogInterface;
import android.os.Bundle;
import android.text.Editable;
import android.text.TextWatcher;
inflater.inflate(R.menu.profile_details, menu);
final MenuItem menuDeleteProfile = menu.findItem(R.id.menuDelete);
menuDeleteProfile.setOnMenuItemClickListener(item -> {
- Log.d("profiles", String.format("[fragment] removing profile %s", mProfile.getUuid()));
- mProfile.removeFromDB();
- Data.profiles.remove(mProfile);
- if (Data.profile.get().equals(mProfile)) {
- Log.d("profiles", "[fragment] setting current profile to 0");
- Data.setCurrentProfile(Data.profiles.get(0));
- }
+ AlertDialog.Builder builder = new AlertDialog.Builder(getContext());
+ builder.setTitle(mProfile.getName());
+ builder.setMessage(R.string.remove_profile_dialog_message);
+ builder.setPositiveButton(R.string.Remove, new DialogInterface.OnClickListener() {
+ @Override
+ public void onClick(DialogInterface dialog, int which) {
+ Log.d("profiles", String.format("[fragment] removing profile %s", mProfile.getUuid()));
+ mProfile.removeFromDB();
+ Data.profiles.remove(mProfile);
+ if (Data.profile.get().equals(mProfile)) {
+ Log.d("profiles", "[fragment] setting current profile to 0");
+ Data.setCurrentProfile(Data.profiles.get(0));
+ }
+ getActivity().finish();
+ }
+ });
+ builder.show();
return false;
});
menuDeleteProfile.setVisible((mProfile != null) && (Data.profiles.size() > 1));
<string name="btn_ok">Добре</string>
<string name="profile_list_rearrange_handle_label">Манипулатор за промяна на подредбата</string>
<string name="color_label">Цвят</string>
+ <string name="pref_preferred_autocompletion_account_filter_hint" >Филтър при избор на предишна трансакция</string>
+ <string name="remove_profile_dialog_message">Потвърдете окончателното премахване на профила</string>
+ <string name="Remove">Премахване</string>
</resources>
<string name="default_color_btn">Default</string>
<string name="profile_color_label">Profile color</string>
<string name="btn_select_label">Select</string>
+ <string name="pref_preferred_autocompletion_account_filter_hint">Filter for transaction auto-completion</string>
+ <string name="remove_profile_dialog_message">Permanently remove this profile?</string>
+ <string name="Remove">Remove</string>
</resources>