当前位置: 首页>>代码示例>>Java>>正文


Java ActivityOptions类代码示例

本文整理汇总了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) {
    }
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:25,代码来源:SwipeBackActivityHelper.java

示例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());
}
 
开发者ID:komamj,项目名称:KomaMusic,代码行数:23,代码来源:ArtistsAdapter.java

示例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);
}
 
开发者ID:googlesamples,项目名称:android-instant-apps,代码行数:20,代码来源:MainActivity.java

示例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;
}
 
开发者ID:googlesamples,项目名称:android-instant-apps,代码行数:25,代码来源:MainActivity.java

示例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);
    }
}
 
开发者ID:Ramotion,项目名称:showroom-android,代码行数:24,代码来源:GarlandViewProfileActivity.java

示例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);
    }
}
 
开发者ID:Ramotion,项目名称:showroom-android,代码行数:20,代码来源:GarlandViewDetailsActivity.java

示例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;
}
 
开发者ID:Onelio,项目名称:ConnectU,代码行数:20,代码来源:AnimTransHelper.java

示例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());
            }
        }
    });
}
 
开发者ID:TonnyL,项目名称:Espresso,代码行数:18,代码来源:PackageDetailsAdapter.java

示例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) {
    }
}
 
开发者ID:Zyj163,项目名称:yyox,代码行数:24,代码来源:Utils.java

示例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);
    }
}
 
开发者ID:Vinetos,项目名称:Hello-Music-droid,代码行数:21,代码来源:NavigationUtils.java

示例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());
}
 
开发者ID:komamj,项目名称:KomaMusic,代码行数:25,代码来源:AlbumsAdapter.java

示例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;
}
 
开发者ID:MSay2,项目名称:Mire,代码行数:18,代码来源:AdapterWallpaper.java

示例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);
            }
        }
    });
}
 
开发者ID:HStanN,项目名称:TakeRest,代码行数:21,代码来源:ShotsFragment.java

示例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);
            }
        }
    });
}
 
开发者ID:HStanN,项目名称:TakeRest,代码行数:21,代码来源:OnShownMovieFragment.java

示例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);
    }
}
 
开发者ID:Ramotion,项目名称:garland-view-android,代码行数:24,代码来源:ProfileActivity.java


注:本文中的android.app.ActivityOptions类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。