當前位置: 首頁>>代碼示例>>Java>>正文


Java View.setTransitionName方法代碼示例

本文整理匯總了Java中android.view.View.setTransitionName方法的典型用法代碼示例。如果您正苦於以下問題:Java View.setTransitionName方法的具體用法?Java View.setTransitionName怎麽用?Java View.setTransitionName使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在android.view.View的用法示例。


在下文中一共展示了View.setTransitionName方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: handleElementOnClick

import android.view.View; //導入方法依賴的package包/類
@SuppressLint("NewApi")
@Override
void handleElementOnClick(View view) {
	int itemPosition =  getRecyclerView().getChildAdapterPosition(view);

	if (itemPosition < 0 || getElements().size() <= itemPosition) {
		return;
	}

	boolean deviceHasLollipop = Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP;
	StreamInfo item = getElements().get(itemPosition);
	Intent intent = LiveStreamActivity.createLiveStreamIntent(item, deviceHasLollipop, getContext());

	if (deviceHasLollipop) {
		View sharedView = view.findViewById(R.id.image_stream_preview);
		sharedView.setTransitionName(getContext().getString(R.string.stream_preview_transition));
		final ActivityOptionsCompat options = ActivityOptionsCompat.
				makeSceneTransitionAnimation(activity, sharedView, getContext().getString(R.string.stream_preview_transition));
		activity.startActivity(intent, options.toBundle());
	} else {
		getContext().startActivity(intent);
		activity.overridePendingTransition(R.anim.slide_in_bottom_anim, R.anim.fade_out_semi_anim);
	}
}
 
開發者ID:SebastianRask,項目名稱:Pocket-Plays-for-Twitch,代碼行數:25,代碼來源:StreamsAdapter.java

示例2: handleElementOnClick

import android.view.View; //導入方法依賴的package包/類
@Override
void handleElementOnClick(final View view) {
	final int itemPosition =  getRecyclerView().getChildAdapterPosition(view);
	VideoOnDemand item = getElements().get(itemPosition);
	if (activity instanceof VODActivity) {
		((VODActivity) activity).startNewVOD(item);
	} else {
		Intent intent = VODActivity.createVODIntent(item, getContext());

		if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
			intent.putExtra(getContext().getString(R.string.stream_preview_url), item.getMediumPreview());
			intent.putExtra(getContext().getString(R.string.stream_preview_alpha), hasVodBeenWatched(item.getVideoId()) ? VOD_WATCHED_IMAGE_ALPHA : 1.0f);

			final View sharedView = view.findViewById(R.id.image_stream_preview);
			sharedView.setTransitionName(getContext().getString(R.string.stream_preview_transition));
			final ActivityOptionsCompat options = ActivityOptionsCompat.
					makeSceneTransitionAnimation(activity, sharedView, getContext().getString(R.string.stream_preview_transition));

			activity.setExitSharedElementCallback(new SharedElementCallback() {
				@SuppressLint("NewApi")
				@Override
				public void onSharedElementEnd(List<String> sharedElementNames, List<View> sharedElements, List<View> sharedElementSnapshots) {
					super.onSharedElementEnd(sharedElementNames, sharedElements, sharedElementSnapshots);

					sharedView.animate().alpha(VOD_WATCHED_IMAGE_ALPHA).setDuration(300).start();
					activity.setExitSharedElementCallback(null);
				}
			});

			activity.startActivity(intent, options.toBundle());
		} else {
			getContext().startActivity(intent);
			activity.overridePendingTransition(R.anim.slide_in_bottom_anim, R.anim.fade_out_semi_anim);
		}
	}
}
 
開發者ID:SebastianRask,項目名稱:Pocket-Plays-for-Twitch,代碼行數:37,代碼來源:VODAdapter.java

示例3: setTransitionName

import android.view.View; //導入方法依賴的package包/類
public static void setTransitionName(View view, String transitionName) {
    view.setTransitionName(transitionName);
}
 
開發者ID:JackChan1999,項目名稱:letv,代碼行數:4,代碼來源:ViewCompatLollipop.java

示例4: handleElementOnClick

import android.view.View; //導入方法依賴的package包/類
@Override
void handleElementOnClick(final View view) {
	int itemPosition = getRecyclerView().getChildAdapterPosition(view);
	final ChannelInfo item = getElements().get(itemPosition);
	final StreamerInfoViewHolder vh = (StreamerInfoViewHolder) getRecyclerView().getChildViewHolder(view);
	final PreviewTarget previewTarget = getTargets().get(vh.getTargetsKey());

	// Create intent for opening StreamerInfo activity. Send the StreamerInfo object with
	// the intent, and flag it to make sure it creates a new task on the history stack
	final Intent intent = new Intent(getContext(), ChannelActivity.class);
	intent.putExtra(getContext().getResources().getString(R.string.channel_info_intent_object), item);
	intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);

	if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
		View sharedView = view.findViewById(R.id.profileLogoImageView);
		sharedView.setTransitionName(getContext().getString(R.string.streamerInfo_transition));
		final ActivityOptionsCompat options = ActivityOptionsCompat.
				makeSceneTransitionAnimation(activity, sharedView, getContext().getString(R.string.streamerInfo_transition));

		activity.setExitSharedElementCallback(new SharedElementCallback() {
			@SuppressLint("NewApi")
			@Override
			public void onSharedElementEnd(List<String> sharedElementNames, List<View> sharedElements, List<View> sharedElementSnapshots) {
				super.onSharedElementEnd(sharedElementNames, sharedElements, sharedElementSnapshots);

				if (!sharedElements.isEmpty() && sharedElements.get(0) != null && previewTarget != null) {
					View element = sharedElements.get(0);
					Animation anim = new RoundImageAnimation(element.getWidth()/2, 0, (ImageView) element, previewTarget.getPreview());
					anim.setDuration(200);
					anim.setInterpolator(new DecelerateInterpolator());
					view.startAnimation(anim);
				}
				activity.setExitSharedElementCallback(null);
			}
		});
		activity.startActivity(intent, options.toBundle());
	} else {
		getContext().startActivity(intent);
		if(activity != null) {
			activity.overridePendingTransition(R.anim.slide_in_right_anim, R.anim.fade_out_semi_anim);
		}
	}
}
 
開發者ID:SebastianRask,項目名稱:Pocket-Plays-for-Twitch,代碼行數:44,代碼來源:ChannelsAdapter.java


注:本文中的android.view.View.setTransitionName方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。