diff --git a/common/src/main/java/com/yunbao/common/custom/LiveGifWallAchieveWearTransformer.java b/common/src/main/java/com/yunbao/common/custom/LiveGifWallAchieveWearTransformer.java new file mode 100644 index 000000000..2e9d2cd1d --- /dev/null +++ b/common/src/main/java/com/yunbao/common/custom/LiveGifWallAchieveWearTransformer.java @@ -0,0 +1,85 @@ +package com.yunbao.common.custom; + +import android.view.View; + +import androidx.core.view.ViewCompat; + +import com.stx.xhb.androidx.transformers.BasePageTransformer; +import com.yunbao.common.utils.L; + +public class LiveGifWallAchieveWearTransformer extends BasePageTransformer { + /** + * author: xiaohaibin. + * time: 2018/10/9 + * mail:xhb_199409@163.com + * github:https://github.com/xiaohaibin + * describe: 适用于一屏显示多个模式 + */ + private float mMinScale = 0.55f; + private float mMinAlpha = 1f; + + public LiveGifWallAchieveWearTransformer() { + } + + public LiveGifWallAchieveWearTransformer(float minAlpha, float minScale) { + setMinAlpha(minAlpha); + setMinScale(minScale); + } + + @Override + public void handleInvisiblePage(View view, float position) { + ViewCompat.setAlpha(view, 0); + } + + @Override + public void handleLeftPage(View view, float position) { + float scale = Math.max(mMinScale, 1 + position); + float vertMargin = view.getHeight() * (1 - scale) / 2; + float horzMargin = view.getWidth() * (1 - scale) / 2; + L.eSw("l position:"+position); + L.eSw("l mMinScale:"+mMinScale); + L.eSw("l getHeight:"+view.getHeight()); + L.eSw("l getWidth:"+view.getWidth()); + L.eSw("l scale:"+scale); + L.eSw("l vertMargin:"+vertMargin); + L.eSw("l horzMargin:"+horzMargin); + L.eSw("l setTranslationX :"+(horzMargin - vertMargin / 2)); + L.eSw("l setAlpha :"+mMinAlpha + (scale - mMinScale) / (1 - mMinScale) * (1 - mMinAlpha)); + view.setTranslationX(horzMargin - vertMargin / 4); + view.setScaleX(scale); + view.setScaleY( scale); + view.setAlpha( mMinAlpha + (scale - mMinScale) / (1 - mMinScale) * (1 - mMinAlpha)); + } + + @Override + public void handleRightPage(View view, float position) { + float scale = Math.max(mMinScale, 1 - position); + float vertMargin = view.getHeight() * (1 - scale) / 2; + float horzMargin = view.getWidth() * (1 - scale) / 2; + L.eSw("r position:"+position); + L.eSw("r mMinScale:"+mMinScale); + L.eSw("r getHeight:"+view.getHeight()); + L.eSw("r getWidth:"+view.getWidth()); + L.eSw("r scale:"+scale); + L.eSw("r vertMargin:"+vertMargin); + L.eSw("r horzMargin:"+horzMargin); + L.eSw("r setTranslationX :"+(horzMargin - vertMargin / 2)); + L.eSw("r setAlpha :"+mMinAlpha + (scale - mMinScale) / (1 - mMinScale) * (1 - mMinAlpha)); + view.setTranslationX( -horzMargin + vertMargin / 4); + view.setScaleX( scale); + view.setScaleY( scale); + view.setAlpha( mMinAlpha + (scale - mMinScale) / (1 - mMinScale) * (1 - mMinAlpha)); + } + + public void setMinAlpha(float minAlpha) { + if (minAlpha >= 0.6f && minAlpha <= 1.0f) { + mMinAlpha = minAlpha; + } + } + + public void setMinScale(float minScale) { + if (minScale >= 0.6f && minScale <= 1.0f) { + mMinScale = minScale; + } + } +} diff --git a/common/src/main/java/com/yunbao/common/custom/LiveGuardScalePageTransformer.java b/common/src/main/java/com/yunbao/common/custom/LiveGuardScalePageTransformer.java index a335d6e4e..92c4d75d8 100644 --- a/common/src/main/java/com/yunbao/common/custom/LiveGuardScalePageTransformer.java +++ b/common/src/main/java/com/yunbao/common/custom/LiveGuardScalePageTransformer.java @@ -51,6 +51,7 @@ public class LiveGuardScalePageTransformer extends BasePageTransformer { float horzMargin = view.getWidth() * (1 - scale) / 2; view.setTranslationX( -horzMargin + vertMargin / 2); view.setScaleX( scale); + view.setScaleY( scale); L.e("handleRightPage scale:"+scale); view.setAlpha( mMinAlpha + (scale - mMinScale) / (1 - mMinScale) * (1 - mMinAlpha)); @@ -68,3 +69,4 @@ public class LiveGuardScalePageTransformer extends BasePageTransformer { } } } + diff --git a/common/src/main/java/com/yunbao/common/dialog/GiftWallAchieveDialog.java b/common/src/main/java/com/yunbao/common/dialog/GiftWallAchieveDialog.java index 12e90ba32..7325b31cf 100644 --- a/common/src/main/java/com/yunbao/common/dialog/GiftWallAchieveDialog.java +++ b/common/src/main/java/com/yunbao/common/dialog/GiftWallAchieveDialog.java @@ -4,6 +4,7 @@ import android.content.Context; import android.view.View; import android.view.ViewGroup; import android.widget.ImageView; +import android.widget.LinearLayout; import android.widget.RelativeLayout; import android.widget.TextView; @@ -48,6 +49,7 @@ public class GiftWallAchieveDialog extends AbsDialogPopupWindow { private boolean isAnchor; private View topBar; private TextView honor; + private ImageView top_icon; private List userMedalListModelList = new ArrayList<>(); @@ -98,7 +100,10 @@ public class GiftWallAchieveDialog extends AbsDialogPopupWindow { numCount = findViewById(R.id.numCount); topBar = findViewById(R.id.top_bar); honor = findViewById(R.id.honor); - + top_icon = findViewById(R.id.top_icon); + LinearLayout.LayoutParams params = (LinearLayout.LayoutParams) top_icon.getLayoutParams(); + params.width = DpUtil.dp2px(WordUtil.isNewZh() ? 65 : 130); + top_icon.setLayoutParams(params); mIvBack.setOnClickListener(new OnClickListener() { @Override public void onClick(View view) { @@ -109,15 +114,7 @@ public class GiftWallAchieveDialog extends AbsDialogPopupWindow { ViewClicksAntiShake.clicksAntiShake(honor, () -> { StringBuffer htmlUrl = new StringBuffer(); IMLoginModel userInfo = IMLoginManager.get(getContext()).getUserInfo(); - htmlUrl.append(CommonAppConfig.HOST) - .append("/h5/shequ/index.html#/h5/shequ/RongYuQiang?") - .append("touid=") - .append(toUid) - .append("&token=") - .append(userInfo.getToken()) - .append("&uid=") - .append(userInfo.getId()) .append("&isZh=") - .append(WordUtil.isNewZh() ? "1" : 0); + htmlUrl.append(CommonAppConfig.HOST).append("/h5/shequ/index.html#/h5/shequ/RongYuQiang?").append("touid=").append(toUid).append("&token=").append(userInfo.getToken()).append("&uid=").append(userInfo.getId()).append("&isZh=").append(WordUtil.isNewZh() ? "1" : 0); RouteUtil.forwardLiveZhuangBanActivity(htmlUrl.toString(), true); }); } @@ -128,8 +125,9 @@ public class GiftWallAchieveDialog extends AbsDialogPopupWindow { initView(); if (isFullWindows) { mIvBg.setScaleType(ImageView.ScaleType.CENTER_CROP); - ViewGroup.LayoutParams params1 = topBar.getLayoutParams(); - params1.height=DpUtil.dp2px(35);; + ViewGroup.LayoutParams params1 = topBar.getLayoutParams(); + params1.height = DpUtil.dp2px(35); + ; topBar.setLayoutParams(params1); } else { mIvBg.setScaleType(ImageView.ScaleType.FIT_XY); @@ -138,32 +136,31 @@ public class GiftWallAchieveDialog extends AbsDialogPopupWindow { } private void initData() { - LiveNetManager.get(getContext()) - .getGiftHallMedalList(toUid,isAnchor?"1":"2",new HttpCallback() { + LiveNetManager.get(getContext()).getGiftHallMedalList(toUid, isAnchor ? "1" : "2", new HttpCallback() { + @Override + public void onSuccess(MedalAchievementModel data) { + numCount.setText(data.getMedalLightNumber() + "/" + data.getMedalTotalNumber()); + userMedalListModelList = data.getMedalData(); + giftWallAchieveAdapter = new GiftWallAchieveAdapter(userMedalListModelList, mContext); + giftWallAchieveAdapter.setOnItemClickListener(new GiftWallAchieveAdapter.OnItemClickListener() { @Override - public void onSuccess(MedalAchievementModel data) { - numCount.setText(data.getMedalLightNumber()+"/"+data.getMedalTotalNumber()); - userMedalListModelList = data.getMedalData(); - giftWallAchieveAdapter = new GiftWallAchieveAdapter(userMedalListModelList,mContext); - giftWallAchieveAdapter.setOnItemClickListener(new GiftWallAchieveAdapter.OnItemClickListener() { + public void onItemClick(int position) { + GiftWallAchieveWearDialog giftWallAchieveWearDialog = new GiftWallAchieveWearDialog(mContext, toUid, isAnchor, userMedalListModelList.get(position).getDressInfo(), new GiftWallAchieveWearDialog.UserUseDressSuccess() { @Override - public void onItemClick(int position) { - GiftWallAchieveWearDialog giftWallAchieveWearDialog = new GiftWallAchieveWearDialog(mContext, isAnchor, userMedalListModelList.get(position).getDressInfo(), new GiftWallAchieveWearDialog.UserUseDressSuccess() { - @Override - public void onSuccess() { - initData(); - } - }); - giftWallAchieveWearDialog.showDialog(); + public void onSuccess() { + initData(); } }); - mRecyclerView.setAdapter(giftWallAchieveAdapter); - } - - @Override - public void onError(String error) { - ToastUtil.show(error); + giftWallAchieveWearDialog.showDialog(); } }); + mRecyclerView.setAdapter(giftWallAchieveAdapter); + } + + @Override + public void onError(String error) { + ToastUtil.show(error); + } + }); } } diff --git a/common/src/main/java/com/yunbao/common/dialog/GiftWallAchieveWearDialog.java b/common/src/main/java/com/yunbao/common/dialog/GiftWallAchieveWearDialog.java index 7780a3429..e86d86c7b 100644 --- a/common/src/main/java/com/yunbao/common/dialog/GiftWallAchieveWearDialog.java +++ b/common/src/main/java/com/yunbao/common/dialog/GiftWallAchieveWearDialog.java @@ -11,9 +11,11 @@ import androidx.viewpager.widget.ViewPager; import com.lxj.xpopup.XPopup; import com.stx.xhb.androidx.XBanner; import com.stx.xhb.androidx.transformers.Transformer; +import com.yunbao.common.CommonAppConfig; import com.yunbao.common.R; import com.yunbao.common.bean.HttpCallbackModel; import com.yunbao.common.bean.UserMedalModel; +import com.yunbao.common.custom.LiveGuardScalePageTransformer; import com.yunbao.common.glide.ImgLoader; import com.yunbao.common.http.base.HttpCallback; import com.yunbao.common.http.live.LiveNetManager; @@ -45,9 +47,9 @@ public class GiftWallAchieveWearDialog extends AbsDialogPopupWindow { private List achieveWearModels = new ArrayList<>(); private UserUseDressSuccess userUseDressSuccess; - - public GiftWallAchieveWearDialog(@NonNull Context context,boolean isAnchor, List achieveWearModels,UserUseDressSuccess userUseDressSuccess) { + public GiftWallAchieveWearDialog(@NonNull Context context,String toUid,boolean isAnchor, List achieveWearModels,UserUseDressSuccess userUseDressSuccess) { super(context); + this.toUid = toUid; this.isAnchor = isAnchor; this.achieveWearModels = achieveWearModels; this.userUseDressSuccess = userUseDressSuccess; @@ -118,6 +120,7 @@ public class GiftWallAchieveWearDialog extends AbsDialogPopupWindow { } } }); + btnConfirm.setVisibility(CommonAppConfig.getInstance().getUid().equals(toUid)?View.VISIBLE:View.GONE); } @Override @@ -151,8 +154,8 @@ public class GiftWallAchieveWearDialog extends AbsDialogPopupWindow { private void initData() { setWearInfo(); - xBanner.setBannerData(R.layout.dialog_gift_wall_achieve_wear_item, achieveWearModels); + //xBanner.setCustomPageTransformer(new LiveGuardScalePageTransformer()); //xBanner.setCustomPageTransformer(new LiveGifWallAchieveWearTransformer()); xBanner.setIsClipChildrenMode(true); xBanner.setPageTransformer(Transformer.Scale); diff --git a/common/src/main/res/layout/dialog_gift_wall_achieve.xml b/common/src/main/res/layout/dialog_gift_wall_achieve.xml index b360c7757..f4404fefc 100644 --- a/common/src/main/res/layout/dialog_gift_wall_achieve.xml +++ b/common/src/main/res/layout/dialog_gift_wall_achieve.xml @@ -15,78 +15,79 @@ + android:layout_height="0dp" /> + android:text="@string/gift_wall_achieve_title" + android:textColor="@color/white" + android:textSize="20sp" + android:textStyle="bold" /> + android:gravity="center_vertical" + android:orientation="horizontal"> + android:src="@mipmap/dialog_gift_wall_achieve_top_icon" /> + android:textColor="#FDE9D8" /> + android:layout_height="match_parent" + android:gravity="center_vertical" + android:text="@string/wall_honor" + android:textColor="#E0E0E0" + android:textSize="12dp" /> + android:layout_height="13dp" + android:layout_marginRight="7dp" + android:src="@mipmap/dialog_gift_wall_more" /> + android:layout_marginTop="15dp" + android:layout_marginRight="10dp" /> \ No newline at end of file diff --git a/common/src/main/res/layout/dialog_gift_wall_achieve_wear.xml b/common/src/main/res/layout/dialog_gift_wall_achieve_wear.xml index 74d2f78c4..de528a426 100644 --- a/common/src/main/res/layout/dialog_gift_wall_achieve_wear.xml +++ b/common/src/main/res/layout/dialog_gift_wall_achieve_wear.xml @@ -7,7 +7,7 @@ @@ -85,7 +85,6 @@ android:layout_below="@+id/text_achieve_hint" android:layout_centerHorizontal="true" android:layout_marginTop="10dp" - android:layout_marginBottom="16dp" android:background="@drawable/gift_wall_achieve_wear_disable" android:gravity="center" android:text="@string/gift_wall_achieve_put_on" diff --git a/live/src/main/java/com/yunbao/live/activity/SudSwGameActivity.java b/live/src/main/java/com/yunbao/live/activity/SudSwGameActivity.java index 4b8130988..fd8c742e3 100644 --- a/live/src/main/java/com/yunbao/live/activity/SudSwGameActivity.java +++ b/live/src/main/java/com/yunbao/live/activity/SudSwGameActivity.java @@ -519,7 +519,7 @@ public class SudSwGameActivity extends AbsActivity implements GameSwMicManager.M if (IMLoginManager.get(mContext).getLocaleLanguage() == Locale.SIMPLIFIED_CHINESE) { ToastUtil.show("貨幣数量不足 "); } else { - ToastUtil.show("Shortage of money"); + ToastUtil.show("Insufficient number of currency"); } } @@ -532,7 +532,7 @@ public class SudSwGameActivity extends AbsActivity implements GameSwMicManager.M if (IMLoginManager.get(mContext).getLocaleLanguage() == Locale.SIMPLIFIED_CHINESE) { ToastUtil.show("貨幣数量不足 "); } else { - ToastUtil.show("Shortage of money"); + ToastUtil.show("Insufficient number of currency"); } } 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 27504c8d0..26ce37f8a 100644 --- a/live/src/main/java/com/yunbao/live/views/LiveRoomViewHolder.java +++ b/live/src/main/java/com/yunbao/live/views/LiveRoomViewHolder.java @@ -436,10 +436,9 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis private pl.droidsonroids.gif.GifDrawable mGifDrawable; private static boolean isSw; - - public static SVGAVideoEntity drawableTitleCn; - public static SVGAVideoEntity drawableTitleEn; - public static SVGAVideoEntity drawableBg; + public static SVGAVideoEntity drawableTitleCn; + public static SVGAVideoEntity drawableTitleEn; + public static SVGAVideoEntity drawableBg; public LiveRoomViewHolder setGuardType(int guardType) { this.guardType = guardType; @@ -543,7 +542,6 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis SVGADrawable drawable = new SVGADrawable(videoItem); svga_new_user_gif.setImageDrawable(drawable); SVGAViewUtils.playEndClear(svga_new_user_gif); - } @Override @@ -615,28 +613,31 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis System.err.println("-------------SVGA报错了"); } }, null); - new SVGAParser(mContext).decodeFromAssets("gift_live_naming_title_cn.svga", new SVGAParser.ParseCompletion() { - @Override - public void onComplete(@NonNull SVGAVideoEntity videoItem) { - drawableTitleCn = videoItem; - } + if(WordUtil.isNewZh()){ + new SVGAParser(mContext).decodeFromAssets("gift_live_naming_title_cn.svga", new SVGAParser.ParseCompletion() { + @Override + public void onComplete(@NonNull SVGAVideoEntity videoItem) { + drawableTitleCn = videoItem; + } - @Override - public void onError() { - System.err.println("-------------SVGA报错了"); - } - }, null); - new SVGAParser(mContext).decodeFromAssets("gift_live_naming_title_en.svga", new SVGAParser.ParseCompletion() { - @Override - public void onComplete(@NonNull SVGAVideoEntity videoItem) { - drawableTitleEn = videoItem; - } + @Override + public void onError() { + System.err.println("-------------SVGA报错了"); + } + }, null); + }else{ + new SVGAParser(mContext).decodeFromAssets("gift_live_naming_title_en.svga", new SVGAParser.ParseCompletion() { + @Override + public void onComplete(@NonNull SVGAVideoEntity videoItem) { + drawableTitleEn = videoItem; + } - @Override - public void onError() { - System.err.println("-------------SVGA报错了"); - } - }, null); + @Override + public void onError() { + System.err.println("-------------SVGA报错了"); + } + }, null); + } } public void clearList() { @@ -3686,7 +3687,8 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis ViewClicksAntiShake.clicksAntiShake(giftWall, new ViewClicksAntiShake.ViewClicksCallBack() { @Override public void onViewClicks() { - Bus.get().post(new LiveAudienceEvent().setType(LiveAudienceEvent.LiveAudienceType.GIFT_WALL).setUid(mLiveUid).setVoicePress(true).setAvatar(mAvatarUrl).setUname(mAnchorName)); + new com.yunbao.common.dialog.GiftWallDialog(mContext, mLiveUid + "",mAnchorName, true).setFullWindows(false).showDialog(); + //Bus.get().post(new LiveAudienceEvent().setType(LiveAudienceEvent.LiveAudienceType.GIFT_WALL).setUid(mLiveUid).setVoicePress(true).setAvatar(mAvatarUrl).setUname(mAnchorName)); } }); }