Search contact

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

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

@ -272,10 +272,11 @@ public class FragmentDialogOpenLink extends FragmentDialogBase {
LocalBroadcastManager lbm = LocalBroadcastManager.getInstance(context); LocalBroadcastManager lbm = LocalBroadcastManager.getInstance(context);
lbm.sendBroadcast( lbm.sendBroadcast(
new Intent(ActivityView.ACTION_SEARCH_SENDER) new Intent(ActivityView.ACTION_SEARCH_ADDRESS)
.putExtra("account", -1L) .putExtra("account", -1L)
.putExtra("folder", -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(); long[] ids = getSelection();
if (ids.length != 1) if (ids.length != 1)
return false; return false;
searchSender(getContext(), getViewLifecycleOwner(), getParentFragmentManager(), ids[0]); searchContact(getContext(), getViewLifecycleOwner(), getParentFragmentManager(), ids[0], true);
return true; return true;
} }
return false; return false;
@ -10106,7 +10106,7 @@ public class FragmentMessages extends FragmentBase
fragmentTransaction.commit(); 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(); Bundle args = new Bundle();
args.putLong("id", message); args.putLong("id", message);
@ -10161,10 +10161,11 @@ public class FragmentMessages extends FragmentBase
String query = ((InternetAddress) addresses[0]).getAddress(); String query = ((InternetAddress) addresses[0]).getAddress();
LocalBroadcastManager lbm = LocalBroadcastManager.getInstance(context); LocalBroadcastManager lbm = LocalBroadcastManager.getInstance(context);
lbm.sendBroadcast( lbm.sendBroadcast(
new Intent(ActivityView.ACTION_SEARCH_SENDER) new Intent(ActivityView.ACTION_SEARCH_ADDRESS)
.putExtra("account", -1L) .putExtra("account", -1L)
.putExtra("folder", -1L) .putExtra("folder", -1L)
.putExtra("query", query)); .putExtra("query", query)
.putExtra("sender_only", sender_only));
} }
@Override @Override

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

Loading…
Cancel
Save