diff --git a/common/src/main/java/com/yunbao/common/dialog/GiftWallDialog.java b/common/src/main/java/com/yunbao/common/dialog/GiftWallDialog.java new file mode 100644 index 000000000..99a75fe4a --- /dev/null +++ b/common/src/main/java/com/yunbao/common/dialog/GiftWallDialog.java @@ -0,0 +1,150 @@ +package com.yunbao.common.dialog; + +import android.content.Context; +import android.graphics.Color; +import android.graphics.Typeface; +import android.view.View; +import android.view.ViewGroup; +import android.widget.ImageView; +import android.widget.LinearLayout; +import android.widget.TextView; + +import androidx.annotation.NonNull; +import androidx.constraintlayout.widget.ConstraintLayout; +import androidx.fragment.app.Fragment; +import androidx.fragment.app.FragmentActivity; +import androidx.viewpager2.adapter.FragmentStateAdapter; +import androidx.viewpager2.widget.ViewPager2; + +import com.lxj.xpopup.XPopup; +import com.yunbao.common.R; +import com.yunbao.common.fragment.BaseFragment; +import com.yunbao.common.fragment.GiftWallMainTab1Fragment; +import com.yunbao.common.fragment.GiftWallMainTab2Fragment; +import com.yunbao.common.utils.DpUtil; +import com.yunbao.common.utils.ScreenDimenUtil; +import com.yunbao.common.views.CustomEllipsizeTextView; +import com.yunbao.common.views.weight.ViewClicksAntiShake; + +import java.util.ArrayList; +import java.util.List; + +/** + * 礼物墙 + */ +public class GiftWallDialog extends AbsDialogPopupWindow { + + private ImageView mIvBg; + private ImageView mIvTips; + private ImageView mIvBack; + private CustomEllipsizeTextView mTvUserName; + private View mAchievement; + private TextView mTvTab1, mTvTab2; + private ViewPager2 mViewPager; + private LinearLayout mIvTabsLayout; + private List fragments = new ArrayList<>(); + + private boolean isFullWindows; + + public GiftWallDialog(@NonNull Context context) { + super(context); + } + + public GiftWallDialog setFullWindows(boolean fullWindows) { + isFullWindows = fullWindows; + return this; + } + + @Override + public void buildDialog(XPopup.Builder builder) { + + } + + @Override + public int bindLayoutId() { + return R.layout.dialog_gift_wall; + } + + @Override + protected int getPopupHeight() { + if (isFullWindows) { + return super.getPopupHeight(); + } + int screenHeight = ScreenDimenUtil.getInstance().getScreenHeight(); + return (int) (screenHeight * 0.8); + } + + void initView() { + mIvBg = findViewById(R.id.iv_root_bg); + mIvTips = findViewById(R.id.v_tips); + mIvBack = findViewById(R.id.iv_back); + mTvUserName = findViewById(R.id.user_name); + mAchievement = findViewById(R.id.v_achievement); + mTvTab1 = findViewById(R.id.tab1); + mTvTab2 = findViewById(R.id.tab2); + mViewPager = findViewById(R.id.viewPager2); + mIvTabsLayout = findViewById(R.id.tab_layout); + + fragments.add(new GiftWallMainTab1Fragment()); + fragments.add(new GiftWallMainTab2Fragment()); + mViewPager.setAdapter(new FragmentStateAdapter((FragmentActivity) mContext) { + @NonNull + @Override + public Fragment createFragment(int position) { + return fragments.get(position); + } + + @Override + public int getItemCount() { + return fragments.size(); + } + }); + mViewPager.setUserInputEnabled(false); + + + ViewClicksAntiShake.clicksAntiShake(mTvTab1, () -> { + mIvBg.setImageResource(R.mipmap.bg_gift_wall_main_root); + mIvTabsLayout.setBackgroundResource(R.mipmap.icon_gift_wall_main_switch_main); + mTvTab1.setTextColor(Color.parseColor("#9CE7FF")); + mTvTab1.setTextSize(16); + mTvTab1.setTypeface(Typeface.defaultFromStyle(Typeface.BOLD)); + + mTvTab2.setTextColor(Color.parseColor("#FFFFFF")); + mTvTab2.setTextSize(14); + mTvTab2.setTypeface(Typeface.defaultFromStyle(Typeface.NORMAL)); + mViewPager.setCurrentItem(0,false); + }); + ViewClicksAntiShake.clicksAntiShake(mTvTab2, () -> { + + mIvBg.setImageResource(R.mipmap.bg_gift_wall_main_root2); + mIvTabsLayout.setBackgroundResource(R.mipmap.icon_gift_wall_main_switch_full); + mTvTab1.setTextColor(Color.parseColor("#FFFFFF")); + mTvTab1.setTextSize(14); + mTvTab1.setTypeface(Typeface.defaultFromStyle(Typeface.NORMAL)); + + mTvTab2.setTextColor(Color.parseColor("#FFC593")); + mTvTab2.setTextSize(16); + mTvTab2.setTypeface(Typeface.defaultFromStyle(Typeface.BOLD)); + mViewPager.setCurrentItem(1,false); + }); + + } + + @Override + protected void onCreate() { + super.onCreate(); + initView(); + ConstraintLayout.LayoutParams params = (ConstraintLayout.LayoutParams) mIvBack.getLayoutParams(); + if (isFullWindows) { + params.width=DpUtil.dp2px(20); + mIvBack.setVisibility(View.VISIBLE); + mIvBg.setScaleType(ImageView.ScaleType.CENTER_CROP); + } else { + params.width=DpUtil.dp2px(1); + mIvBack.setVisibility(View.INVISIBLE); + mIvBg.setScaleType(ImageView.ScaleType.FIT_XY); + } + mIvBack.setLayoutParams(params); + + } +} diff --git a/common/src/main/java/com/yunbao/common/fragment/GiftWallMainTab1Fragment.java b/common/src/main/java/com/yunbao/common/fragment/GiftWallMainTab1Fragment.java new file mode 100644 index 000000000..46ace5f33 --- /dev/null +++ b/common/src/main/java/com/yunbao/common/fragment/GiftWallMainTab1Fragment.java @@ -0,0 +1,34 @@ +package com.yunbao.common.fragment; + +import android.graphics.Color; +import android.os.Bundle; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; +import android.widget.TextView; + +public class GiftWallMainTab1Fragment extends BaseFragment { + @Override + public View createView(LayoutInflater inflater, ViewGroup container) { + TextView textView = new TextView(getActivity()); + textView.setText("第一页"); + textView.setTextColor(Color.WHITE); + textView.setTextSize(24); + return textView; + } + + @Override + protected void initVariables(Bundle bundle) { + + } + + @Override + protected void initViews(Bundle savedInstanceState, View contentView) { + + } + + @Override + protected void loadData() { + + } +} diff --git a/common/src/main/java/com/yunbao/common/fragment/GiftWallMainTab2Fragment.java b/common/src/main/java/com/yunbao/common/fragment/GiftWallMainTab2Fragment.java new file mode 100644 index 000000000..9c4b7f12d --- /dev/null +++ b/common/src/main/java/com/yunbao/common/fragment/GiftWallMainTab2Fragment.java @@ -0,0 +1,34 @@ +package com.yunbao.common.fragment; + +import android.graphics.Color; +import android.os.Bundle; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; +import android.widget.TextView; + +public class GiftWallMainTab2Fragment extends BaseFragment { + @Override + public View createView(LayoutInflater inflater, ViewGroup container) { + TextView textView = new TextView(getActivity()); + textView.setText("第二页"); + textView.setTextColor(Color.WHITE); + textView.setTextSize(24); + return textView; + } + + @Override + protected void initVariables(Bundle bundle) { + + } + + @Override + protected void initViews(Bundle savedInstanceState, View contentView) { + + } + + @Override + protected void loadData() { + + } +} diff --git a/common/src/main/java/com/yunbao/common/views/CustomEllipsizeTextView.java b/common/src/main/java/com/yunbao/common/views/CustomEllipsizeTextView.java new file mode 100644 index 000000000..09e714bdd --- /dev/null +++ b/common/src/main/java/com/yunbao/common/views/CustomEllipsizeTextView.java @@ -0,0 +1,46 @@ +package com.yunbao.common.views; + +import android.content.Context; +import android.graphics.Canvas; +import android.text.Layout; +import android.text.TextPaint; +import android.text.TextUtils; +import android.util.AttributeSet; + +import androidx.appcompat.widget.AppCompatTextView; + +public class CustomEllipsizeTextView extends AppCompatTextView { + + public CustomEllipsizeTextView(Context context) { + super(context); + } + + public CustomEllipsizeTextView(Context context, AttributeSet attrs) { + super(context, attrs); + } + + public CustomEllipsizeTextView(Context context, AttributeSet attrs, int defStyleAttr) { + super(context, attrs, defStyleAttr); + } + + @Override + protected void onDraw(Canvas canvas) { + super.onDraw(canvas); + CharSequence text = getText(); + float measureText = getPaint().measureText(text, 0, text.length()); + if (measureText > getMeasuredWidth() && text.length() > 5) { + CharSequence end = text.subSequence(text.length() - 5, text.length()); + CharSequence start = text.subSequence(0, text.length() - 5); + CharSequence newCharSequence = getAutoText(start, end, getPaint()); + setText(newCharSequence); + } + } + + private CharSequence getAutoText(CharSequence start, CharSequence end, TextPaint paint) { + CharSequence text = TextUtils.concat(start.subSequence(0, start.length() - 1), "...", end); + if (paint.measureText(text, 0, text.length()) > getMeasuredWidth()) { + return getAutoText(start.subSequence(0, start.length() - 1), end, paint); + } + return text; + } +} \ No newline at end of file diff --git a/common/src/main/res/layout/dialog_gift_wall.xml b/common/src/main/res/layout/dialog_gift_wall.xml new file mode 100644 index 000000000..2329b37d1 --- /dev/null +++ b/common/src/main/res/layout/dialog_gift_wall.xml @@ -0,0 +1,133 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/common/src/main/res/mipmap-xxhdpi/bg_gift_wall_main_achievement.png b/common/src/main/res/mipmap-xxhdpi/bg_gift_wall_main_achievement.png new file mode 100644 index 000000000..8e611ba5b Binary files /dev/null and b/common/src/main/res/mipmap-xxhdpi/bg_gift_wall_main_achievement.png differ diff --git a/common/src/main/res/mipmap-xxhdpi/bg_gift_wall_main_root.png b/common/src/main/res/mipmap-xxhdpi/bg_gift_wall_main_root.png new file mode 100644 index 000000000..526dd7eea Binary files /dev/null and b/common/src/main/res/mipmap-xxhdpi/bg_gift_wall_main_root.png differ diff --git a/common/src/main/res/mipmap-xxhdpi/bg_gift_wall_main_root2.png b/common/src/main/res/mipmap-xxhdpi/bg_gift_wall_main_root2.png new file mode 100644 index 000000000..988555e9f Binary files /dev/null and b/common/src/main/res/mipmap-xxhdpi/bg_gift_wall_main_root2.png differ diff --git a/common/src/main/res/mipmap-xxhdpi/ic_gift_wall_time.png b/common/src/main/res/mipmap-xxhdpi/ic_gift_wall_time.png new file mode 100644 index 000000000..8297ff59b Binary files /dev/null and b/common/src/main/res/mipmap-xxhdpi/ic_gift_wall_time.png differ diff --git a/common/src/main/res/mipmap-xxhdpi/icon_gift_wall_main_switch_full.png b/common/src/main/res/mipmap-xxhdpi/icon_gift_wall_main_switch_full.png new file mode 100644 index 000000000..fcc3a169d Binary files /dev/null and b/common/src/main/res/mipmap-xxhdpi/icon_gift_wall_main_switch_full.png differ diff --git a/common/src/main/res/mipmap-xxhdpi/icon_gift_wall_main_switch_main.png b/common/src/main/res/mipmap-xxhdpi/icon_gift_wall_main_switch_main.png new file mode 100644 index 000000000..fc8d9f0a4 Binary files /dev/null and b/common/src/main/res/mipmap-xxhdpi/icon_gift_wall_main_switch_main.png differ diff --git a/common/src/main/res/mipmap-xxhdpi/icon_gift_wall_main_tips.png b/common/src/main/res/mipmap-xxhdpi/icon_gift_wall_main_tips.png new file mode 100644 index 000000000..213f37fb9 Binary files /dev/null and b/common/src/main/res/mipmap-xxhdpi/icon_gift_wall_main_tips.png differ diff --git a/common/src/main/res/values-zh/strings.xml b/common/src/main/res/values-zh/strings.xml index f118df88a..0fae9ad0e 100644 --- a/common/src/main/res/values-zh/strings.xml +++ b/common/src/main/res/values-zh/strings.xml @@ -1497,5 +1497,8 @@ 短劇 完成*1 主播正在PK,稍後再試 - + 的禮物展館 + 個人展館 + 全站展館 + 榮譽成就 diff --git a/common/src/main/res/values/strings.xml b/common/src/main/res/values/strings.xml index 136420081..9e2e998aa 100644 --- a/common/src/main/res/values/strings.xml +++ b/common/src/main/res/values/strings.xml @@ -841,8 +841,7 @@ How long does the heat card take effect? After using the hot card for the designated anchor, it will take effect immediately. The effect time is 24 hours. Regardless of whether the anchor is online, the heat time will continue to decrease Rewards coming! - Receive free -Limited ride And limited avatar frame + Receive free Limited ride And limited avatar frame Looking for you like? Go contact your personal guide to get your prize redemption code! @@ -1506,4 +1505,8 @@ Limited ride And limited avatar frame Theater The anchor is in PK, please try again later once + \'sGift Hall + Personal hal + Whole site hal + Honors diff --git a/main/src/main/java/com/yunbao/main/views/MainHomeViewHolder.java b/main/src/main/java/com/yunbao/main/views/MainHomeViewHolder.java index 3f92eb5b5..11d54abeb 100644 --- a/main/src/main/java/com/yunbao/main/views/MainHomeViewHolder.java +++ b/main/src/main/java/com/yunbao/main/views/MainHomeViewHolder.java @@ -12,7 +12,10 @@ import android.widget.TextView; import androidx.appcompat.app.AppCompatActivity; import com.lxj.xpopup.XPopup; +import com.lxj.xpopup.core.BottomPopupView; +import com.yunbao.common.dialog.GiftWallDialog; import com.yunbao.common.manager.IMLoginManager; +import com.yunbao.common.utils.AppManager; import com.yunbao.common.utils.MobclickAgent; import com.yunbao.common.activity.AbsActivity; import com.yunbao.common.dialog.SkitCheckInWasSuccessfulPopup; @@ -65,9 +68,12 @@ public class MainHomeViewHolder extends AbsMainHomeParentViewHolder { img_trophy.setOnLongClickListener(new View.OnLongClickListener() { @Override public boolean onLongClick(View view) { - LivePrankDialogFragment fragment = new LivePrankDialogFragment(); - fragment.setmLiveUid(String.valueOf(IMLoginManager.get(mContext).getUserInfo().getId())); - fragment.show(((AppCompatActivity) mContext).getSupportFragmentManager(), "LivePrankDialogFragment"); + AppManager.runDebugCode(new Runnable() { + @Override + public void run() { + new GiftWallDialog(mContext).setFullWindows(false).showDialog(); + } + }); return true; } });