本文整理汇总了Java中android.app.ActivityOptions.makeSceneTransitionAnimation方法的典型用法代码示例。如果您正苦于以下问题:Java ActivityOptions.makeSceneTransitionAnimation方法的具体用法?Java ActivityOptions.makeSceneTransitionAnimation怎么用?Java ActivityOptions.makeSceneTransitionAnimation使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.app.ActivityOptions
的用法示例。
在下文中一共展示了ActivityOptions.makeSceneTransitionAnimation方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getActivityOptions
import android.app.ActivityOptions; //导入方法依赖的package包/类
private ActivityOptions getActivityOptions(PhotoViewHolder holder) {
TextView author =
holder.itemView.findViewById(com.example.android.unsplash.base.R.id.author);
ImageView photo =
holder.itemView.findViewById(com.example.android.unsplash.base.R.id.photo);
Pair authorPair = Pair.create(author, author.getTransitionName());
Pair photoPair = Pair.create(photo, photo.getTransitionName());
View decorView = getWindow().getDecorView();
View statusBackground = decorView.findViewById(android.R.id.statusBarBackground);
View navBackground = decorView.findViewById(android.R.id.navigationBarBackground);
Pair statusPair = Pair.create(statusBackground,
statusBackground.getTransitionName());
final ActivityOptions options;
if (navBackground == null) {
options = ActivityOptions.makeSceneTransitionAnimation(this,
authorPair, photoPair, statusPair);
} else {
Pair navPair = Pair.create(navBackground, navBackground.getTransitionName());
options = ActivityOptions.makeSceneTransitionAnimation(this,
authorPair, photoPair, statusPair, navPair);
}
return options;
}
示例2: start
import android.app.ActivityOptions; //导入方法依赖的package包/类
public static void start(final GarlandViewMainActivity activity,
final String name, final String address, final String url,
final View card, final View avatar) {
Intent starter = new Intent(activity, GarlandViewDetailsActivity.class);
starter.putExtra(BUNDLE_NAME, name);
starter.putExtra(BUNDLE_INFO, address);
starter.putExtra(BUNDLE_AVATAR_URL, url);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
final Pair<View, String> p1 = Pair.create(card, activity.getString(R.string.gv_transition_card));
final Pair<View, String> p2 = Pair.create(avatar, activity.getString(R.string.gv_transition_avatar_border));
final ActivityOptions options = ActivityOptions.makeSceneTransitionAnimation(activity, p1, p2);
activity.startActivity(starter, options.toBundle());
} else {
activity.startActivity(starter);
}
}
示例3: onBuildClicked
import android.app.ActivityOptions; //导入方法依赖的package包/类
@Override
public void onBuildClicked(BuildViewHolder buildViewHolder) {
BuildViewModel model = buildViewHolder.viewModel;
Intent i = new Intent(getActivity(), BriefActivity.class);
i.putExtra(KEY_BUILD_ID, model.getBuildId()); // pass build order record ID
// speed optimization - pass these so brief activity doesn't need to
// requery them from the database and can display them instantly
i.putExtra(KEY_FACTION_ENUM, mFaction);
i.putExtra(KEY_EXPANSION_ENUM, mCurrentExpansion);
i.putExtra(KEY_BUILD_NAME, model.getName());
if (VERSION.SDK_INT >= android.os.Build.VERSION_CODES.LOLLIPOP) {
// create the transition animation - the views in the layouts
// of both activities are defined with android:transitionName="buildName"
ActivityOptions options = ActivityOptions
.makeSceneTransitionAnimation(
getActivity(),
buildViewHolder.nameText,
getString(R.string.transition_build_name));
getActivity().startActivity(i, options.toBundle());
} else {
getActivity().startActivity(i);
}
}
示例4: openPostDetailsActivity
import android.app.ActivityOptions; //导入方法依赖的package包/类
private void openPostDetailsActivity(Post post, View v) {
Intent intent = new Intent(MainActivity.this, PostDetailsActivity.class);
intent.putExtra(PostDetailsActivity.POST_ID_EXTRA_KEY, post.getId());
if (android.os.Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
View imageView = v.findViewById(R.id.postImageView);
View authorImageView = v.findViewById(R.id.authorImageView);
ActivityOptions options = ActivityOptions.
makeSceneTransitionAnimation(MainActivity.this,
new android.util.Pair<>(imageView, getString(R.string.post_image_transition_name)),
new android.util.Pair<>(authorImageView, getString(R.string.post_author_image_transition_name))
);
startActivityForResult(intent, PostDetailsActivity.UPDATE_POST_REQUEST, options.toBundle());
} else {
startActivityForResult(intent, PostDetailsActivity.UPDATE_POST_REQUEST);
}
}
示例5: start
import android.app.ActivityOptions; //导入方法依赖的package包/类
public static void start(final MainActivity activity,
final String name, final String address, final String url,
final View card, final View avatar) {
Intent starter = new Intent(activity, DetailsActivity.class);
starter.putExtra(BUNDLE_NAME, name);
starter.putExtra(BUNDLE_INFO, address);
starter.putExtra(BUNDLE_AVATAR_URL, url);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
final Pair<View, String> p1 = Pair.create(card, activity.getString(R.string.transition_card));
final Pair<View, String> p2 = Pair.create(avatar, activity.getString(R.string.transition_avatar_border));
final ActivityOptions options = ActivityOptions.makeSceneTransitionAnimation(activity, p1, p2);
activity.startActivity(starter, options.toBundle());
} else {
activity.startActivity(starter);
}
}
示例6: onStartLocationClick
import android.app.ActivityOptions; //导入方法依赖的package包/类
@Override
public void onStartLocationClick(LinearLayout startLocationLayout,EditText startLocation){
Log.d("start location","triggered");
Intent intent = new Intent(getBaseContext(), ChooseLocationActivity.class);
if(startLocation.getText().length() != 0)
intent.putExtra(ChooseLocationActivity.ADDRESS_EXTRA, startLocation.getText().toString());
intent.putExtra(ChooseLocationActivity.TITLE_EXTRA, getResources().getString(R.string.choose_start));
ActivityOptions options = ActivityOptions.makeSceneTransitionAnimation(MainActivity.this, startLocationLayout, getResources().getString(R.string.search_view_transition_name));
startActivityForResult(intent, START_LOCATION_SEARCH_REQUEST, options.toBundle());
}
示例7: licensePressed
import android.app.ActivityOptions; //导入方法依赖的package包/类
@OnClick(R.id.license_image)
public void licensePressed() {
final Intent intent = new Intent(this, PictureZoomActivity.class);
final Bundle extras = new Bundle();
extras.putByteArray("picture", licence.getPhoto());
intent.putExtras(extras);
ActivityOptions options = ActivityOptions.makeSceneTransitionAnimation(this, headshot, "zoom");
startActivity(intent, options.toBundle());
}
示例8: makeSceneTransitionAnimation
import android.app.ActivityOptions; //导入方法依赖的package包/类
public static ActivityOptionsCompat21 makeSceneTransitionAnimation(Activity activity, View[] sharedElements, String[] sharedElementNames) {
Pair[] pairs = null;
if (sharedElements != null) {
pairs = new Pair[sharedElements.length];
for (int i = 0; i < pairs.length; i++) {
pairs[i] = Pair.create(sharedElements[i], sharedElementNames[i]);
}
}
return new ActivityOptionsCompat21(ActivityOptions.makeSceneTransitionAnimation(activity, pairs));
}
示例9: onClick
import android.app.ActivityOptions; //导入方法依赖的package包/类
@OnClick({R.id.bt_go, R.id.fab})
public void onClick(View view) {
switch (view.getId()) {
case R.id.fab:
getWindow().setExitTransition(null);
getWindow().setEnterTransition(null);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
ActivityOptions options =
ActivityOptions.makeSceneTransitionAnimation(this, fab, fab.getTransitionName());
startActivity(new Intent(this, RegisterActivity.class), options.toBundle());
} else {
startActivity(new Intent(this, RegisterActivity.class));
}
break;
case R.id.bt_go:
Explode explode = new Explode();
explode.setDuration(500);
getWindow().setExitTransition(explode);
getWindow().setEnterTransition(explode);
ActivityOptionsCompat oc2 = ActivityOptionsCompat.makeSceneTransitionAnimation(this);
Intent i2 = new Intent(this,LoginSuccessActivity.class);
startActivity(i2, oc2.toBundle());
break;
}
}
示例10: switchToRegister
import android.app.ActivityOptions; //导入方法依赖的package包/类
@Override
public void switchToRegister(FloatingActionButton fab) {
mActivity.getWindow().setExitTransition(null);
mActivity.getWindow().setEnterTransition(null);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
ActivityOptions options =
ActivityOptions.makeSceneTransitionAnimation(mActivity, fab, fab.getTransitionName());
mActivity.startActivity(new Intent(mActivity, RegisterActivity.class), options.toBundle());
} else {
mActivity.startActivity(new Intent(mActivity, RegisterActivity.class));
}
}
示例11: simpleSharedElementTransition
import android.app.ActivityOptions; //导入方法依赖的package包/类
public void simpleSharedElementTransition(View view) {
Intent intent = new Intent(this, SimpleSharedTransitionActivity.class);
ActivityOptions options = ActivityOptions.makeSceneTransitionAnimation(this, findViewById(R.id.simple_shared), "test");
startActivity(intent, options.toBundle());
}
示例12: onEndLocationClick
import android.app.ActivityOptions; //导入方法依赖的package包/类
@Override
public void onEndLocationClick(LinearLayout endLocationLayout,EditText endLocation){
Log.d("end location","triggered");
Intent intent = new Intent(getBaseContext(), ChooseLocationActivity.class);
if(endLocation.getText().length() != 0)
intent.putExtra(ChooseLocationActivity.ADDRESS_EXTRA, endLocation.getText().toString());
intent.putExtra(ChooseLocationActivity.TITLE_EXTRA, getResources().getString(R.string.choose_end));
ActivityOptions options = ActivityOptions.makeSceneTransitionAnimation(MainActivity.this,
endLocationLayout, getResources().getString(R.string.search_view_transition_name));
startActivityForResult(intent, END_LOCATION_SEARCH_REQUEST, options.toBundle());
//overridePendingTransition(R.anim.slide_from_right, R.anim.slide_to_left);
}
示例13: onClick
import android.app.ActivityOptions; //导入方法依赖的package包/类
@Override
public void onClick(View v) {
Intent intent = new Intent(mContext, DetailActivity.class);
ActivityOptions options = ActivityOptions.makeSceneTransitionAnimation(MainActivity.getInstance(), Pair.create((View) cover, "cover"));
mContext.startActivity(intent, options.toBundle());
}
示例14: open
import android.app.ActivityOptions; //导入方法依赖的package包/类
public static void open(AppCompatActivity context, View fab, String title, CharSequence content) {
Intent intent = getIntent(context, title, content, null, "OK");
if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.LOLLIPOP) {
ActivityOptions options = ActivityOptions.makeSceneTransitionAnimation(context, fab, "morph_transition");
context.startActivityForResult(intent, 1, options.toBundle());
} else
context.startActivityForResult(intent, 1);
}
示例15: start
import android.app.ActivityOptions; //导入方法依赖的package包/类
public static void start(Activity context, ArrayList<GankModel> meizis, int position, View sharedView) {
Intent starter = new Intent(context, GalleryActivity.class);
starter.putExtra(EXTRA_STARTING_GALLERY_POSITION, position);
starter.putParcelableArrayListExtra("mz", meizis);
ActivityOptions options = ActivityOptions.makeSceneTransitionAnimation(context, sharedView,
sharedView.getTransitionName());
context.startActivity(starter, options.toBundle());
}