From 0b79fe2853a6df27379c31ce48b86708453afb85 Mon Sep 17 00:00:00 2001 From: Damyan Ivanov Date: Fri, 29 Mar 2019 00:19:17 +0200 Subject: [PATCH] handle preferred accounts filter setting in the profile detail UI --- .../ui/profiles/ProfileDetailFragment.java | 12 ++++++++++++ app/src/main/res/layout/profile_detail.xml | 18 ++++++++++++++++++ 2 files changed, 30 insertions(+) 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 299ec42b..607c6b69 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 @@ -78,6 +78,8 @@ public class ProfileDetailFragment extends Fragment implements HueRingDialog.Hue private TextInputLayout passwordLayout; private TextView profileName; private TextInputLayout profileNameLayout; + private TextView preferredAccountsFilter; + private TextInputLayout preferredAccountsFilterLayout; private View huePickerView; /** @@ -175,10 +177,12 @@ public class ProfileDetailFragment extends Fragment implements HueRingDialog.Hue mProfile.setName(profileName.getText()); mProfile.setUrl(url.getText()); mProfile.setPostingPermitted(postingPermitted.isChecked()); + mProfile.setPreferredAccountsFilter(preferredAccountsFilter.getText()); 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) { @@ -196,6 +200,9 @@ public class ProfileDetailFragment extends Fragment implements HueRingDialog.Hue password = rootView.findViewById(R.id.password); passwordLayout = rootView.findViewById(R.id.password_layout); huePickerView = rootView.findViewById(R.id.btn_pick_ring_color); + preferredAccountsFilter = rootView.findViewById(R.id.preferred_accounts_filter_filter); + preferredAccountsFilterLayout = + rootView.findViewById(R.id.preferred_accounts_accounts_filter_layout); useAuthentication.setOnCheckedChangeListener((buttonView, isChecked) -> { Log.d("profiles", isChecked ? "auth enabled " : "auth disabled"); @@ -203,6 +210,11 @@ public class ProfileDetailFragment extends Fragment implements HueRingDialog.Hue if (isChecked) userName.requestFocus(); }); + preferredAccountsFilter.setText(mProfile.getPreferredAccountsFilter()); + postingPermitted.setOnCheckedChangeListener(((buttonView, isChecked) -> { + preferredAccountsFilterLayout.setVisibility(isChecked ? View.VISIBLE : View.GONE); + })); + hookClearErrorOnFocusListener(profileName, profileNameLayout); hookClearErrorOnFocusListener(url, urlLayout); hookClearErrorOnFocusListener(userName, userNameLayout); diff --git a/app/src/main/res/layout/profile_detail.xml b/app/src/main/res/layout/profile_detail.xml index 6b55c283..e7b9c6c8 100644 --- a/app/src/main/res/layout/profile_detail.xml +++ b/app/src/main/res/layout/profile_detail.xml @@ -61,6 +61,7 @@ + + + + +