]> git.ktnx.net Git - mobile-ledger.git/commitdiff
profile details: confirm profile deletion
authorDamyan Ivanov <dam+mobileledger@ktnx.net>
Thu, 28 Mar 2019 21:40:01 +0000 (23:40 +0200)
committerDamyan Ivanov <dam+mobileledger@ktnx.net>
Thu, 28 Mar 2019 21:40:01 +0000 (23:40 +0200)
app/src/main/java/net/ktnx/mobileledger/ui/profiles/ProfileDetailFragment.java
app/src/main/res/values-bg/strings.xml
app/src/main/res/values/strings.xml

index 0a532e8facec161b62aa5cd37935c8d4803e3df3..dbbe85ff817fd566ae6b321963bd7addf88946fb 100644 (file)
@@ -18,6 +18,8 @@
 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;
@@ -91,13 +93,23 @@ public class ProfileDetailFragment extends Fragment implements HueRingDialog.Hue
         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));
index ab4f238da8564dc75f3b5a8829f8d3ddc65f29ef..2632606ca2324212b055ca1d52ecf421814a0b75 100644 (file)
     <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>
index 50b808c8867a97ee7299ad106228e0f6c346ffaf..784bc4d577e767909f190b28e12b81774b873ad2 100644 (file)
     <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>