修改 测试问题

This commit is contained in:
18401019693 2023-12-05 09:27:47 +08:00
parent 2ab1b31a94
commit b4b1efe730
24 changed files with 474 additions and 0 deletions

View File

@ -0,0 +1,14 @@
package com.yunbao.common.bean;
public class CoolConfig extends BaseModel {
private int rate;
public int getRate() {
return rate;
}
public CoolConfig setRate(int rate) {
this.rate = rate;
return this;
}
}

View File

@ -0,0 +1,14 @@
package com.yunbao.common.bean;
public class NativeCallbackModel extends BaseModel{
private String uid ;
public String getUid() {
return uid;
}
public NativeCallbackModel setUid(String uid) {
this.uid = uid;
return this;
}
}

View File

@ -0,0 +1,99 @@
package com.yunbao.common.dialog;
import android.content.Context;
import android.view.View;
import android.widget.TextView;
import androidx.annotation.NonNull;
import com.lxj.xpopup.core.CenterPopupView;
import com.yunbao.common.R;
import com.yunbao.common.bean.CoolConfig;
import com.yunbao.common.http.base.HttpCallback;
import com.yunbao.common.http.live.LiveNetManager;
import com.yunbao.common.utils.ToastUtil;
import com.yunbao.common.views.weight.ViewClicksAntiShake;
import java.math.BigDecimal;
public class CinemaTicketPopupWindow extends CenterPopupView {
private CoolConfig mCoolConfig;
private TextView cinemaTicket, ticketsPlusMinus, quantityNeed;
private int ticket = 1;
private CinemaTicketPopupWindowCallBack mCinemaTicketPopupWindowCallBack;
public CinemaTicketPopupWindow(@NonNull Context context, CoolConfig coolConfig, CinemaTicketPopupWindowCallBack cinemaTicketPopupWindowCallBack) {
super(context);
mCoolConfig = coolConfig;
mCinemaTicketPopupWindowCallBack = cinemaTicketPopupWindowCallBack;
}
@Override
protected int getImplLayoutId() {
return R.layout.cinema_ticket_popup;
}
// 执行初始化操作比如findView设置点击或者任何你弹窗内的业务逻辑
@Override
protected void onCreate() {
super.onCreate();
cinemaTicket = findViewById(R.id.cinema_ticket);
ticketsPlusMinus = findViewById(R.id.tickets_plus_minus);
quantityNeed = findViewById(R.id.quantity_need);
cinemaTicket.setText(String.valueOf(ticket));
ticketsPlusMinus.setText(String.valueOf(ticket));
quantityNeed.setText(new BigDecimal(ticket).multiply(new BigDecimal(mCoolConfig.getRate())).toString());
ViewClicksAntiShake.clicksAntiShake(findViewById(R.id.cinema_ticket_close), new ViewClicksAntiShake.ViewClicksCallBack() {
@Override
public void onViewClicks() {
dialog.dismiss();
}
});
findViewById(R.id.sub).setOnClickListener(new OnClickListener() {
@Override
public void onClick(View view) {
if (ticket > 1) {
ticket = ticket - 1;
cinemaTicket.setText(String.valueOf(ticket));
ticketsPlusMinus.setText(String.valueOf(ticket));
quantityNeed.setText(new BigDecimal(ticket).multiply(new BigDecimal(mCoolConfig.getRate())).toString());
}
}
});
findViewById(R.id.add).setOnClickListener(new OnClickListener() {
@Override
public void onClick(View view) {
ticket = ticket + 1;
cinemaTicket.setText(String.valueOf(ticket));
ticketsPlusMinus.setText(String.valueOf(ticket));
quantityNeed.setText(new BigDecimal(ticket).multiply(new BigDecimal(mCoolConfig.getRate())).toString());
}
});
ViewClicksAntiShake.clicksAntiShake(findViewById(R.id.cinema_ticket_exchange), new ViewClicksAntiShake.ViewClicksCallBack() {
@Override
public void onViewClicks() {
LiveNetManager.get(getContext())
.buyTicket(String.valueOf(ticket), new HttpCallback<Object>() {
@Override
public void onSuccess(Object data) {
if (mCinemaTicketPopupWindowCallBack != null) {
mCinemaTicketPopupWindowCallBack.onCallBack();
}
dialog.dismiss();
}
@Override
public void onError(String error) {
ToastUtil.show(error);
}
});
}
});
}
public interface CinemaTicketPopupWindowCallBack {
void onCallBack();
}
}

