From ebc9d1e219e7b86e35acde2c799252f5da1dc5af Mon Sep 17 00:00:00 2001 From: Damyan Ivanov Date: Sun, 3 Mar 2019 16:23:44 +0200 Subject: [PATCH] wider touch area for rearranging profiles thara was a tiny bit that scrolled the list between the handle and the color tag --- .../ui/activity/MainActivity.java | 2 +- .../profiles/ProfilesRecyclerViewAdapter.java | 9 ++-- .../main/res/layout/profile_list_content.xml | 54 ++++++++++--------- 3 files changed, 36 insertions(+), 29 deletions(-) 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 c2ee2c60..0e5f469d 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 @@ -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 diff --git a/app/src/main/java/net/ktnx/mobileledger/ui/profiles/ProfilesRecyclerViewAdapter.java b/app/src/main/java/net/ktnx/mobileledger/ui/profiles/ProfilesRecyclerViewAdapter.java index 5b935df9..a96517c2 100644 --- a/app/src/main/java/net/ktnx/mobileledger/ui/profiles/ProfilesRecyclerViewAdapter.java +++ b/app/src/main/java/net/ktnx/mobileledger/ui/profiles/ProfilesRecyclerViewAdapter.java @@ -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); } } } diff --git a/app/src/main/res/layout/profile_list_content.xml b/app/src/main/res/layout/profile_list_content.xml index f76c40c0..6f09955a 100644 --- a/app/src/main/res/layout/profile_list_content.xml +++ b/app/src/main/res/layout/profile_list_content.xml @@ -27,17 +27,34 @@ android:layout_gravity="center_horizontal" android:foregroundGravity="center_vertical"> - + app:layout_constraintTop_toTopOf="parent"> + + + + + - - -- 2.39.5