diff --git a/app/src/main/java/eu/faircode/email/FragmentMessages.java b/app/src/main/java/eu/faircode/email/FragmentMessages.java index 59d23f55e6..a40d2d31ee 100644 --- a/app/src/main/java/eu/faircode/email/FragmentMessages.java +++ b/app/src/main/java/eu/faircode/email/FragmentMessages.java @@ -249,7 +249,6 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences. private ImageButton ibHintSupport; private ImageButton ibHintSwipe; private ImageButton ibHintSelect; - private TextViewAutoCompleteAction etSearch; private TextView tvNoEmail; private TextView tvNoEmailHint; private FixedRecyclerView rvMessage; @@ -262,6 +261,7 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences. private ImageButton ibSeen; private ImageButton ibUnflagged; private ImageButton ibSnoozed; + private TextViewAutoCompleteAction etSearch; private BottomNavigationView bottom_navigation; private ContentLoadingProgressBar pbWait; private Group grpSupport; @@ -472,7 +472,6 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences. ibHintSupport = view.findViewById(R.id.ibHintSupport); ibHintSwipe = view.findViewById(R.id.ibHintSwipe); ibHintSelect = view.findViewById(R.id.ibHintSelect); - etSearch = view.findViewById(R.id.etSearch); tvNoEmail = view.findViewById(R.id.tvNoEmail); tvNoEmailHint = view.findViewById(R.id.tvNoEmailHint); rvMessage = view.findViewById(R.id.rvMessage); @@ -485,6 +484,7 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences. ibSeen = view.findViewById(R.id.ibSeen); ibUnflagged = view.findViewById(R.id.ibUnflagged); ibSnoozed = view.findViewById(R.id.ibSnoozed); + etSearch = view.findViewById(R.id.etSearch); bottom_navigation = view.findViewById(R.id.bottom_navigation); pbWait = view.findViewById(R.id.pbWait); @@ -548,49 +548,6 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences. } }); - etSearch.setOnFocusChangeListener(new View.OnFocusChangeListener() { - @Override - public void onFocusChange(View v, boolean hasFocus) { - if (!hasFocus) - endSearch(); - } - }); - - etSearch.setOnEditorActionListener(new TextView.OnEditorActionListener() { - @Override - public boolean onEditorAction(TextView v, int actionId, KeyEvent event) { - if (actionId == EditorInfo.IME_ACTION_DONE) { - endSearch(); - return true; - } else - return false; - } - }); - - etSearch.setActionRunnable(new Runnable() { - @Override - public void run() { - performSearch(true); - } - }); - - etSearch.addTextChangedListener(new TextWatcher() { - @Override - public void beforeTextChanged(CharSequence s, int start, int count, int after) { - // Do nothing - } - - @Override - public void onTextChanged(CharSequence s, int start, int before, int count) { - performSearch(false); - } - - @Override - public void afterTextChanged(Editable s) { - // Do nothing - } - }); - rvMessage.setHasFixedSize(false); int threads = prefs.getInt("query_threads", 4); @@ -878,6 +835,50 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences. } }); + + etSearch.setOnFocusChangeListener(new View.OnFocusChangeListener() { + @Override + public void onFocusChange(View v, boolean hasFocus) { + if (!hasFocus) + endSearch(); + } + }); + + etSearch.setOnEditorActionListener(new TextView.OnEditorActionListener() { + @Override + public boolean onEditorAction(TextView v, int actionId, KeyEvent event) { + if (actionId == EditorInfo.IME_ACTION_DONE) { + endSearch(); + return true; + } else + return false; + } + }); + + etSearch.setActionRunnable(new Runnable() { + @Override + public void run() { + performSearch(true); + } + }); + + etSearch.addTextChangedListener(new TextWatcher() { + @Override + public void beforeTextChanged(CharSequence s, int start, int count, int after) { + // Do nothing + } + + @Override + public void onTextChanged(CharSequence s, int start, int before, int count) { + performSearch(false); + } + + @Override + public void afterTextChanged(Editable s) { + // Do nothing + } + }); + //bottom_navigation.findViewById(R.id.action_delete).setOnLongClickListener(new View.OnLongClickListener() { // @Override // public boolean onLongClick(View v) { diff --git a/app/src/main/res/layout/fragment_messages.xml b/app/src/main/res/layout/fragment_messages.xml index ca7e122ffa..d308bb03e8 100644 --- a/app/src/main/res/layout/fragment_messages.xml +++ b/app/src/main/res/layout/fragment_messages.xml @@ -135,23 +135,6 @@ app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toBottomOf="@id/tvHintSelect" /> - - + app:layout_constraintTop_toBottomOf="@id/vSeparatorHintSelect" /> @@ -282,7 +265,7 @@ android:background="?attr/selectableItemBackground" android:contentDescription="@string/title_accessibility_filter_out_seen" android:padding="12dp" - app:layout_constraintBottom_toTopOf="@+id/bottom_navigation" + app:layout_constraintBottom_toTopOf="@+id/etSearch" app:layout_constraintEnd_toStartOf="@id/ibUnflagged" app:layout_constraintHorizontal_chainStyle="packed" app:layout_constraintStart_toStartOf="parent" @@ -296,7 +279,7 @@ android:background="?attr/selectableItemBackground" android:contentDescription="@string/title_accessibility_filter_out_unflagged" android:padding="12dp" - app:layout_constraintBottom_toTopOf="@+id/bottom_navigation" + app:layout_constraintBottom_toTopOf="@+id/etSearch" app:layout_constraintEnd_toStartOf="@+id/ibSnoozed" app:layout_constraintStart_toEndOf="@id/ibSeen" app:srcCompat="@drawable/baseline_star_24" @@ -309,7 +292,7 @@ android:background="?attr/selectableItemBackground" android:contentDescription="@string/title_accessibility_filter_out_snoozed" android:padding="12dp" - app:layout_constraintBottom_toTopOf="@+id/bottom_navigation" + app:layout_constraintBottom_toTopOf="@+id/etSearch" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintStart_toEndOf="@id/ibUnflagged" app:srcCompat="@drawable/twotone_timelapse_24" @@ -319,7 +302,23 @@ android:id="@+id/sbThread" android:layout_width="match_parent" android:layout_height="wrap_content" - app:layout_constraintBottom_toTopOf="@+id/bottom_navigation" + app:layout_constraintBottom_toTopOf="@+id/etSearch" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintStart_toStartOf="parent" /> + +