]> git.ktnx.net Git - mobile-ledger.git/commitdiff
profile details: put posting params in a layout so that they can be hidden easier
authorDamyan Ivanov <dam+mobileledger@ktnx.net>
Wed, 13 May 2020 19:10:33 +0000 (22:10 +0300)
committerDamyan Ivanov <dam+mobileledger@ktnx.net>
Thu, 14 May 2020 17:39:53 +0000 (17:39 +0000)
app/src/main/java/net/ktnx/mobileledger/ui/profiles/ProfileDetailFragment.java
app/src/main/res/layout/profile_detail.xml
app/src/main/res/values/strings.xml

index aba3b0f2c4f9b9829a996b8bfca9a988046f10f1..522de24787b3374e8cbf9d18b79aa79cce2047a0 100644 (file)
@@ -256,13 +256,12 @@ public class ProfileDetailFragment extends Fragment {
                 (buttonView, isChecked) -> model.setShowCommodityByDefault(isChecked));
         model.observeShowCommodityByDefault(viewLifecycleOwner, showCommodityByDefault::setChecked);
 
+        View postingSubItems = context.findViewById(R.id.posting_sub_items);
+
         Switch postingPermitted = context.findViewById(R.id.profile_permit_posting);
         model.observePostingPermitted(viewLifecycleOwner, isChecked -> {
             postingPermitted.setChecked(isChecked);
-            defaultCommodityLayout.setVisibility(isChecked ? View.VISIBLE : View.GONE);
-            showCommodityByDefault.setVisibility(isChecked ? View.VISIBLE : View.GONE);
-            preferredAccountsFilterLayout.setVisibility(isChecked ? View.VISIBLE : View.GONE);
-            futureDatesLayout.setVisibility(isChecked ? View.VISIBLE : View.GONE);
+            postingSubItems.setVisibility(isChecked ? View.VISIBLE : View.GONE);
         });
         postingPermitted.setOnCheckedChangeListener(
                 ((buttonView, isChecked) -> model.setPostingPermitted(isChecked)));
index f640f3e65b1234e1218235ae795486b56191f00b..b70d55f05b188d1dc283218ab2f4a03c5b1a16d9 100644 (file)
             android:textAppearance="?android:textAppearanceListItem" />
 
         <LinearLayout
-            android:id="@+id/default_commodity_layout"
-            android:orientation="vertical"
+            android:id="@+id/posting_sub_items"
             android:layout_width="match_parent"
             android:layout_height="wrap_content"
-            android:clickable="true"
-            android:focusable="true"
-            android:layout_marginBottom="16dp">
+            android:orientation="vertical">
 
-            <TextView
+            <LinearLayout
+                android:id="@+id/default_commodity_layout"
                 android:layout_width="match_parent"
                 android:layout_height="wrap_content"
-                android:text="@string/profile_default_commodity"
-                android:textAppearance="?android:textAppearanceListItem" />
+                android:layout_marginBottom="16dp"
+                android:clickable="true"
+                android:focusable="true"
+                android:orientation="vertical">
 
-            <TextView
-                android:id="@+id/default_commodity_text"
+                <TextView
+                    android:layout_width="match_parent"
+                    android:layout_height="wrap_content"
+                    android:text="@string/profile_default_commodity"
+                    android:textAppearance="?android:textAppearanceListItem" />
+
+                <TextView
+                    android:id="@+id/default_commodity_text"
+                    android:layout_width="match_parent"
+                    android:layout_height="wrap_content"
+                    android:text="@string/btn_no_currency"
+                    android:textAppearance="?android:textAppearanceListItemSecondary"
+                    android:textColor="?attr/textColor" />
+            </LinearLayout>
+
+            <Switch
+                android:id="@+id/profile_show_commodity"
                 android:layout_width="match_parent"
                 android:layout_height="wrap_content"
-                android:textAppearance="?android:textAppearanceListItemSecondary"
-                android:textColor="?attr/textColor"
-                android:text="@string/btn_no_currency"/>
-        </LinearLayout>
-
-        <Switch
-            android:id="@+id/profile_show_commodity"
-            android:layout_width="match_parent"
-            android:layout_height="wrap_content"
-            android:layout_marginBottom="16dp"
-            android:text="@string/currency_input_by_default"
-            android:textAppearance="?android:textAppearanceListItem"/>
+                android:layout_marginBottom="16dp"
+                android:text="@string/currency_input_by_default"
+                android:textAppearance="?android:textAppearanceListItem" />
 
         <LinearLayout
             android:id="@+id/future_dates_layout"
             android:layout_marginBottom="16dp"
             android:orientation="vertical">
 
-            <TextView
-                android:id="@+id/future_dates_title"
-                android:layout_width="match_parent"
-                android:layout_height="wrap_content"
-                android:text="@string/profile_future_dates_label"
-                android:textAppearance="?android:textAppearanceListItem" />
-
-            <TextView
-                android:id="@+id/future_dates_text"
-                android:layout_width="match_parent"
-                android:layout_height="wrap_content"
-                android:textAppearance="?android:textAppearanceListItemSecondary"
-                android:textColor="?attr/textColor" />
-        </LinearLayout>
+                <TextView
+                    android:id="@+id/future_dates_title"
+                    android:layout_width="match_parent"
+                    android:layout_height="wrap_content"
+                    android:text="@string/profile_future_dates_label"
+                    android:textAppearance="?android:textAppearanceListItem" />
 
-        <com.google.android.material.textfield.TextInputLayout
-            android:id="@+id/preferred_accounts_accounts_filter_layout"
-            android:layout_width="match_parent"
-            android:layout_height="wrap_content"
-            android:layout_marginBottom="16dp"
-            android:orientation="vertical">
+                <TextView
+                    android:id="@+id/future_dates_text"
+                    android:layout_width="match_parent"
+                    android:layout_height="wrap_content"
+                    android:textAppearance="?android:textAppearanceListItemSecondary"
+                    android:textColor="?attr/textColor" />
+            </LinearLayout>
 
-            <com.google.android.material.textfield.TextInputEditText
-                android:id="@+id/preferred_accounts_filter_filter"
+            <com.google.android.material.textfield.TextInputLayout
+                android:id="@+id/preferred_accounts_accounts_filter_layout"
                 android:layout_width="match_parent"
                 android:layout_height="wrap_content"
-                android:ems="10"
-                android:fontFamily="monospace"
-                android:hint="@string/pref_preferred_autocompletion_account_filter_hint"
-                android:inputType="text"
-                android:textColor="?attr/editTextColor" />
-        </com.google.android.material.textfield.TextInputLayout>
+                android:layout_marginBottom="16dp"
+                android:orientation="vertical">
+
+                <com.google.android.material.textfield.TextInputEditText
+                    android:id="@+id/preferred_accounts_filter_filter"
+                    android:layout_width="match_parent"
+                    android:layout_height="wrap_content"
+                    android:ems="10"
+                    android:fontFamily="monospace"
+                    android:hint="@string/pref_preferred_autocompletion_account_filter_hint"
+                    android:inputType="text"
+                    android:textColor="?attr/editTextColor" />
+            </com.google.android.material.textfield.TextInputLayout>
+        </LinearLayout>
 
         <LinearLayout
             android:layout_width="match_parent"
index a23586968b230dca4d33ebb36c15d3ecb01d3497..9327f4a3c15104b868f19e13fb6ee6878f6de4da 100644 (file)
     <string name="ignoring_preferred_account">No transactions with preferred account found</string>
     <string name="icon">icon</string>
     <string name="show_comments_switch">Comments</string>
+    <string name="show_comment_input_by_default">Show comment fields by default</string>
 </resources>