diff --git a/live/src/main/java/com/yunbao/live/views/LiveRoomViewHolder.java b/live/src/main/java/com/yunbao/live/views/LiveRoomViewHolder.java index d6ed5200f..b9b144cdc 100644 --- a/live/src/main/java/com/yunbao/live/views/LiveRoomViewHolder.java +++ b/live/src/main/java/com/yunbao/live/views/LiveRoomViewHolder.java @@ -221,6 +221,7 @@ import io.rong.imkit.userinfo.RongUserInfoManager; import io.rong.imlib.RongIMClient; import io.rong.imlib.model.Conversation; import io.rong.imlib.model.UserInfo; +import com.bumptech.glide.load.resource.gif.GifDrawable; import pl.droidsonroids.gif.GifImageView; /** @@ -415,7 +416,8 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis private View prank_group; public TextView prank_group_title,prank_group_turntable; private RecyclerView recycler_prank; - private ImageView prank_group_bottom_icon,prank_group_turntable_icon,prank_small_icon; + private ImageView prank_group_bottom_icon,prank_group_turntable_icon; + private GifImageView prank_small_icon; private PrankAdapter prankAdapter; private List prankAndComboList = new ArrayList<>(); private List completedList = new ArrayList<>(); @@ -423,6 +425,9 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis private boolean prankAnisShow; private LinearLayout prank_top_layout; private ImageView prank_group_top_icon; + + private pl.droidsonroids.gif.GifDrawable mGifDrawable; + public LiveRoomViewHolder setGuardType(int guardType) { this.guardType = guardType; return this; @@ -1677,7 +1682,21 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis prank_group_turntable = (TextView) findViewById(R.id.prank_group_turntable);//文字转盘整蛊(用户端已删除,主播端为待完成整蛊按钮) prank_group_bottom_icon = (ImageView) findViewById(R.id.prank_group_bottom_icon);//收起icon prank_group_turntable_icon = (ImageView) findViewById(R.id.prank_group_turntable_icon);//转盘图标 - prank_small_icon = (ImageView) findViewById(R.id.prank_small_icon);//收起后图标 + prank_small_icon = (GifImageView) findViewById(R.id.prank_small_icon);//收起后图标 + + try { + if (WordUtil.isNewZh()){ + mGifDrawable = new pl.droidsonroids.gif.GifDrawable(mContext.getResources(),R.drawable.pran_zh); + }else { + mGifDrawable = new pl.droidsonroids.gif.GifDrawable(mContext.getResources(),R.drawable.pran_en); + } + prank_small_icon.setImageDrawable(mGifDrawable); + mGifDrawable.stop(); + }catch (Exception e){ + e.printStackTrace(); + } + + //点击文字转盘整蛊(跳转转盘整蛊) prank_group_turntable.setOnClickListener(v->{ prankAnisShow = !prankAnisShow; @@ -1699,6 +1718,11 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis prank_group_bottom_icon.setOnClickListener(v->{ prank_group.setVisibility(View.GONE); prank_small_icon.setVisibility(View.VISIBLE); + if (CommonAppConfig.getInstance().getUid().equals(mLiveUid)){ + switchGifDrawable(!completedList.isEmpty()); + }else { + switchGifDrawable(false); + } }); //点击收起整蛊icon @@ -1865,6 +1889,7 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis public void onClick(View view) { prank_group.setVisibility(View.GONE); prank_small_icon.setVisibility(View.VISIBLE); + switchGifDrawable(!completedList.isEmpty()); } }); prank_group_top_icon.setVisibility(View.VISIBLE); @@ -1875,6 +1900,7 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis } prank_group_bottom_icon.setVisibility(View.GONE); }else{ + switchGifDrawable(false); if(mPrankType==1){ prank_group_title.setText(R.string.prank_progress); }else{ @@ -1924,6 +1950,18 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis }); } + private void switchGifDrawable(boolean start){ + LogUtils.e("yqw=====>判断闪烁:"+(mGifDrawable != null)+","+start); + if (mGifDrawable != null){ + if (start){ + mGifDrawable.start(); + }else { + mGifDrawable.seekTo(0); + mGifDrawable.stop(); + } + } + } + int ttttttype = 0; private LinearLayout dragonImmediateParticipation, dragonImmediateParticipationTime; private FrameLayout redPacket; diff --git a/live/src/main/res/layout/view_live_room.xml b/live/src/main/res/layout/view_live_room.xml index 87c990e0a..b1054eb1c 100644 --- a/live/src/main/res/layout/view_live_room.xml +++ b/live/src/main/res/layout/view_live_room.xml @@ -2403,14 +2403,14 @@ tools:visibility="visible" layout="@layout/view_prank_group"/> - + />