+ tagAndHandleLayout = view.findViewById(R.id.handle_and_tag);
+ mRow = (ConstraintLayout) view;
+
+
+ mRow.setOnClickListener(this::onProfileRowClicked);
+ mTitle.setOnClickListener(v -> {
+ View row = (View) v.getParent();
+ onProfileRowClicked(row);
+ });
+ mColorTag.setOnClickListener(v -> {
+ View row = (View) v.getParent()
+ .getParent();
+ onProfileRowClicked(row);
+ });
+ mTitle.setOnLongClickListener(v -> {
+ flipEditingProfiles();
+ return true;
+ });
+
+ View.OnTouchListener dragStarter = (v, event) -> {
+ if (rearrangeHelper != null && editingProfiles()) {
+ rearrangeHelper.startDrag(this);
+ return true;
+ }
+ return false;
+ };
+
+ tagAndHandleLayout.setOnTouchListener(dragStarter);
+ }
+ private void onProfileRowClicked(View v) {
+ if (editingProfiles())
+ return;
+ Profile profile = listDiffer.getCurrentList()
+ .get(getBindingAdapterPosition());
+ if (Data.getProfile() != profile) {
+ debug("profiles", "Setting profile to " + profile.getName());
+ Data.drawerOpen.setValue(false);
+ Data.setCurrentProfile(profile);
+ }
+ else
+ debug("profiles",
+ "Not setting profile to the current profile " + profile.getName());