From bd96568cc5501949c4951023eccd902682e05e9c Mon Sep 17 00:00:00 2001 From: stom79 Date: Sat, 14 Apr 2018 11:34:26 +0200 Subject: [PATCH 1/3] Remove expand buttons when they are not needed --- .../adapters/PermissionListAdapter.java | 24 +++++++++---------- app/src/main/res/layout/permission_item.xml | 16 ++----------- 2 files changed, 14 insertions(+), 26 deletions(-) diff --git a/app/src/main/java/org/eu/exodus_privacy/exodusprivacy/adapters/PermissionListAdapter.java b/app/src/main/java/org/eu/exodus_privacy/exodusprivacy/adapters/PermissionListAdapter.java index 3a65f61..4ecb907 100644 --- a/app/src/main/java/org/eu/exodus_privacy/exodusprivacy/adapters/PermissionListAdapter.java +++ b/app/src/main/java/org/eu/exodus_privacy/exodusprivacy/adapters/PermissionListAdapter.java @@ -1,7 +1,6 @@ package org.eu.exodus_privacy.exodusprivacy.adapters; import android.databinding.DataBindingUtil; -import android.databinding.ViewDataBinding; import android.support.annotation.NonNull; import android.support.v7.widget.RecyclerView; import android.view.LayoutInflater; @@ -10,12 +9,9 @@ import android.view.ViewGroup; import org.eu.exodus_privacy.exodusprivacy.R; import org.eu.exodus_privacy.exodusprivacy.databinding.PermissionItemBinding; -import org.eu.exodus_privacy.exodusprivacy.databinding.TrackerItemBinding; import org.eu.exodus_privacy.exodusprivacy.objects.Permission; -import org.eu.exodus_privacy.exodusprivacy.objects.Tracker; import java.util.List; -import java.util.Set; public class PermissionListAdapter extends RecyclerView.Adapter{ @@ -67,10 +63,12 @@ public class PermissionListAdapter extends RecyclerView.Adapter { - permission.expanded = !permission.expanded; - manageExpanded(permission); - }); + if( permission.description != null && permission.description.trim().length() > 0) + permissionItemBinding.mainLayout.setOnClickListener((View.OnClickListener) v -> { + permission.expanded = !permission.expanded; + manageExpanded(permission); + }); + } else permissionItemBinding.permissionName.setText(R.string.no_permissions); @@ -79,13 +77,15 @@ public class PermissionListAdapter extends RecyclerView.Adapter 0 ) + permissionItemBinding.arrow.setText("▶"); + else + permissionItemBinding.arrow.setText("■"); permissionItemBinding.permissionDescription.setVisibility(View.GONE); + } } } diff --git a/app/src/main/res/layout/permission_item.xml b/app/src/main/res/layout/permission_item.xml index 1bdac76..035c312 100644 --- a/app/src/main/res/layout/permission_item.xml +++ b/app/src/main/res/layout/permission_item.xml @@ -14,31 +14,19 @@ android:orientation="horizontal" android:layout_width="match_parent" android:layout_height="wrap_content"> - From 9749d594d181dbf41a8a846b833a0524897196e5 Mon Sep 17 00:00:00 2001 From: stom79 Date: Sat, 14 Apr 2018 11:50:04 +0200 Subject: [PATCH 2/3] Fix handle for clicks when no content --- .../exodusprivacy/adapters/PermissionListAdapter.java | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/app/src/main/java/org/eu/exodus_privacy/exodusprivacy/adapters/PermissionListAdapter.java b/app/src/main/java/org/eu/exodus_privacy/exodusprivacy/adapters/PermissionListAdapter.java index 4ecb907..6798182 100644 --- a/app/src/main/java/org/eu/exodus_privacy/exodusprivacy/adapters/PermissionListAdapter.java +++ b/app/src/main/java/org/eu/exodus_privacy/exodusprivacy/adapters/PermissionListAdapter.java @@ -63,15 +63,18 @@ public class PermissionListAdapter extends RecyclerView.Adapter 0) - permissionItemBinding.mainLayout.setOnClickListener((View.OnClickListener) v -> { + permissionItemBinding.mainLayout.setOnClickListener((View.OnClickListener) v -> { + if( permission.description != null && permission.description.trim().length() > 0) { permission.expanded = !permission.expanded; manageExpanded(permission); - }); + } + }); } - else + else { permissionItemBinding.permissionName.setText(R.string.no_permissions); + permissionItemBinding.arrow.setText(" "); + } } From 12c455cce612c7636dad807f3df6ae905c2cfc24 Mon Sep 17 00:00:00 2001 From: stom79 Date: Sat, 14 Apr 2018 11:54:39 +0200 Subject: [PATCH 3/3] Remove drawable padding that is not needed --- app/src/main/res/layout/permission_item.xml | 1 - 1 file changed, 1 deletion(-) diff --git a/app/src/main/res/layout/permission_item.xml b/app/src/main/res/layout/permission_item.xml index 035c312..f149ea4 100644 --- a/app/src/main/res/layout/permission_item.xml +++ b/app/src/main/res/layout/permission_item.xml @@ -26,7 +26,6 @@ android:layout_marginLeft="5dp" />