mirror of https://github.com/M66B/FairEmail.git
Made search for sender public
This commit is contained in:
parent
a8eed5fead
commit
35c7993d92
|
@ -133,6 +133,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 = BuildConfig.APPLICATION_ID + ".SEARCH";
|
||||
static final String ACTION_VIEW_THREAD = BuildConfig.APPLICATION_ID + ".VIEW_THREAD";
|
||||
static final String ACTION_STORE_RAW = BuildConfig.APPLICATION_ID + ".STORE_RAW";
|
||||
static final String ACTION_EDIT_FOLDER = BuildConfig.APPLICATION_ID + ".EDIT_FOLDER";
|
||||
|
@ -534,6 +535,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);
|
||||
iff.addAction(ACTION_VIEW_THREAD);
|
||||
iff.addAction(ACTION_STORE_RAW);
|
||||
iff.addAction(ACTION_EDIT_FOLDER);
|
||||
|
@ -1012,6 +1014,8 @@ public class ActivityView extends ActivityBilling implements FragmentManager.OnB
|
|||
onViewFolders(intent);
|
||||
else if (ACTION_VIEW_MESSAGES.equals(action))
|
||||
onViewMessages(intent);
|
||||
else if (ACTION_SEARCH.equals(action))
|
||||
onSearchMessages(intent);
|
||||
else if (ACTION_VIEW_THREAD.equals(action))
|
||||
onViewThread(intent);
|
||||
else if (ACTION_STORE_RAW.equals(action))
|
||||
|
@ -1061,6 +1065,14 @@ public class ActivityView extends ActivityBilling implements FragmentManager.OnB
|
|||
fragmentTransaction.commit();
|
||||
}
|
||||
|
||||
private void onSearchMessages(Intent intent) {
|
||||
long folder = intent.getLongExtra("folder", -1);
|
||||
String query = intent.getStringExtra("search");
|
||||
FragmentMessages.search(
|
||||
this, this, getSupportFragmentManager(),
|
||||
folder, false, query);
|
||||
}
|
||||
|
||||
private void onViewThread(Intent intent) {
|
||||
boolean found = intent.getBooleanExtra("found", false);
|
||||
|
||||
|
|
|
@ -26,7 +26,6 @@ import android.app.Dialog;
|
|||
import android.app.Notification;
|
||||
import android.app.NotificationChannel;
|
||||
import android.app.NotificationManager;
|
||||
import android.content.ComponentName;
|
||||
import android.content.ContentResolver;
|
||||
import android.content.Context;
|
||||
import android.content.DialogInterface;
|
||||
|
@ -144,7 +143,6 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
|
|||
|
||||
private boolean hasWebView;
|
||||
private boolean contacts;
|
||||
private boolean search;
|
||||
private float textSize;
|
||||
|
||||
private boolean date;
|
||||
|
@ -759,9 +757,10 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
|
|||
grpExpanded.setVisibility(View.VISIBLE);
|
||||
|
||||
boolean hasFrom = (message.from != null && message.from.length > 0);
|
||||
boolean hasTo = (message.to != null && message.to.length > 0);
|
||||
boolean hasChannel = (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O);
|
||||
|
||||
ibSearchContact.setVisibility(show_addresses && search && BuildConfig.DEBUG ? View.VISIBLE : View.GONE);
|
||||
ibSearchContact.setVisibility(show_addresses && (hasFrom || hasTo) ? View.VISIBLE : View.GONE);
|
||||
ibNotifyContact.setVisibility(show_addresses && hasChannel && hasFrom ? View.VISIBLE : View.GONE);
|
||||
ibAddContact.setVisibility(show_addresses && contacts && hasFrom ? View.VISIBLE : View.GONE);
|
||||
|
||||
|
@ -1205,11 +1204,12 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
|
|||
|
||||
@Override
|
||||
protected void onExecuted(Bundle args, Address[] addresses) {
|
||||
if (addresses != null && addresses.length > 0) {
|
||||
Intent search = new Intent(context, ActivityView.class);
|
||||
search.putExtra(Intent.EXTRA_PROCESS_TEXT, ((InternetAddress) addresses[0]).getAddress());
|
||||
context.startActivity(search);
|
||||
}
|
||||
String query = ((InternetAddress) addresses[0]).getAddress();
|
||||
LocalBroadcastManager lbm = LocalBroadcastManager.getInstance(context);
|
||||
lbm.sendBroadcast(
|
||||
new Intent(ActivityView.ACTION_SEARCH)
|
||||
.putExtra("folder", -1L)
|
||||
.putExtra("query", query));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -3012,9 +3012,6 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
|
|||
|
||||
this.hasWebView = Helper.hasWebView(context);
|
||||
this.contacts = Helper.hasPermission(context, Manifest.permission.READ_CONTACTS);
|
||||
this.search = (context.getPackageManager().getComponentEnabledSetting(
|
||||
new ComponentName(context, ActivitySearch.class)) ==
|
||||
PackageManager.COMPONENT_ENABLED_STATE_ENABLED);
|
||||
this.textSize = Helper.getTextSize(context, zoom);
|
||||
|
||||
this.date = prefs.getBoolean("date", true);
|
||||
|
|
|
@ -259,6 +259,28 @@
|
|||
app:layout_constraintStart_toEndOf="@id/ivContacts"
|
||||
app:layout_constraintTop_toTopOf="@id/ivContacts" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/ivSearch"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:contentDescription="@string/title_legend_search"
|
||||
android:padding="12dp"
|
||||
android:src="@drawable/baseline_search_24"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/ivContacts" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvSearch"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="0dp"
|
||||
android:gravity="center_vertical"
|
||||
android:text="@string/title_legend_search"
|
||||
android:textAppearance="@style/TextAppearance.AppCompat.Medium"
|
||||
app:layout_constraintBottom_toBottomOf="@id/ivSearch"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toEndOf="@id/ivSearch"
|
||||
app:layout_constraintTop_toTopOf="@id/ivSearch" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/ivView"
|
||||
android:layout_width="wrap_content"
|
||||
|
@ -267,7 +289,7 @@
|
|||
android:padding="12dp"
|
||||
android:src="@drawable/baseline_visibility_24"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/ivContacts" />
|
||||
app:layout_constraintTop_toBottomOf="@id/ivSearch" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvView"
|
||||
|
|
|
@ -596,6 +596,7 @@
|
|||
<string name="title_legend_attachment">Has attachment</string>
|
||||
<string name="title_legend_flagged">Is favorite</string>
|
||||
<string name="title_legend_contacts">Manage contacts</string>
|
||||
<string name="title_legend_search">Search for sender</string>
|
||||
<string name="title_legend_view">View content</string>
|
||||
<string name="title_legend_hide">Hide content</string>
|
||||
<string name="title_legend_download">Download content</string>
|
||||
|
|
Loading…
Reference in New Issue