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


Java ImageView.setTransitionName方法代碼示例

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


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

示例1: onBindViewHolder

import android.widget.ImageView; //導入方法依賴的package包/類
@Override
public void onBindViewHolder(final PhotoViewHolder holder, final int position) {
    Photo data = photos.get(position);
    TextView authorview = holder.itemView.findViewById(R.id.author);
    ImageView photoview = holder.itemView.findViewById(R.id.photo);
    holder.setAuthor(data.author);
    photoview.setTransitionName(String.format(photoTransitionFormat, data.id));
    authorview.setText(data.author);
    authorview.setTransitionName(String.format(authorTransitionFormat, data.id));
    holder.setId(data.id);
    Glide.with(layoutInflater.getContext())
            .load(data.getPhotoUrl(requestedPhotoWidth))
            .placeholder(R.color.placeholder)
            .override(ImageSize.NORMAL[0], ImageSize.NORMAL[1])
            .into((ImageView) holder.itemView.findViewById(R.id.photo));
}
 
開發者ID:googlesamples,項目名稱:android-instant-apps,代碼行數:17,代碼來源:PhotoAdapter.java

示例2: onCreateView

import android.widget.ImageView; //導入方法依賴的package包/類
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View rootView = inflater.inflate(
            R.layout.fragment_artist_detail, container, false);

    artistArt = (ImageView) rootView.findViewById(R.id.artist_art);

    collapsingToolbarLayout = (CollapsingToolbarLayout) rootView.findViewById(R.id.collapsing_toolbar);
    appBarLayout = (AppBarLayout) rootView.findViewById(R.id.app_bar);

    if (getArguments().getBoolean("transition")) {
        artistArt.setTransitionName(getArguments().getString("transition_name"));
    }

    toolbar = (Toolbar) rootView.findViewById(R.id.toolbar);
    setupToolbar();
    setUpArtistDetails();

    getChildFragmentManager().beginTransaction().replace(R.id.container, ArtistMusicFragment.newInstance(artistID)).commit();


    return rootView;
}
 
開發者ID:Vinetos,項目名稱:Hello-Music-droid,代碼行數:24,代碼來源:ArtistDetailFragment.java

示例3: instantiateItem

import android.widget.ImageView; //導入方法依賴的package包/類
@Override
public Object instantiateItem(ViewGroup container, int position) {
    ImageView imageView = new ImageView(container.getContext());
    imageView.setLayoutParams(new ViewGroup.LayoutParams(
            ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT));
    imageView.setScaleType(ImageView.ScaleType.FIT_CENTER);
    imageView.setImageURI(uris.get(position));
    DismissFrameLayout layout = new DismissFrameLayout(container.getContext());
    layout.setDismissListener(onDismissListener);
    layout.setLayoutParams(new ViewPager.LayoutParams());
    layout.addView(imageView);

    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
        String name = container.getContext()
                .getString(R.string.transition_name, adapterPosition, position);
        imageView.setTransitionName(name);
        imageView.setTag(name);
        if (position == current) {
            setStartPostTransition(imageView);
        }
    }

    container.addView(layout);
    return layout;
}
 
開發者ID:mingdroid,項目名稱:SETransitionDemo,代碼行數:26,代碼來源:DestinationActivity.java

示例4: onCreate

import android.widget.ImageView; //導入方法依賴的package包/類
@Override
protected void onCreate(Bundle savedInstanceState) {
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
        setTheme(R.style.AppTheme);
    }
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_share_element);
    mImageView = (ImageView) findViewById(R.id.image_view);
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
        mImageView.setTransitionName(MainActivity.TRANSITION_NAME_SHARE);
    } else {
        ShareElementInfo info = getIntent().getExtras().getParcelable(MainActivity.EXTRA_SHARE_ELEMENT_INFO);
        mShareElement = new FKJShareElement(info, this, mImageView.getRootView());
        mShareElement.convert(mImageView)
                .setDuration(ANIMATOR_DURATION)
                .setInterpolator(new LinearInterpolator())
                .startEnterAnimator();
    }
}
 
開發者ID:idisfkj,項目名稱:AndroidShareElement,代碼行數:20,代碼來源:ShareElementActivity.java

示例5: onCreate

import android.widget.ImageView; //導入方法依賴的package包/類
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_animal_detail);
    supportPostponeEnterTransition();

    Bundle extras = getIntent().getExtras();
    AnimalItem animalItem = extras.getParcelable(RecyclerViewActivity.EXTRA_ANIMAL_ITEM);

    ImageView imageView = (ImageView) findViewById(R.id.animal_detail_image_view);
    TextView textView = (TextView) findViewById(R.id.animal_detail_text);
    textView.setText(animalItem.detail);

    String imageUrl = animalItem.imageUrl;
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
        String imageTransitionName = extras.getString(RecyclerViewActivity.EXTRA_ANIMAL_IMAGE_TRANSITION_NAME);
        imageView.setTransitionName(imageTransitionName);
    }

    Picasso.with(this)
            .load(imageUrl)
            .noFade()
            .into(imageView, new Callback() {
                @Override
                public void onSuccess() {
                    supportStartPostponedEnterTransition();
                }

                @Override
                public void onError() {
                    supportStartPostponedEnterTransition();
                }
            });
}
 
