魔法帽UI修改

This commit is contained in:
huangjian
2023-03-21 14:21:15 +08:00
parent 1feda0e047
commit 3be3591b15
4 changed files with 24 additions and 16 deletions

View File

@@ -437,9 +437,9 @@ class RoomEffectView @JvmOverloads constructor(
val textView = val textView =
LayoutInflater.from(mContext).inflate(R.layout.layout_room_box_notify, null) as TextView LayoutInflater.from(mContext).inflate(R.layout.layout_room_box_notify, null) as TextView
val text = SpannableBuilder() val text = SpannableBuilder()
.append("厉害了! ", ForegroundColorSpan(Color.WHITE)) .append("厉害了!", ForegroundColorSpan(Color.WHITE))
.append( .append(
attachment.nick.sub(6) + " ", attachment.nick.sub(6),
ForegroundColorSpan(resources.getColor(R.color.notice_nick)) ForegroundColorSpan(resources.getColor(R.color.notice_nick))
) )
.append("在魔法帽中获得", ForegroundColorSpan(Color.WHITE)) .append("在魔法帽中获得", ForegroundColorSpan(Color.WHITE))
@@ -485,9 +485,9 @@ class RoomEffectView @JvmOverloads constructor(
private fun showBoxNotifyBySVGA(chatRoomMessage: ChatRoomMessage) { private fun showBoxNotifyBySVGA(chatRoomMessage: ChatRoomMessage) {
val attachment = chatRoomMessage.attachment as RoomBoxPrizeAttachment val attachment = chatRoomMessage.attachment as RoomBoxPrizeAttachment
val text = SpannableBuilder() val text = SpannableBuilder()
.append("厉害了! ", ForegroundColorSpan(Color.WHITE)) .append("厉害了!", ForegroundColorSpan(Color.WHITE))
.append( .append(
attachment.nick + " ", attachment.nick.sub(6),
ForegroundColorSpan(resources.getColor(R.color.notice_nick)) ForegroundColorSpan(resources.getColor(R.color.notice_nick))
) )
.append("在魔法帽中获得", ForegroundColorSpan(Color.WHITE)) .append("在魔法帽中获得", ForegroundColorSpan(Color.WHITE))

View File

@@ -26,8 +26,8 @@ public class EmptyViewHelper {
public static TextView createEmptyTextView(Context context,CharSequence text) { public static TextView createEmptyTextView(Context context,CharSequence text) {
TextView textView = new TextView(context); TextView textView = new TextView(context);
textView.setGravity(Gravity.CENTER); textView.setGravity(Gravity.CENTER);
textView.setTextColor(Color.WHITE); textView.setTextColor(Color.parseColor("#dcc3ff"));
textView.setTextSize(12); textView.setTextSize(11);
textView.setSingleLine(true); textView.setSingleLine(true);
textView.setText(text); textView.setText(text);
return textView; return textView;

View File

@@ -11,9 +11,9 @@
android:maxLines="2" android:maxLines="2"
android:lineSpacingExtra="0dp" android:lineSpacingExtra="0dp"
android:lineSpacingMultiplier="0.9" android:lineSpacingMultiplier="0.9"
android:paddingStart="80dp" android:paddingStart="45dp"
android:paddingEnd="80dp" android:paddingEnd="45dp"
android:textSize="13sp" android:textSize="13sp"
android:paddingTop="7dp" android:paddingTop="7dp"
tools:layout_height="wrap_content" tools:layout_height="wrap_content"
tools:text="哈哈哈哈哈哈啊哈哈啊哈哈哈哈哈哈哈哈哈哈哈" /> tools:text="厉害了!用户名六个字 在魔法帽中获得礼物名字11" />

View File

@@ -59,9 +59,9 @@ import io.reactivex.android.schedulers.AndroidSchedulers;
@ActLayoutRes(R.layout.activity_treasure_box) @ActLayoutRes(R.layout.activity_treasure_box)
public class TreasureBoxActivity extends BaseBindingActivity<ActivityTreasureBoxBinding> implements View.OnClickListener { public class TreasureBoxActivity extends BaseBindingActivity<ActivityTreasureBoxBinding> implements View.OnClickListener {
private final Runnable removeRunnable = () -> mBinding.llPrizeHint.removeAllViews(); private final Runnable removeRunnable = () -> mBinding.llPrizeHint.removeAllViews();
private volatile int keyNum;
private final ArrayList<PrizeInfo> hintPrizeCacheList = new ArrayList<>(); private final ArrayList<PrizeInfo> hintPrizeCacheList = new ArrayList<>();
private final int boxType = IBoxModel.BOX_TYPE_NORMAL; private final int boxType = IBoxModel.BOX_TYPE_NORMAL;
private volatile int keyNum;
private int height; private int height;
private int sendMessageSwitchLevel; private int sendMessageSwitchLevel;
@@ -107,7 +107,7 @@ public class TreasureBoxActivity extends BaseBindingActivity<ActivityTreasureBox
mBinding.editNum.setSelection(3); mBinding.editNum.setSelection(3);
SingleToastUtil.showToast("一次性最多只能摘200次"); SingleToastUtil.showToast("一次性最多只能摘200次");
} else { } else {
mBinding.tvContinuousNum.setText("消耗" + num +"根魔法棒可连续变"); mBinding.tvContinuousNum.setText("消耗" + num + "根魔法棒可连续变");
} }
} }
}); });
@@ -142,7 +142,7 @@ public class TreasureBoxActivity extends BaseBindingActivity<ActivityTreasureBox
@Override @Override
public void onBackPressed() { public void onBackPressed() {
if (mBinding.fragmentContainer.getVisibility() == View.VISIBLE) { if (mBinding.fragmentContainer.getVisibility() == View.VISIBLE) {
mBinding.fragmentContainer.setVisibility(View.GONE); hideFragmentContainer();
} else { } else {
super.onBackPressed(); super.onBackPressed();
} }
@@ -153,7 +153,7 @@ public class TreasureBoxActivity extends BaseBindingActivity<ActivityTreasureBox
switch (v.getId()) { switch (v.getId()) {
case R.id.root_view: case R.id.root_view:
if (mBinding.fragmentContainer.getVisibility() == View.VISIBLE) { if (mBinding.fragmentContainer.getVisibility() == View.VISIBLE) {
mBinding.fragmentContainer.setVisibility(View.GONE); hideFragmentContainer();
} else { } else {
finish(); finish();
} }
@@ -181,7 +181,7 @@ public class TreasureBoxActivity extends BaseBindingActivity<ActivityTreasureBox
DialogWebViewActivity.start(this, UriProvider.getBoxKey()); DialogWebViewActivity.start(this, UriProvider.getBoxKey());
break; break;
case R.id.tv_get_key: case R.id.tv_get_key:
mBinding.fragmentContainer.setVisibility(View.GONE); hideFragmentContainer();
DialogWebViewActivity.start(this, UriProvider.getBoxKey()); DialogWebViewActivity.start(this, UriProvider.getBoxKey());
break; break;
case R.id.tv_box_rule: case R.id.tv_box_rule:
@@ -200,6 +200,14 @@ public class TreasureBoxActivity extends BaseBindingActivity<ActivityTreasureBox
.replace(R.id.fragment_container, fragment) .replace(R.id.fragment_container, fragment)
.commitNow(); .commitNow();
mBinding.fragmentContainer.setVisibility(View.VISIBLE); mBinding.fragmentContainer.setVisibility(View.VISIBLE);
mBinding.ivMore.setVisibility(View.INVISIBLE);
mBinding.bgKeyNum.setVisibility(View.INVISIBLE);
}
private void hideFragmentContainer() {
mBinding.fragmentContainer.setVisibility(View.GONE);
mBinding.ivMore.setVisibility(View.VISIBLE);
mBinding.bgKeyNum.setVisibility(View.VISIBLE);
} }
/** /**
@@ -233,13 +241,13 @@ public class TreasureBoxActivity extends BaseBindingActivity<ActivityTreasureBox
BoxModel.get().openBox(boxType, count, sendMessage) BoxModel.get().openBox(boxType, count, sendMessage)
.compose(bindToLifecycle()) .compose(bindToLifecycle())
.doOnError(throwable -> { .doOnError(throwable -> {
// mBinding.ivOpen.setEnabled(true); // mBinding.ivOpen.setEnabled(true);
SingleToastUtil.showToast(throwable.getMessage()); SingleToastUtil.showToast(throwable.getMessage());
}) })
.toObservable() .toObservable()
//.delay(startTime - System.currentTimeMillis() + 300, TimeUnit.MILLISECONDS) //.delay(startTime - System.currentTimeMillis() + 300, TimeUnit.MILLISECONDS)
.observeOn(AndroidSchedulers.mainThread()) .observeOn(AndroidSchedulers.mainThread())
.doOnNext(openBoxResult ->{ .doOnNext(openBoxResult -> {
//mBinding.ivOpen.setEnabled(true); //mBinding.ivOpen.setEnabled(true);
changeKeyNum(openBoxResult.getRemainKeyNum()); changeKeyNum(openBoxResult.getRemainKeyNum());
mBinding.svgaGiftBg.startAnimation(); mBinding.svgaGiftBg.startAnimation();