mirror of
https://github.com/M66B/FairEmail.git
synced 2025-02-23 14:41:08 +00:00
Use intermediate activity for search
This commit is contained in:
parent
77610730aa
commit
9fe22c7609
4 changed files with 37 additions and 9 deletions
|
@ -41,6 +41,7 @@
|
|||
<activity
|
||||
android:name=".ActivityMain"
|
||||
android:excludeFromRecents="true"
|
||||
android:exported="true"
|
||||
android:launchMode="singleInstance"
|
||||
android:theme="@style/Theme.Transparent">
|
||||
|
||||
|
@ -68,9 +69,18 @@
|
|||
|
||||
<activity
|
||||
android:name=".ActivityView"
|
||||
android:exported="true"
|
||||
android:exported="false"
|
||||
android:launchMode="singleTop"
|
||||
android:parentActivityName=".ActivityMain">
|
||||
android:parentActivityName=".ActivityMain" />
|
||||
|
||||
<activity
|
||||
android:name=".ActivitySearch"
|
||||
android:excludeFromRecents="true"
|
||||
android:exported="true"
|
||||
android:icon="@mipmap/ic_launcher"
|
||||
android:label="@string/app_name"
|
||||
android:launchMode="singleTop"
|
||||
android:theme="@style/Theme.Transparent">
|
||||
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.PROCESS_TEXT" />
|
||||
|
|
18
app/src/main/java/eu/faircode/email/ActivitySearch.java
Normal file
18
app/src/main/java/eu/faircode/email/ActivitySearch.java
Normal file
|
@ -0,0 +1,18 @@
|
|||
package eu.faircode.email;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
|
||||
public class ActivitySearch extends ActivityBase {
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
Intent view = new Intent(this, ActivityView.class);
|
||||
view.putExtra(Intent.EXTRA_PROCESS_TEXT, getIntent().getCharSequenceExtra(Intent.EXTRA_PROCESS_TEXT));
|
||||
startActivity(view);
|
||||
|
||||
finish();
|
||||
}
|
||||
}
|
|
@ -288,9 +288,9 @@ public class ServiceSynchronize extends LifecycleService {
|
|||
PackageManager pm = getPackageManager();
|
||||
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this);
|
||||
if (prefs.getBoolean("why", false) || why.resolveActivity(pm) == null) {
|
||||
Intent main = new Intent(this, ActivityView.class);
|
||||
main.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||
startActivity(main);
|
||||
Intent view = new Intent(this, ActivityView.class);
|
||||
view.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||
startActivity(view);
|
||||
} else {
|
||||
prefs.edit().putBoolean("why", true).apply();
|
||||
startActivity(why);
|
||||
|
|
|
@ -46,10 +46,10 @@ public class Widget extends AppWidgetProvider {
|
|||
}
|
||||
|
||||
private static void update(int[] appWidgetIds, AppWidgetManager appWidgetManager, Context context, int count) {
|
||||
Intent intent = new Intent(context, ActivityView.class);
|
||||
intent.setAction("unified");
|
||||
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||
PendingIntent pi = PendingIntent.getActivity(context, ActivityView.REQUEST_UNIFIED, intent, PendingIntent.FLAG_UPDATE_CURRENT);
|
||||
Intent view = new Intent(context, ActivityView.class);
|
||||
view.setAction("unified");
|
||||
view.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||
PendingIntent pi = PendingIntent.getActivity(context, ActivityView.REQUEST_UNIFIED, view, PendingIntent.FLAG_UPDATE_CURRENT);
|
||||
for (int id : appWidgetIds) {
|
||||
RemoteViews views = new RemoteViews(context.getPackageName(), R.layout.widget);
|
||||
views.setOnClickPendingIntent(R.id.widget, pi);
|
||||
|
|
Loading…
Reference in a new issue