From: Damyan Ivanov Date: Thu, 28 Mar 2019 22:11:16 +0000 (+0200) Subject: put updating of profile data from the UI in a method X-Git-Tag: v0.9~50 X-Git-Url: https://git.ktnx.net/?a=commitdiff_plain;h=47db6d25a06cc89d721f59a01cf47befa5d02fd2;p=mobile-ledger.git put updating of profile data from the UI in a method will be used on new profiles too --- 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) {