use of androidx.core.app.TaskStackBuilder in project orgzly-android by orgzly.
the class ShareActivity method createNewNoteIntent.
public static PendingIntent createNewNoteIntent(Context context, SavedSearch savedSearch) {
Intent resultIntent = createNewNoteInNotebookIntent(context, null);
if (savedSearch != null && savedSearch.getQuery() != null) {
resultIntent.putExtra(AppIntent.EXTRA_QUERY_STRING, savedSearch.getQuery());
}
// The stack builder object will contain an artificial back stack for the
// started Activity.
// This ensures that navigating backward from the Activity leads out of
// your application to the Home screen.
TaskStackBuilder stackBuilder = TaskStackBuilder.create(context);
// Adds the back stack for the Intent (but not the Intent itself)
stackBuilder.addParentStack(ShareActivity.class);
// Adds the Intent that starts the Activity to the top of the stack
stackBuilder.addNextIntent(resultIntent);
// return PendingIntent.getActivity(context, 0, resultIntent, PendingIntent.FLAG_UPDATE_CURRENT);
return stackBuilder.getPendingIntent(0, PendingIntent.FLAG_UPDATE_CURRENT);
}
use of androidx.core.app.TaskStackBuilder in project EhViewer by seven332.
the class AppCompatPreferenceActivity method onSupportNavigateUp.
/**
* This method is called whenever the user chooses to navigate Up within your application's
* activity hierarchy from the action bar.
*
* <p>If a parent was specified in the manifest for this activity or an activity-alias to it,
* default Up navigation will be handled automatically. See
* {@link #getSupportParentActivityIntent()} for how to specify the parent. If any activity
* along the parent chain requires extra Intent arguments, the Activity subclass
* should override the method {@link #onPrepareSupportNavigateUpTaskStack(androidx.core.app.TaskStackBuilder)}
* to supply those arguments.</p>
*
* <p>See <a href="{@docRoot}guide/topics/fundamentals/tasks-and-back-stack.html">Tasks and
* Back Stack</a> from the developer guide and
* <a href="{@docRoot}design/patterns/navigation.html">Navigation</a> from the design guide
* for more information about navigating within your app.</p>
*
* <p>See the {@link androidx.core.app.TaskStackBuilder} class and the Activity methods
* {@link #getSupportParentActivityIntent()}, {@link #supportShouldUpRecreateTask(android.content.Intent)}, and
* {@link #supportNavigateUpTo(android.content.Intent)} for help implementing custom Up navigation.</p>
*
* @return true if Up navigation completed successfully and this Activity was finished,
* false otherwise.
*/
public boolean onSupportNavigateUp() {
Intent upIntent = getSupportParentActivityIntent();
if (upIntent != null) {
if (supportShouldUpRecreateTask(upIntent)) {
TaskStackBuilder b = TaskStackBuilder.create(this);
onCreateSupportNavigateUpTaskStack(b);
onPrepareSupportNavigateUpTaskStack(b);
b.startActivities();
try {
ActivityCompat.finishAffinity(this);
} catch (IllegalStateException e) {
// This can only happen on 4.1+, when we don't have a parent or a result set.
// In that case we should just finish().
finish();
}
} else {
// This activity is part of the application's task, so simply
// navigate up to the hierarchical parent activity.
supportNavigateUpTo(upIntent);
}
return true;
}
return false;
}
use of androidx.core.app.TaskStackBuilder in project DeepLinkDispatch by airbnb.
the class MainActivity method getTaskStackBuilder.
@NotNull
private static TaskStackBuilder getTaskStackBuilder(Context context, String action) {
Intent detailsIntent = new Intent(context, SecondActivity.class).setAction(action);
Intent parentIntent = new Intent(context, MainActivity.class).setAction(action);
TaskStackBuilder taskStackBuilder = TaskStackBuilder.create(context);
taskStackBuilder.addNextIntent(parentIntent);
taskStackBuilder.addNextIntent(detailsIntent);
return taskStackBuilder;
}
use of androidx.core.app.TaskStackBuilder in project DeepLinkDispatch by airbnb.
the class MainActivity method intentForTaskStackBuilderMethods.
/**
* Handles deep link with params.
* @param context of the activity
* @param bundle expected to contain the key {@code qp}.
* @return TaskStackBuilder set with first intent to start {@link MainActivity} and second intent
* to start {@link SecondActivity}.
*/
@DeepLink("http://example.com/deepLink/{id}/{name}/{place}")
public static TaskStackBuilder intentForTaskStackBuilderMethods(Context context, Bundle bundle) {
Log.d(TAG, "without query parameter :");
if (bundle != null && bundle.containsKey("qp")) {
Log.d(TAG, "found new parameter :with query parameter :" + bundle.getString("qp"));
}
TaskStackBuilder taskStackBuilder = getTaskStackBuilder(context, ACTION_DEEP_LINK_COMPLEX);
return taskStackBuilder;
}
use of androidx.core.app.TaskStackBuilder in project android-oss by kickstarter.
the class PushNotifications method surveyResponseContentIntent.
@NonNull
private PendingIntent surveyResponseContentIntent(@NonNull final PushNotificationEnvelope envelope, @NonNull final SurveyResponse surveyResponse) {
final Intent activityFeedIntent = new Intent(this.context, ActivityFeedActivity.class);
final Intent surveyResponseIntent = new Intent(this.context, SurveyResponseActivity.class).putExtra(IntentKey.SURVEY_RESPONSE, surveyResponse);
final TaskStackBuilder taskStackBuilder = TaskStackBuilder.create(this.context).addNextIntentWithParentStack(activityFeedIntent).addNextIntent(surveyResponseIntent);
return taskStackBuilder.getPendingIntent(envelope.signature(), PendingIntent.FLAG_IMMUTABLE);
}
Aggregations