View File

@ -9,6 +9,7 @@ import com.yunbao.common.bean.BlindBoxInfoModel;
import com.yunbao.common.bean.CheckLiveModel; import com.yunbao.common.bean.CheckLiveModel;
import com.yunbao.common.bean.CheckRemainingBalance; import com.yunbao.common.bean.CheckRemainingBalance;
import com.yunbao.common.bean.ContributeModel; import com.yunbao.common.bean.ContributeModel;
import com.yunbao.common.bean.CoolConfig;
import com.yunbao.common.bean.CreateSudRoomModel; import com.yunbao.common.bean.CreateSudRoomModel;
import com.yunbao.common.bean.CustomSidebarInfoModel; import com.yunbao.common.bean.CustomSidebarInfoModel;
import com.yunbao.common.bean.DiscountsModel; import com.yunbao.common.bean.DiscountsModel;
@ -1081,4 +1082,13 @@ public interface PDLiveApi {
Observable<ResponseModel<QuickGiftSendGiftModel>> viewingDurationGetGift( Observable<ResponseModel<QuickGiftSendGiftModel>> viewingDurationGetGift(
@Query("liveuid") String liveUid @Query("liveuid") String liveUid
); );
@GET("/api/public/?service=cool.config")
Observable<ResponseModel<CoolConfig>> getCoolConfig();
@FormUrlEncoded
@POST("/api/public/?service=cool.buy_ticket")
Observable<ResponseModel<Object>> buyTicket(
@Field("quantity") String quantity
);
} }

View File

