From: Damyan Ivanov Date: Mon, 28 Jan 2019 19:07:29 +0000 (+0200) Subject: fix the 'Posting committed' switch in the profile editor X-Git-Tag: v0.4~5 X-Git-Url: https://git.ktnx.net/?a=commitdiff_plain;h=0e2937f7e472c52675d47ff7a5dcb214adbeb35d;p=mobile-ledger.git fix the 'Posting committed' switch in the profile editor --- diff --git a/app/src/main/java/net/ktnx/mobileledger/model/MobileLedgerProfile.java b/app/src/main/java/net/ktnx/mobileledger/model/MobileLedgerProfile.java index bbd9a2be..d619c4bb 100644 --- a/app/src/main/java/net/ktnx/mobileledger/model/MobileLedgerProfile.java +++ b/app/src/main/java/net/ktnx/mobileledger/model/MobileLedgerProfile.java @@ -95,10 +95,12 @@ public final class MobileLedgerProfile { db.endTransaction(); } } - public boolean isPostingPermitted() { return permitPosting; } + public void setPostingPermitted(boolean permitPosting) { + this.permitPosting = permitPosting; + } public String getUuid() { return uuid; } diff --git a/app/src/main/java/net/ktnx/mobileledger/ui/activity/MainActivity.java b/app/src/main/java/net/ktnx/mobileledger/ui/activity/MainActivity.java index 83b608bf..fb8a7327 100644 --- a/app/src/main/java/net/ktnx/mobileledger/ui/activity/MainActivity.java +++ b/app/src/main/java/net/ktnx/mobileledger/ui/activity/MainActivity.java @@ -97,8 +97,14 @@ public class MainActivity extends AppCompatActivity { if (profile == null) setTitle(R.string.app_name); else setTitle(profile.getName()); updateLastUpdateTextFromDB(); - if (profile.isPostingPermitted()) fab.show(); - else fab.hide(); + if (profile.isPostingPermitted()) { + toolbar.setSubtitle(null); + fab.show(); + } + else { + toolbar.setSubtitle(R.string.profile_subitlte_read_only); + fab.hide(); + } }); }); 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 7cbfa0e7..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 @@ -127,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()); diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index dc800351..f4ae09f5 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -132,4 +132,5 @@ December Posting of new transactions enabled + (Read only)