]> git.ktnx.net Git - mobile-ledger.git/commitdiff
put updating of profile data from the UI in a method
authorDamyan Ivanov <dam+mobileledger@ktnx.net>
Thu, 28 Mar 2019 22:11:16 +0000 (00:11 +0200)
committerDamyan Ivanov <dam+mobileledger@ktnx.net>
Thu, 28 Mar 2019 22:11:16 +0000 (00:11 +0200)
will be used on new profiles too

app/src/main/java/net/ktnx/mobileledger/ui/profiles/ProfileDetailFragment.java

index dbbe85ff817fd566ae6b321963bd7addf88946fb..2d58e40b76b861ccbe91755d6446415e7b7e29e8 100644 (file)
@@ -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) {