Search contact

pull/210/head
M66B 2 years ago
parent bd86097300
commit 0b898d07c0

@ -168,7 +168,7 @@ public class ActivityView extends ActivityBilling implements FragmentManager.OnB
static final String ACTION_VIEW_FOLDERS = BuildConfig.APPLICATION_ID + ".VIEW_FOLDERS";
static final String ACTION_VIEW_MESSAGES = BuildConfig.APPLICATION_ID + ".VIEW_MESSAGES";
static final String ACTION_SEARCH_SENDER = BuildConfig.APPLICATION_ID + ".SEARCH_SENDER";
static final String ACTION_SEARCH_ADDRESS = BuildConfig.APPLICATION_ID + ".SEARCH_ADDRESS";
static final String ACTION_VIEW_THREAD = BuildConfig.APPLICATION_ID + ".VIEW_THREAD";
static final String ACTION_EDIT_FOLDER = BuildConfig.APPLICATION_ID + ".EDIT_FOLDER";
static final String ACTION_VIEW_OUTBOX = BuildConfig.APPLICATION_ID + ".VIEW_OUTBOX";
@ -1072,7 +1072,7 @@ public class ActivityView extends ActivityBilling implements FragmentManager.OnB
IntentFilter iff = new IntentFilter();
iff.addAction(ACTION_VIEW_FOLDERS);
iff.addAction(ACTION_VIEW_MESSAGES);
iff.addAction(ACTION_SEARCH_SENDER);
iff.addAction(ACTION_SEARCH_ADDRESS);
iff.addAction(ACTION_VIEW_THREAD);
iff.addAction(ACTION_EDIT_FOLDER);
iff.addAction(ACTION_VIEW_OUTBOX);
@ -2116,8 +2116,8 @@ public class ActivityView extends ActivityBilling implements FragmentManager.OnB
onViewFolders(intent);
else if (ACTION_VIEW_MESSAGES.equals(action))
onViewMessages(intent);
else if (ACTION_SEARCH_SENDER.equals(action))
onSearchSender(intent);
else if (ACTION_SEARCH_ADDRESS.equals(action))
onSearchAddress(intent);
else if (ACTION_VIEW_THREAD.equals(action))
onViewThread(intent);
else if (ACTION_EDIT_FOLDER.equals(action))
@ -2175,10 +2175,11 @@ public class ActivityView extends ActivityBilling implements FragmentManager.OnB
fragmentTransaction.commit();
}
private void onSearchSender(Intent intent) {
private void onSearchAddress(Intent intent) {
long account = intent.getLongExtra("account", -1);
long folder = intent.getLongExtra("folder", -1);
String query = intent.getStringExtra("query");
boolean sender_only = intent.getBooleanExtra("sender_only", false);
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this);
boolean fts = prefs.getBoolean("fts", false);
@ -2187,11 +2188,13 @@ public class ActivityView extends ActivityBilling implements FragmentManager.OnB
criteria.query = query;
criteria.fts = fts;
criteria.in_senders = true;
criteria.in_recipients = false;
criteria.in_subject = false;
criteria.in_keywords = false;
criteria.in_message = false;
criteria.in_notes = false;
if (sender_only) {
criteria.in_recipients = false;
criteria.in_subject = false;
criteria.in_keywords = false;
criteria.in_message = false;
criteria.in_notes = false;
}
FragmentMessages.search(
this, this, getSupportFragmentManager(),

@ -4071,7 +4071,7 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
else if (id == R.id.ibReceipt)
onReceipt(message);
else if (id == R.id.ibSearchContact)
onSearchContact(message);
onSearchContact(message, false);
else if (id == R.id.ibNotifyContact)
onNotifyContact(message);
else if (id == R.id.ibPinContact)
@ -4135,7 +4135,7 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
} else if (id == R.id.ibSearchText) {
onSearchText(message);
} else if (id == R.id.ibSearch) {
onSearchContact(message);
onSearchContact(message, false);
} else if (id == R.id.ibTranslate) {
if (DeepL.canTranslate(context))
onActionTranslate(message);
@ -4789,8 +4789,8 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
}
}
private void onSearchContact(TupleMessageEx message) {
FragmentMessages.searchSender(context, owner, parentFragment.getParentFragmentManager(), message.id);
private void onSearchContact(TupleMessageEx message, boolean sender_only) {
FragmentMessages.searchContact(context, owner, parentFragment.getParentFragmentManager(), message.id, sender_only);
}
@TargetApi(Build.VERSION_CODES.O)

@ -272,10 +272,11 @@ public class FragmentDialogOpenLink extends FragmentDialogBase {
LocalBroadcastManager lbm = LocalBroadcastManager.getInstance(context);
lbm.sendBroadcast(
new Intent(ActivityView.ACTION_SEARCH_SENDER)
new Intent(ActivityView.ACTION_SEARCH_ADDRESS)
.putExtra("account", -1L)
.putExtra("folder", -1L)
.putExtra("query", MailTo.parse(uri).getTo()));
.putExtra("query", MailTo.parse(uri).getTo())
.putExtra("sender_only", false));
}
});

@ -3815,7 +3815,7 @@ public class FragmentMessages extends FragmentBase
long[] ids = getSelection();
if (ids.length != 1)
return false;
searchSender(getContext(), getViewLifecycleOwner(), getParentFragmentManager(), ids[0]);
searchContact(getContext(), getViewLifecycleOwner(), getParentFragmentManager(), ids[0], true);
return true;
}
return false;
@ -10106,7 +10106,7 @@ public class FragmentMessages extends FragmentBase
fragmentTransaction.commit();
}
static void searchSender(Context context, LifecycleOwner owner, FragmentManager fm, long message) {
static void searchContact(Context context, LifecycleOwner owner, FragmentManager fm, long message, boolean sender_only) {
Bundle args = new Bundle();
args.putLong("id", message);
@ -10161,10 +10161,11 @@ public class FragmentMessages extends FragmentBase
String query = ((InternetAddress) addresses[0]).getAddress();
LocalBroadcastManager lbm = LocalBroadcastManager.getInstance(context);
lbm.sendBroadcast(
new Intent(ActivityView.ACTION_SEARCH_SENDER)
new Intent(ActivityView.ACTION_SEARCH_ADDRESS)
.putExtra("account", -1L)
.putExtra("folder", -1L)
.putExtra("query", query));
.putExtra("query", query)
.putExtra("sender_only", sender_only));
}
@Override

@ -207,7 +207,7 @@
android:layout_marginTop="12dp"
android:drawableEnd="@drawable/twotone_search_24"
android:drawablePadding="6dp"
android:text="@string/title_search_sender"
android:text="@string/title_button_search"
android:textAppearance="@style/TextAppearance.AppCompat.Small"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"

Loading…
Cancel
Save