Search code examples
androidanimationandroid-activityandroid-appwidgetappwidgetprovider

makescaleupanimation from appwidget


Some appwidgets are using the makeScaleUpAnimation (introduced in JellyBean 4.1) when starting an activity from the widget. How is this possible when you can't reach the view from your widget provider?

Is there any way to get the whole appwidgets view or something? I can't find a solution..

ActivityOptions opts = ActivityOptions.makeScaleUpAnimation(view, 0, 0,
        view.getWidth(), view.getHeight());
  // Request the activity be started, using the custom animation options.
  startActivity(new Intent(MainActivity.this, AnimationActivity.class),
        opts.toBundle());

I'm opening the sms inbox from my widget

Intent inboxIntent = new Intent(Intent.ACTION_MAIN);
                inboxIntent.setType("vnd.android-dir/mms-sms");
                int flags = Intent.FLAG_ACTIVITY_NEW_TASK |

                        Intent.FLAG_ACTIVITY_SINGLE_TOP |          

                        Intent.FLAG_ACTIVITY_CLEAR_TOP;
                inboxIntent.setFlags(flags);

                context.startActivity(inboxIntent);

Solution

  • Your activity should call getIntent().getSourceBounds() to fetch this information.