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=0288378393766a3331270154616079a0ecb3d937;hp=7ef511d00656c2badc098dcedec3ba21a78b1a52;hb=0e2937f7e472c52675d47ff7a5dcb214adbeb35d;hpb=a588974b72e78f9cd1ff5ec9cb0c4d0ae36a7746 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 7ef511d0..02883783 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; @@ -126,6 +127,7 @@ public class ProfileDetailFragment extends Fragment { 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()); @@ -140,8 +142,9 @@ 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(); @@ -165,6 +168,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); @@ -185,6 +189,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); @@ -194,6 +199,7 @@ public class ProfileDetailFragment extends Fragment { else { profileName.setText(""); url.setText(""); + postingPermitted.setChecked(true); useAuthentication.setChecked(false); authParams.setVisibility(View.GONE); userName.setText("");