Moved text search to bottom

This commit is contained in:
M66B 2021-07-02 09:18:22 +02:00
parent c599b323b7
commit 3f830f2639
2 changed files with 68 additions and 68 deletions

View File

@ -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) {

View File

@ -135,23 +135,6 @@
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/tvHintSelect" />
<eu.faircode.email.TextViewAutoCompleteAction
android:id="@+id/etSearch"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_margin="6dp"
android:background="?attr/colorSeparator"
android:completionThreshold="2"
android:hint="@string/title_search_for_hint"
android:imeOptions="actionDone"
android:inputType="text"
android:maxLines="1"
android:padding="6dp"
app:end_drawable="@drawable/twotone_fast_forward_24"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/vSeparatorHintSelect" />
<eu.faircode.email.ViewTextDelayed
android:id="@+id/tvNoEmail"
android:layout_width="wrap_content"
@ -190,7 +173,7 @@
app:layout_constraintBottom_toTopOf="@+id/sbThread"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/etSearch" />
app:layout_constraintTop_toBottomOf="@id/vSeparatorHintSelect" />
<View
android:id="@+id/vwAnchor"
@ -258,7 +241,7 @@
android:background="?attr/selectableItemBackground"
android:contentDescription="@string/title_folder_outbox"
android:padding="12dp"
app:layout_constraintBottom_toTopOf="@+id/bottom_navigation"
app:layout_constraintBottom_toTopOf="@+id/etSearch"
app:layout_constraintStart_toStartOf="parent"
app:srcCompat="@drawable/twotone_schedule_send_24"
app:tint="?attr/colorSeparator" />
@ -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" />
<eu.faircode.email.TextViewAutoCompleteAction
android:id="@+id/etSearch"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:background="?attr/colorSeparator"
android:completionThreshold="2"
android:hint="@string/title_search_for_hint"
android:imeOptions="actionDone"
android:inputType="text"
android:maxLines="1"
android:padding="6dp"
app:end_drawable="@drawable/twotone_fast_forward_24"
app:layout_constraintBottom_toTopOf="@id/bottom_navigation"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent" />