Error layout improvement

pull/194/merge
M66B 3 years ago
parent 312aa299f7
commit 99d8685e0c

@ -361,7 +361,6 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
private TextView tvPreview;
private TextView tvNotes;
private TextView tvError;
private ImageButton ibHelp;
private ImageButton ibSettings;
private View vsBody;
@ -669,7 +668,6 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
tvCount = itemView.findViewById(R.id.tvCount);
ivThread = itemView.findViewById(R.id.ivThread);
tvError = itemView.findViewById(R.id.tvError);
ibHelp = itemView.findViewById(R.id.ibHelp);
ibSettings = itemView.findViewById(R.id.ibSettings);
if (vwColor != null)
@ -908,7 +906,7 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
ibFlagged.setOnLongClickListener(this);
tvFolder.setOnLongClickListener(this);
}
ibHelp.setOnClickListener(this);
tvError.setOnClickListener(this);
ibSettings.setOnClickListener(this);
if (vsBody != null) {
@ -1008,7 +1006,7 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
ibFlagged.setOnLongClickListener(null);
tvFolder.setOnLongClickListener(null);
}
ibHelp.setOnClickListener(null);
tvError.setOnClickListener(null);
ibSettings.setOnClickListener(null);
if (vsBody != null) {
@ -1404,7 +1402,6 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
error = message.thread;
tvError.setText(error);
tvError.setVisibility(error == null ? View.GONE : View.VISIBLE);
ibHelp.setVisibility(error == null ? View.GONE : View.VISIBLE);
ibSettings.setVisibility(
error != null && EntityFolder.OUTBOX.equals(message.folderType)
? View.VISIBLE : View.GONE);
@ -3413,7 +3410,7 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
onShowSnoozed(message);
else if (view.getId() == R.id.ibFlagged)
onToggleFlag(message);
else if (view.getId() == R.id.ibHelp)
else if (view.getId() == R.id.tvError)
onHelp(message);
else if (view.getId() == R.id.ibSettings)
onSettings(message);
@ -3954,6 +3951,13 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
}
private void onHelp(TupleMessageEx message) {
ClipboardManager clipboard =
(ClipboardManager) context.getSystemService(Context.CLIPBOARD_SERVICE);
if (clipboard != null) {
ClipData clip = ClipData.newPlainText(context.getString(R.string.app_name), tvError.getText());
clipboard.setPrimaryClip(clip);
}
Helper.viewFAQ(context, 130);
}
@ -5889,10 +5893,10 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
context.getString(R.string.title_accessibility_show_snooze_time)));
ibSnoozed.setImportantForAccessibility(View.IMPORTANT_FOR_ACCESSIBILITY_NO);
if (ibHelp.getVisibility() == View.VISIBLE)
info.addAction(new AccessibilityNodeInfo.AccessibilityAction(R.id.ibHelp,
if (tvError.getVisibility() == View.VISIBLE)
info.addAction(new AccessibilityNodeInfo.AccessibilityAction(R.id.tvError,
context.getString(R.string.title_accessibility_view_help)));
ibHelp.setImportantForAccessibility(View.IMPORTANT_FOR_ACCESSIBILITY_NO);
tvError.setImportantForAccessibility(View.IMPORTANT_FOR_ACCESSIBILITY_NO);
info.setContentDescription(populateContentDescription(message));
}
@ -5918,7 +5922,7 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
} else if (action == R.id.ibSnoozed) {
onShowSnoozed(message);
return true;
} else if (action == R.id.ibHelp) {
} else if (action == R.id.tvError) {
onHelp(message);
return true;
}

@ -389,36 +389,27 @@
android:layout_height="wrap_content"
android:layout_marginStart="6dp"
android:layout_marginEnd="6dp"
android:background="?android:attr/selectableItemBackground"
android:drawableStart="@drawable/twotone_info_24"
android:drawablePadding="6dp"
android:drawableTint="?attr/colorWarning"
android:gravity="center_vertical"
android:minHeight="24dp"
android:text="error"
android:textAppearance="@style/TextAppearance.AppCompat.Small"
android:textColor="?attr/colorWarning"
android:textIsSelectable="true"
app:layout_constraintEnd_toStartOf="@+id/ibHelp"
app:layout_constraintEnd_toStartOf="@+id/ibSettings"
app:layout_constraintStart_toEndOf="@id/paddingStart"
app:layout_constraintTop_toBottomOf="@id/tvNotes" />
<ImageButton
android:id="@+id/ibHelp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="6dp"
android:background="?android:attr/selectableItemBackgroundBorderless"
app:layout_constraintEnd_toStartOf="@+id/paddingEnd"
app:layout_constraintTop_toTopOf="@id/tvError"
app:srcCompat="@drawable/twotone_info_24"
app:tint="?attr/colorWarning" />
<ImageButton
android:id="@+id/ibSettings"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="6dp"
android:layout_marginEnd="6dp"
android:background="?android:attr/selectableItemBackgroundBorderless"
app:layout_constraintEnd_toStartOf="@+id/paddingEnd"
app:layout_constraintTop_toBottomOf="@id/ibHelp"
app:layout_constraintTop_toTopOf="@id/tvError"
app:srcCompat="@drawable/twotone_settings_24"
app:tint="?attr/colorWarning" />
@ -438,5 +429,5 @@
android:visibility="gone"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/ibSettings" />
app:layout_constraintTop_toBottomOf="@id/tvError" />
</androidx.constraintlayout.widget.ConstraintLayout>

@ -389,36 +389,27 @@
android:layout_marginStart="6dp"
android:layout_marginTop="6dp"
android:layout_marginEnd="6dp"
android:background="?android:attr/selectableItemBackground"
android:drawableStart="@drawable/twotone_info_24"
android:drawablePadding="6dp"
android:drawableTint="?attr/colorWarning"
android:gravity="center_vertical"
android:minHeight="24dp"
android:text="error"
android:textAppearance="@style/TextAppearance.AppCompat.Small"
android:textColor="?attr/colorWarning"
android:textIsSelectable="true"
app:layout_constraintEnd_toStartOf="@+id/ibHelp"
app:layout_constraintEnd_toStartOf="@+id/ibSettings"
app:layout_constraintStart_toEndOf="@id/paddingStart"
app:layout_constraintTop_toBottomOf="@id/tvNotes" />
<ImageButton
android:id="@+id/ibHelp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="6dp"
android:background="?android:attr/selectableItemBackgroundBorderless"
app:layout_constraintEnd_toStartOf="@+id/paddingEnd"
app:layout_constraintTop_toTopOf="@id/tvError"
app:srcCompat="@drawable/twotone_info_24"
app:tint="?attr/colorWarning" />
<ImageButton
android:id="@+id/ibSettings"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="6dp"
android:layout_marginEnd="6dp"
android:background="?android:attr/selectableItemBackgroundBorderless"
app:layout_constraintEnd_toStartOf="@+id/paddingEnd"
app:layout_constraintTop_toBottomOf="@id/ibHelp"
app:layout_constraintTop_toTopOf="@id/tvError"
app:srcCompat="@drawable/twotone_settings_24"
app:tint="?attr/colorWarning" />
@ -436,5 +427,5 @@
android:layout_height="3dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/ibSettings" />
app:layout_constraintTop_toBottomOf="@id/tvError" />
</androidx.constraintlayout.widget.ConstraintLayout>

Loading…
Cancel
Save