小礼物逻辑第er次上传
This commit is contained in:
@@ -1766,7 +1766,7 @@ public class LiveAudienceActivity extends LiveActivity {
|
||||
}
|
||||
}
|
||||
|
||||
@Subscribe(threadMode = ThreadMode .MAIN)
|
||||
@Subscribe(threadMode = ThreadMode.MAIN)
|
||||
public void onSlideEvent(SlideEvent event) {
|
||||
verticalViewPager.setEnableScroll(event.isSlide());
|
||||
}
|
||||
@@ -1775,7 +1775,12 @@ public class LiveAudienceActivity extends LiveActivity {
|
||||
public void onQuickGiftingEvent(QuickGiftingEvent event) {
|
||||
if (manager != null) {
|
||||
|
||||
manager.onQuickGifting(event.getIndex(), event.getSvgaName());
|
||||
|
||||
if (event.isShow()) {
|
||||
manager.onQuickGifting2(true);
|
||||
} else {
|
||||
manager.onQuickGifting(event.getIndex(), event.getSvgaName());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -29,6 +29,7 @@ import com.umeng.analytics.MobclickAgent;
|
||||
import com.yunbao.common.CommonAppConfig;
|
||||
import com.yunbao.common.Constants;
|
||||
import com.yunbao.common.bean.NewPeopleInfo;
|
||||
import com.yunbao.common.bean.QuickGiftSendGiftModel;
|
||||
import com.yunbao.common.dialog.LiveNewRolePopup;
|
||||
import com.yunbao.common.event.MessageIMEvent;
|
||||
import com.yunbao.common.event.QuickGiftingEvent;
|
||||
@@ -36,12 +37,14 @@ import com.yunbao.common.glide.ImgLoader;
|
||||
import com.yunbao.common.http.API;
|
||||
import com.yunbao.common.http.HttpCallback;
|
||||
import com.yunbao.common.http.HttpClient;
|
||||
import com.yunbao.common.http.live.LiveNetManager;
|
||||
import com.yunbao.common.manager.IMLoginManager;
|
||||
import com.yunbao.common.utils.Bus;
|
||||
import com.yunbao.common.utils.ProcessResultUtil;
|
||||
import com.yunbao.common.utils.SpUtil;
|
||||
import com.yunbao.common.utils.ToastUtil;
|
||||
import com.yunbao.common.utils.WordUtil;
|
||||
import com.yunbao.common.views.weight.CircleProgress2;
|
||||
import com.yunbao.common.views.weight.ViewClicksAntiShake;
|
||||
import com.yunbao.live.R;
|
||||
import com.yunbao.live.activity.LiveActivity;
|
||||
@@ -80,7 +83,7 @@ public class LiveAudienceViewHolder extends AbsLiveViewHolder {
|
||||
private View v_msg_redpoint, stationHornBanner;
|
||||
private Activity context;
|
||||
private ViewFlipper viewFlipper;
|
||||
private TextView goToRomm;
|
||||
private TextView goToRomm, quick_gift_remaining_quantity, time_text;
|
||||
private int icon = 0;
|
||||
private String nobleName, nobleTtext;
|
||||
private ImageView giftImage, liveNewPeople;
|
||||
@@ -91,6 +94,7 @@ public class LiveAudienceViewHolder extends AbsLiveViewHolder {
|
||||
private ImageView mPlay;//玩
|
||||
private ImageView mCheat;//整蛊
|
||||
private ImageView pd_pao, combo;
|
||||
private CircleProgress2 circleProgress;
|
||||
|
||||
public LiveAudienceViewHolder(Context context, ViewGroup parentView) {
|
||||
super(context, parentView);
|
||||
@@ -116,6 +120,8 @@ public class LiveAudienceViewHolder extends AbsLiveViewHolder {
|
||||
findViewById(R.id.btn_zg).setOnClickListener(this);
|
||||
voiceButton = (LinearLayout) findViewById(R.id.voice_button);
|
||||
giftImage = (ImageView) findViewById(R.id.gift_image);
|
||||
quick_gift_remaining_quantity = (TextView) findViewById(R.id.quick_gift_remaining_quantity);
|
||||
time_text = (TextView) findViewById(R.id.time_text);
|
||||
liveNewPeople = (ImageView) findViewById(R.id.live_new_people);
|
||||
|
||||
viewFlipper = (ViewFlipper) findViewById(R.id.viewflipper_banner);
|
||||
@@ -126,6 +132,7 @@ public class LiveAudienceViewHolder extends AbsLiveViewHolder {
|
||||
mNewPeopleRedDot = findViewById(R.id.live_new_people_red_dot);
|
||||
pd_pao = (ImageView) findViewById(R.id.pd_pao);
|
||||
combo = (ImageView) findViewById(R.id.combo);
|
||||
circleProgress = (CircleProgress2) findViewById(R.id.circleProgress);
|
||||
combo.setVisibility(View.GONE);
|
||||
liveNewPeople.setOnClickListener(this);
|
||||
mRole.setOnClickListener(this);
|
||||
@@ -270,52 +277,121 @@ public class LiveAudienceViewHolder extends AbsLiveViewHolder {
|
||||
return true;
|
||||
});
|
||||
mProcessResultUtil = new ProcessResultUtil((FragmentActivity) mContext);
|
||||
|
||||
quick_gift_remaining_quantity.setVisibility(View.GONE);
|
||||
time_text.setVisibility(View.GONE);
|
||||
pd_pao.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
quickGiftingIndex = 1;
|
||||
combo.setVisibility(View.VISIBLE);
|
||||
removeRunnable = true;
|
||||
lianSongHandler.postDelayed(lianSongRunnable, 1000);
|
||||
Random random = new Random();
|
||||
int randomNumber = random.nextInt(shortSvgas.size());
|
||||
String randomName = shortSvgas.get(randomNumber);
|
||||
Bus.get().post(new QuickGiftingEvent().setIndex(quickGiftingIndex).setSvgaName(randomName));
|
||||
if (mQuickGiftRemainingQuantity > 0) {
|
||||
quickGiftingIndex = 1;
|
||||
combo.setVisibility(View.VISIBLE);
|
||||
removeRunnable = true;
|
||||
lianSongHandler.postDelayed(lianSongRunnable, 1000);
|
||||
Random random = new Random();
|
||||
int randomNumber = random.nextInt(shortSvgas.size());
|
||||
String randomName = shortSvgas.get(randomNumber);
|
||||
Bus.get().post(new QuickGiftingEvent().setIndex(quickGiftingIndex).setSvgaName(randomName));
|
||||
mQuickGiftRemainingQuantity = mQuickGiftRemainingQuantity - 1;
|
||||
quick_gift_remaining_quantity.setText(String.valueOf(mQuickGiftRemainingQuantity));
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
combo.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
quickGiftingIndex = quickGiftingIndex + 1;
|
||||
removeRunnable = true;
|
||||
lianSongHandler.postDelayed(lianSongRunnable, 1000);
|
||||
Random random = new Random();
|
||||
if (quickGiftingIndex<11){
|
||||
int randomNumber = random.nextInt(shortSvgas.size());
|
||||
String randomName = shortSvgas.get(randomNumber);
|
||||
Bus.get().post(new QuickGiftingEvent().setIndex(quickGiftingIndex).setSvgaName(randomName));
|
||||
}else {
|
||||
int randomNumber = random.nextInt(highSvgas.size());
|
||||
String randomName = highSvgas.get(randomNumber);
|
||||
if (quickGiftingIndex>=88){
|
||||
|
||||
Bus.get().post(new QuickGiftingEvent().setIndex(quickGiftingIndex).setSvgaName("littlepanda_craft.svga"));
|
||||
}else {
|
||||
if (mQuickGiftRemainingQuantity > 0) {
|
||||
quickGiftingIndex = quickGiftingIndex + 1;
|
||||
removeRunnable = true;
|
||||
lianSongHandler.postDelayed(lianSongRunnable, 1000);
|
||||
Random random = new Random();
|
||||
if (quickGiftingIndex < 11) {
|
||||
int randomNumber = random.nextInt(shortSvgas.size());
|
||||
String randomName = shortSvgas.get(randomNumber);
|
||||
Bus.get().post(new QuickGiftingEvent().setIndex(quickGiftingIndex).setSvgaName(randomName));
|
||||
} else {
|
||||
int randomNumber = random.nextInt(highSvgas.size());
|
||||
String randomName = highSvgas.get(randomNumber);
|
||||
if (quickGiftingIndex >= 88) {
|
||||
|
||||
Bus.get().post(new QuickGiftingEvent().setIndex(quickGiftingIndex).setSvgaName("littlepanda_craft.svga"));
|
||||
} else {
|
||||
Bus.get().post(new QuickGiftingEvent().setIndex(quickGiftingIndex).setSvgaName(randomName));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
mQuickGiftRemainingQuantity = mQuickGiftRemainingQuantity - 1;
|
||||
quick_gift_remaining_quantity.setText(String.valueOf(mQuickGiftRemainingQuantity));
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private int mQuickGiftRemainingQuantity = 0, mIfViewingDurationComplete;
|
||||
|
||||
public void upDataQuickGift(int quickGiftRemainingQuantity, int ifViewingDurationComplete) {
|
||||
mQuickGiftRemainingQuantity = quickGiftRemainingQuantity;
|
||||
mIfViewingDurationComplete = ifViewingDurationComplete;
|
||||
quickGiftContDown = 120;
|
||||
circleProgress.setMax(120);
|
||||
circleProgress.setCurrent(quickGiftContDown);
|
||||
if (quickGiftRemainingQuantity > 0) {
|
||||
quick_gift_remaining_quantity.setVisibility(View.VISIBLE);
|
||||
quick_gift_remaining_quantity.setText(String.valueOf(quickGiftRemainingQuantity));
|
||||
} else {
|
||||
quick_gift_remaining_quantity.setVisibility(View.GONE);
|
||||
}
|
||||
if (quickGiftRemainingQuantity >= 10 && ifViewingDurationComplete > 0) {
|
||||
quickGiftHandler.postDelayed(quickGiftRunnable, 1000);
|
||||
}
|
||||
}
|
||||
|
||||
private int quickGiftContDown = 120;
|
||||
private Handler quickGiftHandler = new Handler();
|
||||
private Runnable quickGiftRunnable = new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
if (mQuickGiftRemainingQuantity == 0) {
|
||||
time_text.setVisibility(View.VISIBLE);
|
||||
quick_gift_remaining_quantity.setVisibility(View.GONE);
|
||||
|
||||
} else {
|
||||
time_text.setVisibility(View.GONE);
|
||||
}
|
||||
if (quickGiftContDown > 0) {
|
||||
quickGiftContDown = quickGiftContDown - 1;
|
||||
if (time_text.getVisibility() == View.VISIBLE) {
|
||||
time_text.setText(String.valueOf(quickGiftContDown) + "s");
|
||||
}
|
||||
circleProgress.setCurrent(quickGiftContDown);
|
||||
quickGiftHandler.postDelayed(quickGiftRunnable, 1000);
|
||||
} else {
|
||||
quickGiftHandler.removeCallbacks(quickGiftRunnable);
|
||||
LiveNetManager.get(mContext).viewingDurationGetGift(mLiveUid, new com.yunbao.common.http.base.HttpCallback<QuickGiftSendGiftModel>() {
|
||||
@Override
|
||||
public void onSuccess(QuickGiftSendGiftModel data) {
|
||||
if (data.getQuickGiftRemainingQuantity() >= 10 && data.getIfViewingDurationComplete() > 0) {
|
||||
upDataQuickGift(data.getQuickGiftRemainingQuantity(), data.getIfViewingDurationComplete());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(String error) {
|
||||
ToastUtil.show(error);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
public void resetView() {
|
||||
pd_pao.setVisibility(View.VISIBLE);
|
||||
combo.setVisibility(View.GONE);
|
||||
lianSongHandler.removeCallbacks(lianSongRunnable);
|
||||
lianSongHandler.removeCallbacks(lianSongRunnable);
|
||||
}
|
||||
|
||||
private boolean removeRunnable = false;
|
||||
private int mLianCountDownCount;//连送倒计时的数字
|
||||
private Handler lianSongHandler = new Handler();
|
||||
@@ -334,6 +410,21 @@ public class LiveAudienceViewHolder extends AbsLiveViewHolder {
|
||||
pd_pao.setVisibility(View.VISIBLE);
|
||||
combo.setVisibility(View.GONE);
|
||||
lianSongHandler.removeCallbacks(lianSongRunnable);
|
||||
Bus.get().post(new QuickGiftingEvent().setShow(true));
|
||||
LiveNetManager.get(mContext).quickGiftSendGift(String.valueOf(quickGiftingIndex), mLiveUid, mStream, new com.yunbao.common.http.base.HttpCallback<QuickGiftSendGiftModel>() {
|
||||
@Override
|
||||
public void onSuccess(QuickGiftSendGiftModel data) {
|
||||
upDataQuickGift(data.getQuickGiftRemainingQuantity(), data.getIfViewingDurationComplete());
|
||||
if (mQuickGiftRemainingQuantity >= 10 && mIfViewingDurationComplete > 0) {
|
||||
quickGiftHandler.postDelayed(quickGiftRunnable, 1000);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(String error) {
|
||||
ToastUtil.show(error);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
lianSongHandler.postDelayed(lianSongRunnable, 1000);
|
||||
}
|
||||
|
||||
@@ -708,12 +708,18 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
|
||||
|
||||
HashMap<String, SVGAImageView> svgaImageViewHashMap = new HashMap<>();
|
||||
|
||||
public void onQuickGifting2(boolean show) {
|
||||
if (show) {
|
||||
combo_layout.setVisibility(View.GONE);
|
||||
}
|
||||
}
|
||||
|
||||
public void onQuickGifting(int index, String svgaName) {
|
||||
pa_pao_layout.setVisibility(View.VISIBLE);
|
||||
combo_layout.setVisibility(View.VISIBLE);
|
||||
combo_number.setText(String.valueOf(index));
|
||||
SVGAImageView svgaImageView = new SVGAImageView(mContext);
|
||||
String tag = svgaName+System.currentTimeMillis();
|
||||
String tag = svgaName + System.currentTimeMillis();
|
||||
svgaImageViewHashMap.put(tag, svgaImageView);
|
||||
|
||||
Bus.get().post(new SlideEvent().setSlide(!(svgaImageViewHashMap.size() > 0)));
|
||||
@@ -739,7 +745,7 @@ String tag = svgaName+System.currentTimeMillis();
|
||||
Log.e("QuickGiftingEvent", "pa_pao_layout:getChildCount:" + pa_pao_layout.getChildCount());
|
||||
if (pa_pao_layout.getChildCount() == 0) {
|
||||
pa_pao_layout.setVisibility(View.GONE);
|
||||
combo_layout.setVisibility(View.GONE);
|
||||
|
||||
Bus.get().post(new SlideEvent().setSlide(true));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -56,7 +56,6 @@ import com.yunbao.common.event.LiveFloatEvent;
|
||||
import com.yunbao.common.event.LiveGiftDialogEvent;
|
||||
import com.yunbao.common.event.LiveRoomChangeEvent;
|
||||
import com.yunbao.common.event.LiveSudGamePopupShowOrHideEvent;
|
||||
import com.yunbao.common.event.QuickGiftingEvent;
|
||||
import com.yunbao.common.event.SendBlindGiftEvent;
|
||||
import com.yunbao.common.glide.ImgLoader;
|
||||
import com.yunbao.common.http.CommonHttpConsts;
|
||||
@@ -224,9 +223,15 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe
|
||||
}
|
||||
}
|
||||
|
||||
public void onQuickGifting(int index,String svgaName) {
|
||||
public void onQuickGifting(int index, String svgaName) {
|
||||
if (mLiveRoomViewHolder != null) {
|
||||
mLiveRoomViewHolder.onQuickGifting(index,svgaName);
|
||||
mLiveRoomViewHolder.onQuickGifting(index, svgaName);
|
||||
}
|
||||
}
|
||||
|
||||
public void onQuickGifting2(boolean show) {
|
||||
if (mLiveRoomViewHolder != null) {
|
||||
mLiveRoomViewHolder.onQuickGifting2(show);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -734,6 +739,7 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe
|
||||
mLiveRoomViewHolder.setSudName(WordUtil.isNewZh() ? data.getSudGameDateModel().getSudGameName() : data.getSudGameDateModel().getSud_game_name_en(), data.getSudGameDateModel());
|
||||
}
|
||||
}
|
||||
mLiveAudienceViewHolder.upDataQuickGift(data.getQuickGiftRemainingQuantity(), data.getIfViewingDurationComplete());
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -392,34 +392,50 @@
|
||||
|
||||
<com.yunbao.common.views.weight.CircleProgress2
|
||||
android:id="@+id/circleProgress"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent" />
|
||||
android:layout_width="32dp"
|
||||
android:layout_height="32dp"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:layout_centerVertical="true" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/pd_pao"
|
||||
android:layout_width="30dp"
|
||||
android:layout_height="30dp"
|
||||
android:layout_width="27dp"
|
||||
android:layout_height="27dp"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:layout_centerVertical="true"
|
||||
android:src="@mipmap/icon_pd_pao" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="30dp"
|
||||
android:layout_height="30dp"
|
||||
android:id="@+id/time_text"
|
||||
android:layout_width="27dp"
|
||||
android:layout_height="27dp"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:layout_centerVertical="true"
|
||||
android:background="@drawable/backgroud_panda_time"
|
||||
android:gravity="center"
|
||||
android:text="120S"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="12sp"
|
||||
android:textSize="10sp"
|
||||
android:visibility="gone" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/quick_gift_remaining_quantity"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:layout_marginBottom="-2dp"
|
||||
android:text="99"
|
||||
android:textColor="#FFB403"
|
||||
android:textSize="10sp"
|
||||
android:textStyle="bold" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/combo"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:src="@mipmap/icon_combo" />
|
||||
android:src="@mipmap/icon_combo"
|
||||
android:visibility="gone" />
|
||||
</RelativeLayout>
|
||||
|
||||
<!--礼物-->
|
||||
|
||||
Reference in New Issue
Block a user