diff --git a/common/src/main/java/com/yunbao/common/custom/LiveGuardScalePageTransformer.java b/common/src/main/java/com/yunbao/common/custom/LiveGuardScalePageTransformer.java new file mode 100644 index 000000000..34a6970f0 --- /dev/null +++ b/common/src/main/java/com/yunbao/common/custom/LiveGuardScalePageTransformer.java @@ -0,0 +1,34 @@ +package com.yunbao.common.custom; + +import android.view.View; + +import com.stx.xhb.androidx.transformers.BasePageTransformer; + +public class LiveGuardScalePageTransformer extends BasePageTransformer { + /** + * author: xiaohaibin. + * time: 2018/10/9 + * mail:xhb_199409@163.com + * github:https://github.com/xiaohaibin + * describe: 适用于一屏显示多个模式 + */ + private static final float MIN_SCALE = 0.8F; + + @Override + public void handleInvisiblePage(View view, float position) { + view.setScaleY(MIN_SCALE); + } + + @Override + public void handleLeftPage(View view, float position) { + float scale = Math.max(MIN_SCALE, 1 - Math.abs(position)); + view.setScaleY(scale); + } + + @Override + public void handleRightPage(View view, float position) { + float scale = Math.max(MIN_SCALE, 1 - Math.abs(position)); + view.setScaleY(scale); + } + +} diff --git a/live/src/main/java/com/yunbao/live/dialog/LiveBuyGuardDialog.java b/live/src/main/java/com/yunbao/live/dialog/LiveBuyGuardDialog.java index 164dbd564..f39ca7d03 100644 --- a/live/src/main/java/com/yunbao/live/dialog/LiveBuyGuardDialog.java +++ b/live/src/main/java/com/yunbao/live/dialog/LiveBuyGuardDialog.java @@ -30,6 +30,8 @@ import com.lxj.xpopup.XPopup; import com.lxj.xpopup.enums.PopupPosition; import com.makeramen.roundedimageview.RoundedImageView; import com.stx.xhb.androidx.XBanner; +import com.stx.xhb.androidx.transformers.ScalePageTransformer; +import com.yunbao.common.custom.LiveGuardScalePageTransformer; import com.yunbao.common.utils.MobclickAgent; import com.yunbao.common.CommonAppConfig; import com.yunbao.common.adapter.LiveBuyGuardPrivilegeAdapter; @@ -159,6 +161,7 @@ public class LiveBuyGuardDialog extends AbsDialogPopupWindow { } buyGuardBanner.setBannerData(R.layout.banner_item_buy_guard, buyGuardBannerModels); buyGuardBanner.setIsClipChildrenMode(true); + buyGuardBanner.setCustomPageTransformer(new LiveGuardScalePageTransformer()); guardPrivilegeStrings = data.getGuardData().get(0).getGuardPrivilege(); buyGuardBanner.postDelayed(new Runnable() { @Override diff --git a/main/src/main/java/com/yunbao/main/activity/MainActivity.java b/main/src/main/java/com/yunbao/main/activity/MainActivity.java index 5a35b8efb..05d7a1ab9 100644 --- a/main/src/main/java/com/yunbao/main/activity/MainActivity.java +++ b/main/src/main/java/com/yunbao/main/activity/MainActivity.java @@ -529,6 +529,11 @@ public class MainActivity extends AbsActivity implements MainAppBarLayoutListene floatBanner.setVisibility(View.VISIBLE); } else { floatBanner.setVisibility(View.GONE); + if (floatRedPacket.getTag() == null) { + floatRedPacket.setVisibility(View.GONE); + } else { + floatRedPacket.setVisibility(View.VISIBLE); + } } } } @@ -673,6 +678,7 @@ public class MainActivity extends AbsActivity implements MainAppBarLayoutListene floatRedPacket.setVisibility(View.GONE); } else if (floatWarOrder.getTag() == null && floatWarOrder.getTag() == null) { floatRedPacket.setVisibility(View.VISIBLE); + floatRedPacket.setTag(data); ((ProgressBar) floatRedPacket.findViewById(R.id.progress)).setMax(data.getRedPacketTotal()); ((ProgressBar) floatRedPacket.findViewById(R.id.progress)).setProgress(data.getRedPacketNum()); ((TextView) floatRedPacket.findViewById(R.id.progressText)).setText(data.getRedPacketNum() + "/" + data.getRedPacketTotal()); @@ -1521,9 +1527,6 @@ public class MainActivity extends AbsActivity implements MainAppBarLayoutListene @Subscribe(threadMode = ThreadMode.MAIN) public void onFloatWarOrderEvent(FloatWarOrderEvent event) { - System.out.println("FloatWarOrderEvent:事件" + event.isFloatWarOrder()); - System.out.println("战令:" + floatWarOrder.getTag()); - System.out.println("Banner:" + floatBanner.getTag()); floatEventShow = event.isFloatWarOrder(); if (event.isFloatWarOrder()) { if (floatWarOrder.getTag() == null) { @@ -1536,9 +1539,15 @@ public class MainActivity extends AbsActivity implements MainAppBarLayoutListene } else { floatBanner.setVisibility(View.VISIBLE); } + if (floatRedPacket.getTag() == null) { + floatRedPacket.setVisibility(View.GONE); + } else { + floatRedPacket.setVisibility(View.VISIBLE); + } } else { floatBanner.setVisibility(View.GONE); floatWarOrder.setVisibility(View.GONE); + floatRedPacket.setVisibility(View.GONE); } /* if(floatWarOrder.getTag()!=null){ floatWarOrder.setVisibility(View.VISIBLE);