Merge branch 'expand_buttons' into stom79_baseline
This commit is contained in:
commit
b2fde810cd
|
@ -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<PermissionListAdapter.TrackerListViewHolder>{
|
||||
|
||||
|
@ -68,24 +64,31 @@ public class PermissionListAdapter extends RecyclerView.Adapter<PermissionListAd
|
|||
permissionItemBinding.permissionDescription.setText(permission.description);
|
||||
manageExpanded(permission);
|
||||
permissionItemBinding.mainLayout.setOnClickListener((View.OnClickListener) v -> {
|
||||
permission.expanded = !permission.expanded;
|
||||
manageExpanded(permission);
|
||||
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(" ");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void manageExpanded(Permission permission) {
|
||||
if(permission.expanded) {
|
||||
permissionItemBinding.rightArrow.setVisibility(View.GONE);
|
||||
permissionItemBinding.downArrow.setVisibility(View.VISIBLE);
|
||||
permissionItemBinding.arrow.setText("▼");
|
||||
permissionItemBinding.permissionDescription.setVisibility(View.VISIBLE);
|
||||
} else {
|
||||
permissionItemBinding.rightArrow.setVisibility(View.VISIBLE);
|
||||
permissionItemBinding.downArrow.setVisibility(View.GONE);
|
||||
if( permission.description != null && permission.description.trim().length() > 0 )
|
||||
permissionItemBinding.arrow.setText("▶");
|
||||
else
|
||||
permissionItemBinding.arrow.setText("■");
|
||||
permissionItemBinding.permissionDescription.setVisibility(View.GONE);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -14,27 +14,14 @@
|
|||
android:orientation="horizontal"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
<TextView
|
||||
android:text="▶"
|
||||
android:id="@+id/right_arrow"
|
||||
android:textColor="@android:color/black"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginEnd="10dp"
|
||||
android:layout_marginRight="10dp"
|
||||
|
||||
android:layout_marginStart="5dp"
|
||||
android:layout_marginLeft="5dp"
|
||||
/>
|
||||
<TextView
|
||||
android:text="▼"
|
||||
android:id="@+id/down_arrow"
|
||||
android:id="@+id/arrow"
|
||||
android:textColor="@android:color/black"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginEnd="10dp"
|
||||
android:layout_marginRight="10dp"
|
||||
|
||||
android:layout_marginStart="5dp"
|
||||
android:layout_marginLeft="5dp"
|
||||
/>
|
||||
|
|
Loading…
Reference in New Issue