心愿单修改

This commit is contained in:
18401019693
2023-04-08 15:10:16 +08:00
parent a8178c51a0
commit 9c3fbe0506
13 changed files with 70 additions and 28 deletions

View File

@@ -1,9 +1,11 @@
package com.yunbao.common.views;
import android.graphics.Color;
import android.text.TextUtils;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;
@@ -14,7 +16,6 @@ import androidx.viewpager2.widget.ViewPager2;
import com.google.android.material.tabs.TabLayout;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import com.lxj.xpopup.XPopup;
import com.lxj.xpopup.core.BottomPopupView;
import com.yunbao.common.R;
@@ -35,9 +36,9 @@ import com.yunbao.common.views.weight.ViewClicksAntiShake;
import org.greenrobot.eventbus.Subscribe;
import org.greenrobot.eventbus.ThreadMode;
import java.lang.reflect.Modifier;
import java.util.ArrayList;
import java.util.List;
import java.util.Locale;
/**
* 新版心愿单
@@ -54,12 +55,16 @@ public class LiveNewWishListPopup extends BottomPopupView {
private boolean zhouXin;
private boolean lunarWish;
private boolean seasonalWish;
private String ct;
private LiveNewWishListFragment dayWishFragment, zhouXinFragment, lunarWishFragment, seasonalWishFragment;
private ImageView wishListTop;
public LiveNewWishListPopup(@NonNull FragmentActivity context) {
super(context);
mContext = context;
ct = Locale.getDefault().getLanguage();
}
// 返回自定义弹窗的布局
@@ -180,6 +185,7 @@ public class LiveNewWishListPopup extends BottomPopupView {
private void initView() {
fragmentViewpager = findViewById(R.id.context_layout);
wishTab = findViewById(R.id.wish_tab);
wishListTop = findViewById(R.id.wish_list_top);
replacementWish = findViewById(R.id.replacement_wish);
wishTab.setSelectedTabIndicatorColor(Color.TRANSPARENT);
wishTab.setFocusableInTouchMode(false);
@@ -191,7 +197,11 @@ public class LiveNewWishListPopup extends BottomPopupView {
ViewList.add(zhouXinFragment);
ViewList.add(lunarWishFragment);
ViewList.add(seasonalWishFragment);
if (TextUtils.equals(ct, "zh")) {
wishListTop.setBackgroundResource(R.drawable.wish_list_day_zh);
} else {
wishListTop.setBackgroundResource(R.drawable.wish_list_day_en);
}
LiveNewWishListAdapter liveNewWishListAdapter = new LiveNewWishListAdapter(mContext, ViewList);
fragmentViewpager.setAdapter(liveNewWishListAdapter);
@@ -239,15 +249,35 @@ public class LiveNewWishListPopup extends BottomPopupView {
type = tab.getId() + 1;
switch (type) {
case 1:
if (TextUtils.equals(ct, "zh")) {
wishListTop.setBackgroundResource(R.drawable.wish_list_day_zh);
} else {
wishListTop.setBackgroundResource(R.drawable.wish_list_day_en);
}
replacementWish.setText(R.string.replacement_wish_day);
break;
case 2:
if (TextUtils.equals(ct, "zh")) {
wishListTop.setBackgroundResource(R.drawable.wish_list_week_zh);
} else {
wishListTop.setBackgroundResource(R.drawable.wish_list_week_en);
}
replacementWish.setText(R.string.replacement_wish_zhou);
break;
case 3:
if (TextUtils.equals(ct, "zh")) {
wishListTop.setBackgroundResource(R.drawable.wish_list_lunar_zh);
} else {
wishListTop.setBackgroundResource(R.drawable.wish_list_lunar_en);
}
replacementWish.setText(R.string.replacement_wish_lunar);
break;
case 4:
if (TextUtils.equals(ct, "zh")) {
wishListTop.setBackgroundResource(R.drawable.wish_list_seasonal_zh);
} else {
wishListTop.setBackgroundResource(R.drawable.wish_list_seasonal_en);
}
replacementWish.setText(R.string.replacement_wish_seasonal);
break;
}