本文整理汇总了Java中android.app.ActivityOptions类的典型用法代码示例。如果您正苦于以下问题:Java ActivityOptions类的具体用法?Java ActivityOptions怎么用?Java ActivityOptions使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ActivityOptions类属于android.app包,在下文中一共展示了ActivityOptions类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: convertActivityToTranslucent
import android.app.ActivityOptions; //导入依赖的package包/类
@SuppressLint({"NewApi"})
public void convertActivityToTranslucent() {
try {
Class<?> translucentConversionListenerClazz = null;
for (Class<?> clazz : Activity.class.getDeclaredClasses()) {
if (clazz.getSimpleName().contains("TranslucentConversionListener")) {
translucentConversionListenerClazz = clazz;
}
}
Method method;
if (VERSION.SDK_INT > 19) {
method = Activity.class.getDeclaredMethod("convertToTranslucent", new
Class[]{translucentConversionListenerClazz, ActivityOptions.class});
method.setAccessible(true);
method.invoke(this.mActivity, new Object[]{null, null});
return;
}
method = Activity.class.getDeclaredMethod("convertToTranslucent", new
Class[]{translucentConversionListenerClazz});
method.setAccessible(true);
method.invoke(this.mActivity, new Object[]{null});
} catch (Throwable th) {
}
}
示例2: onClick
import android.app.ActivityOptions; //导入依赖的package包/类
@Override
public void onClick(View view) {
int position = (int) view.getTag();
long artistId = mData.get(position).mArtistId;
String artistName = mData.get(position).mArtistName;
Intent intent = new Intent();
intent.putExtra(Constants.ARTIST_ID, artistId);
intent.putExtra(Constants.ARTIST_NAME, artistName);
intent.putExtra(Constants.WHICH_DETAIL_PAGE, Constants.ARTIST_DETAIL);
ComponentName componentName = new ComponentName(Constants.MUSIC_PACKAGE_NAME,
Constants.DETAIL_PACKAGE_NAME);
intent.setComponent(componentName);
mContext.startActivity(intent, ActivityOptions.makeSceneTransitionAnimation(
((AppCompatActivity) mContext), new Pair<View, String>(mAlbum,
mAlbumTransitionName)).toBundle());
}
示例3: populateGrid
import android.app.ActivityOptions; //导入依赖的package包/类
private void populateGrid() {
grid.setAdapter(new PhotoAdapter(this, relevantPhotos));
grid.addOnItemTouchListener(new OnItemSelectedListener(MainActivity.this) {
public void onItemSelected(RecyclerView.ViewHolder holder, int position) {
if (!(holder instanceof PhotoViewHolder)) {
return;
}
MainActivity activity = MainActivity.this;
PhotoViewHolder pvh = (PhotoViewHolder) holder;
final Intent intent = getDetailActivityStartIntent(
activity, position, pvh);
final ActivityOptions activityOptions = getActivityOptions(pvh);
activity.startActivityForResult(
intent, IntentUtil.REQUEST_CODE, activityOptions.toBundle());
}
});
empty.setVisibility(View.GONE);
}
示例4: 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;
}
示例5: start
import android.app.ActivityOptions; //导入依赖的package包/类
public static void start(Activity activity,
String url, String name, String info, String status,
View avatar, View card, View image, View list,
ArrayList<DetailsData> listData) {
Intent starter = new Intent(activity, GarlandViewProfileActivity.class);
starter.putExtra(BUNDLE_NAME, name);
starter.putExtra(BUNDLE_INFO, info);
starter.putExtra(BUNDLE_STATUS, status);
starter.putExtra(BUNDLE_AVATAR_URL, url);
starter.putParcelableArrayListExtra(BUNDLE_LIST_DATA, listData);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
final Pair<View, String> p1 = Pair.create(avatar, activity.getString(R.string.gv_transition_avatar_border));
final Pair<View, String> p2 = Pair.create(card, activity.getString(R.string.gv_transition_card));
final Pair<View, String> p3 = Pair.create(image, activity.getString(R.string.gv_transition_background));
final Pair<View, String> p4 = Pair.create(list, activity.getString(R.string.gv_transition_list));
final ActivityOptions options = ActivityOptions.makeSceneTransitionAnimation(activity, p1, p2, p3, p4);
activity.startActivity(starter, options.toBundle());
} else {
activity.startActivity(starter);
}
}
示例6: 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);
}
}
示例7: circleSlideUp
import android.app.ActivityOptions; //导入依赖的package包/类
public static Bundle circleSlideUp(Context context, View v) {
Bundle optsBundle;
ActivityOptions opts = null;
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
int left = 0, top = 0;
int width = v.getMeasuredWidth(), height = v.getMeasuredHeight();
opts = ActivityOptions.makeClipRevealAnimation(v, left, top, width, height);
} else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
// Below L, we use a scale up animation
opts = ActivityOptions.makeScaleUpAnimation(v, 0, 0, v.getMeasuredWidth(), v.getMeasuredHeight());
} else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP_MR1) {
// On L devices, we use the device default slide-up transition.
// On L MR1 devices, we use a custom version of the slide-up transition which
// doesn't have the delay present in the device default.
opts = ActivityOptions.makeCustomAnimation(context, R.anim.task_open_enter, R.anim.no_anim);
}
optsBundle = opts != null ? opts.toBundle() : null;
return optsBundle;
}
示例8: HeaderViewHolder
import android.app.ActivityOptions; //导入依赖的package包/类
public HeaderViewHolder(View itemView) {
super(itemView);
textViewCompany = (AppCompatTextView) itemView.findViewById(R.id.textViewCompany);
textViewNumber = (AppCompatTextView) itemView.findViewById(R.id.textViewPackageNumber);
textViewName = (AppCompatTextView) itemView.findViewById(R.id.textViewName);
textViewCompany.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (aPackage.getCompany() != null) {
Intent intent = new Intent(context, CompanyDetailActivity.class);
intent.putExtra(CompanyDetailActivity.COMPANY_ID, aPackage.getCompany());
context.startActivity(intent, ActivityOptions.makeSceneTransitionAnimation((PackageDetailsActivity)context).toBundle());
}
}
});
}
示例9: convertActivityToTranslucentAfterL
import android.app.ActivityOptions; //导入依赖的package包/类
/**
* Calling the convertToTranslucent method on platforms after Android 5.0
*/
private static void convertActivityToTranslucentAfterL(Activity activity) {
try {
Method getActivityOptions = Activity.class.getDeclaredMethod("getActivityOptions");
getActivityOptions.setAccessible(true);
Object options = getActivityOptions.invoke(activity);
Class<?>[] classes = Activity.class.getDeclaredClasses();
Class<?> translucentConversionListenerClazz = null;
for (Class clazz : classes) {
if (clazz.getSimpleName().contains("TranslucentConversionListener")) {
translucentConversionListenerClazz = clazz;
}
}
Method convertToTranslucent = Activity.class.getDeclaredMethod("convertToTranslucent",
translucentConversionListenerClazz, ActivityOptions.class);
convertToTranslucent.setAccessible(true);
convertToTranslucent.invoke(activity, null, options);
} catch (Throwable t) {
}
}
示例10: navigateToPlaylistDetail
import android.app.ActivityOptions; //导入依赖的package包/类
@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);
}
}
示例11: onClick
import android.app.ActivityOptions; //导入依赖的package包/类
@Override
public void onClick(View view) {
Intent intent = new Intent();
int position = (int) view.getTag();
long albumId = mData.get(position).mAlbumId;
String albumName = mData.get(position).mAlbumName;
intent.putExtra(Constants.ALBUM_ID, albumId);
intent.putExtra(Constants.ALBUM_NAME, albumName);
intent.putExtra(Constants.WHICH_DETAIL_PAGE, Constants.ALBUM_DETAIL);
ComponentName componentName = new ComponentName(Constants.MUSIC_PACKAGE_NAME,
Constants.DETAIL_PACKAGE_NAME);
intent.setComponent(componentName);
mContext.startActivity(intent, ActivityOptions.makeSceneTransitionAnimation(
((AppCompatActivity) mContext), new Pair<View, String>(mAlbum,
mAlbumTransitionName),
new Pair<View, String>(mFabPlay, mFabTransitionName)).toBundle());
}
示例12: onLongClick
import android.app.ActivityOptions; //导入依赖的package包/类
@Override
public boolean onLongClick(View view)
{
int id = view.getId();
int position = getAdapterPosition();
if (id == R.id.id_open_image)
{
Intent intent = new Intent(context, ActivityWallpaperInfo.class);
intent.putExtra("id_img", item_data.get(position).getImageUrl());
intent.putExtra("id_title", item_data.get(position).getTitle());
intent.putExtra("id_text", item_data.get(position).getText());
context.startActivity(intent, ActivityOptions.makeSceneTransitionAnimation((Activity)context).toBundle());
}
return true;
}
示例13: onSuccess
import android.app.ActivityOptions; //导入依赖的package包/类
@Override
public void onSuccess(final List<Shot> list) {
adapter = new ShotsAdapter(getActivity(), list);
mRecyclerView.setAdapter(adapter);
adapter.setOnItemClickLitener(new ShotsAdapter.OnItemClickLitener() {
@Override
public void onItemClick(View avator, int position) {
Shot shot = list.get(position);
Intent intent = new Intent(getActivity(),ShotDetailActivity.class);
intent.putExtra("shot_id",shot.getId());
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP){
ActivityOptions options = ActivityOptions
.makeSceneTransitionAnimation(getActivity(), avator, "avator");
startActivity(intent, options.toBundle());
}else {
startActivity(intent);
}
}
});
}
示例14: onSuccess
import android.app.ActivityOptions; //导入依赖的package包/类
@Override
public void onSuccess(final List<Movie> list) {
adapter = new MovieAdapter(getActivity(), list);
recyclerView.setAdapter(adapter);
adapter.setOnItemClickLitener(new MovieAdapter.OnItemClickLitener() {
@Override
public void onItemClick(View view, int position) {
int id = list.get(position).getId();
Intent intent = new Intent(getActivity(), MovieBasicActivity.class);
intent.putExtra("id", id);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
ActivityOptions options = ActivityOptions
.makeSceneTransitionAnimation(getActivity(), view, "movie_image");
startActivity(intent, options.toBundle());
} else {
startActivity(intent);
}
}
});
}
示例15: start
import android.app.ActivityOptions; //导入依赖的package包/类
public static void start(Activity activity,
String url, String name, String info, String status,
View avatar, View card, View image, View list,
ArrayList<DetailsData> listData) {
Intent starter = new Intent(activity, ProfileActivity.class);
starter.putExtra(BUNDLE_NAME, name);
starter.putExtra(BUNDLE_INFO, info);
starter.putExtra(BUNDLE_STATUS, status);
starter.putExtra(BUNDLE_AVATAR_URL, url);
starter.putParcelableArrayListExtra(BUNDLE_LIST_DATA, listData);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
final Pair<View, String> p1 = Pair.create(avatar, activity.getString(R.string.transition_avatar_border));
final Pair<View, String> p2 = Pair.create(card, activity.getString(R.string.transition_card));
final Pair<View, String> p3 = Pair.create(image, activity.getString(R.string.transition_background));
final Pair<View, String> p4 = Pair.create(list, activity.getString(R.string.transition_list));
final ActivityOptions options = ActivityOptions.makeSceneTransitionAnimation(activity, p1, p2, p3, p4);
activity.startActivity(starter, options.toBundle());
} else {
activity.startActivity(starter);
}
}