X-Git-Url: https://git.ktnx.net/?p=mobile-ledger.git;a=blobdiff_plain;f=app%2Fsrc%2Fmain%2Fjava%2Fnet%2Fktnx%2Fmobileledger%2Fui%2Fprofiles%2FProfileDetailFragment.java;h=7cbfa0e7062c20abf3b7c2d6b75a6b128fccb7e7;hp=004763a7ac87a45343018d67b095872aa612efc6;hb=649f399014447df347d0fd5c76219b6549f53ee0;hpb=e322f11defd133f4e85cd80ef5f2d9131d6877e0 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 004763a7..7cbfa0e7 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 @@ -61,6 +61,7 @@ public class ProfileDetailFragment extends Fragment { */ private MobileLedgerProfile mProfile; private TextView url; + private Switch postingPermitted; private TextInputLayout urlLayout; private LinearLayout authParams; private Switch useAuthentication; @@ -140,11 +141,15 @@ public class ProfileDetailFragment extends Fragment { } } else { - mProfile = new MobileLedgerProfile(profileName.getText(), url.getText(), - useAuthentication.isChecked(), userName.getText(), password.getText()); + mProfile = new MobileLedgerProfile(profileName.getText(), postingPermitted.isChecked(), + url.getText(), useAuthentication.isChecked(), userName.getText(), + password.getText()); mProfile.storeInDB(); Data.profiles.add(mProfile); MobileLedgerProfile.storeProfilesOrder(); + + // first profile ever? + if (Data.profiles.getList().size() == 1) Data.profile.set(mProfile); } Activity activity = getActivity(); @@ -162,6 +167,7 @@ public class ProfileDetailFragment extends Fragment { profileNameLayout = rootView.findViewById(R.id.profile_name_layout); url = rootView.findViewById(R.id.url); urlLayout = rootView.findViewById(R.id.url_layout); + postingPermitted = rootView.findViewById(R.id.profile_permit_posting); authParams = rootView.findViewById(R.id.auth_params); useAuthentication = rootView.findViewById(R.id.enable_http_auth); userName = rootView.findViewById(R.id.auth_user_name); @@ -182,6 +188,7 @@ public class ProfileDetailFragment extends Fragment { if (mProfile != null) { profileName.setText(mProfile.getName()); + postingPermitted.setChecked(mProfile.isPostingPermitted()); url.setText(mProfile.getUrl()); useAuthentication.setChecked(mProfile.isAuthEnabled()); authParams.setVisibility(mProfile.isAuthEnabled() ? View.VISIBLE : View.GONE); @@ -191,6 +198,7 @@ public class ProfileDetailFragment extends Fragment { else { profileName.setText(""); url.setText(""); + postingPermitted.setChecked(true); useAuthentication.setChecked(false); authParams.setVisibility(View.GONE); userName.setText("");