當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。