From 47db6d25a06cc89d721f59a01cf47befa5d02fd2 Mon Sep 17 00:00:00 2001 From: Damyan Ivanov Date: Fri, 29 Mar 2019 00:11:16 +0200 Subject: [PATCH] put updating of profile data from the UI in a method will be used on new profiles too --- .../ui/profiles/ProfileDetailFragment.java | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/app/src/main/java/net/ktnx/mobileledger/ui/profiles/ProfileDetailFragment.java b/app/src/main/java/net/ktnx/mobileledger/ui/profiles/ProfileDetailFragment.java index dbbe85ff..2d58e40b 100644 --- a/app/src/main/java/net/ktnx/mobileledger/ui/profiles/ProfileDetailFragment.java +++ b/app/src/main/java/net/ktnx/mobileledger/ui/profiles/ProfileDetailFragment.java @@ -142,13 +142,7 @@ public class ProfileDetailFragment extends Fragment implements HueRingDialog.Hue if (!checkValidity()) return; if (mProfile != null) { - mProfile.setName(profileName.getText()); - mProfile.setUrl(url.getText()); - mProfile.setPostingPermitted(postingPermitted.isChecked()); - mProfile.setAuthEnabled(useAuthentication.isChecked()); - mProfile.setAuthUserName(userName.getText()); - mProfile.setAuthPassword(password.getText()); - mProfile.setThemeId(huePickerView.getTag()); + updateProfileFromUI(); // Log.d("profiles", String.format("Selected item is %d", mProfile.getThemeId())); mProfile.storeInDB(); Log.d("profiles", "profile stored in DB"); @@ -179,6 +173,14 @@ public class ProfileDetailFragment extends Fragment implements HueRingDialog.Hue profileName.requestFocus(); } + private void updateProfileFromUI() { + mProfile.setName(profileName.getText()); + mProfile.setUrl(url.getText()); + mProfile.setPostingPermitted(postingPermitted.isChecked()); + mProfile.setAuthEnabled(useAuthentication.isChecked()); + mProfile.setAuthUserName(userName.getText()); + mProfile.setAuthPassword(password.getText()); + mProfile.setThemeId(huePickerView.getTag()); @Override public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { -- 2.39.5