修复:修改主播播放时长位置
This commit is contained in:
parent
a5516ebfb3
commit
606fc64262
@ -670,6 +670,7 @@ public class LiveRyAnchorActivity extends LiveActivity implements LiveFunctionCl
|
|||||||
L.e("createRoom----播放地址--->" + playUrl);
|
L.e("createRoom----播放地址--->" + playUrl);
|
||||||
mLiveBean.setPull(playUrl);
|
mLiveBean.setPull(playUrl);
|
||||||
mTxAppId = obj.getString("tx_appid");
|
mTxAppId = obj.getString("tx_appid");
|
||||||
|
|
||||||
//移除开播前的设置控件,添加直播间控件
|
//移除开播前的设置控件,添加直播间控件
|
||||||
if (mLiveReadyViewHolder != null) {
|
if (mLiveReadyViewHolder != null) {
|
||||||
mLiveReadyViewHolder.removeFromParent();
|
mLiveReadyViewHolder.removeFromParent();
|
||||||
@ -701,6 +702,7 @@ public class LiveRyAnchorActivity extends LiveActivity implements LiveFunctionCl
|
|||||||
mLiveAnchorViewHolder = new LiveRyAnchorViewHolder(mContext, mContainer);
|
mLiveAnchorViewHolder = new LiveRyAnchorViewHolder(mContext, mContainer);
|
||||||
mLiveAnchorViewHolder.setLiveBean(mLiveBean);
|
mLiveAnchorViewHolder.setLiveBean(mLiveBean);
|
||||||
mLiveAnchorViewHolder.addToParent();
|
mLiveAnchorViewHolder.addToParent();
|
||||||
|
mLiveAnchorViewHolder.startAnchorLiveTime();
|
||||||
}
|
}
|
||||||
mLiveBottomViewHolder = mLiveAnchorViewHolder;
|
mLiveBottomViewHolder = mLiveAnchorViewHolder;
|
||||||
mSocketRyClient = new SocketRyClient(mLiveUid, this);
|
mSocketRyClient = new SocketRyClient(mLiveUid, this);
|
||||||
|
@ -208,8 +208,7 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
|
|||||||
private GifImageView mGifImageView;
|
private GifImageView mGifImageView;
|
||||||
public static SVGAImageView mSVGAImageView;
|
public static SVGAImageView mSVGAImageView;
|
||||||
private ViewGroup mLiveGiftPrizePoolContainer;
|
private ViewGroup mLiveGiftPrizePoolContainer;
|
||||||
private TextView mLiveTimeTextView;//主播的直播时长
|
|
||||||
private long mAnchorLiveTime;//主播直播时间
|
|
||||||
private View mBtnPrizePool;//奖池按钮
|
private View mBtnPrizePool;//奖池按钮
|
||||||
private TextView mPrizePoolLevel;//奖池等级
|
private TextView mPrizePoolLevel;//奖池等级
|
||||||
private int forAct;
|
private int forAct;
|
||||||
@ -939,9 +938,6 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
|
|||||||
mBtnRedPack.setOnClickListener(this);
|
mBtnRedPack.setOnClickListener(this);
|
||||||
if (mContext instanceof LiveAudienceActivity) {
|
if (mContext instanceof LiveAudienceActivity) {
|
||||||
mRoot.setOnClickListener(this);
|
mRoot.setOnClickListener(this);
|
||||||
} else {
|
|
||||||
mLiveTimeTextView = (TextView) findViewById(R.id.live_time);
|
|
||||||
mLiveTimeTextView.setVisibility(View.VISIBLE);
|
|
||||||
}
|
}
|
||||||
mLightAnimPresenter = new LiveLightAnimPresenter(mContext, mParentView);
|
mLightAnimPresenter = new LiveLightAnimPresenter(mContext, mParentView);
|
||||||
mLiveEnterRoomAnimPresenter = new LiveEnterRoomAnimPresenter(mContext, mContentView, mScreenWdith);
|
mLiveEnterRoomAnimPresenter = new LiveEnterRoomAnimPresenter(mContext, mContentView, mScreenWdith);
|
||||||
@ -2916,16 +2912,7 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 主播显示直播时间
|
|
||||||
*/
|
|
||||||
private void showAnchorLiveTime() {
|
|
||||||
if (mLiveTimeTextView != null) {
|
|
||||||
mAnchorLiveTime += 1000;
|
|
||||||
mLiveTimeTextView.setText(StringUtil.getDurationText(mAnchorLiveTime));
|
|
||||||
startAnchorLiveTime();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void startAnchorLiveTime() {
|
public void startAnchorLiveTime() {
|
||||||
if (mLiveRoomHandler != null) {
|
if (mLiveRoomHandler != null) {
|
||||||
@ -3226,9 +3213,6 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
|
|||||||
case WHAT_TIME_CHARGE:
|
case WHAT_TIME_CHARGE:
|
||||||
mLiveRoomViewHolder.requestTimeCharge();
|
mLiveRoomViewHolder.requestTimeCharge();
|
||||||
break;
|
break;
|
||||||
case WHAT_ANCHOR_LIVE_TIME:
|
|
||||||
mLiveRoomViewHolder.showAnchorLiveTime();
|
|
||||||
break;
|
|
||||||
case WHAT_ANCHOR_PAUSE:
|
case WHAT_ANCHOR_PAUSE:
|
||||||
mLiveRoomViewHolder.anchorEndLive();
|
mLiveRoomViewHolder.anchorEndLive();
|
||||||
break;
|
break;
|
||||||
|
@ -4,13 +4,15 @@ import static com.yunbao.live.activity.LiveActivity.mLiveUid;
|
|||||||
import static com.yunbao.live.activity.LiveRyAnchorActivity.PKing;
|
import static com.yunbao.live.activity.LiveRyAnchorActivity.PKing;
|
||||||
import static com.yunbao.live.activity.LiveRyAnchorActivity.pk_nub;
|
import static com.yunbao.live.activity.LiveRyAnchorActivity.pk_nub;
|
||||||
import static com.yunbao.live.event.LiveAudienceEvent.LiveAudienceType.START_MESSAGE;
|
import static com.yunbao.live.event.LiveAudienceEvent.LiveAudienceType.START_MESSAGE;
|
||||||
import static com.yunbao.live.event.LiveAudienceEvent.LiveAudienceType.WISH_LIST;
|
|
||||||
import static com.yunbao.live.event.LiveAudienceEvent.LiveAudienceType.WISH_LIST_UPDATE;
|
import static com.yunbao.live.event.LiveAudienceEvent.LiveAudienceType.WISH_LIST_UPDATE;
|
||||||
import static com.yunbao.live.presenter.LiveRyLinkMicPkPresenter.leaveDRRoom;
|
import static com.yunbao.live.presenter.LiveRyLinkMicPkPresenter.leaveDRRoom;
|
||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.graphics.drawable.Drawable;
|
import android.graphics.drawable.Drawable;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
|
import android.os.Handler;
|
||||||
|
import android.os.Message;
|
||||||
|
import android.os.SystemClock;
|
||||||
import android.text.TextUtils;
|
import android.text.TextUtils;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
@ -37,6 +39,7 @@ import com.yunbao.common.http.HttpClient;
|
|||||||
import com.yunbao.common.http.live.LiveNetManager;
|
import com.yunbao.common.http.live.LiveNetManager;
|
||||||
import com.yunbao.common.manager.IMLoginManager;
|
import com.yunbao.common.manager.IMLoginManager;
|
||||||
import com.yunbao.common.utils.Bus;
|
import com.yunbao.common.utils.Bus;
|
||||||
|
import com.yunbao.common.utils.StringUtil;
|
||||||
import com.yunbao.common.utils.ToastUtil;
|
import com.yunbao.common.utils.ToastUtil;
|
||||||
import com.yunbao.live.R;
|
import com.yunbao.live.R;
|
||||||
import com.yunbao.live.activity.LiveRyAnchorActivity;
|
import com.yunbao.live.activity.LiveRyAnchorActivity;
|
||||||
@ -77,10 +80,13 @@ public class LiveRyAnchorViewHolder extends AbsLiveViewHolder {
|
|||||||
private LiveBean mLiveBean;
|
private LiveBean mLiveBean;
|
||||||
private List<BannerBean> mBannerList = new ArrayList<>();
|
private List<BannerBean> mBannerList = new ArrayList<>();
|
||||||
private String activityUrl;
|
private String activityUrl;
|
||||||
|
private TextView mLiveTimeTextView;//主播的直播时长
|
||||||
|
private long mAnchorLiveTime;//主播直播时间
|
||||||
|
private LiveRoomHandler mLiveRoomHandler;
|
||||||
|
|
||||||
public LiveRyAnchorViewHolder(Context context, ViewGroup parentView) {
|
public LiveRyAnchorViewHolder(Context context, ViewGroup parentView) {
|
||||||
super(context, parentView);
|
super(context, parentView);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -163,6 +169,9 @@ public class LiveRyAnchorViewHolder extends AbsLiveViewHolder {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
findViewById(R.id.btn_link_mic).setOnClickListener(this);
|
findViewById(R.id.btn_link_mic).setOnClickListener(this);
|
||||||
|
mLiveTimeTextView = (TextView) findViewById(R.id.live_time);
|
||||||
|
mLiveTimeTextView.setVisibility(View.VISIBLE);
|
||||||
|
mLiveRoomHandler = new LiveRoomHandler();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -568,4 +577,50 @@ public class LiveRyAnchorViewHolder extends AbsLiveViewHolder {
|
|||||||
initWishList();
|
initWishList();
|
||||||
setLiveUid(mLiveBean.getUid());
|
setLiveUid(mLiveBean.getUid());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 主播显示直播时间
|
||||||
|
*/
|
||||||
|
private void showAnchorLiveTime() {
|
||||||
|
if (mLiveTimeTextView != null) {
|
||||||
|
mAnchorLiveTime += 1000;
|
||||||
|
mLiveTimeTextView.setText(StringUtil.getDurationText(mAnchorLiveTime));
|
||||||
|
startAnchorLiveTime();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void startAnchorLiveTime() {
|
||||||
|
if (mLiveRoomHandler != null) {
|
||||||
|
mLiveRoomHandler.sendEmptyMessageAtTime(WHAT_ANCHOR_LIVE_TIME, getNextTime(1000));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private final int WHAT_ANCHOR_LIVE_TIME = 3;//直播间主播计时
|
||||||
|
|
||||||
|
private class LiveRoomHandler extends Handler {
|
||||||
|
@Override
|
||||||
|
public void handleMessage(Message msg) {
|
||||||
|
|
||||||
|
switch (msg.what) {
|
||||||
|
|
||||||
|
case WHAT_ANCHOR_LIVE_TIME:
|
||||||
|
showAnchorLiveTime();
|
||||||
|
break;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void release() {
|
||||||
|
removeCallbacksAndMessages(null);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private long getNextTime(int time) {
|
||||||
|
long now = SystemClock.uptimeMillis();
|
||||||
|
if (time < 1000) {
|
||||||
|
return now + time;
|
||||||
|
}
|
||||||
|
return now + time + -now % 1000;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -133,6 +133,7 @@ PK"
|
|||||||
android:layout_height="45dp"
|
android:layout_height="45dp"
|
||||||
android:layout_gravity="bottom">
|
android:layout_gravity="bottom">
|
||||||
|
|
||||||
|
|
||||||
<ImageView
|
<ImageView
|
||||||
android:id="@+id/btn_close"
|
android:id="@+id/btn_close"
|
||||||
android:layout_width="1dp"
|
android:layout_width="1dp"
|
||||||
@ -231,5 +232,25 @@ PK"
|
|||||||
android:translationY="-4dp"
|
android:translationY="-4dp"
|
||||||
android:visibility="invisible" />
|
android:visibility="invisible" />
|
||||||
|
|
||||||
|
<com.yunbao.common.custom.DrawableTextView
|
||||||
|
android:id="@+id/live_time"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="34dp"
|
||||||
|
android:layout_centerVertical="true"
|
||||||
|
android:layout_marginStart="42dp"
|
||||||
|
android:layout_marginEnd="10dp"
|
||||||
|
android:layout_toEndOf="@id/et_input"
|
||||||
|
android:background="@drawable/bg_live_push_time"
|
||||||
|
android:drawablePadding="5dp"
|
||||||
|
android:gravity="center_vertical"
|
||||||
|
android:paddingLeft="10dp"
|
||||||
|
android:paddingRight="10dp"
|
||||||
|
android:text="00:00"
|
||||||
|
android:textColor="@color/white"
|
||||||
|
android:textSize="10sp"
|
||||||
|
android:visibility="invisible"
|
||||||
|
app:dt_left_drawable="@drawable/bg_push_time_point"
|
||||||
|
app:dt_left_height="4dp"
|
||||||
|
app:dt_left_width="4dp" />
|
||||||
</RelativeLayout>
|
</RelativeLayout>
|
||||||
</LinearLayout>
|
</LinearLayout>
|
Loading…
Reference in New Issue
Block a user