Search dialog layout improvement

This commit is contained in:
M66B 2021-03-27 10:01:55 +01:00
parent f03480de0c
commit e7fe938c32
2 changed files with 93 additions and 87 deletions

View File

@ -79,12 +79,12 @@ public class FragmentDialogSearch extends FragmentDialogBase {
View dview = LayoutInflater.from(context).inflate(R.layout.dialog_search, null); View dview = LayoutInflater.from(context).inflate(R.layout.dialog_search, null);
final AutoCompleteTextView etQuery = dview.findViewById(R.id.etQuery); final AutoCompleteTextView etQuery = dview.findViewById(R.id.etQuery);
final ImageButton ibNotes = dview.findViewById(R.id.ibNotes);
final ImageButton ibAttachment = dview.findViewById(R.id.ibAttachment);
final ImageButton ibEvent = dview.findViewById(R.id.ibInvite);
final ImageButton ibUnseen = dview.findViewById(R.id.ibUnseen);
final ImageButton ibFlagged = dview.findViewById(R.id.ibFlagged);
final ImageButton ibInfo = dview.findViewById(R.id.ibInfo); final ImageButton ibInfo = dview.findViewById(R.id.ibInfo);
final ImageButton ibFlagged = dview.findViewById(R.id.ibFlagged);
final ImageButton ibUnseen = dview.findViewById(R.id.ibUnseen);
final ImageButton ibInvite = dview.findViewById(R.id.ibInvite);
final ImageButton ibAttachment = dview.findViewById(R.id.ibAttachment);
final ImageButton ibNotes = dview.findViewById(R.id.ibNotes);
final ImageButton ibMore = dview.findViewById(R.id.ibMore); final ImageButton ibMore = dview.findViewById(R.id.ibMore);
final TextView tvMore = dview.findViewById(R.id.tvMore); final TextView tvMore = dview.findViewById(R.id.tvMore);
final CheckBox cbSearchIndex = dview.findViewById(R.id.cbSearchIndex); final CheckBox cbSearchIndex = dview.findViewById(R.id.cbSearchIndex);
@ -389,17 +389,17 @@ public class FragmentDialogSearch extends FragmentDialogBase {
BoundaryCallbackMessages.SearchCriteria criteria = new BoundaryCallbackMessages.SearchCriteria(); BoundaryCallbackMessages.SearchCriteria criteria = new BoundaryCallbackMessages.SearchCriteria();
int id = v.getId(); int id = v.getId();
if (id == R.id.ibNotes) if (id == R.id.ibFlagged)
criteria.with_notes = true; criteria.with_flagged = true;
else if (id == R.id.ibAttachment) else if (id == R.id.ibUnseen)
criteria.with_attachments = true; criteria.with_unseen = true;
else if (id == R.id.ibInvite) { else if (id == R.id.ibInvite) {
criteria.with_attachments = true; criteria.with_attachments = true;
criteria.with_types = new String[]{"text/calendar"}; criteria.with_types = new String[]{"text/calendar"};
} else if (id == R.id.ibUnseen) } else if (id == R.id.ibAttachment)
criteria.with_unseen = true; criteria.with_attachments = true;
else if (id == R.id.ibFlagged) else if (id == R.id.ibNotes)
criteria.with_flagged = true; criteria.with_notes = true;
FragmentMessages.search( FragmentMessages.search(
context, getViewLifecycleOwner(), getParentFragmentManager(), context, getViewLifecycleOwner(), getParentFragmentManager(),
@ -409,7 +409,7 @@ public class FragmentDialogSearch extends FragmentDialogBase {
ibNotes.setOnClickListener(onClick); ibNotes.setOnClickListener(onClick);
ibAttachment.setOnClickListener(onClick); ibAttachment.setOnClickListener(onClick);
ibEvent.setOnClickListener(onClick); ibInvite.setOnClickListener(onClick);
ibUnseen.setOnClickListener(onClick); ibUnseen.setOnClickListener(onClick);
ibFlagged.setOnClickListener(onClick); ibFlagged.setOnClickListener(onClick);

View File

@ -1,6 +1,7 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<eu.faircode.email.ScrollViewEx xmlns:android="http://schemas.android.com/apk/res/android" <eu.faircode.email.ScrollViewEx xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:fadeScrollbars="false" android:fadeScrollbars="false"
@ -13,83 +14,14 @@
<eu.faircode.email.FixedTextView <eu.faircode.email.FixedTextView
android:id="@+id/tvCaption" android:id="@+id/tvCaption"
android:layout_width="wrap_content" android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="@string/title_search" android:text="@string/title_search"
android:textAppearance="@style/TextAppearance.AppCompat.Large" android:textAppearance="@style/TextAppearance.AppCompat.Large"
app:layout_constraintEnd_toStartOf="@+id/ibInfo"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" /> app:layout_constraintTop_toTopOf="parent" />
<ImageButton
android:id="@+id/ibNotes"
android:layout_width="36dp"
android:layout_height="36dp"
android:layout_marginEnd="12dp"
android:background="?android:attr/selectableItemBackgroundBorderless"
android:contentDescription="@string/title_search_flag_notes"
android:padding="6dp"
android:scaleType="fitCenter"
android:tooltipText="@string/title_search_flag_notes"
app:layout_constraintEnd_toStartOf="@+id/ibAttachment"
app:layout_constraintTop_toBottomOf="@id/tvCaption"
app:srcCompat="@drawable/twotone_sticky_note_2_24" />
<ImageButton
android:id="@+id/ibAttachment"
android:layout_width="36dp"
android:layout_height="36dp"
android:layout_marginEnd="12dp"
android:background="?android:attr/selectableItemBackgroundBorderless"
android:contentDescription="@string/title_search_flag_attachments"
android:padding="6dp"
android:scaleType="fitCenter"
android:tooltipText="@string/title_search_flag_attachments"
app:layout_constraintEnd_toStartOf="@+id/ibInvite"
app:layout_constraintTop_toBottomOf="@id/tvCaption"
app:srcCompat="@drawable/twotone_attachment_24" />
<ImageButton
android:id="@+id/ibInvite"
android:layout_width="36dp"
android:layout_height="36dp"
android:layout_marginEnd="12dp"
android:background="?android:attr/selectableItemBackgroundBorderless"
android:contentDescription="@string/title_search_flag_invite"
android:padding="6dp"
android:scaleType="fitCenter"
android:tooltipText="@string/title_search_flag_invite"
app:layout_constraintEnd_toStartOf="@+id/ibUnseen"
app:layout_constraintTop_toBottomOf="@id/tvCaption"
app:srcCompat="@drawable/twotone_event_24" />
<ImageButton
android:id="@+id/ibUnseen"
android:layout_width="36dp"
android:layout_height="36dp"
android:layout_marginEnd="12dp"
android:background="?android:attr/selectableItemBackgroundBorderless"
android:contentDescription="@string/title_search_flag_unseen"
android:padding="6dp"
android:scaleType="fitCenter"
android:tooltipText="@string/title_search_flag_unseen"
app:layout_constraintEnd_toStartOf="@+id/ibFlagged"
app:layout_constraintTop_toBottomOf="@id/tvCaption"
app:srcCompat="@drawable/twotone_mail_24" />
<ImageButton
android:id="@+id/ibFlagged"
android:layout_width="36dp"
android:layout_height="36dp"
android:layout_marginEnd="12dp"
android:background="?android:attr/selectableItemBackgroundBorderless"
android:contentDescription="@string/title_search_flag_flagged"
android:padding="6dp"
android:scaleType="fitCenter"
android:tooltipText="@string/title_search_flag_flagged"
app:layout_constraintEnd_toStartOf="@+id/ibInfo"
app:layout_constraintTop_toBottomOf="@id/tvCaption"
app:srcCompat="@drawable/twotone_star_24" />
<ImageButton <ImageButton
android:id="@+id/ibInfo" android:id="@+id/ibInfo"
android:layout_width="36dp" android:layout_width="36dp"
@ -100,9 +32,83 @@
android:scaleType="fitCenter" android:scaleType="fitCenter"
android:tooltipText="@string/title_info" android:tooltipText="@string/title_info"
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toBottomOf="@id/tvCaption" app:layout_constraintTop_toTopOf="parent"
app:srcCompat="@drawable/twotone_info_24" /> app:srcCompat="@drawable/twotone_info_24" />
<androidx.constraintlayout.helper.widget.Flow
android:id="@+id/ibFlow"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="12dp"
app:constraint_referenced_ids="ibFlagged,ibUnseen,ibInvite,ibAttachment,ibNotes"
app:flow_horizontalBias="0"
app:flow_horizontalGap="12dp"
app:flow_horizontalStyle="packed"
app:flow_wrapMode="chain"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/tvCaption" />
<ImageButton
android:id="@+id/ibFlagged"
android:layout_width="36dp"
android:layout_height="36dp"
android:background="?android:attr/selectableItemBackgroundBorderless"
android:contentDescription="@string/title_search_flag_flagged"
android:padding="6dp"
android:scaleType="fitCenter"
android:tooltipText="@string/title_search_flag_flagged"
app:srcCompat="@drawable/twotone_star_24"
tools:ignore="MissingConstraints" />
<ImageButton
android:id="@+id/ibUnseen"
android:layout_width="36dp"
android:layout_height="36dp"
android:background="?android:attr/selectableItemBackgroundBorderless"
android:contentDescription="@string/title_search_flag_unseen"
android:padding="6dp"
android:scaleType="fitCenter"
android:tooltipText="@string/title_search_flag_unseen"
app:srcCompat="@drawable/twotone_mail_24"
tools:ignore="MissingConstraints" />
<ImageButton
android:id="@+id/ibInvite"
android:layout_width="36dp"
android:layout_height="36dp"
android:background="?android:attr/selectableItemBackgroundBorderless"
android:contentDescription="@string/title_search_flag_invite"
android:padding="6dp"
android:scaleType="fitCenter"
android:tooltipText="@string/title_search_flag_invite"
app:srcCompat="@drawable/twotone_event_24"
tools:ignore="MissingConstraints" />
<ImageButton
android:id="@+id/ibAttachment"
android:layout_width="36dp"
android:layout_height="36dp"
android:background="?android:attr/selectableItemBackgroundBorderless"
android:contentDescription="@string/title_search_flag_attachments"
android:padding="6dp"
android:scaleType="fitCenter"
android:tooltipText="@string/title_search_flag_attachments"
app:srcCompat="@drawable/twotone_attachment_24"
tools:ignore="MissingConstraints" />
<ImageButton
android:id="@+id/ibNotes"
android:layout_width="36dp"
android:layout_height="36dp"
android:background="?android:attr/selectableItemBackgroundBorderless"
android:contentDescription="@string/title_search_flag_notes"
android:padding="6dp"
android:scaleType="fitCenter"
android:tooltipText="@string/title_search_flag_notes"
app:srcCompat="@drawable/twotone_sticky_note_2_24"
tools:ignore="MissingConstraints" />
<eu.faircode.email.TextViewAutoCompleteClearable <eu.faircode.email.TextViewAutoCompleteClearable
android:id="@+id/etQuery" android:id="@+id/etQuery"
android:layout_width="0dp" android:layout_width="0dp"
@ -115,7 +121,7 @@
android:maxLines="1" android:maxLines="1"
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/ibInfo" /> app:layout_constraintTop_toBottomOf="@id/ibFlow" />
<eu.faircode.email.FixedTextView <eu.faircode.email.FixedTextView
android:id="@+id/tvHint" android:id="@+id/tvHint"