Java Code Examples for android.widget.ImageView#setTransitionName()
The following examples show how to use
android.widget.ImageView#setTransitionName() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: PhotoAdapter.java From atlas with Apache License 2.0 | 6 votes |
@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)); }
Example 2
Source File: DestinationActivity.java From SETransitionDemo with Apache License 2.0 | 6 votes |
@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; }
Example 3
Source File: PhotoAdapter.java From android-instant-apps with Apache License 2.0 | 6 votes |
@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)); }
Example 4
Source File: OnAppClickListener.java From YalpStore with GNU General Public License v2.0 | 6 votes |
@Override public void onItemClick(AdapterView<?> parent, View view, int position, long id) { App app = activity.getAppByListPosition(position); if (null == app) { return; } DetailsActivity.app = app; if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { ImageView iconView = view.findViewById(R.id.icon); String transitionNameIcon = activity.getString(R.string.details_transition_view_name); iconView.setTransitionName(transitionNameIcon); TextView textView = view.findViewById(R.id.text1); String transitionNameText = activity.getString(R.string.details_transition_view_name_text); textView.setTransitionName(transitionNameText); activity.startActivity( DetailsActivity.getDetailsIntent(activity, DetailsActivity.app.getPackageName()), ActivityOptionsCompat.makeSceneTransitionAnimation( activity, new Pair<View, String>(iconView, transitionNameIcon), new Pair<View, String>(textView, transitionNameText) ).toBundle() ); } else { activity.startActivity(DetailsActivity.getDetailsIntent(activity, DetailsActivity.app.getPackageName())); } }
Example 5
Source File: ArtistDetailFragment.java From Muzesto with GNU General Public License v3.0 | 6 votes |
@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; }
Example 6
Source File: ChannelActivity.java From Pocket-Plays-for-Twitch with GNU General Public License v3.0 | 5 votes |
@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(); }
Example 7
Source File: ArtistSongAdapter.java From Music-Player with GNU General Public License v3.0 | 4 votes |
@Override @NonNull public View getView(final int position, View convertView, @NonNull ViewGroup parent) { final Song song = getItem(position); if (convertView == null) { convertView = LayoutInflater.from(getContext()).inflate(R.layout.item_list, parent, false); } final TextView songTitle = convertView.findViewById(R.id.title); final TextView songInfo = convertView.findViewById(R.id.text); final ImageView albumArt = convertView.findViewById(R.id.image); final View shortSeparator = convertView.findViewById(R.id.short_separator); if (position == getCount() - 1) { if (shortSeparator != null) { shortSeparator.setVisibility(View.GONE); } } else { if (shortSeparator != null) { shortSeparator.setVisibility(View.VISIBLE); } } songTitle.setText(song.title); songInfo.setText(song.albumName); SongGlideRequest.Builder.from(Glide.with(activity), song) .checkIgnoreMediaStore(activity).build() .into(albumArt); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { albumArt.setTransitionName(activity.getString(R.string.transition_album_art)); } final ImageView overflowButton = convertView.findViewById(R.id.menu); overflowButton.setOnClickListener(new SongMenuHelper.OnClickSongMenu(activity) { @Override public Song getSong() { return song; } @Override public boolean onMenuItemClick(MenuItem item) { if (item.getItemId() == R.id.action_go_to_album) { Pair[] albumPairs = new Pair[]{ Pair.create(albumArt, activity.getResources().getString(R.string.transition_album_art)) }; NavigationUtil.goToAlbum(activity, song.albumId, albumPairs); return true; } return super.onMenuItemClick(item); } }); convertView.setActivated(isChecked(song)); convertView.setOnClickListener(view -> { if (isInQuickSelectMode()) { toggleChecked(song); } else { MusicPlayerRemote.openQueue(dataSet, position, true); } }); convertView.setOnLongClickListener(view -> { toggleChecked(song); return true; }); return convertView; }
Example 8
Source File: ArtistSongAdapter.java From VinylMusicPlayer with GNU General Public License v3.0 | 4 votes |
@Override @NonNull public View getView(final int position, View convertView, @NonNull ViewGroup parent) { final Song song = getItem(position); if (convertView == null) { convertView = LayoutInflater.from(getContext()).inflate(R.layout.item_list, parent, false); } final TextView songTitle = convertView.findViewById(R.id.title); final TextView songInfo = convertView.findViewById(R.id.text); final ImageView albumArt = convertView.findViewById(R.id.image); final View shortSeparator = convertView.findViewById(R.id.short_separator); if (shortSeparator != null) { shortSeparator.setVisibility((position == getCount() - 1) ? View.GONE : View.VISIBLE); } songTitle.setText(song.title); songInfo.setText(song.albumName); // TODO This album art loading can be factorized with the decorate() helper function if (!MusicPlayerRemote.isPlaying(song)) { GlideApp.with(activity) .asDrawable() .load(VinylGlideExtension.getSongModel(song)) .transition(VinylGlideExtension.getDefaultTransition()) .songOptions(song) .into(albumArt); } PlayingSongDecorationUtil.decorate(songTitle, albumArt, null, song, activity, true); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { albumArt.setTransitionName(activity.getString(R.string.transition_album_art)); } final ImageView overflowButton = convertView.findViewById(R.id.menu); overflowButton.setOnClickListener(new SongMenuHelper.OnClickSongMenu(activity) { @Override public Song getSong() { return song; } @Override public boolean onMenuItemClick(MenuItem item) { if (item.getItemId() == R.id.action_go_to_album) { Pair[] albumPairs = new Pair[]{ Pair.create(albumArt, activity.getResources().getString(R.string.transition_album_art)) }; NavigationUtil.goToAlbum(activity, song.albumId, albumPairs); return true; } return super.onMenuItemClick(item); } }); convertView.setActivated(isChecked(song)); convertView.setOnClickListener(view -> { if (isInQuickSelectMode()) { toggleChecked(song); } else { MusicPlayerRemote.openQueue(dataSet, position, true); } }); convertView.setOnLongClickListener(view -> { toggleChecked(song); return true; }); return convertView; }
Example 9
Source File: AlbumDetailFragment.java From Muzesto with GNU General Public License v3.0 | 4 votes |
@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; }
Example 10
Source File: DetailActivity.java From Game-of-Thrones with Apache License 2.0 | 4 votes |
private void initTransitionInImageView(ImageView ivp) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { ivp.setTransitionName(transitionName); } }
Example 11
Source File: ArtistSongAdapter.java From Phonograph with GNU General Public License v3.0 | 4 votes |
@Override @NonNull public View getView(final int position, View convertView, @NonNull ViewGroup parent) { final Song song = getItem(position); if (convertView == null) { convertView = LayoutInflater.from(getContext()).inflate(R.layout.item_list, parent, false); } final TextView songTitle = convertView.findViewById(R.id.title); final TextView songInfo = convertView.findViewById(R.id.text); final ImageView albumArt = convertView.findViewById(R.id.image); final View shortSeparator = convertView.findViewById(R.id.short_separator); if (position == getCount() - 1) { if (shortSeparator != null) { shortSeparator.setVisibility(View.GONE); } } else { if (shortSeparator != null) { shortSeparator.setVisibility(View.VISIBLE); } } songTitle.setText(song.title); songInfo.setText(song.albumName); SongGlideRequest.Builder.from(Glide.with(activity), song) .checkIgnoreMediaStore(activity).build() .into(albumArt); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { albumArt.setTransitionName(activity.getString(R.string.transition_album_art)); } final ImageView overflowButton = convertView.findViewById(R.id.menu); overflowButton.setOnClickListener(new SongMenuHelper.OnClickSongMenu(activity) { @Override public Song getSong() { return song; } @Override public boolean onMenuItemClick(MenuItem item) { if (item.getItemId() == R.id.action_go_to_album) { Pair[] albumPairs = new Pair[]{ Pair.create(albumArt, activity.getResources().getString(R.string.transition_album_art)) }; NavigationUtil.goToAlbum(activity, song.albumId, albumPairs); return true; } return super.onMenuItemClick(item); } }); convertView.setActivated(isChecked(song)); convertView.setOnClickListener(view -> { if (isInQuickSelectMode()) { toggleChecked(song); } else { MusicPlayerRemote.openQueue(dataSet, position, true); } }); convertView.setOnLongClickListener(view -> { toggleChecked(song); return true; }); return convertView; }