Java Code Examples for android.widget.RelativeLayout#getTag()
The following examples show how to use
android.widget.RelativeLayout#getTag() .
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: AudioPlayer.java From Pix-Art-Messenger with GNU General Public License v3.0 | 6 votes |
private void startStop(ImageButton playPause) { if (ContextCompat.checkSelfPermission(messageAdapter.getActivity(), Manifest.permission.WRITE_EXTERNAL_STORAGE) != PackageManager.PERMISSION_GRANTED && ContextCompat.checkSelfPermission(messageAdapter.getActivity(), Manifest.permission.READ_EXTERNAL_STORAGE) != PackageManager.PERMISSION_GRANTED) { pendingOnClickView.push(new WeakReference<>(playPause)); ActivityCompat.requestPermissions(messageAdapter.getActivity(), new String[]{Manifest.permission.WRITE_EXTERNAL_STORAGE, Manifest.permission.READ_EXTERNAL_STORAGE}, ConversationsActivity.REQUEST_PLAY_PAUSE); return; } initializeProximityWakeLock(playPause.getContext()); final RelativeLayout audioPlayer = (RelativeLayout) playPause.getParent(); final ViewHolder viewHolder = ViewHolder.get(audioPlayer); final Message message = (Message) audioPlayer.getTag(); if (startStop(viewHolder, message)) { this.audioPlayerLayouts.clear(); this.audioPlayerLayouts.addWeakReferenceTo(audioPlayer); stopRefresher(true); } }
Example 2
Source File: FriendsRecyclerAdapter.java From toktok-android with GNU General Public License v3.0 | 6 votes |
@NonNull @Override public FriendsRecyclerViewHolder onCreateViewHolder(@NonNull ViewGroup viewGroup, int viewType) { final RelativeLayout itemView = (RelativeLayout) LayoutInflater.from(viewGroup.getContext()) .inflate(R.layout.fragment_home_friends_item, viewGroup, false); return new FriendsRecyclerViewHolder(itemView, () -> { ViewHolder holder = (ViewHolder) itemView.getTag(); if (expandedItem == holder.getLayoutPosition()) { notifyItemChanged(expandedItem); expandedItem = -1; } else { if (expandedItem >= 0) { notifyItemChanged(expandedItem); } expandedItem = holder.getLayoutPosition(); notifyItemChanged(expandedItem); } }); }
Example 3
Source File: AudioPlayer.java From Conversations with GNU General Public License v3.0 | 6 votes |
private void startStop(ImageButton playPause) { if (ContextCompat.checkSelfPermission(messageAdapter.getActivity(), Manifest.permission.WRITE_EXTERNAL_STORAGE) != PackageManager.PERMISSION_GRANTED) { pendingOnClickView.push(new WeakReference<>(playPause)); ActivityCompat.requestPermissions(messageAdapter.getActivity(), new String[]{Manifest.permission.WRITE_EXTERNAL_STORAGE}, ConversationsActivity.REQUEST_PLAY_PAUSE); return; } initializeProximityWakeLock(playPause.getContext()); final RelativeLayout audioPlayer = (RelativeLayout) playPause.getParent(); final ViewHolder viewHolder = ViewHolder.get(audioPlayer); final Message message = (Message) audioPlayer.getTag(); if (startStop(viewHolder, message)) { this.audioPlayerLayouts.clear(); this.audioPlayerLayouts.addWeakReferenceTo(audioPlayer); stopRefresher(true); } }
Example 4
Source File: AudioPlayer.java From Pix-Art-Messenger with GNU General Public License v3.0 | 5 votes |
private void resetPlayerUi(RelativeLayout audioPlayer) { if (audioPlayer == null) { return; } final ViewHolder viewHolder = ViewHolder.get(audioPlayer); final Message message = (Message) audioPlayer.getTag(); viewHolder.playPause.setImageResource(viewHolder.darkBackground ? R.drawable.ic_play_arrow_white_36dp : R.drawable.ic_play_arrow_black_36dp); if (message != null) { viewHolder.runtime.setText(formatTime(message.getFileParams().runtime)); } viewHolder.progress.setProgress(0); viewHolder.progress.setEnabled(false); }
Example 5
Source File: AudioPlayer.java From Pix-Art-Messenger with GNU General Public License v3.0 | 5 votes |
@Override public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) { synchronized (AudioPlayer.LOCK) { final RelativeLayout audioPlayer = (RelativeLayout) seekBar.getParent(); final Message message = (Message) audioPlayer.getTag(); if (fromUser && message == AudioPlayer.currentlyPlayingMessage) { float percent = progress / 100f; int duration = AudioPlayer.player.getDuration(); int seekTo = Math.round(duration * percent); AudioPlayer.player.seekTo(seekTo); } } }
Example 6
Source File: AudioPlayer.java From Pix-Art-Messenger with GNU General Public License v3.0 | 5 votes |
public static ViewHolder get(RelativeLayout audioPlayer) { ViewHolder viewHolder = (ViewHolder) audioPlayer.getTag(R.id.TAG_AUDIO_PLAYER_VIEW_HOLDER); if (viewHolder == null) { viewHolder = new ViewHolder(); viewHolder.runtime = audioPlayer.findViewById(R.id.runtime); viewHolder.progress = audioPlayer.findViewById(R.id.progress); viewHolder.playPause = audioPlayer.findViewById(R.id.play_pause); audioPlayer.setTag(R.id.TAG_AUDIO_PLAYER_VIEW_HOLDER, viewHolder); } return viewHolder; }
Example 7
Source File: AudioPlayer.java From Conversations with GNU General Public License v3.0 | 5 votes |
private void resetPlayerUi(RelativeLayout audioPlayer) { if (audioPlayer == null) { return; } final ViewHolder viewHolder = ViewHolder.get(audioPlayer); final Message message = (Message) audioPlayer.getTag(); viewHolder.playPause.setImageResource(viewHolder.darkBackground ? R.drawable.ic_play_arrow_white_36dp : R.drawable.ic_play_arrow_black_36dp); if (message != null) { viewHolder.runtime.setText(formatTime(message.getFileParams().runtime)); } viewHolder.progress.setProgress(0); viewHolder.progress.setEnabled(false); }
Example 8
Source File: AudioPlayer.java From Conversations with GNU General Public License v3.0 | 5 votes |
@Override public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) { synchronized (AudioPlayer.LOCK) { final RelativeLayout audioPlayer = (RelativeLayout) seekBar.getParent(); final Message message = (Message) audioPlayer.getTag(); if (fromUser && message == AudioPlayer.currentlyPlayingMessage) { float percent = progress / 100f; int duration = AudioPlayer.player.getDuration(); int seekTo = Math.round(duration * percent); AudioPlayer.player.seekTo(seekTo); } } }
Example 9
Source File: AudioPlayer.java From Conversations with GNU General Public License v3.0 | 5 votes |
public static ViewHolder get(RelativeLayout audioPlayer) { ViewHolder viewHolder = (ViewHolder) audioPlayer.getTag(R.id.TAG_AUDIO_PLAYER_VIEW_HOLDER); if (viewHolder == null) { viewHolder = new ViewHolder(); viewHolder.runtime = audioPlayer.findViewById(R.id.runtime); viewHolder.progress = audioPlayer.findViewById(R.id.progress); viewHolder.playPause = audioPlayer.findViewById(R.id.play_pause); audioPlayer.setTag(R.id.TAG_AUDIO_PLAYER_VIEW_HOLDER, viewHolder); } return viewHolder; }