]> git.ktnx.net Git - mobile-ledger.git/commitdiff
wider touch area for rearranging profiles
authorDamyan Ivanov <dam+mobileledger@ktnx.net>
Sun, 3 Mar 2019 14:23:44 +0000 (16:23 +0200)
committerDamyan Ivanov <dam+mobileledger@ktnx.net>
Sun, 3 Mar 2019 14:23:59 +0000 (16:23 +0200)
thara was a tiny bit that scrolled the list between the handle and the color tag

app/src/main/java/net/ktnx/mobileledger/ui/activity/MainActivity.java
app/src/main/java/net/ktnx/mobileledger/ui/profiles/ProfilesRecyclerViewAdapter.java
app/src/main/res/layout/profile_list_content.xml

index c2ee2c60bc614297b73ffd5bb500e069a201f7bd..0e5f469d6628a8a989a81aa4c80ca52c2c51dd40 100644 (file)
@@ -536,7 +536,7 @@ public class MainActivity extends ProfileThemedActivity {
         for (int i = 0; i < profileList.getChildCount(); i++) {
             View aRow = profileList.getChildAt(i);
             aRow.findViewById(R.id.profile_list_edit_button).setVisibility(View.GONE);
-            aRow.findViewById(R.id.profile_list_rearrange_handle).setVisibility(View.GONE);
+            aRow.findViewById(R.id.profile_list_rearrange_handle).setVisibility(View.INVISIBLE);
         }
         // FIXME disable rearranging
 
index 5b935df98b9954b398bd7143a14210d3cc5fcc6b..a96517c28a0419893f7571425e130c4ba58b4de8 100644 (file)
@@ -25,6 +25,7 @@ import android.view.LayoutInflater;
 import android.view.View;
 import android.view.ViewGroup;
 import android.widget.ImageView;
+import android.widget.LinearLayout;
 import android.widget.TextView;
 
 import net.ktnx.mobileledger.R;
@@ -155,8 +156,8 @@ public class ProfilesRecyclerViewAdapter
             }
             return false;
         };
-        holder.mRearrangeHandle.setOnTouchListener(dragStarter);
-        holder.mColorTag.setOnTouchListener(dragStarter);
+
+        holder.tagAndHandleLayout.setOnTouchListener(dragStarter);
         return holder;
     }
     @Override
@@ -186,7 +187,7 @@ public class ProfilesRecyclerViewAdapter
             holder.mEditButton.setVisibility(View.VISIBLE);
         }
         else {
-            holder.mRearrangeHandle.setVisibility(View.GONE);
+            holder.mRearrangeHandle.setVisibility(View.INVISIBLE);
             holder.mEditButton.setVisibility(View.GONE);
         }
     }
@@ -200,6 +201,7 @@ public class ProfilesRecyclerViewAdapter
     class ProfileListViewHolder extends RecyclerView.ViewHolder {
         final TextView mEditButton;
         final TextView mTitle, mColorTag;
+        final LinearLayout tagAndHandleLayout;
         final ImageView mRearrangeHandle;
 
         ProfileListViewHolder(View view) {
@@ -208,6 +210,7 @@ public class ProfilesRecyclerViewAdapter
             mTitle = view.findViewById(R.id.title);
             mColorTag = view.findViewById(R.id.colorTag);
             mRearrangeHandle = view.findViewById(R.id.profile_list_rearrange_handle);
+            tagAndHandleLayout = view.findViewById(R.id.handle_and_tag);
         }
     }
 }
index f76c40c00d0b41457c51d57d2756999a87a35d0e..6f09955a468cb6b8b31f3d0494dc598bec9cf978 100644 (file)
     android:layout_gravity="center_horizontal"
     android:foregroundGravity="center_vertical">
 
-    <TextView
-        android:id="@+id/colorTag"
-        android:layout_width="16dp"
-        android:layout_height="0dp"
-        android:layout_marginStart="40dp"
-        android:layout_marginTop="4dp"
-        android:layout_marginBottom="4dp"
-        android:background="?colorPrimary"
-        app:layout_constraintBottom_toBottomOf="parent"
+    <LinearLayout
+        android:id="@+id/handle_and_tag"
+        android:layout_width="56dp"
+        android:layout_height="match_parent"
+        android:orientation="horizontal"
         app:layout_constraintStart_toStartOf="parent"
-        app:layout_constraintTop_toTopOf="parent" />
+        app:layout_constraintTop_toTopOf="parent">
+
+        <ImageView
+            android:id="@+id/profile_list_rearrange_handle"
+            android:layout_width="40dp"
+            android:layout_height="match_parent"
+            android:layout_margin="8dp"
+            android:layout_weight="9"
+            android:background="@drawable/ic_unfold_more_black_24dp"
+            android:contentDescription="@string/profile_list_rearrange_handle_label"
+            app:layout_constraintBottom_toBottomOf="parent"
+            app:layout_constraintStart_toStartOf="parent"
+            app:layout_constraintTop_toTopOf="parent" />
+
+        <TextView
+            android:id="@+id/colorTag"
+            android:layout_width="16dp"
+            android:layout_height="match_parent"
+            android:layout_marginTop="6dp"
+            android:layout_marginBottom="6dp"
+            android:background="?colorPrimary" />
+    </LinearLayout>
 
     <TextView
         android:id="@+id/profile_list_edit_button"
         android:layout_weight="9"
         android:drawableStart="@drawable/ic_mode_edit_black_24dp"
         android:padding="8dp"
-        app:layout_constraintBottom_toBottomOf="parent"
-        app:layout_constraintEnd_toEndOf="parent"
-        app:layout_constraintTop_toTopOf="parent"
-        android:visibility="invisible"/>
-
-    <ImageView
-        android:id="@+id/profile_list_rearrange_handle"
-        android:layout_width="wrap_content"
-        android:layout_height="wrap_content"
-        android:layout_marginStart="8dp"
-        android:layout_weight="9"
-        android:background="@drawable/ic_unfold_more_black_24dp"
-        android:contentDescription="@string/profile_list_rearrange_handle_label"
         android:visibility="gone"
         app:layout_constraintBottom_toBottomOf="parent"
-        app:layout_constraintStart_toStartOf="parent"
+        app:layout_constraintEnd_toEndOf="parent"
         app:layout_constraintTop_toTopOf="parent" />
 
     <TextView
@@ -77,7 +81,7 @@
         android:text="Profile name"
         app:layout_constraintBottom_toBottomOf="parent"
         app:layout_constraintEnd_toStartOf="@id/profile_list_edit_button"
-        app:layout_constraintStart_toEndOf="@id/colorTag"
+        app:layout_constraintStart_toEndOf="@id/handle_and_tag"
         app:layout_constraintTop_toTopOf="parent"
         tools:ignore="HardcodedText" />