荣誉成就

This commit is contained in:
Martin 2024-07-16 16:11:27 +08:00
parent ac18150503
commit 96c45820b0
8 changed files with 187 additions and 98 deletions

View File

@ -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;
}
}
}

View File

@ -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 {
}
}
}

View File

@ -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<UserMedalListModel> 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<MedalAchievementModel>() {
LiveNetManager.get(getContext()).getGiftHallMedalList(toUid, isAnchor ? "1" : "2", new HttpCallback<MedalAchievementModel>() {
@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);
}
});
}
}

View File

@ -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<UserMedalModel> achieveWearModels = new ArrayList<>();
private UserUseDressSuccess userUseDressSuccess;
public GiftWallAchieveWearDialog(@NonNull Context context,boolean isAnchor, List<UserMedalModel> achieveWearModels,UserUseDressSuccess userUseDressSuccess) {
public GiftWallAchieveWearDialog(@NonNull Context context,String toUid,boolean isAnchor, List<UserMedalModel> 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);

View File

@ -15,78 +15,79 @@
<View
android:id="@+id/top_bar"
android:layout_width="0dp"
android:layout_height="0dp"/>
android:layout_height="0dp" />
<ImageView
android:id="@+id/iv_back"
android:paddingEnd="25dp"
android:layout_width="80dp"
android:layout_below="@+id/top_bar"
android:layout_height="60dp"
android:layout_below="@+id/top_bar"
android:paddingEnd="25dp"
android:scaleType="center"
android:src="@mipmap/dialog_gift_wall_back" />
<TextView
android:text="@string/gift_wall_achieve_title"
android:layout_width="match_parent"
android:textSize="20sp"
android:layout_height="60dp"
android:layout_below="@+id/top_bar"
android:textColor="@color/white"
android:gravity="center"
android:textStyle="bold"
android:layout_height="60dp" />
android:text="@string/gift_wall_achieve_title"
android:textColor="@color/white"
android:textSize="20sp"
android:textStyle="bold" />
<LinearLayout
android:id="@+id/topLayout"
android:layout_width="match_parent"
android:layout_height="48dp"
android:layout_below="@+id/iv_back"
android:layout_marginLeft="20dp"
android:layout_marginRight="20dp"
android:layout_below="@+id/iv_back"
android:orientation="horizontal"
android:gravity="center_vertical"
android:layout_width="match_parent"
android:background="@mipmap/dialog_gift_wall_achieve_top_bg"
android:layout_height="48dp">
android:gravity="center_vertical"
android:orientation="horizontal">
<ImageView
android:id="@+id/top_icon"
android:layout_width="120dp"
android:layout_height="20dp"
android:layout_marginLeft="10dp"
android:src="@mipmap/dialog_gift_wall_achieve_top_icon"
android:layout_width="wrap_content"
android:layout_height="16dp"/>
android:src="@mipmap/dialog_gift_wall_achieve_top_icon" />
<TextView
android:id="@+id/numCount"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_marginLeft="5dp"
android:layout_weight="1"
android:gravity="start|center_vertical"
android:text="0/1"
android:layout_marginLeft="5dp"
android:textColor="#FDE9D8"
android:layout_width="0dp"
android:layout_weight="1"
android:layout_height="match_parent"/>
android:textColor="#FDE9D8" />
<TextView
android:id="@+id/honor"
android:text="@string/wall_honor"
android:gravity="center_vertical"
android:textColor="#E0E0E0"
android:textSize="12dp"
android:layout_width="wrap_content"
android:layout_height="match_parent"/>
android:layout_height="match_parent"
android:gravity="center_vertical"
android:text="@string/wall_honor"
android:textColor="#E0E0E0"
android:textSize="12dp" />
<ImageView
android:src="@mipmap/dialog_gift_wall_more"
android:layout_marginRight="7dp"
android:layout_width="13dp"
android:layout_height="13dp"/>
android:layout_height="13dp"
android:layout_marginRight="7dp"
android:src="@mipmap/dialog_gift_wall_more" />
</LinearLayout>
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/recyclerView"
android:layout_marginTop="15dp"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/topLayout"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:layout_height="wrap_content"/>
android:layout_marginTop="15dp"
android:layout_marginRight="10dp" />
</RelativeLayout>

View File

@ -7,7 +7,7 @@
<RelativeLayout
android:layout_width="264dp"
android:layout_height="240dp"
android:layout_height="250dp"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:background="@mipmap/dialog_gift_wall_achieve_wear_bg">
@ -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"

View File

@ -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");
}
}

View File

@ -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));
}
});
}