開發者ID:mikescamell,項目名稱:shared-element-transitions,代碼行數:35,代碼來源:AnimalDetailActivity.java

示例6: onViewCreated

import android.widget.ImageView; //導入方法依賴的package包/類
@Override
public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
    super.onViewCreated(view, savedInstanceState);

    AnimalItem animalItem = getArguments().getParcelable(EXTRA_ANIMAL_ITEM);
    String transitionName = getArguments().getString(EXTRA_TRANSITION_NAME);

    TextView detailTextView = (TextView) view.findViewById(R.id.animal_detail_text);
    detailTextView.setText(animalItem.detail);

    ImageView imageView = (ImageView) view.findViewById(R.id.animal_detail_image_view);
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
        imageView.setTransitionName(transitionName);
    }

    Picasso.with(getContext())
            .load(animalItem.imageUrl)
            .noFade()
            .into(imageView, new Callback() {
                @Override
                public void onSuccess() {
                    startPostponedEnterTransition();
                }

                @Override
                public void onError() {
                    startPostponedEnterTransition();
                }
            });
}
 
開發者ID:mikescamell,項目名稱:shared-element-transitions,代碼行數:31,代碼來源:AnimalDetailFragment.java

示例7: onCreate

import android.widget.ImageView; //導入方法依賴的package包/類
@Override
protected void onCreate(Bundle savedInstanceState) {
	super.onCreate(savedInstanceState);
	setContentView(R.layout.activity_streamer_info);

	// Get the various handles of view and layouts that is part of this view
	streamerImage 			= (ImageView) findViewById(R.id.profileImageView);
	additionalInfoLayout 	= (LinearLayout) findViewById(R.id.additional_info_wrapper);
	streamerInfoName 		= (TextView) findViewById(R.id.twitch_name);
	streamerViewers 		= (TextView) findViewById(R.id.txt_viewers);
	streamerFollowers 		= (TextView) findViewById(R.id.txt_followers);
	toolbar 				= (Toolbar) findViewById(R.id.StreamerInfo_Toolbar);
	additionalToolbar 		= (Toolbar) findViewById(R.id.additional_toolbar);
	mViewPager				= (ViewPager) findViewById(R.id.container);
	mTabs					= (TabLayout) findViewById(R.id.tabs);
	mAppBar					= (AppBarLayout) findViewById(R.id.appbar);
	mFab 					= (FloatingActionButton) findViewById(R.id.fab);

	setSupportActionBar(toolbar);
	if (getSupportActionBar() != null) {
		getSupportActionBar().setDisplayHomeAsUpEnabled(true);
	}

	// Get the StreamerInfo object sent with the intent to open this activity
	Intent intent = getIntent();
	info = intent.getParcelableExtra(getResources().getString(R.string.channel_info_intent_object));

	streamerInfoName		.setText(info.getDisplayName());
	streamerFollowers		.setText(getReadableInt(info.getFollowers()));
	streamerViewers			.setText(getReadableInt(info.getViews()));

	if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
		streamerImage.setTransitionName(getString(R.string.streamerInfo_transition));
	}

	setUpTabs();
	initStreamerImageAndColors();
	initiateFAB();
}
 
開發者ID:SebastianRask,項目名稱:Pocket-Plays-for-Twitch,代碼行數:40,代碼來源:ChannelActivity.java

示例8: onCreateView

import android.widget.ImageView; //導入方法依賴的package包/類
@TargetApi(21)
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    final View rootView = inflater.inflate(
            R.layout.fragment_album_detail, container, false);

    albumArt = (ImageView) rootView.findViewById(R.id.album_art);
    artistArt = (ImageView) rootView.findViewById(R.id.artist_art);
    albumTitle = (TextView) rootView.findViewById(R.id.album_title);
    albumDetails = (TextView) rootView.findViewById(R.id.album_details);

    toolbar = (Toolbar) rootView.findViewById(R.id.toolbar);

    fab = (FloatingActionButton) rootView.findViewById(R.id.fab);

    if (getArguments().getBoolean("transition")) {
        albumArt.setTransitionName(getArguments().getString("transition_name"));
    }
    recyclerView = (RecyclerView) rootView.findViewById(R.id.recyclerview);
    collapsingToolbarLayout = (CollapsingToolbarLayout) rootView.findViewById(R.id.collapsing_toolbar);
    appBarLayout = (AppBarLayout) rootView.findViewById(R.id.app_bar);
    recyclerView.setEnabled(false);
    recyclerView.setLayoutManager(new LinearLayoutManager(getActivity()));

    album = AlbumLoader.getAlbum(getActivity(), albumID);

    setAlbumart();

    setUpEverything();


    fab.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            Handler handler = new Handler();
            handler.postDelayed(new Runnable() {
                @Override
                public void run() {
                    AlbumSongsAdapter adapter = (AlbumSongsAdapter) recyclerView.getAdapter();
                    MusicPlayer.playAll(getActivity(), adapter.getSongIds(), 0, albumID, TimberUtils.IdType.Album, true);
                    NavigationUtils.navigateToNowplaying(getActivity(), false);
                }
            }, 150);
        }
    });

    return rootView;
}
 
開發者ID:Vinetos,項目名稱:Hello-Music-droid,代碼行數:49,代碼來源:AlbumDetailFragment.java


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