mirror of
https://github.com/M66B/FairEmail.git
synced 2025-01-01 12:44:42 +00:00
Small improvements
This commit is contained in:
parent
b55442cc8d
commit
54d58812fe
3 changed files with 43 additions and 33 deletions
|
@ -17,6 +17,7 @@ import android.widget.AutoCompleteTextView;
|
|||
import android.widget.CheckBox;
|
||||
import android.widget.CompoundButton;
|
||||
import android.widget.FilterQueryProvider;
|
||||
import android.widget.ImageButton;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
|
@ -32,6 +33,7 @@ public class FragmentDialogSearch extends FragmentDialogBase {
|
|||
View dview = LayoutInflater.from(getContext()).inflate(R.layout.dialog_search, null);
|
||||
|
||||
final AutoCompleteTextView etQuery = dview.findViewById(R.id.etQuery);
|
||||
final ImageButton ibInfo = dview.findViewById(R.id.ibInfo);
|
||||
final CheckBox cbSearchIndex = dview.findViewById(R.id.cbSearchIndex);
|
||||
final CheckBox cbSenders = dview.findViewById(R.id.cbSenders);
|
||||
final CheckBox cbRecipients = dview.findViewById(R.id.cbRecipients);
|
||||
|
@ -52,15 +54,7 @@ public class FragmentDialogSearch extends FragmentDialogBase {
|
|||
boolean filter_unflagged = prefs.getBoolean("filter_unflagged", false);
|
||||
String last_search = prefs.getString("last_search", null);
|
||||
|
||||
if (!TextUtils.isEmpty(last_search)) {
|
||||
etQuery.setText(last_search);
|
||||
etQuery.setSelection(0, last_search.length());
|
||||
}
|
||||
|
||||
etQuery.requestFocus();
|
||||
|
||||
InputMethodManager imm = (InputMethodManager) getContext().getSystemService(Context.INPUT_METHOD_SERVICE);
|
||||
imm.toggleSoftInput(InputMethodManager.SHOW_FORCED, 0);
|
||||
final InputMethodManager imm = (InputMethodManager) getContext().getSystemService(Context.INPUT_METHOD_SERVICE);
|
||||
|
||||
SimpleCursorAdapter adapter = new SimpleCursorAdapter(
|
||||
getContext(),
|
||||
|
@ -87,6 +81,14 @@ public class FragmentDialogSearch extends FragmentDialogBase {
|
|||
|
||||
etQuery.setAdapter(adapter);
|
||||
|
||||
ibInfo.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
imm.hideSoftInputFromWindow(etQuery.getWindowToken(), 0);
|
||||
Helper.viewFAQ(getContext(), 13);
|
||||
}
|
||||
});
|
||||
|
||||
cbSearchIndex.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
||||
@Override
|
||||
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
|
||||
|
@ -108,6 +110,14 @@ public class FragmentDialogSearch extends FragmentDialogBase {
|
|||
cbUnseen.setChecked(filter_seen);
|
||||
cbFlagged.setChecked(filter_unflagged);
|
||||
|
||||
if (!TextUtils.isEmpty(last_search)) {
|
||||
etQuery.setText(last_search);
|
||||
etQuery.setSelection(0, last_search.length());
|
||||
}
|
||||
|
||||
etQuery.requestFocus();
|
||||
imm.toggleSoftInput(InputMethodManager.SHOW_FORCED, 0);
|
||||
|
||||
final AlertDialog dialog = new AlertDialog.Builder(getContext())
|
||||
.setView(dview)
|
||||
.setPositiveButton(android.R.string.yes, new DialogInterface.OnClickListener() {
|
||||
|
@ -137,6 +147,8 @@ public class FragmentDialogSearch extends FragmentDialogBase {
|
|||
criteria.with_attachments = cbAttachments.isChecked();
|
||||
}
|
||||
|
||||
imm.hideSoftInputFromWindow(etQuery.getWindowToken(), 0);
|
||||
|
||||
FragmentMessages.search(
|
||||
getContext(), getViewLifecycleOwner(), getParentFragmentManager(),
|
||||
account, folder, false, criteria);
|
||||
|
@ -148,10 +160,10 @@ public class FragmentDialogSearch extends FragmentDialogBase {
|
|||
// Do nothing
|
||||
}
|
||||
})
|
||||
.setNeutralButton(R.string.title_info, new DialogInterface.OnClickListener() {
|
||||
.setOnDismissListener(new DialogInterface.OnDismissListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
Helper.viewFAQ(getContext(), 13);
|
||||
public void onDismiss(DialogInterface dialog) {
|
||||
imm.hideSoftInputFromWindow(etQuery.getWindowToken(), 0);
|
||||
}
|
||||
})
|
||||
.create();
|
||||
|
|
|
@ -11,18 +11,33 @@
|
|||
|
||||
<eu.faircode.email.FixedTextView
|
||||
android:id="@+id/tvCaption"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/title_search"
|
||||
android:textAppearance="@style/TextAppearance.AppCompat.Large"
|
||||
app:layout_constraintEnd_toStartOf="@id/ibInfo"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<ImageButton
|
||||
android:id="@+id/ibInfo"
|
||||
android:layout_width="36dp"
|
||||
android:layout_height="36dp"
|
||||
android:background="?android:attr/selectableItemBackgroundBorderless"
|
||||
android:contentDescription="@string/title_info"
|
||||
android:foregroundTint="?android:attr/textColorPrimary"
|
||||
android:padding="6dp"
|
||||
android:scaleType="fitCenter"
|
||||
android:tooltipText="@string/title_info"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:srcCompat="@drawable/baseline_info_24" />
|
||||
|
||||
<AutoCompleteTextView
|
||||
android:id="@+id/etQuery"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="12dp"
|
||||
android:layout_marginTop="6dp"
|
||||
android:completionThreshold="2"
|
||||
android:hint="@string/title_search_for_hint"
|
||||
android:imeOptions="actionGo"
|
||||
|
@ -30,7 +45,7 @@
|
|||
android:maxLines="1"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/tvCaption" />
|
||||
app:layout_constraintTop_toBottomOf="@id/ibInfo" />
|
||||
|
||||
<CheckBox
|
||||
android:id="@+id/cbSearchIndex"
|
||||
|
@ -84,7 +99,6 @@
|
|||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="24dp"
|
||||
android:layout_marginTop="12dp"
|
||||
android:checked="true"
|
||||
android:text="@string/title_search_in_keywords"
|
||||
android:textAppearance="@style/TextAppearance.AppCompat.Medium"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
|
@ -167,16 +181,5 @@
|
|||
android:textAppearance="@style/TextAppearance.AppCompat.Medium"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/cbEncrypted" />
|
||||
|
||||
<eu.faircode.email.FixedTextView
|
||||
android:id="@+id/tvHint"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="12dp"
|
||||
android:text="@string/title_search_hint"
|
||||
android:textAppearance="@style/TextAppearance.AppCompat.Small"
|
||||
android:textStyle="italic"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/cbAttachments" />
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
</ScrollView>
|
|
@ -908,7 +908,7 @@
|
|||
<string name="title_search_in_senders">In senders (from)</string>
|
||||
<string name="title_search_in_recipients">In recipients (to, cc)</string>
|
||||
<string name="title_search_in_subject">In subject</string>
|
||||
<string name="title_search_in_keywords">In keyword (if supported)</string>
|
||||
<string name="title_search_in_keywords">In keywords (if supported)</string>
|
||||
<string name="title_search_in_message">In message text</string>
|
||||
<string name="title_search_with">And</string>
|
||||
<string name="title_search_with_unseen">Unread</string>
|
||||
|
@ -922,11 +922,6 @@
|
|||
<string name="title_search_flag_encrypted">encrypted</string>
|
||||
<string name="title_search_flag_attachments">attachments</string>
|
||||
|
||||
<string name="title_search_hint">
|
||||
Searching will initially look at messages stored on your device.
|
||||
To search the server too, tap on the "search again" button.
|
||||
</string>
|
||||
|
||||
<string name="title_search_device">Search on device</string>
|
||||
<string name="title_search_server">Search on server</string>
|
||||
<string name="title_search_in">Search in</string>
|
||||
|
|
Loading…
Reference in a new issue