Refactoring

This commit is contained in:
M66B 2019-09-01 19:19:50 +02:00
parent b6229b9949
commit 72214f2884
1 changed files with 9 additions and 9 deletions

View File

@ -237,7 +237,7 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
private View view; private View view;
private View vwColor; private View vwColor;
private ImageButton ivExpander; private ImageButton ibExpander;
private ImageView ibFlagged; private ImageView ibFlagged;
private ImageView ivAvatar; private ImageView ivAvatar;
private TextView tvFrom; private TextView tvFrom;
@ -345,7 +345,7 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
view = itemView.findViewById(R.id.clItem); view = itemView.findViewById(R.id.clItem);
vwColor = itemView.findViewById(R.id.vwColor); vwColor = itemView.findViewById(R.id.vwColor);
ivExpander = itemView.findViewById(R.id.ibExpander); ibExpander = itemView.findViewById(R.id.ibExpander);
ibFlagged = itemView.findViewById(R.id.ibFlagged); ibFlagged = itemView.findViewById(R.id.ibFlagged);
ivAvatar = itemView.findViewById(R.id.ivAvatar); ivAvatar = itemView.findViewById(R.id.ivAvatar);
tvFrom = itemView.findViewById(subject_top ? R.id.tvSubject : R.id.tvFrom); tvFrom = itemView.findViewById(subject_top ? R.id.tvSubject : R.id.tvFrom);
@ -479,7 +479,7 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
} }
private void wire() { private void wire() {
final View touch = (viewType == ViewType.THREAD ? ivExpander : vwColor); final View touch = (viewType == ViewType.THREAD ? ibExpander : vwColor);
touch.setOnClickListener(this); touch.setOnClickListener(this);
view.post(new Runnable() { view.post(new Runnable() {
@Override @Override
@ -539,7 +539,7 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
} }
private void unwire() { private void unwire() {
final View touch = (viewType == ViewType.THREAD ? ivExpander : vwColor); final View touch = (viewType == ViewType.THREAD ? ibExpander : vwColor);
touch.setOnClickListener(null); touch.setOnClickListener(null);
view.setOnKeyListener(null); view.setOnKeyListener(null);
@ -574,7 +574,7 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
private void clear() { private void clear() {
vwColor.setVisibility(View.GONE); vwColor.setVisibility(View.GONE);
ivExpander.setVisibility(View.GONE); ibExpander.setVisibility(View.GONE);
ibFlagged.setVisibility(View.GONE); ibFlagged.setVisibility(View.GONE);
ivAvatar.setVisibility(View.GONE); ivAvatar.setVisibility(View.GONE);
tvFrom.setText(null); tvFrom.setText(null);
@ -686,11 +686,11 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
// Expander // Expander
boolean expanded = (viewType == ViewType.THREAD && properties.getValue("expanded", message.id)); boolean expanded = (viewType == ViewType.THREAD && properties.getValue("expanded", message.id));
ivExpander.setImageLevel(expanded ? 0 /* less */ : 1 /* more */); ibExpander.setImageLevel(expanded ? 0 /* less */ : 1 /* more */);
if (viewType == ViewType.THREAD) if (viewType == ViewType.THREAD)
ivExpander.setVisibility(EntityFolder.DRAFTS.equals(message.folderType) ? View.INVISIBLE : View.VISIBLE); ibExpander.setVisibility(EntityFolder.DRAFTS.equals(message.folderType) ? View.INVISIBLE : View.VISIBLE);
else else
ivExpander.setVisibility(View.GONE); ibExpander.setVisibility(View.GONE);
// Line 1 // Line 1
boolean outgoing = (viewType != ViewType.THREAD && EntityFolder.isOutgoing(message.folderType)); boolean outgoing = (viewType != ViewType.THREAD && EntityFolder.isOutgoing(message.folderType));
@ -1909,7 +1909,7 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
boolean expanded = !properties.getValue("expanded", message.id); boolean expanded = !properties.getValue("expanded", message.id);
properties.setValue("expanded", message.id, expanded); properties.setValue("expanded", message.id, expanded);
ivExpander.setImageLevel(expanded ? 0 /* less*/ : 1 /* more */); ibExpander.setImageLevel(expanded ? 0 /* less*/ : 1 /* more */);
if (expanded) if (expanded)
bindExpanded(message, true); bindExpanded(message, true);