@ -11,6 +11,7 @@ import com.yunbao.common.bean.BaseModel;
import com.yunbao.common.bean.BlindBoxInfoModel; import com.yunbao.common.bean.BlindBoxInfoModel;
import com.yunbao.common.bean.CheckLiveModel; import com.yunbao.common.bean.CheckLiveModel;
import com.yunbao.common.bean.CheckRemainingBalance; import com.yunbao.common.bean.CheckRemainingBalance;
import com.yunbao.common.bean.CoolConfig;
import com.yunbao.common.bean.CreateSudRoomModel; import com.yunbao.common.bean.CreateSudRoomModel;
import com.yunbao.common.bean.CustomSidebarInfoModel; import com.yunbao.common.bean.CustomSidebarInfoModel;
import com.yunbao.common.bean.DiscountsModel; import com.yunbao.common.bean.DiscountsModel;
@ -2407,6 +2408,51 @@ public class LiveNetManager {
}).isDisposed(); }).isDisposed();
} }
public void getCoolConfig(HttpCallback<CoolConfig> callback) {
API.get().pdLiveApi(mContext)
.getCoolConfig()
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(new Consumer<ResponseModel<CoolConfig>>() {
@Override
public void accept(ResponseModel<CoolConfig> coolConfigResponseModel) throws Exception {
if (callback != null) {
callback.onSuccess(coolConfigResponseModel.getData().getInfo());
}
}
}, new Consumer<Throwable>() {
@Override
public void accept(Throwable throwable) throws Exception {
if (callback != null) {
callback.onError(mContext.getString(R.string.net_error));
}
}
}).isDisposed();
}
public void buyTicket(String quantity, HttpCallback<Object> callback) {
API.get().pdLiveApi(mContext)
.buyTicket(quantity)
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(new Consumer<ResponseModel<Object>>() {
@Override
public void accept(ResponseModel<Object> objectResponseModel) throws Exception {
if (callback != null) {
callback.onSuccess(null);
}
}
}, new Consumer<Throwable>() {
@Override
public void accept(Throwable throwable) throws Exception {
if (callback != null) {
callback.onError(mContext.getString(R.string.net_error));
}
}
}).isDisposed();
}
public void quickGiftSendGift(String quickGiftNumber, String liveUid, String stream, HttpCallback<QuickGiftSendGiftModel> callback) { public void quickGiftSendGift(String quickGiftNumber, String liveUid, String stream, HttpCallback<QuickGiftSendGiftModel> callback) {
API.get().pdLiveApi(mContext) API.get().pdLiveApi(mContext)
.quickGiftSendGift(quickGiftNumber, liveUid, stream) .quickGiftSendGift(quickGiftNumber, liveUid, stream)

View File

@ -6,6 +6,8 @@ import android.webkit.JavascriptInterface;
import android.webkit.ValueCallback; import android.webkit.ValueCallback;
import android.webkit.WebView; import android.webkit.WebView;
import com.yunbao.common.event.JavascriptInterfaceEvent;
public class JavascriptInterfacePlayLetUtils { public class JavascriptInterfacePlayLetUtils {
private Activity mContext; private Activity mContext;
private WebView mWebView; private WebView mWebView;
@ -40,6 +42,11 @@ public class JavascriptInterfacePlayLetUtils {
@JavascriptInterface @JavascriptInterface
public void postWeakBalance(String data) { public void postWeakBalance(String data) {
Log.e("TAG", "postWeakBalance data==" + data); Log.e("TAG", "postWeakBalance data==" + data);
Bus.get().post(new JavascriptInterfaceEvent()
.setMethod("postWeakBalance"));
} }
} }

View File

@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<shape android:shape="rectangle">
<corners android:bottomLeftRadius="0dp" android:bottomRightRadius="16dp" android:topLeftRadius="16dp" android:topRightRadius="0dp" />
<gradient android:angle="360" android:endColor="#F6F5FF" android:startColor="#D3E3FF" />
</shape>
</item>
</selector>

View File

@ -0,0 +1,171 @@
<?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="475dp"
android:layout_marginStart="21dp"
android:layout_marginEnd="21dp"
android:background="@mipmap/background_cinema_ticket"
android:orientation="vertical">
<ImageView
android:id="@+id/cinema_ticket_close"
android:layout_width="24dp"
android:layout_height="24dp"
android:layout_gravity="end"
android:layout_margin="12dp"
android:src="@mipmap/icon_cinema_ticket_close" />
<ImageView
android:layout_width="222dp"
android:layout_height="25dp"
android:layout_gravity="center"
android:src="@mipmap/icon_cinema_ticket_title" />
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginTop="15dp">
<TextView
android:id="@+id/cinema_ticket"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="0"
android:textColor="#DFEAFF"
android:textSize="15sp" />
<ImageView
android:layout_width="23dp"
android:layout_height="19dp"
android:layout_marginStart="5dp"
android:src="@mipmap/icon_cinema_ticket" />
</LinearLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginTop="35dp"
android:gravity="center">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/conversion_quantity"
android:textColor="#FFFFFF"
android:textSize="14sp" />
<LinearLayout
android:layout_width="90dp"
android:layout_height="25dp"
android:background="@mipmap/backgroud_tickets_plus_minus">
<View
android:id="@+id/sub"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1" />
<TextView
android:id="@+id/tickets_plus_minus"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="2"
android:gravity="center"
android:singleLine="true"
android:text="0"
android:textColor="#000000"
android:textSize="12dp" />
<View
android:id="@+id/add"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1" />
</LinearLayout>
</LinearLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginTop="13dp"
android:gravity="center">
<TextView
android:id="@+id/quantity_need"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/conversion_quantity_need"
android:textColor="#DFEAFF"
android:textSize="12sp" />
<ImageView
android:layout_width="16dp"
android:layout_height="16dp"
android:layout_marginStart="3dp"
android:src="@mipmap/icon_collectibles2" />
</LinearLayout>
<ImageButton
android:id="@+id/cinema_ticket_exchange"
android:layout_width="140dp"
android:layout_height="55dp"
android:layout_gravity="center"
android:layout_marginTop="10dp"
android:background="@mipmap/backgroundn_cinema_ticket_exchange" />
<androidx.core.widget.NestedScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginStart="7dp"
android:layout_marginTop="16dp"
android:layout_marginEnd="7dp"
android:layout_marginBottom="23dp"
android:background="@drawable/background_cinema_ticket_hint">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:paddingStart="3dp"
android:paddingTop="10dp"
android:paddingBottom="10dp">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/conversion_quantity_need_of_use"
android:textColor="#000000"
android:textSize="14sp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="11dp"
android:text="@string/conversion_quantity_need_of_use1"
android:textColor="#000000"
android:textSize="13sp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:text="@string/conversion_quantity_need_of_use2"
android:textColor="#000000"
android:textSize="13sp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:text="@string/conversion_quantity_need_of_use3"
android:textColor="#000000"
android:textSize="13sp" />
</LinearLayout>
</androidx.core.widget.NestedScrollView>
</LinearLayout>

Binary file not shown.

After

Width:  |  Height:  |  Size: 104 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 32 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 984 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 101 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 37 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.7 KiB

View File

@ -1387,5 +1387,11 @@ Limited ride And limited avatar frame</string>
<string name="room_sill100_500">100-500 coins</string> <string name="room_sill100_500">100-500 coins</string>
<string name="room_sill500_m">Above 500 coins</string> <string name="room_sill500_m">Above 500 coins</string>
<string name="combo">combo X</string> <string name="combo">combo X</string>
<string name="conversion_quantity">Exchange quantity:</string>
<string name="conversion_quantity_need">Need %s</string>
<string name="conversion_quantity_need_of_use">Exchange&amp;Usage Rules:</string>
<string name="conversion_quantity_need_of_use1">·One star coin can be exchanged for one ticket. You can customize the exchange quantity according to your needs. Once the ticket is exchanged, it cannot be revoked. Please confirm in advance;</string>
<string name="conversion_quantity_need_of_use2">·One ticket can be used to watch one episode of a short drama. After successful redemption, you can return to the viewing page and use the ticket to continue watching the movie;</string>
<string name="conversion_quantity_need_of_use3">·Ticket prohibit illegal activities such as offline trading and acquisitions, and PDLIVE will crack down severely on various profit-making trading activities;</string>
</resources> </resources>

View File

@ -1384,4 +1384,10 @@
<string name="room_sill100_500">100-500星幣</string> <string name="room_sill100_500">100-500星幣</string>
<string name="room_sill500_m">500以上星幣</string> <string name="room_sill500_m">500以上星幣</string>
<string name="combo">連擊×</string> <string name="combo">連擊×</string>
<string name="conversion_quantity">兌換數量:</string>
<string name="conversion_quantity_need">需要 %s</string>
<string name="conversion_quantity_need_of_use">兌換&amp;使用規則:</string>
<string name="conversion_quantity_need_of_use1">·星幣兌換1張觀影券您可以根據需求自定義兌換數量觀影券一經兌換不可撤銷請提前確認</string>
<string name="conversion_quantity_need_of_use2">·張觀影券可觀看一集短劇,兌換成功後即可返回觀影頁面,使用觀影券繼續觀看影片;</string>
<string name="conversion_quantity_need_of_use3">·觀影券禁止線下交易、收購等不正當行為PDLIVE將對各類以盈利為目的的交易行為進行嚴厲 打擊;</string>
</resources> </resources>

View File

@ -1383,4 +1383,10 @@
<string name="room_sill100_500">100-500星幣</string> <string name="room_sill100_500">100-500星幣</string>
<string name="room_sill500_m">500以上星幣</string> <string name="room_sill500_m">500以上星幣</string>
<string name="combo">連擊×</string> <string name="combo">連擊×</string>
<string name="conversion_quantity">兌換數量:</string>
<string name="conversion_quantity_need">需要 %s</string>
<string name="conversion_quantity_need_of_use">兌換&amp;使用規則:</string>
<string name="conversion_quantity_need_of_use1">·星幣兌換1張觀影券您可以根據需求自定義兌換數量觀影券一經兌換不可撤銷請提前確認</string>
<string name="conversion_quantity_need_of_use2">·張觀影券可觀看一集短劇,兌換成功後即可返回觀影頁面,使用觀影券繼續觀看影片;</string>
<string name="conversion_quantity_need_of_use3">·觀影券禁止線下交易、收購等不正當行為PDLIVE將對各類以盈利為目的的交易行為進行嚴厲 打擊;</string>
</resources> </resources>

View File

@ -1383,5 +1383,11 @@
<string name="room_sill100_500">100-500星幣</string> <string name="room_sill100_500">100-500星幣</string>
<string name="room_sill500_m">500以上星幣</string> <string name="room_sill500_m">500以上星幣</string>
<string name="combo">連擊×</string> <string name="combo">連擊×</string>
<string name="conversion_quantity">兌換數量:</string>
<string name="conversion_quantity_need">需要 %s</string>
<string name="conversion_quantity_need_of_use">兌換&amp;使用規則:</string>
<string name="conversion_quantity_need_of_use1">·星幣兌換1張觀影券您可以根據需求自定義兌換數量觀影券一經兌換不可撤銷請提前確認</string>
<string name="conversion_quantity_need_of_use2">·張觀影券可觀看一集短劇,兌換成功後即可返回觀影頁面,使用觀影券繼續觀看影片;</string>
<string name="conversion_quantity_need_of_use3">·觀影券禁止線下交易、收購等不正當行為PDLIVE將對各類以盈利為目的的交易行為進行嚴厲打擊</string>
</resources> </resources>

View File

@ -1390,4 +1390,10 @@ Limited ride And limited avatar frame</string>
<string name="room_sill100_500">100-500 coins</string> <string name="room_sill100_500">100-500 coins</string>
<string name="room_sill500_m">Above 500 coins</string> <string name="room_sill500_m">Above 500 coins</string>
<string name="combo">combo X</string> <string name="combo">combo X</string>
<string name="conversion_quantity">Exchange quantity:</string>
<string name="conversion_quantity_need">Need %s</string>
<string name="conversion_quantity_need_of_use">Exchange&amp;Usage Rules:</string>
<string name="conversion_quantity_need_of_use1">·One star coin can be exchanged for one ticket. You can customize the exchange quantity according to your needs. Once the ticket is exchanged, it cannot be revoked. Please confirm in advance;</string>
<string name="conversion_quantity_need_of_use2">·One ticket can be used to watch one episode of a short drama. After successful redemption, you can return to the viewing page and use the ticket to continue watching the movie;</string>
<string name="conversion_quantity_need_of_use3">·Ticket prohibit illegal activities such as offline trading and acquisitions, and PDLIVE will crack down severely on various profit-making trading activities;</string>
</resources> </resources>

View File

@ -2,6 +2,7 @@ package com.yunbao.main.views;
import static android.content.Context.CLIPBOARD_SERVICE; import static android.content.Context.CLIPBOARD_SERVICE;
import android.app.Activity;
import android.content.ClipData; import android.content.ClipData;
import android.content.ClipboardManager; import android.content.ClipboardManager;
import android.content.Context; import android.content.Context;
@ -28,16 +29,23 @@ import androidx.annotation.RequiresApi;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.lxj.xpopup.XPopup;
import com.momo.mcamera.util.JsonUtil;
import com.yunbao.common.CommonAppConfig; import com.yunbao.common.CommonAppConfig;
import com.yunbao.common.Constants; import com.yunbao.common.Constants;
import com.yunbao.common.HtmlConfig; import com.yunbao.common.HtmlConfig;
import com.yunbao.common.bean.CoolConfig;
import com.yunbao.common.bean.LiveBean; import com.yunbao.common.bean.LiveBean;
import com.yunbao.common.bean.NativeCallbackModel;
import com.yunbao.common.dialog.CinemaTicketPopupWindow;
import com.yunbao.common.event.JavascriptInterfaceEvent; import com.yunbao.common.event.JavascriptInterfaceEvent;
import com.yunbao.common.http.HttpCallback; import com.yunbao.common.http.HttpCallback;
import com.yunbao.common.http.LiveHttpUtil; import com.yunbao.common.http.LiveHttpUtil;
import com.yunbao.common.http.live.LiveNetManager;
import com.yunbao.common.interfaces.OnItemClickListener; import com.yunbao.common.interfaces.OnItemClickListener;
import com.yunbao.common.manager.IMLoginManager; import com.yunbao.common.manager.IMLoginManager;
import com.yunbao.common.utils.Bus; import com.yunbao.common.utils.Bus;
import com.yunbao.common.utils.DeviceUtils;
import com.yunbao.common.utils.DpUtil; import com.yunbao.common.utils.DpUtil;
import com.yunbao.common.utils.JavascriptInterfacePlayLetUtils; import com.yunbao.common.utils.JavascriptInterfacePlayLetUtils;
import com.yunbao.common.utils.JavascriptInterfaceUtils; import com.yunbao.common.utils.JavascriptInterfaceUtils;
@ -90,6 +98,7 @@ public class MainHomeCommunityViewHolder extends AbsMainHomeChildViewHolder impl
Bus.getOn(this); Bus.getOn(this);
String url = HtmlConfig.ENCOURAGE + "?t=" + Math.random() + "&uid=" + CommonAppConfig.getInstance().getUid() + "&token=" + CommonAppConfig.getInstance().getToken() String url = HtmlConfig.ENCOURAGE + "?t=" + Math.random() + "&uid=" + CommonAppConfig.getInstance().getUid() + "&token=" + CommonAppConfig.getInstance().getToken()
+ "&isZh=" + ((IMLoginManager.get(mContext).getLocaleLanguage() == Locale.SIMPLIFIED_CHINESE) ? "1" : "0"); + "&isZh=" + ((IMLoginManager.get(mContext).getLocaleLanguage() == Locale.SIMPLIFIED_CHINESE) ? "1" : "0");
// String url = "https://coolshi.feioou.com/testAndroid.html";
final LinearLayout rootView = (LinearLayout) findViewById(R.id.rootView); final LinearLayout rootView = (LinearLayout) findViewById(R.id.rootView);
mProgressBar = (ProgressBar) findViewById(R.id.progressbar); mProgressBar = (ProgressBar) findViewById(R.id.progressbar);
mWebView = new WebView(mContext); mWebView = new WebView(mContext);
@ -214,6 +223,26 @@ public class MainHomeCommunityViewHolder extends AbsMainHomeChildViewHolder impl
mWebView.getSettings().setMixedContentMode(WebSettings.MIXED_CONTENT_ALWAYS_ALLOW); mWebView.getSettings().setMixedContentMode(WebSettings.MIXED_CONTENT_ALWAYS_ALLOW);
} }
mWebView.loadUrl(url); mWebView.loadUrl(url);
findViewById(R.id.native_callback).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
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) {
}
});
}
});
}
});
} }
public void loadNewUrl() { public void loadNewUrl() {
@ -360,7 +389,44 @@ public class MainHomeCommunityViewHolder extends AbsMainHomeChildViewHolder impl
.setShareLink(CommonAppConfig.HOST + json.getString("link")) .setShareLink(CommonAppConfig.HOST + json.getString("link"))
.setAnchorAvatar(json.getString("avatar")) .setAnchorAvatar(json.getString("avatar"))
.showDialog(); .showDialog();
} else if (TextUtils.equals(event.getMethod(), "postWeakBalance")) {
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, new CinemaTicketPopupWindow.CinemaTicketPopupWindowCallBack() {
@Override
public void onCallBack() {
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);
}
});
} }
} }
} }
} }

View File

@ -18,4 +18,11 @@
android:layout_height="3dp" android:layout_height="3dp"
android:progressDrawable="@drawable/bg_horizontal_progressbar" /> android:progressDrawable="@drawable/bg_horizontal_progressbar" />
<Button
android:id="@+id/native_callback"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="nativeCallback" />
</RelativeLayout> </RelativeLayout>