diff --git a/common/src/main/java/com/yunbao/common/dialog/AbsDialogFragment.java b/common/src/main/java/com/yunbao/common/dialog/AbsDialogFragment.java index 99243dcfb..80de088c4 100644 --- a/common/src/main/java/com/yunbao/common/dialog/AbsDialogFragment.java +++ b/common/src/main/java/com/yunbao/common/dialog/AbsDialogFragment.java @@ -27,6 +27,7 @@ public abstract class AbsDialogFragment extends DialogFragment { protected Context mContext; protected View mRootView; + protected Dialog dialog; @NonNull @Override @@ -37,7 +38,7 @@ public abstract class AbsDialogFragment extends DialogFragment { } else { mRootView = LayoutInflater.from(mContext).inflate(getLayoutId(), null); } - Dialog dialog = new Dialog(mContext, getDialogStyle()); + dialog = new Dialog(mContext, getDialogStyle()); dialog.setContentView(mRootView); dialog.setCancelable(canCancel()); dialog.setCanceledOnTouchOutside(canCancel()); diff --git a/common/src/main/res/values/colors.xml b/common/src/main/res/values/colors.xml index 64d247c68..48c57b325 100644 --- a/common/src/main/res/values/colors.xml +++ b/common/src/main/res/values/colors.xml @@ -78,4 +78,6 @@ #F6F7FB #F4F4F4 + #FFFFBD59 + diff --git a/live/src/main/java/com/yunbao/live/adapter/LiveChatAdapter.java b/live/src/main/java/com/yunbao/live/adapter/LiveChatAdapter.java index 7cc20ac16..4fcd1820a 100644 --- a/live/src/main/java/com/yunbao/live/adapter/LiveChatAdapter.java +++ b/live/src/main/java/com/yunbao/live/adapter/LiveChatAdapter.java @@ -242,8 +242,6 @@ public class LiveChatAdapter extends RecyclerView.Adapter { SVGAImageView avatar_gift_svga; RelativeLayout avatarLayout; - TextView event_entrance; - public Vh(View itemView) { super(itemView); mBg = (LinearLayout) itemView.findViewById(R.id.bg); @@ -277,8 +275,6 @@ public class LiveChatAdapter extends RecyclerView.Adapter { msg_avatar = itemView.findViewById(R.id.msg_avatar); avatar_gift_svga = itemView.findViewById(R.id.avatar_gift_svga); avatarLayout = itemView.findViewById(R.id.avatarLayout); - - event_entrance = itemView.findViewById(R.id.event_entrance); } void setData(final LiveChatBean bean, int position) { @@ -574,11 +570,21 @@ public class LiveChatAdapter extends RecyclerView.Adapter { mTextView.setText(Html.fromHtml(stringBuffer.toString())); new LoadDian9TuUtil().loadDian9TuAssets(mContext, mBg, 1); } else if(bean.getType() == TYPE_TO_TASK_INLET){ - StringBuffer stringBuffer = new StringBuffer(); - stringBuffer.append("" + (WordUtil.isNewZh() ? "發送彈幕與主播進行互動吧!完成弹幕互动和点赞任務,还可以领取超多新人豪華禮物哦" : "Send bullet screens to interact with the anchor! Complete the bullet screen interaction and like tasks, and you can also receive many new luxury gifts!") + ""); - stringBuffer.append("," + (WordUtil.isNewZh() ? "活動入口" : "Event Entrance") + ""); - mTextView.setText(Html.fromHtml(stringBuffer.toString())); - event_entrance.setVisibility(View.VISIBLE); + String str = "發送彈幕與主播進行互動吧!參與新人觀播活动,完成任務領取超多新人豪華禮物!"; + String str_en = "Send bullet comments and interact with the streamer! Join the newbie event, complete tasks, and get luxurious gifts!"; + if(WordUtil.isNewZh()){ + SpannableString spannableString = new SpannableString(str); + int start = str.indexOf("新人觀播活动"); + int end = start + "新人觀播活动".length(); + spannableString.setSpan(new ForegroundColorSpan(mContext.getColor(R.color.chat_event_entrance)), start, end, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE); + mTextView.setText(spannableString); + }else{ + SpannableString spannableString = new SpannableString(str_en); + int start = str_en.indexOf("newbie event"); + int end = start + "newbie event".length(); + spannableString.setSpan(new ForegroundColorSpan(mContext.getColor(R.color.chat_event_entrance)), start, end, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE); + mTextView.setText(spannableString); + } new LoadDian9TuUtil().loadDian9TuAssets(mContext, mBg, 1); }else if(bean.getType() == TYPE_TO_TASK_INLET1){ String str = "您有一份獎勵可領取,點擊此處前往領取禮物吧!"; @@ -589,6 +595,7 @@ public class LiveChatAdapter extends RecyclerView.Adapter { int end = start + "點擊此處".length(); float size = TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_SP, 14, mContext.getResources().getDisplayMetrics()); spannableString.setSpan(new AbsoluteSizeSpan((int) size), start, end, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE); + spannableString.setSpan(new ForegroundColorSpan(mContext.getColor(R.color.chat_event_entrance)), start, end, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE); mTextView.setText(spannableString); }else{ SpannableString spannableString = new SpannableString(str_en); @@ -596,6 +603,7 @@ public class LiveChatAdapter extends RecyclerView.Adapter { int end = start + "click here".length(); float size = TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_SP, 14, mContext.getResources().getDisplayMetrics()); spannableString.setSpan(new AbsoluteSizeSpan((int) size), start, end, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE); + spannableString.setSpan(new ForegroundColorSpan(mContext.getColor(R.color.chat_event_entrance)), start, end, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE); mTextView.setText(spannableString); } new LoadDian9TuUtil().loadDian9TuAssets(mContext, mBg, 1); diff --git a/live/src/main/java/com/yunbao/live/dialog/LiveHDDialogFragment.java b/live/src/main/java/com/yunbao/live/dialog/LiveHDDialogFragment.java index 631c0f7e9..7bdb046bc 100644 --- a/live/src/main/java/com/yunbao/live/dialog/LiveHDDialogFragment.java +++ b/live/src/main/java/com/yunbao/live/dialog/LiveHDDialogFragment.java @@ -70,7 +70,6 @@ public class LiveHDDialogFragment extends AbsDialogFragment { private TextView htmlError; private boolean isSetHeight = false; OnDisListener onDisListener; - Dialog dialog; public LiveHDDialogFragment() { @@ -78,6 +77,14 @@ public class LiveHDDialogFragment extends AbsDialogFragment { public void setOnDisListener(OnDisListener onDisListener) { this.onDisListener = onDisListener; + if(dialog!=null){ + dialog.setOnDismissListener(new DialogInterface.OnDismissListener() { + @Override + public void onDismiss(DialogInterface dialog) { + onDisListener.onDis(); + } + }); + } } /** @@ -244,18 +251,8 @@ public class LiveHDDialogFragment extends AbsDialogFragment { }); } } - dialog = getDialog(); - dialog.setOnDismissListener(new DialogInterface.OnDismissListener() { - @Override - public void onDismiss(DialogInterface dialog) { - if(onDisListener!=null){ - onDisListener.onDis(); - } - } - }); } - private void gotoLive(final String live_id) { if (!TextUtils.equals(roomId, live_id)) { LiveHttpUtil.getLiveInfo(live_id, new HttpCallback() { 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 98582fdbb..585720139 100644 --- a/live/src/main/java/com/yunbao/live/views/LiveRoomViewHolder.java +++ b/live/src/main/java/com/yunbao/live/views/LiveRoomViewHolder.java @@ -486,12 +486,14 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis private TextView new_task_send_gift_details; private ImageView close_task_send_gift_close; + private ImageView newPersonTask; + public LiveRoomViewHolder setGuardType(int guardType) { this.guardType = guardType; return this; } - public void setComAll(boolean isComAll){ + public void setComAll(boolean isComAll) { this.isComAll = isComAll; } @@ -957,7 +959,7 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis if (notify_follow_layout != null) { animatorFollowFirstLook(false); firstFollowLookHandler.removeCallbacks(firstFollowLookRunnable); - if(!nothingCheck || !isComAll){//没有任何操作 + if (!nothingCheck || !isComAll) {//没有任何操作 new Handler().postDelayed(new Runnable() { @Override public void run() { @@ -1023,7 +1025,7 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis public void run() { notify_follow_layout.setVisibility(View.GONE); } - },1000); + }, 1000); } animator_follow_first_look.setInterpolator(new LinearInterpolator()); animator_follow_first_look.start(); @@ -1083,7 +1085,7 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis public void run() { new_task_gift_notify.setVisibility(View.GONE); } - },1000); + }, 1000); } animator_first_task_details.setInterpolator(new LinearInterpolator()); animator_first_task_details.start(); @@ -1143,7 +1145,7 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis public void run() { new_task_gift_notify1.setVisibility(View.GONE); } - },1000); + }, 1000); } animator_first_task_details1.setInterpolator(new LinearInterpolator()); animator_first_task_details1.start(); @@ -1175,7 +1177,7 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis @Override public void onClick(View v) { //跳转到免费礼物 - ((LiveAudienceActivity) mContext).openGiftWindow("", "1"); + ((LiveAudienceActivity) mContext).openGiftWindow(); animatorSendGiftTask(false); sendGiftTaskHandler.removeCallbacks(sendGiftTaskRunnable); } @@ -1206,7 +1208,7 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis public void run() { new_task_send_gift_notify.setVisibility(View.GONE); } - },1000); + }, 1000); } animator_send_gift_task.setInterpolator(new LinearInterpolator()); animator_send_gift_task.start(); @@ -1214,18 +1216,18 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis public boolean isShowH5Dialog; - public void showH5Dialog(){ + public void showH5Dialog() { Bundle bundle = new Bundle(); - bundle.putString("url", CommonAppConfig.HOST+"/h5/activity/pdlNewUes/index.html?1=1"); + bundle.putString("url", CommonAppConfig.HOST + "/h5/activity/pdlNewUes/index.html?1=1"); LiveHDDialogFragment fragment = new LiveHDDialogFragment(); + fragment.setArguments(bundle); + fragment.show(((LiveActivity) mContext).getSupportFragmentManager(), "LiveHDDialogFragment"); fragment.setOnDisListener(new LiveHDDialogFragment.OnDisListener() { @Override public void onDis() { startTaskInletTime(); } }); - fragment.setArguments(bundle); - fragment.show(((LiveAudienceActivity) mContext).getSupportFragmentManager(), "LiveHDDialogFragment"); } //向chatList发送一条活动入口消息 @@ -1239,7 +1241,7 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis } }, 1000); if (mLiveRoomHandler != null) { - mLiveRoomHandler.sendEmptyMessageAtTime(LiveRoomHandler.WHAT_TASK_INLET_LIVE, getNextTime(1000*300)); + mLiveRoomHandler.sendEmptyMessageAtTime(LiveRoomHandler.WHAT_TASK_INLET_LIVE, getNextTime(1000 * 300)); } } @@ -1256,8 +1258,8 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis } - public void startTaskInletTime(){ - if(!isShowH5Dialog){ + public void startTaskInletTime() { + if (!isShowH5Dialog) { firstTaskInletNotify(); } isShowH5Dialog = true; @@ -1927,11 +1929,13 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis } else if (mContext instanceof LiveSwAnchorActivity) { com.yunbao.live.activity.LiveSwAnchorActivity.mLiveAnchorViewHolder.closeMenuRed(); } - }else if(bean.getType() == TYPE_TO_TASK_INLET||bean.getType() == TYPE_TO_TASK_INLET1){ + } else if (bean.getType() == TYPE_TO_TASK_INLET || bean.getType() == TYPE_TO_TASK_INLET1) { + L.e("TYPE_TO_TASK_INLET1=" + bean.getType()); showH5Dialog(); } else { showUserDialog(bean.getId()); } + L.e("onItemClickonItemClickonItemClick=" + bean.getType()); } }); @@ -2292,9 +2296,17 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis new_task_gift_details1 = findViewById(R.id.new_task_gift_details1); close_task_receive_close1 = findViewById(R.id.close_task_receive_close1); - new_task_send_gift_notify= findViewById(R.id.new_task_send_gift_notify); - new_task_send_gift_details= findViewById(R.id.new_task_send_gift_details); - close_task_send_gift_close= findViewById(R.id.close_task_send_gift_close); + new_task_send_gift_notify = findViewById(R.id.new_task_send_gift_notify); + new_task_send_gift_details = findViewById(R.id.new_task_send_gift_details); + close_task_send_gift_close = findViewById(R.id.close_task_send_gift_close); + + newPersonTask = findViewById(R.id.newPersonTask); + newPersonTask.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + showH5Dialog(); + } + }); } /** @@ -4981,29 +4993,37 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis */ public void firstLook5MinLiveNotify() { if (mLiveRoomHandler != null) { - mLiveRoomHandler.sendEmptyMessageAtTime(LiveRoomHandler.WHAT_LOOK_5_MIN_LIVE, getNextTime(1000*5)); + mLiveRoomHandler.sendEmptyMessageAtTime(LiveRoomHandler.WHAT_LOOK_5_MIN_LIVE, getNextTime(1000 *60* 5)); } } /** - * 打開活動彈窗 + * 打開活動彈窗 关闭5min后 */ public void firstTaskInletNotify() { if (mLiveRoomHandler != null) { - mLiveRoomHandler.sendEmptyMessageAtTime(LiveRoomHandler.WHAT_TASK_INLET_LIVE, getNextTime(1000*5)); + //取消观看200秒后的定时器-产品需求,只需要存在一个逻辑 mLiveRoomHandler.removeMessages(LiveRoomHandler.WHAT_TASK_INLET_LIVE); + mLiveRoomHandler.sendEmptyMessageAtTime(LiveRoomHandler.WHAT_TASK_INLET_LIVE, getNextTime(1000 * 5)); } } /** - * 打開活動彈窗观看200秒之后 + * 观看200秒之后 */ public void firstTaskInlet1Notify() { if (mLiveRoomHandler != null) { - mLiveRoomHandler.sendEmptyMessageAtTime(LiveRoomHandler.WHAT_TASK_INLET_LIVE, getNextTime(1000*200)); + mLiveRoomHandler.sendEmptyMessageAtTime(LiveRoomHandler.WHAT_TASK_INLET_LIVE, getNextTime(1000 * 200)); } } + /** + * 新人观播礼-判断是否是新用户 + */ + public void setNewPersonTask() { + newPersonTask.setVisibility(View.VISIBLE); + } + private long getNextTime(int time) { long now = SystemClock.uptimeMillis(); if (time < 1000) { diff --git a/live/src/main/java/com/yunbao/live/views/PortraitLiveManager.java b/live/src/main/java/com/yunbao/live/views/PortraitLiveManager.java index 40332065a..e32ffee11 100644 --- a/live/src/main/java/com/yunbao/live/views/PortraitLiveManager.java +++ b/live/src/main/java/com/yunbao/live/views/PortraitLiveManager.java @@ -916,6 +916,10 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe } //观看200秒之后,推送活动入口im消息 mLiveRoomViewHolder.firstTaskInlet1Notify(); + //新人观播礼-判断是否是新用户 + if(data.getEnterRoomInfo().getIsNewUser().equals("1")){ + mLiveRoomViewHolder.setNewPersonTask(); + } } @Override diff --git a/live/src/main/res/layout/item_live_chat.xml b/live/src/main/res/layout/item_live_chat.xml index 1d39cc6e0..07281f1cc 100644 --- a/live/src/main/res/layout/item_live_chat.xml +++ b/live/src/main/res/layout/item_live_chat.xml @@ -62,19 +62,6 @@ tools:ignore="RtlHardcoded" tools:text="aaaaaaaaa111111111111111111111111111111111111111111111111111111111" /> - - + + + android:orientation="vertical"> @@ -3115,9 +3127,9 @@ android:fontFamily="sans-serif-condensed-medium" android:gravity="center" android:maxWidth="50dp" - android:text="點擊\n前往" + android:text="@string/live_room_push_to_new_task" android:textColor="#FF2B5AB8" - android:textSize="10sp" + android:textSize="12sp" android:visibility="visible" tools:visibility="visible" /> @@ -3135,10 +3147,10 @@ @@ -3179,10 +3191,8 @@ android:fontFamily="sans-serif-condensed-medium" android:gravity="center" android:maxWidth="50dp" - android:paddingStart="10dp" - android:paddingEnd="10dp" android:singleLine="true" - android:text="详情" + android:text="@string/live_room_push_details" android:textColor="#FF2B5AB8" android:textSize="12sp" android:visibility="visible" @@ -3202,27 +3212,27 @@ + android:paddingStart="10dp"> + android:scaleType="centerCrop" + android:src="@mipmap/icon_live_room_follow_avatar" + app:riv_oval="true" /> - + android:textSize="10sp" /> 心願 新手任務 活動入口 + 點擊\n前往 + 您有一份獎勵可領取,速速前往! + 看了這麼久,送ta一份免費禮物吧 ~ 完成首次送禮任務還可以領取精美獎品! + 查看禮物 + 完成新人任務,可領多重專屬豪禮! + 詳情 + 喜歡主播就關注ta吧~ + diff --git a/live/src/main/res/values/strings.xml b/live/src/main/res/values/strings.xml index 2bf1d6c21..98e3d7a42 100644 --- a/live/src/main/res/values/strings.xml +++ b/live/src/main/res/values/strings.xml @@ -169,4 +169,11 @@ Wishlist Newb job Event entrance + Click \nto go + You have a viewing reward to claim, go there quickly! + After watching for so long, give her a free gift~ You can also receive exquisite gifts by completing the gift-giving task! + View Gifts + Complete the newcomer tasks and receive multiple gifts + Details + If you like this anchor, please subscribe to him. \ No newline at end of file