Made search for sender public

This commit is contained in:
M66B
2019-05-13 14:08:51 +02:00
parent a8eed5fead
commit 35c7993d92
4 changed files with 44 additions and 12 deletions

View File

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