弹窗整合
This commit is contained in:
parent
e353638ec1
commit
280920d5f0
@ -1,24 +1,72 @@
|
||||
package com.yunbao.common.dialog;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.Context;
|
||||
import android.widget.Button;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
import com.lxj.xpopup.XPopup;
|
||||
import com.lxj.xpopup.core.CenterPopupView;
|
||||
import com.yunbao.common.R;
|
||||
import com.yunbao.common.utils.DeviceUtils;
|
||||
import com.yunbao.common.utils.DpUtil;
|
||||
import com.yunbao.common.views.weight.ViewClicksAntiShake;
|
||||
|
||||
public class ActivateEliteBattleOrderPopupWindow extends CenterPopupView {
|
||||
public ActivateEliteBattleOrderPopupWindow(@NonNull Context context) {
|
||||
super(context);
|
||||
}
|
||||
@Override
|
||||
protected int getImplLayoutId() {
|
||||
return R.layout.activate_elite_battle_order_popup;
|
||||
}
|
||||
private boolean elites;//是否精英战令
|
||||
private String spendMoney;//花费钱
|
||||
private Button buttonWarOrder;
|
||||
|
||||
// 执行初始化操作,比如:findView,设置点击,或者任何你弹窗内的业务逻辑
|
||||
@Override
|
||||
protected void onCreate() {
|
||||
super.onCreate();
|
||||
}
|
||||
public ActivateEliteBattleOrderPopupWindow(@NonNull Context context, String mSpendMoney, boolean elites) {
|
||||
super(context);
|
||||
this.elites = elites;
|
||||
spendMoney = mSpendMoney;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int getImplLayoutId() {
|
||||
return R.layout.activate_elite_battle_order_popup;
|
||||
}
|
||||
|
||||
// 执行初始化操作,比如:findView,设置点击,或者任何你弹窗内的业务逻辑
|
||||
@Override
|
||||
protected void onCreate() {
|
||||
super.onCreate();
|
||||
buttonWarOrder = findViewById(R.id.button_war_order);
|
||||
if (elites) {
|
||||
findViewById(R.id.gift_overvalue).setVisibility(VISIBLE);
|
||||
findViewById(R.id.gift_overvalue3).setVisibility(GONE);
|
||||
findViewById(R.id.enjoy_image).setVisibility(GONE);
|
||||
findViewById(R.id.gift_overvalue).setVisibility(VISIBLE);
|
||||
} else {
|
||||
findViewById(R.id.gift_overvalue).setVisibility(GONE);
|
||||
findViewById(R.id.gift_overvalue3).setVisibility(VISIBLE);
|
||||
findViewById(R.id.enjoy_image).setVisibility(VISIBLE);
|
||||
findViewById(R.id.gift_overvalue).setVisibility(GONE);
|
||||
}
|
||||
ViewClicksAntiShake.clicksAntiShake(findViewById(R.id.war_order_close), new ViewClicksAntiShake.ViewClicksCallBack() {
|
||||
@Override
|
||||
public void onViewClicks() {
|
||||
dialog.dismiss();
|
||||
}
|
||||
});
|
||||
//中文按钮文字
|
||||
StringBuffer stringBuffer = new StringBuffer();
|
||||
stringBuffer.append(spendMoney)
|
||||
.append("鑽開通");
|
||||
buttonWarOrder.setText(stringBuffer.toString());
|
||||
|
||||
ViewClicksAntiShake.clicksAntiShake(buttonWarOrder, new ViewClicksAntiShake.ViewClicksCallBack() {
|
||||
@Override
|
||||
public void onViewClicks() {
|
||||
dialog.dismiss();
|
||||
new XPopup.Builder(getContext())
|
||||
.enableDrag(false)
|
||||
.maxWidth(DeviceUtils.getScreenHeight((Activity) getContext()) - DpUtil.dp2px(34))
|
||||
.asCustom(new LiberalBattlePassPopupWindow(getContext(), spendMoney, elites))
|
||||
.show();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,59 @@
|
||||
package com.yunbao.common.dialog;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.Color;
|
||||
import android.text.Spannable;
|
||||
import android.text.SpannableStringBuilder;
|
||||
import android.text.style.ForegroundColorSpan;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
import com.lxj.xpopup.core.CenterPopupView;
|
||||
import com.yunbao.common.R;
|
||||
import com.yunbao.common.views.weight.ViewClicksAntiShake;
|
||||
|
||||
public class LiberalBattlePassPopupWindow extends CenterPopupView {
|
||||
private String spendMoney;//花费钱
|
||||
private boolean mElites;//是否精英战令
|
||||
private TextView liberalBattlePass;
|
||||
|
||||
public LiberalBattlePassPopupWindow(@NonNull Context context, String mSpendMoney, boolean elites) {
|
||||
super(context);
|
||||
spendMoney = mSpendMoney;
|
||||
mElites = elites;
|
||||
}
|
||||
|
||||
protected int getImplLayoutId() {
|
||||
return R.layout.liberal_battle_pass_popup;
|
||||
}
|
||||
|
||||
// 执行初始化操作,比如:findView,设置点击,或者任何你弹窗内的业务逻辑
|
||||
@Override
|
||||
protected void onCreate() {
|
||||
super.onCreate();
|
||||
liberalBattlePass = findViewById(R.id.liberal_battle_pass);
|
||||
//中文版
|
||||
StringBuffer liberalBattlePassHint = new StringBuffer();
|
||||
liberalBattlePassHint.append("是否花費");
|
||||
liberalBattlePassHint.append(spendMoney).append(mElites ? "鑽石開通精英戰令!" : "鑽石開通尊享戰令!");
|
||||
//英文版
|
||||
|
||||
//设置样式
|
||||
String liberalBattlePassStr = liberalBattlePassHint.toString();
|
||||
SpannableStringBuilder builder = new SpannableStringBuilder();
|
||||
builder.append(liberalBattlePassStr);
|
||||
int spendMoneyIndex = liberalBattlePassStr.indexOf(spendMoney);
|
||||
int spendMoneySize = spendMoneyIndex + spendMoney.length();
|
||||
builder.setSpan(new ForegroundColorSpan(Color.parseColor("#CE2BFF")), spendMoneyIndex, spendMoneySize, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
|
||||
liberalBattlePass.setText(builder);
|
||||
ViewClicksAntiShake.clicksAntiShake(findViewById(R.id.cancel), new ViewClicksAntiShake.ViewClicksCallBack() {
|
||||
@Override
|
||||
public void onViewClicks() {
|
||||
dialog.dismiss();
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
}
|
||||
}
|
@ -1,19 +1,29 @@
|
||||
package com.yunbao.common.dialog;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.Context;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
import com.lxj.xpopup.XPopup;
|
||||
import com.lxj.xpopup.core.CenterPopupView;
|
||||
import com.yunbao.common.R;
|
||||
import com.yunbao.common.utils.DeviceUtils;
|
||||
import com.yunbao.common.utils.DpUtil;
|
||||
import com.yunbao.common.views.weight.ViewClicksAntiShake;
|
||||
|
||||
/**
|
||||
* 升級精英/尊享戰令
|
||||
*/
|
||||
public class PromotionElitePopupWindow extends CenterPopupView {
|
||||
public PromotionElitePopupWindow(@NonNull Context context) {
|
||||
private String enjoySpendMoney,quintessenceSpendMoney;//花费钱
|
||||
|
||||
public PromotionElitePopupWindow(@NonNull Context context, String mEnjoySpendMoney, String mQuintessenceSpendMoney) {
|
||||
super(context);
|
||||
enjoySpendMoney = mEnjoySpendMoney;
|
||||
quintessenceSpendMoney = mQuintessenceSpendMoney;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int getImplLayoutId() {
|
||||
return R.layout.promotion_elite_popup;
|
||||
@ -23,5 +33,33 @@ public class PromotionElitePopupWindow extends CenterPopupView {
|
||||
@Override
|
||||
protected void onCreate() {
|
||||
super.onCreate();
|
||||
ViewClicksAntiShake.clicksAntiShake(findViewById(R.id.close), new ViewClicksAntiShake.ViewClicksCallBack() {
|
||||
@Override
|
||||
public void onViewClicks() {
|
||||
dialog.dismiss();
|
||||
}
|
||||
});
|
||||
ViewClicksAntiShake.clicksAntiShake(findViewById(R.id.button_quintessence), new ViewClicksAntiShake.ViewClicksCallBack() {
|
||||
@Override
|
||||
public void onViewClicks() {
|
||||
dialog.dismiss();
|
||||
new XPopup.Builder(getContext())
|
||||
.enableDrag(false)
|
||||
.maxWidth(DeviceUtils.getScreenHeight((Activity) getContext()) - DpUtil.dp2px(34))
|
||||
.asCustom(new ActivateEliteBattleOrderPopupWindow(getContext(), quintessenceSpendMoney, true))
|
||||
.show();
|
||||
}
|
||||
});
|
||||
ViewClicksAntiShake.clicksAntiShake(findViewById(R.id.button_enjoy), new ViewClicksAntiShake.ViewClicksCallBack() {
|
||||
@Override
|
||||
public void onViewClicks() {
|
||||
dialog.dismiss();
|
||||
new XPopup.Builder(getContext())
|
||||
.enableDrag(false)
|
||||
.maxWidth(DeviceUtils.getScreenHeight((Activity) getContext()) - DpUtil.dp2px(34))
|
||||
.asCustom(new ActivateEliteBattleOrderPopupWindow(getContext(), enjoySpendMoney, false))
|
||||
.show();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
@ -1,18 +1,38 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="300dp"
|
||||
android:layout_height="291dp"
|
||||
android:layout_marginStart="17dp"
|
||||
android:layout_marginEnd="17dp"
|
||||
android:background="@drawable/background_order_dialog"
|
||||
android:orientation="vertical">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/war_order_close"
|
||||
android:layout_width="19dp"
|
||||
android:layout_height="19dp"
|
||||
android:layout_gravity="end"
|
||||
android:layout_marginTop="14dp"
|
||||
android:layout_marginEnd="14dp"
|
||||
android:src="@mipmap/icon_sud_rule_close" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/elites_image"
|
||||
android:layout_width="211dp"
|
||||
android:layout_height="27dp"
|
||||
android:layout_gravity="center"
|
||||
android:layout_marginTop="39dp"
|
||||
android:src="@mipmap/icon_activate_the_elite_battle_order" />
|
||||
android:layout_marginTop="3dp"
|
||||
android:src="@mipmap/icon_activate_the_elite_battle_order"
|
||||
android:visibility="gone" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/enjoy_image"
|
||||
android:layout_width="211dp"
|
||||
android:layout_height="27dp"
|
||||
android:layout_gravity="center"
|
||||
android:layout_marginTop="3dp"
|
||||
android:src="@mipmap/icon_enjoy_image"
|
||||
android:visibility="visible" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
@ -34,12 +54,24 @@
|
||||
android:src="@mipmap/icon_war_order_diamond" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/gift_overvalue"
|
||||
android:layout_width="71dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="8dp"
|
||||
android:gravity="center"
|
||||
android:text="@string/gift_overvalue"
|
||||
android:textColor="#CE2BFF"
|
||||
android:textSize="14sp"
|
||||
android:visibility="gone" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/gift_overvalue3"
|
||||
android:layout_width="71dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="8dp"
|
||||
android:gravity="center"
|
||||
android:text="@string/gift_overvalue3"
|
||||
android:textColor="#CE2BFF"
|
||||
android:textSize="14sp" />
|
||||
</LinearLayout>
|
||||
|
||||
@ -97,8 +129,13 @@
|
||||
android:textSize="13sp" />
|
||||
|
||||
<Button
|
||||
android:layout_width="152dp"
|
||||
android:layout_height="72dp"
|
||||
android:id="@+id/button_war_order"
|
||||
android:layout_width="150dp"
|
||||
android:layout_height="48dp"
|
||||
android:textSize="15sp"
|
||||
android:textColor="@color/white"
|
||||
android:textStyle="bold"
|
||||
android:gravity="center"
|
||||
android:layout_gravity="center"
|
||||
android:layout_marginTop="10dp"
|
||||
android:background="@mipmap/button_war_order" />
|
||||
|
50
common/src/main/res/layout/liberal_battle_pass_popup.xml
Normal file
50
common/src/main/res/layout/liberal_battle_pass_popup.xml
Normal file
@ -0,0 +1,50 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="218dp"
|
||||
android:layout_marginStart="22dp"
|
||||
android:layout_marginEnd="22dp"
|
||||
android:background="@drawable/background_order_dialog"
|
||||
android:orientation="vertical">
|
||||
|
||||
|
||||
<TextView
|
||||
android:id="@+id/liberal_battle_pass"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:layout_marginTop="73dp"
|
||||
android:text="liberal_battle_pass2"
|
||||
android:textColor="#0D21B2"
|
||||
android:textSize="16sp" />
|
||||
|
||||
<FrameLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="57dp">
|
||||
|
||||
|
||||
<Button
|
||||
android:id="@+id/cancel"
|
||||
android:layout_width="116dp"
|
||||
android:layout_height="38dp"
|
||||
android:layout_marginStart="19dp"
|
||||
android:background="@mipmap/button_liberal_battle_cancel"
|
||||
android:gravity="center"
|
||||
android:text="@string/cancel"
|
||||
android:textColor="#FFFFFF"
|
||||
android:textSize="14sp" />
|
||||
|
||||
<Button
|
||||
android:layout_width="116dp"
|
||||
android:layout_height="38dp"
|
||||
android:layout_gravity="end"
|
||||
android:layout_marginEnd="19dp"
|
||||
android:background="@mipmap/button_liberal_battle_sure"
|
||||
android:gravity="center"
|
||||
android:text="@string/confirm"
|
||||
android:textColor="#E03600"
|
||||
android:textSize="14sp" />
|
||||
</FrameLayout>
|
||||
|
||||
</LinearLayout>
|
@ -8,6 +8,7 @@
|
||||
android:orientation="vertical">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/close"
|
||||
android:layout_width="19dp"
|
||||
android:layout_height="19dp"
|
||||
android:layout_gravity="end"
|
||||
@ -40,12 +41,14 @@
|
||||
android:layout_marginTop="30dp">
|
||||
|
||||
<Button
|
||||
android:id="@+id/button_quintessence"
|
||||
android:layout_width="116dp"
|
||||
android:layout_height="38dp"
|
||||
android:layout_marginStart="34dp"
|
||||
android:background="@mipmap/button_quintessence" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/button_enjoy"
|
||||
android:layout_width="116dp"
|
||||
android:layout_height="38dp"
|
||||
android:layout_gravity="end"
|
||||
|
BIN
common/src/main/res/mipmap-b+en+us/icon_enjoy_image.png
Normal file
BIN
common/src/main/res/mipmap-b+en+us/icon_enjoy_image.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 43 KiB |
Binary file not shown.
After Width: | Height: | Size: 14 KiB |
BIN
common/src/main/res/mipmap-xxhdpi/button_liberal_battle_sure.png
Normal file
BIN
common/src/main/res/mipmap-xxhdpi/button_liberal_battle_sure.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 29 KiB |
Binary file not shown.
Before Width: | Height: | Size: 93 KiB After Width: | Height: | Size: 37 KiB |
BIN
common/src/main/res/mipmap-xxhdpi/icon_enjoy_image.png
Normal file
BIN
common/src/main/res/mipmap-xxhdpi/icon_enjoy_image.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 30 KiB |
@ -1406,6 +1406,8 @@ Limited ride And limited avatar frame</string>
|
||||
<string name="rule_of_war_hint6">6.活動最終解釋權歸PDLIVE所有。</string>
|
||||
<string name="more_integral">更多積分</string>
|
||||
<string name="gift_overvalue">禮物價值超 200%</string>
|
||||
<string name="gift_overvalue3">禮物價值超 300%</string>
|
||||
<string name="unlock_more_gifts">解鎖更多禮物 和全套珍稀裝扮</string>
|
||||
<string name="has_reached_level_after_opening">開通后已達到等級的獎勵將會自動解鎖!</string>
|
||||
|
||||
</resources>
|
||||
|
@ -35,6 +35,7 @@ import com.yunbao.common.Constants;
|
||||
import com.yunbao.common.HtmlConfig;
|
||||
import com.yunbao.common.bean.LiveBean;
|
||||
import com.yunbao.common.dialog.ActivateEliteBattleOrderPopupWindow;
|
||||
import com.yunbao.common.dialog.LiberalBattlePassPopupWindow;
|
||||
import com.yunbao.common.dialog.PromotionElitePopupWindow;
|
||||
import com.yunbao.common.dialog.RuleOfWarPopupWindow;
|
||||
import com.yunbao.common.event.JavascriptInterfaceEvent;
|
||||
@ -388,60 +389,57 @@ public class MainHomeCommunityViewHolder extends AbsMainHomeChildViewHolder impl
|
||||
.setAnchorAvatar(json.getString("avatar"))
|
||||
.showDialog();
|
||||
} else if (TextUtils.equals(event.getMethod(), "postWeakBalance")) {
|
||||
new XPopup.Builder(mContext)
|
||||
.enableDrag(false)
|
||||
.maxWidth(DeviceUtils.getScreenHeight((Activity) mContext) - DpUtil.dp2px(34))
|
||||
.asCustom(new ActivateEliteBattleOrderPopupWindow(mContext)) .show();
|
||||
|
||||
// LiveNetManager.get(mContext).
|
||||
// getCoolConfig(new com.yunbao.common.http.base.HttpCallback<CoolConfig>() {
|
||||
// @Override
|
||||
// public void onSuccess(CoolConfig data) {
|
||||
// new XPopup.Builder(mContext)
|
||||
// .enableDrag(false)
|
||||
// .maxWidth(DeviceUtils.getScreenHeight((Activity) mContext) - DpUtil.dp2px(34))
|
||||
// .asCustom(new CinemaTicketPopupWindow(mContext, data.setTicketCount(event.getCoolConfig().getTicketCount()), new CinemaTicketPopupWindow.CinemaTicketPopupWindowCallBack() {
|
||||
// @Override
|
||||
// public void onCallBack(String data) {
|
||||
// if (TextUtils.equals(data, "2")) {
|
||||
// DialogUitl.showSimpleDialog(mContext, mContext.getString(com.yunbao.live.R.string.live_coin_not_enough), false,
|
||||
// new DialogUitl.SimpleCallback2() {
|
||||
// @Override
|
||||
// public void onConfirmClick(Dialog dialog, String content) {
|
||||
// mContext.startActivity(new Intent(mContext, MyWalletActivity.class).putExtra("p", 1));
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void onCancelClick() {
|
||||
//
|
||||
// }
|
||||
// });
|
||||
// } else if (TextUtils.equals(data, "1")) {
|
||||
// mWebView.post(new Runnable() {
|
||||
// @Override
|
||||
// public void run() {
|
||||
//
|
||||
// NativeCallbackModel model = new NativeCallbackModel();
|
||||
// model.setUid(String.valueOf(IMLoginManager.get(mContext).getUserInfo().getId()));
|
||||
// String nativeJson = new JsonUtil().toJson(model);
|
||||
// mWebView.evaluateJavascript("javascript:nativeCallback('" + nativeJson + "')", new ValueCallback<String>() {
|
||||
// @Override
|
||||
// public void onReceiveValue(String value) {
|
||||
// }
|
||||
// });
|
||||
//
|
||||
// }
|
||||
// });
|
||||
// }
|
||||
//
|
||||
// }
|
||||
// })).show();
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void onError (String error){
|
||||
// ToastUtil.show(error);
|
||||
// }
|
||||
|
||||
LiveNetManager.get(mContext).
|
||||
getCoolConfig(new com.yunbao.common.http.base.HttpCallback<CoolConfig>() {
|
||||
@Override
|
||||
public void onSuccess(CoolConfig data) {
|
||||
new XPopup.Builder(mContext)
|
||||
.enableDrag(false)
|
||||
.maxWidth(DeviceUtils.getScreenHeight((Activity) mContext) - DpUtil.dp2px(34))
|
||||
.asCustom(new CinemaTicketPopupWindow(mContext, data.setTicketCount(event.getCoolConfig().getTicketCount()), new CinemaTicketPopupWindow.CinemaTicketPopupWindowCallBack() {
|
||||
@Override
|
||||
public void onCallBack(String data) {
|
||||
if (TextUtils.equals(data, "2")) {
|
||||
DialogUitl.showSimpleDialog(mContext, mContext.getString(com.yunbao.live.R.string.live_coin_not_enough), false,
|
||||
new DialogUitl.SimpleCallback2() {
|
||||
@Override
|
||||
public void onConfirmClick(Dialog dialog, String content) {
|
||||
mContext.startActivity(new Intent(mContext, MyWalletActivity.class).putExtra("p", 1));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCancelClick() {
|
||||
|
||||
}
|
||||
});
|
||||
} else if (TextUtils.equals(data, "1")) {
|
||||
mWebView.post(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
|
||||
NativeCallbackModel model = new NativeCallbackModel();
|
||||
model.setUid(String.valueOf(IMLoginManager.get(mContext).getUserInfo().getId()));
|
||||
String nativeJson = new JsonUtil().toJson(model);
|
||||
mWebView.evaluateJavascript("javascript:nativeCallback('" + nativeJson + "')", new ValueCallback<String>() {
|
||||
@Override
|
||||
public void onReceiveValue(String value) {
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
})).show();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError (String error){
|
||||
ToastUtil.show(error);
|
||||
}
|
||||
// });
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user