Search in sources :

Example 11 with ActivityOptions

use of android.app.ActivityOptions in project animate by hitherejoe.

the class MorphTransitionsActivity method onFabClick.

@OnClick(R.id.fab_morph)
public void onFabClick(View view) {
    Intent login = PopupActivity.getStartIntent(this, PopupActivity.MORPH_TYPE_FAB);
    ActivityOptions options = ActivityOptions.makeSceneTransitionAnimation(MorphTransitionsActivity.this, view, getString(R.string.transition_morph_view));
    startActivity(login, options.toBundle());
}
Also used : Intent(android.content.Intent) ActivityOptions(android.app.ActivityOptions) OnClick(butterknife.OnClick)

Example 12 with ActivityOptions

use of android.app.ActivityOptions in project Timber by naman14.

the class NavigationUtils method navigateToPlaylistDetail.

@TargetApi(21)
public static void navigateToPlaylistDetail(Activity context, String action, long firstAlbumID, String playlistName, int foregroundcolor, long playlistID, ArrayList<Pair> transitionViews) {
    final Intent intent = new Intent(context, PlaylistDetailActivity.class);
    if (!PreferencesUtility.getInstance(context).getSystemAnimations()) {
        intent.setFlags(Intent.FLAG_ACTIVITY_NO_ANIMATION);
    }
    intent.setAction(action);
    intent.putExtra(Constants.PLAYLIST_ID, playlistID);
    intent.putExtra(Constants.PLAYLIST_FOREGROUND_COLOR, foregroundcolor);
    intent.putExtra(Constants.ALBUM_ID, firstAlbumID);
    intent.putExtra(Constants.PLAYLIST_NAME, playlistName);
    intent.putExtra(Constants.ACTIVITY_TRANSITION, transitionViews != null);
    if (transitionViews != null && TimberUtils.isLollipop() && PreferencesUtility.getInstance(context).getAnimations()) {
        ActivityOptions options = ActivityOptions.makeSceneTransitionAnimation(MainActivity.getInstance(), transitionViews.get(0), transitionViews.get(1), transitionViews.get(2));
        context.startActivityForResult(intent, Constants.ACTION_DELETE_PLAYLIST, options.toBundle());
    } else {
        context.startActivityForResult(intent, Constants.ACTION_DELETE_PLAYLIST);
    }
}
Also used : Intent(android.content.Intent) ActivityOptions(android.app.ActivityOptions) TargetApi(android.annotation.TargetApi)

Example 13 with ActivityOptions

use of android.app.ActivityOptions in project plaid by nickbutcher.

the class FeedAdapter method createDesignerNewsStoryHolder.

@NonNull
private DesignerNewsStoryHolder createDesignerNewsStoryHolder(ViewGroup parent) {
    final DesignerNewsStoryHolder holder = new DesignerNewsStoryHolder(layoutInflater.inflate(R.layout.designer_news_story_item, parent, false), pocketIsInstalled);
    holder.itemView.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            final Story story = (Story) getItem(holder.getAdapterPosition());
            CustomTabActivityHelper.openCustomTab(host, DesignerNewsStory.getCustomTabIntent(host, story, null).build(), Uri.parse(story.url));
        }
    });
    holder.comments.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View commentsView) {
            final Intent intent = new Intent();
            intent.setClass(host, DesignerNewsStory.class);
            intent.putExtra(DesignerNewsStory.EXTRA_STORY, (Story) getItem(holder.getAdapterPosition()));
            ReflowText.addExtras(intent, new ReflowText.ReflowableTextView(holder.title));
            setGridItemContentTransitions(holder.itemView);
            // on return, fade the pocket & comments buttons in
            host.setExitSharedElementCallback(new SharedElementCallback() {

                @Override
                public void onSharedElementStart(List<String> sharedElementNames, List<View> sharedElements, List<View> sharedElementSnapshots) {
                    host.setExitSharedElementCallback(null);
                    notifyItemChanged(holder.getAdapterPosition(), HomeGridItemAnimator.STORY_COMMENTS_RETURN);
                }
            });
            final ActivityOptions options = ActivityOptions.makeSceneTransitionAnimation(host, Pair.create((View) holder.title, host.getString(R.string.transition_story_title)), Pair.create(holder.itemView, host.getString(R.string.transition_story_title_background)), Pair.create(holder.itemView, host.getString(R.string.transition_story_background)));
            host.startActivity(intent, options.toBundle());
        }
    });
    if (pocketIsInstalled) {
        // grumble... no xml setter, grumble...
        holder.pocket.setImageAlpha(178);
        holder.pocket.setOnClickListener(new View.OnClickListener() {

            @Override
            public void onClick(final View view) {
                PocketUtils.addToPocket(host, ((Story) getItem(holder.getAdapterPosition())).url);
                // notify changed with a payload asking RV to run the anim
                notifyItemChanged(holder.getAdapterPosition(), HomeGridItemAnimator.ADD_TO_POCKET);
            }
        });
    }
    return holder;
}
Also used : CustomTabsIntent(android.support.customtabs.CustomTabsIntent) Intent(android.content.Intent) List(java.util.List) ArrayList(java.util.ArrayList) SharedElementCallback(android.app.SharedElementCallback) BindView(butterknife.BindView) View(android.view.View) TextView(android.widget.TextView) BadgedFourThreeImageView(io.plaidapp.ui.widget.BadgedFourThreeImageView) RecyclerView(android.support.v7.widget.RecyclerView) Story(io.plaidapp.data.api.designernews.model.Story) ActivityOptions(android.app.ActivityOptions) NonNull(android.support.annotation.NonNull)

