| | |
| | | */ |
| | | public static void setPlayImage(ImageView iv_play, boolean isPlaying, boolean land) { |
| | | String resourceName = ""; |
| | | |
| | | if (isPlaying) |
| | | if (land) |
| | | resourceName = "ic_player_play"; |
| | | else |
| | | resourceName = "ic_player_play_small"; |
| | | else { |
| | | if (isPlaying) { |
| | | if (land) |
| | | resourceName = "ic_player_pause"; |
| | | else |
| | | resourceName = "ic_player_pause_small"; |
| | | } else { |
| | | if (land) |
| | | resourceName = "ic_player_play"; |
| | | else |
| | | resourceName = "ic_player_play_small"; |
| | | } |
| | | |
| | | Object picture = iv_play.getTag(); |
| | | if (picture != null && picture.toString().equalsIgnoreCase(resourceName)) { |
| | | return; |
| | | } |
| | | |
| | | iv_play.setTag(resourceName); |
| | | |
| | | iv_play.setImageResource(iv_play.getResources().getIdentifier(resourceName, "drawable", iv_play.getContext().getPackageName())); |
| | | ViewGroup.LayoutParams params = iv_play.getLayoutParams(); |
| | | if (land) { |
| | | params.width = DimenUtils.dip2px(iv_play.getContext(), 38); |
| | | params.height = DimenUtils.dip2px(iv_play.getContext(), 38); |
| | | iv_play.setPadding(0, 0, 0, 0); |
| | | } else { |
| | | int padding = DimenUtils.dip2px(iv_play.getContext(), 5); |
| | | iv_play.setPadding(padding, padding, padding, padding); |
| | | params.width = ViewGroup.LayoutParams.WRAP_CONTENT; |
| | | params.height = DimenUtils.dip2px(iv_play.getContext(), 14); |
| | | params.height = DimenUtils.dip2px(iv_play.getContext(), 24); |
| | | } |
| | | } |
| | | |