use of android.support.v4.app.ActivityOptionsCompat in project mvpanimation by androidMVP.
the class ExpandingAdapter method startActivity.
private void startActivity(Context context, Intent intent, ViewHolder viewHolder) {
final Pair<View, String>[] pairs = createSafeTransitionParticipants((Activity) context, false, new Pair<>(viewHolder.avatar1, "avatar1"), new Pair<>(viewHolder.avatar2, "avatar2"), new Pair<>(viewHolder.mImageView, "image"));
ActivityOptionsCompat transitionActivityOptions = ActivityOptionsCompat.makeSceneTransitionAnimation((Activity) context, pairs);
context.startActivity(intent, transitionActivityOptions.toBundle());
}
use of android.support.v4.app.ActivityOptionsCompat in project vialer-android by VoIPGRID.
the class MainActivity method openDialer.
/**
* Show the dialer view
*/
public void openDialer() {
Intent intent = new Intent(this, DialerActivity.class);
if (Build.VERSION.SDK_INT > Build.VERSION_CODES.KITKAT) {
ActivityOptionsCompat options = ActivityOptionsCompat.makeSceneTransitionAnimation(this, findViewById(R.id.floating_action_button), "floating_action_button_transition_name");
startActivity(intent, options.toBundle());
} else {
startActivity(intent);
}
}
use of android.support.v4.app.ActivityOptionsCompat in project Now by XunMengWinter.
the class BigImagePagerActivity method startThis.
public static void startThis(final AppCompatActivity activity, List<View> imageViews, List<String> imageUrls, int enterIndex) {
Intent intent = new Intent(activity, BigImagePagerActivity.class);
intent.putStringArrayListExtra(KEY_IMAGE_URLS, (ArrayList<String>) imageUrls);
intent.putExtra(KEY_ENTER_INDEX, enterIndex);
ActivityOptionsCompat optionsCompat = ActivityOptionsCompat.makeSceneTransitionAnimation(activity, imageViews.get(enterIndex), imageUrls.get(enterIndex));
try {
ActivityCompat.startActivity(activity, intent, optionsCompat.toBundle());
} catch (IllegalArgumentException e) {
e.printStackTrace();
activity.startActivity(intent);
}
activity.setExitSharedElementCallback(new SharedElementCallback() {
/* 这个方法会调用两次,一次进入前,一次回来前。 */
@Override
public void onMapSharedElements(List<String> names, Map<String, View> sharedElements) {
super.onMapSharedElements(names, sharedElements);
if (sExitIndex == null) {
return;
}
int exitIndex = sExitIndex;
sExitIndex = null;
if (exitIndex != enterIndex) {
names.clear();
sharedElements.clear();
View view = imageViews.get(exitIndex);
String transitName = imageUrls.get(exitIndex);
if (view == null) {
activity.setExitSharedElementCallback((SharedElementCallback) null);
return;
}
names.add(transitName);
sharedElements.put(transitName, view);
}
activity.setExitSharedElementCallback((SharedElementCallback) null);
}
});
}
use of android.support.v4.app.ActivityOptionsCompat in project butter-android by butterproject.
the class StreamLoadingActivity method startActivity.
public static Intent startActivity(Activity activity, StreamInfo info, Pair<View, String>... elements) {
Intent intent = new Intent(activity, StreamLoadingActivity.class);
intent.putExtra(EXTRA_INFO, info);
ActivityOptionsCompat options = ActivityOptionsCompat.makeSceneTransitionAnimation(activity, elements);
ActivityCompat.startActivity(activity, intent, options.toBundle());
return intent;
}
use of android.support.v4.app.ActivityOptionsCompat in project opacclient by opacapp.
the class SearchResultListActivity method showDetail.
public void showDetail(SearchResult res, View coverView, int touchX, int touchY) {
Bitmap cover = BitmapUtils.bitmapFromBytes(res.getCoverBitmap());
Bitmap smallCover;
if (cover != null && cover.getWidth() * cover.getHeight() > 300 * 300) {
// Android's Parcelable implementation doesn't like huge images
int max = Math.max(cover.getWidth(), cover.getHeight());
int width = (int) ((300f / max) * cover.getWidth());
int height = (int) ((300f / max) * cover.getHeight());
smallCover = Bitmap.createScaledBitmap(cover, width, height, false);
} else {
smallCover = cover;
}
if (twoPane) {
// In two-pane mode, show the detail view in this activity by
// adding or replacing the detail fragment using a
// fragment transaction.
Bundle arguments = new Bundle();
arguments.putInt(SearchResultDetailFragment.ARG_ITEM_NR, res.getNr());
if (res.getId() != null) {
arguments.putString(SearchResultDetailFragment.ARG_ITEM_ID, res.getId());
}
if (res.getCoverBitmap() != null) {
arguments.putParcelable(SearchResultDetailFragment.ARG_ITEM_COVER_BITMAP, smallCover);
}
if (res.getType() != null) {
arguments.putString(SearchResultDetailFragment.ARG_ITEM_MEDIATYPE, res.getType().toString());
}
detailFragment = new SearchResultDetailFragment();
detailFragment.setArguments(arguments);
getSupportFragmentManager().beginTransaction().replace(R.id.searchresult_detail_container, detailFragment).commit();
} else {
// In single-pane mode, simply start the detail activity
// for the selected item ID.
Intent detailIntent = new Intent(this, SearchResultDetailActivity.class);
detailIntent.putExtra(SearchResultDetailFragment.ARG_ITEM_NR, res.getNr());
if (res.getId() != null) {
detailIntent.putExtra(SearchResultDetailFragment.ARG_ITEM_ID, res.getId());
}
if (res.getType() != null) {
detailIntent.putExtra(SearchResultDetailFragment.ARG_ITEM_MEDIATYPE, res.getType().toString());
}
if (res.getCoverBitmap() != null) {
detailIntent.putExtra(SearchResultDetailFragment.ARG_ITEM_COVER_BITMAP, smallCover);
detailIntent.putExtra(SearchResultDetailActivity.ARG_TOUCH_POSITION_X, touchX);
detailIntent.putExtra(SearchResultDetailActivity.ARG_TOUCH_POSITION_Y, touchY);
@SuppressWarnings("unchecked") ActivityOptionsCompat options = ActivityOptionsCompat.makeSceneTransitionAnimation(this, new Pair<>(coverView, getString(R.string.transition_cover)), new Pair<>((View) toolbar, getString(R.string.transition_toolbar)));
ActivityCompat.startActivity(this, detailIntent, options.toBundle());
} else {
startActivity(detailIntent);
}
}
}
Aggregations