Example 14 with ActivityOptions

use of android.app.ActivityOptions in project plaid by nickbutcher.

the class HomeActivity method fabClick.

@OnClick(R.id.fab)
protected void fabClick() {
    if (designerNewsPrefs.isLoggedIn()) {
        Intent intent = new Intent(this, PostNewDesignerNewsStory.class);
        FabTransform.addExtras(intent, ContextCompat.getColor(this, R.color.accent), R.drawable.ic_add_dark);
        intent.putExtra(PostStoryService.EXTRA_BROADCAST_RESULT, true);
        registerPostStoryResultListener();
        ActivityOptions options = ActivityOptions.makeSceneTransitionAnimation(this, fab, getString(R.string.transition_new_designer_news_post));
        startActivityForResult(intent, RC_NEW_DESIGNER_NEWS_STORY, options.toBundle());
    } else {
        Intent intent = new Intent(this, DesignerNewsLogin.class);
        FabTransform.addExtras(intent, ContextCompat.getColor(this, R.color.accent), R.drawable.ic_add_dark);
        ActivityOptions options = ActivityOptions.makeSceneTransitionAnimation(this, fab, getString(R.string.transition_designer_news_login));
        startActivityForResult(intent, RC_NEW_DESIGNER_NEWS_LOGIN, options.toBundle());
    }
}
Also used : Intent(android.content.Intent) ActivityOptions(android.app.ActivityOptions) OnClick(butterknife.OnClick)

Example 15 with ActivityOptions

use of android.app.ActivityOptions in project plaid by nickbutcher.

the class PostNewDesignerNewsStory method postNewStory.

@OnClick(R.id.new_story_post)
protected void postNewStory() {
    if (DesignerNewsPrefs.get(this).isLoggedIn()) {
        ImeUtils.hideIme(title);
        Intent postIntent = new Intent(PostStoryService.ACTION_POST_NEW_STORY, null, this, PostStoryService.class);
        postIntent.putExtra(PostStoryService.EXTRA_STORY_TITLE, title.getText().toString());
        postIntent.putExtra(PostStoryService.EXTRA_STORY_URL, url.getText().toString());
        postIntent.putExtra(PostStoryService.EXTRA_STORY_COMMENT, comment.getText().toString());
        postIntent.putExtra(PostStoryService.EXTRA_BROADCAST_RESULT, getIntent().getBooleanExtra(PostStoryService.EXTRA_BROADCAST_RESULT, false));
        startService(postIntent);
        setResult(RESULT_POSTING);
        finishAfterTransition();
    } else {
        Intent login = new Intent(this, DesignerNewsLogin.class);
        MorphTransform.addExtras(login, ContextCompat.getColor(this, R.color.designer_news), 0);
        ActivityOptions options = ActivityOptions.makeSceneTransitionAnimation(this, post, getString(R.string.transition_designer_news_login));
        startActivity(login, options.toBundle());
    }
}
Also used : Intent(android.content.Intent) ActivityOptions(android.app.ActivityOptions) OnClick(butterknife.OnClick)

Aggregations

ActivityOptions (android.app.ActivityOptions)178 Intent (android.content.Intent)88 RemoteException (android.os.RemoteException)33 Point (android.graphics.Point)30 RecentsTaskLoader (com.android.systemui.recents.model.RecentsTaskLoader)20 TaskStack (com.android.systemui.recents.model.TaskStack)20 PendingIntent (android.app.PendingIntent)18 SystemServicesProxy (com.android.systemui.recents.misc.SystemServicesProxy)15 ActivityManager (android.app.ActivityManager)14 ComponentName (android.content.ComponentName)13 ActivityInfo (android.content.pm.ActivityInfo)13 ResolveInfo (android.content.pm.ResolveInfo)12 UserHandle (android.os.UserHandle)12 Configuration (android.content.res.Configuration)10 ReferrerIntent (com.android.internal.content.ReferrerIntent)10 RecentsTaskLoadPlan (com.android.systemui.recents.model.RecentsTaskLoadPlan)10 Task (com.android.systemui.recents.model.Task)10 Bundle (android.os.Bundle)9 ActivityNotFoundException (android.content.ActivityNotFoundException)8 RecyclerView (android.support.v7.widget.RecyclerView)8