测试更改

This commit is contained in:
18401019693 2022-11-18 15:49:24 +08:00
parent 4a28abf5b7
commit 859d884941
20 changed files with 157 additions and 147 deletions

View File

@ -139,7 +139,7 @@ public class WebViewActivity extends AbsActivity {
} }
}); });
mWebView.addJavascriptInterface(new JavascriptInterfaceUtils(mContext, mWebView).setPageClose(true).setLiveZhuangBana(false), "androidObject"); mWebView.addJavascriptInterface(JavascriptInterfaceUtils.getInstance().setmContext(mContext, mWebView).setPageClose(true).setLiveZhuangBana(false), "androidObject");
mWebView.getSettings().setJavaScriptCanOpenWindowsAutomatically(true); // 是否允许JS打开新窗口 mWebView.getSettings().setJavaScriptCanOpenWindowsAutomatically(true); // 是否允许JS打开新窗口
mWebView.getSettings().setJavaScriptEnabled(true); mWebView.getSettings().setJavaScriptEnabled(true);
mWebView.getSettings().setDomStorageEnabled(true); mWebView.getSettings().setDomStorageEnabled(true);

View File

@ -40,6 +40,7 @@ public class JavascriptInterfaceUtils {
private boolean dialogClose = false; private boolean dialogClose = false;
//同名activity跳转问题 //同名activity跳转问题
private boolean LiveZhuangBana = true; private boolean LiveZhuangBana = true;
private static JavascriptInterfaceUtils sInstance;
public JavascriptInterfaceUtils setPageClose(boolean pageClose) { public JavascriptInterfaceUtils setPageClose(boolean pageClose) {
this.pageClose = pageClose; this.pageClose = pageClose;
@ -56,9 +57,21 @@ public class JavascriptInterfaceUtils {
return this; return this;
} }
public JavascriptInterfaceUtils(Activity mContext, WebView mWebView) { public JavascriptInterfaceUtils setmContext(Activity mContext, WebView mWebView) {
this.mContext = mContext; this.mContext = mContext;
this.mWebView = mWebView; this.mWebView = mWebView;
return this;
}
public static JavascriptInterfaceUtils getInstance() {
if (sInstance == null) {
synchronized (CityUtil.class) {
if (sInstance == null) {
sInstance = new JavascriptInterfaceUtils();
}
}
}
return sInstance;
} }
@ -453,6 +466,7 @@ public class JavascriptInterfaceUtils {
.setData(json)); .setData(json));
} }
@JavascriptInterface @JavascriptInterface
public void setHeight(String height, String width) { public void setHeight(String height, String width) {
if ("0".equals(height)) { if ("0".equals(height)) {

View File

@ -140,7 +140,7 @@ public class WebViewActivityMedal extends AbsActivity {
} }
}); });
mWebView.addJavascriptInterface(new JavascriptInterfaceUtils(mContext, mWebView), "androidObject"); mWebView.addJavascriptInterface( JavascriptInterfaceUtils.getInstance().setmContext(mContext, mWebView), "androidObject");
mWebView.getSettings().setJavaScriptEnabled(true); mWebView.getSettings().setJavaScriptEnabled(true);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
mWebView.getSettings().setMixedContentMode(WebSettings.MIXED_CONTENT_ALWAYS_ALLOW); mWebView.getSettings().setMixedContentMode(WebSettings.MIXED_CONTENT_ALWAYS_ALLOW);

View File

@ -199,7 +199,7 @@ public class ZhuangBanActivity extends AbsActivity {
} }
}); });
mWebView.addJavascriptInterface(new JavascriptInterfaceUtils(mContext, mWebView) mWebView.addJavascriptInterface(JavascriptInterfaceUtils.getInstance().setmContext(mContext, mWebView)
.setPageClose(true) .setPageClose(true)
.setLiveZhuangBana(true), "androidObject"); .setLiveZhuangBana(true), "androidObject");
mWebView.getSettings().setJavaScriptEnabled(true); mWebView.getSettings().setJavaScriptEnabled(true);

View File

@ -95,7 +95,7 @@ public class LiveFansFragment extends AbsDialogFragment {
}); });
mWebView.getSettings().setJavaScriptEnabled(true); // 是否开启JS支持 mWebView.getSettings().setJavaScriptEnabled(true); // 是否开启JS支持
mWebView.addJavascriptInterface(new JavascriptInterfaceUtils(mContext, mWebView).setPageClose(false), "androidObject"); mWebView.addJavascriptInterface(JavascriptInterfaceUtils.getInstance().setmContext(mContext, mWebView).setPageClose(false), "androidObject");
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
mWebView.getSettings().setMixedContentMode(WebSettings.MIXED_CONTENT_ALWAYS_ALLOW); mWebView.getSettings().setMixedContentMode(WebSettings.MIXED_CONTENT_ALWAYS_ALLOW);
} }

View File

@ -159,7 +159,7 @@ public class LiveGameDialogFragment extends AbsDialogFragment {
mWebView = (WebView) findViewById(R.id.rlWebview); mWebView = (WebView) findViewById(R.id.rlWebview);
tabLayout = (TabLayout) findViewById(R.id.tabLayout); tabLayout = (TabLayout) findViewById(R.id.tabLayout);
layout = (LinearLayout) findViewById(R.id.bg_layout); layout = (LinearLayout) findViewById(R.id.bg_layout);
mWebView.addJavascriptInterface(new JavascriptInterfaceUtils(getActivity(), mWebView) mWebView.addJavascriptInterface(JavascriptInterfaceUtils.getInstance().setmContext(getActivity(), mWebView)
.setLiveZhuangBana(true). .setLiveZhuangBana(true).
setDialogClose(true). setDialogClose(true).
setPageClose(false), "androidObject"); setPageClose(false), "androidObject");

View File

@ -146,7 +146,7 @@ public class LiveHDDialogFragment extends AbsDialogFragment {
mWebView = (WebView) findViewById(R.id.rlWebview); mWebView = (WebView) findViewById(R.id.rlWebview);
htmlError = (TextView) findViewById(R.id.html_error); htmlError = (TextView) findViewById(R.id.html_error);
findViewById(R.id.btn_back).setOnClickListener(v -> dismiss()); findViewById(R.id.btn_back).setOnClickListener(v -> dismiss());
mWebView.addJavascriptInterface(new JavascriptInterfaceUtils(getActivity(), mWebView) mWebView.addJavascriptInterface(JavascriptInterfaceUtils.getInstance().setmContext(getActivity(), mWebView)
.setLiveZhuangBana(true). .setLiveZhuangBana(true).
setDialogClose(true). setDialogClose(true).
setPageClose(false), "androidObject"); setPageClose(false), "androidObject");

View File

@ -76,7 +76,7 @@ public class LiveOneDialogFragment extends AbsDialogFragment {
public void onActivityCreated(Bundle savedInstanceState) { public void onActivityCreated(Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState); super.onActivityCreated(savedInstanceState);
mWebView = (WebView) findViewById(R.id.rlWebview); mWebView = (WebView) findViewById(R.id.rlWebview);
mWebView.addJavascriptInterface(new JavascriptInterfaceUtils(mContext, mWebView), "androidObject"); mWebView.addJavascriptInterface(JavascriptInterfaceUtils.getInstance().setmContext(mContext, mWebView), "androidObject");
mWebView.getSettings().setJavaScriptEnabled(true); mWebView.getSettings().setJavaScriptEnabled(true);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
mWebView.getSettings().setMixedContentMode(WebSettings.MIXED_CONTENT_ALWAYS_ALLOW); mWebView.getSettings().setMixedContentMode(WebSettings.MIXED_CONTENT_ALWAYS_ALLOW);

View File

@ -75,7 +75,7 @@ public class TurnTableWebViewHolder extends AbsLivePageViewHolder implements Vie
}); });
mWebView.addJavascriptInterface(new JavascriptInterfaceUtils(mContext, mWebView), "androidObject"); mWebView.addJavascriptInterface(JavascriptInterfaceUtils.getInstance().setmContext(mContext, mWebView), "androidObject");
mWebView.setWebChromeClient(new WebChromeClient() { mWebView.setWebChromeClient(new WebChromeClient() {
@Override @Override
public void onProgressChanged(WebView view, int newProgress) { public void onProgressChanged(WebView view, int newProgress) {

View File

@ -97,7 +97,7 @@ public class WishlistWebViewHolder extends AbsLivePageViewHolder implements View
// 自适应 屏幕大小界面 // 自适应 屏幕大小界面
webSettings.setLoadWithOverviewMode(true); webSettings.setLoadWithOverviewMode(true);
mWebView.addJavascriptInterface(new JavascriptInterfaceUtils((Activity) mContext, mWebView).setPageClose(false), "androidObject"); mWebView.addJavascriptInterface(JavascriptInterfaceUtils.getInstance().setmContext((Activity) mContext, mWebView).setPageClose(false), "androidObject");
mWebView.setWebChromeClient(new WebChromeClient() { mWebView.setWebChromeClient(new WebChromeClient() {
@Override @Override
public void onProgressChanged(WebView view, int newProgress) { public void onProgressChanged(WebView view, int newProgress) {

View File

@ -6,18 +6,17 @@ import static com.yunbao.common.CommonAppContext.mFirebaseAnalytics;
import static com.yunbao.main.activity.MyWalletActivity.dis; import static com.yunbao.main.activity.MyWalletActivity.dis;
import android.annotation.SuppressLint; import android.annotation.SuppressLint;
import android.app.Activity; import android.app.ProgressDialog;
import android.os.Bundle; import android.os.Bundle;
import android.os.Handler; import android.os.Handler;
import android.text.TextUtils;
import android.util.Log; import android.util.Log;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.View; import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
import android.webkit.JavascriptInterface;
import android.webkit.WebSettings; import android.webkit.WebSettings;
import android.webkit.WebView; import android.webkit.WebView;
import androidx.annotation.Nullable;
import androidx.fragment.app.Fragment; import androidx.fragment.app.Fragment;
import com.adjust.sdk.Adjust; import com.adjust.sdk.Adjust;
@ -28,19 +27,13 @@ import com.google.android.gms.ads.identifier.AdvertisingIdClient;
import com.google.android.gms.common.GooglePlayServicesNotAvailableException; import com.google.android.gms.common.GooglePlayServicesNotAvailableException;
import com.google.android.gms.common.GooglePlayServicesRepairableException; import com.google.android.gms.common.GooglePlayServicesRepairableException;
import com.yunbao.common.CommonAppConfig; import com.yunbao.common.CommonAppConfig;
import com.yunbao.common.event.JavascriptInterfaceEvent;
import com.yunbao.common.http.CommonHttpUtil; import com.yunbao.common.http.CommonHttpUtil;
import com.yunbao.common.http.HttpCallback; import com.yunbao.common.http.HttpCallback;
import com.yunbao.common.utils.Bus;
import com.yunbao.common.utils.GoogleBillingUtilNew; import com.yunbao.common.utils.GoogleBillingUtilNew;
import com.yunbao.common.utils.JavascriptInterfaceUtils;
import com.yunbao.common.utils.ToastUtil; import com.yunbao.common.utils.ToastUtil;
import com.yunbao.main.R; import com.yunbao.main.R;
import com.yunbao.main.views.TestWebViewClient; import com.yunbao.main.views.TestWebViewClient;
import org.greenrobot.eventbus.Subscribe;
import org.greenrobot.eventbus.ThreadMode;
import java.io.IOException; import java.io.IOException;
import java.util.List; import java.util.List;
@ -54,24 +47,11 @@ public class GoogleFragment extends Fragment {
private WebView rlWebview; private WebView rlWebview;
private String url; private String url;
String adid = null; String adid = null;
private Activity mContext;
@SuppressLint("ValidFragment") @SuppressLint("ValidFragment")
public GoogleFragment(Activity context, String urls) { public GoogleFragment(String urls) {
url = urls; url = urls;
mContext = context; Log.e("google", "111aa");
}
@Override
public void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Bus.getOn(this);
}
@Override
public void onDetach() {
super.onDetach();
Bus.getOff(this);
} }
@Override @Override
@ -114,7 +94,7 @@ public class GoogleFragment extends Fragment {
webSettings.setBuiltInZoomControls(true); // 是否支持缩放变焦前提是支持缩放 webSettings.setBuiltInZoomControls(true); // 是否支持缩放变焦前提是支持缩放
rlWebview.addJavascriptInterface(new JavascriptInterfaceUtils(mContext, rlWebview).setPageClose(true), "androidObject"); rlWebview.addJavascriptInterface(new JsInteration(), "androidObject");
TestWebViewClient testWebViewClient = new TestWebViewClient(getActivity(), rlWebview); TestWebViewClient testWebViewClient = new TestWebViewClient(getActivity(), rlWebview);
@ -131,106 +111,122 @@ public class GoogleFragment extends Fragment {
} }
private Handler payHandler = new Handler(); private Handler payHandler = new Handler();
//js调用原生
public class JsInteration {
@JavascriptInterface
public void androidNewGoToGooglePay(String ProductId, String OrderNumber, String MoneyUsd) {
Log.e(TAG, "ProductId" + ProductId + "OrderNumber" + OrderNumber + "MoneyUsd" + MoneyUsd);
mProductId = ProductId;
mOrderid = OrderNumber;
MoneyUsds = MoneyUsd;
// googleBillingUtil.purchaseInApp(getActivity(), mProductId);
GoogleBillingUtilNew.getInstance().setBillingListener(new GoogleBillingUtilNew.GoogleBillingListener() {
@Override
public void onPaySuccess(List<Purchase> list) {
for (Purchase purchase : list) {
for (int i = 0; i < list.size(); i++) {
int finalI = i;
payHandler.post(new Runnable() {
@Override
public void run() {
CommonHttpUtil.notifyGoogle(list.get(finalI).getPurchaseToken(), list.get(finalI).getOrderId(), mProductId, mOrderid, adid, new HttpCallback() {
@Override
public void onSuccess(int code, String msg, String[] info) {
if (code == 0) {
Bundle params = new Bundle();
params.putString("currency", "HKD");
params.putString("money", MoneyUsds);
logger.logEvent("FB_iap_Play", params);
Bundle fb_params = new Bundle();
fb_params.putString(AppEventsConstants.EVENT_PARAM_CURRENCY, "HKD");
fb_params.putString(AppEventsConstants.EVENT_PARAM_CONTENT_ID, mProductId);
//fb官方事件记录充值
logger.logEvent(AppEventsConstants.EVENT_NAME_PURCHASED,
Double.parseDouble(MoneyUsds),
fb_params);
//Google官方充值通知
Bundle google_params = new Bundle();
google_params.putString("currency", "HKD");
google_params.putString("product_id", mProductId);
google_params.putString("transaction_id", mOrderid);
google_params.putString("value", MoneyUsds);
google_params.putString("price", MoneyUsds);
google_params.putString("quantity", "1");
mFirebaseAnalytics.logEvent("FS_iap_Play", google_params);
AdjustEvent adjustEvent1 = new AdjustEvent("cgssol");
Adjust.trackEvent(adjustEvent1);
CommonHttpUtil.setAdvertisingChannels("cgssol", new HttpCallback() {
@Override
public void onSuccess(int code, String msg, String[] info) {
if (code == 0) {
logger.logEvent("FB_iap_users", null);
mFirebaseAnalytics.logEvent("FS_iap_users", null);
}
}
});
AdjustEvent adjustEvent2 = new AdjustEvent("tr8lb9");
adjustEvent2.setRevenue(Double.parseDouble(MoneyUsds),"HKD");
adjustEvent2.addCallbackParameter("GOrderid",purchase.getOrderId());
adjustEvent2.addCallbackParameter("POrderid",mOrderid);
adjustEvent2.addCallbackParameter("Uid", CommonAppConfig.getInstance().getUid());
adjustEvent2.addCallbackParameter("GADid",adid);
adjustEvent2.setOrderId(mOrderid);
Adjust.trackEvent(adjustEvent2);
dis();
ToastUtil.show("支付成功");
}
}
});
}
});
}
Log.e("谷歌支付", purchase.toString());
}
}
@Override
public void onPayFailed(int code, String msg) {
}
}).checkSku(ProductId)
;
//下单
Bundle params = new Bundle();
params.putString(AppEventsConstants.EVENT_PARAM_CONTENT_ID, mProductId);
params.putString(AppEventsConstants.EVENT_PARAM_CURRENCY, "HKD");
logger.logEvent(AppEventsConstants.EVENT_NAME_INITIATED_CHECKOUT, Double.parseDouble(MoneyUsds),
params);
}
@JavascriptInterface
public void androidMethodBack() {
getActivity().onBackPressed();
}
@JavascriptInterface
public void androidGoBack() {
getActivity().onBackPressed();
}
}
public void release() { public void release() {
} }
@Subscribe(threadMode = ThreadMode.MAIN)
public void onJavascriptInterfaceEvent(JavascriptInterfaceEvent event) {
if (!TextUtils.isEmpty(event.getMethod())) {
if (TextUtils.equals(event.getMethod(), "androidNewGoToGooglePay")) {
mProductId = event.getProductId();
mOrderid = event.getOrderNumber();
MoneyUsds = event.getMoneyUsd();
GoogleBillingUtilNew.getInstance().setBillingListener(new GoogleBillingUtilNew.GoogleBillingListener() {
@Override
public void onPaySuccess(List<Purchase> list) {
for (Purchase purchase : list) {
for (int i = 0; i < list.size(); i++) {
int finalI = i;
payHandler.post(new Runnable() {
@Override
public void run() {
CommonHttpUtil.notifyGoogle(list.get(finalI).getPurchaseToken(), list.get(finalI).getOrderId(), mProductId, mOrderid, adid, new HttpCallback() {
@Override
public void onSuccess(int code, String msg, String[] info) {
if (code == 0) {
Bundle params = new Bundle();
params.putString("currency", "HKD");
params.putString("money", MoneyUsds);
logger.logEvent("FB_iap_Play", params);
Bundle fb_params = new Bundle();
fb_params.putString(AppEventsConstants.EVENT_PARAM_CURRENCY, "HKD");
fb_params.putString(AppEventsConstants.EVENT_PARAM_CONTENT_ID, mProductId);
//fb官方事件记录充值
logger.logEvent(AppEventsConstants.EVENT_NAME_PURCHASED,
Double.parseDouble(MoneyUsds),
fb_params);
//Google官方充值通知
Bundle google_params = new Bundle();
google_params.putString("currency", "HKD");
google_params.putString("product_id", mProductId);
google_params.putString("transaction_id", mOrderid);
google_params.putString("value", MoneyUsds);
google_params.putString("price", MoneyUsds);
google_params.putString("quantity", "1");
mFirebaseAnalytics.logEvent("FS_iap_Play", google_params);
AdjustEvent adjustEvent1 = new AdjustEvent("cgssol");
Adjust.trackEvent(adjustEvent1);
CommonHttpUtil.setAdvertisingChannels("cgssol", new HttpCallback() {
@Override
public void onSuccess(int code, String msg, String[] info) {
if (code == 0) {
logger.logEvent("FB_iap_users", null);
mFirebaseAnalytics.logEvent("FS_iap_users", null);
}
}
});
AdjustEvent adjustEvent2 = new AdjustEvent("tr8lb9");
adjustEvent2.setRevenue(Double.parseDouble(MoneyUsds), "HKD");
adjustEvent2.addCallbackParameter("GOrderid", purchase.getOrderId());
adjustEvent2.addCallbackParameter("POrderid", mOrderid);
adjustEvent2.addCallbackParameter("Uid", CommonAppConfig.getInstance().getUid());
adjustEvent2.addCallbackParameter("GADid", adid);
adjustEvent2.setOrderId(mOrderid);
Adjust.trackEvent(adjustEvent2);
dis();
ToastUtil.show("支付成功");
}
}
});
}
});
}
Log.e("谷歌支付", purchase.toString());
}
}
@Override
public void onPayFailed(int code, String msg) {
Log.e("谷歌支付",code+msg);
}
}).checkSku(event.getProductId())
;
//下单
Bundle params = new Bundle();
params.putString(AppEventsConstants.EVENT_PARAM_CONTENT_ID, mProductId);
params.putString(AppEventsConstants.EVENT_PARAM_CURRENCY, "HKD");
logger.logEvent(AppEventsConstants.EVENT_NAME_INITIATED_CHECKOUT, Double.parseDouble(MoneyUsds),
params);
}
}
}
} }

View File

@ -121,26 +121,26 @@ public class MyWalletActivity extends AbsActivity {
Log.i("tss", "首充"); Log.i("tss", "首充");
if (CommonAppConfig.IS_GOOGLE_PLAY == false) { if (CommonAppConfig.IS_GOOGLE_PLAY == false) {
//链接版本 //链接版本
fragments = new Fragment[]{new GoogleFragment(this, CommonAppConfig.HOST + "/index.php?g=Appapi&first_page=1&m=Mall&a=walletcoin&uid=" + CommonAppConfig.getInstance().getUid() + "&token=" + CommonAppConfig.getInstance().getToken() + "&package_name=pd"), fragments = new Fragment[]{new GoogleFragment(CommonAppConfig.HOST + "/index.php?g=Appapi&first_page=1&m=Mall&a=walletcoin&uid=" + CommonAppConfig.getInstance().getUid() + "&token=" + CommonAppConfig.getInstance().getToken() + "&package_name=pd"),
new GoogleFragment(this, CommonAppConfig.HOST + "/index.php?g=Appapi&m=Mall&first_page=1&a=walletgold&uid=" + CommonAppConfig.getInstance().getUid() + "&token=" + CommonAppConfig.getInstance().getToken() + "&package_name=pd"), new GoogleFragment(CommonAppConfig.HOST + "/index.php?g=Appapi&m=Mall&first_page=1&a=walletgold&uid=" + CommonAppConfig.getInstance().getUid() + "&token=" + CommonAppConfig.getInstance().getToken() + "&package_name=pd"),
new WalletFragment(this, CommonAppConfig.HOST + "/index.php?g=Appapi&m=Mall&first_page=1&a=walletbean&uid=" + CommonAppConfig.getInstance().getUid() + "&token=" + CommonAppConfig.getInstance().getToken() + "&package_name=pd")}; new WalletFragment(this, CommonAppConfig.HOST + "/index.php?g=Appapi&m=Mall&first_page=1&a=walletbean&uid=" + CommonAppConfig.getInstance().getUid() + "&token=" + CommonAppConfig.getInstance().getToken() + "&package_name=pd")};
} else { } else {
rView.setVisibility(View.VISIBLE); rView.setVisibility(View.VISIBLE);
fragments = new Fragment[]{new GoogleFragment(this, CommonAppConfig.HOST + "/index.php?g=Appapi&m=Mall&a=googlepaycoin&uid=" + CommonAppConfig.getInstance().getUid() + "&token=" + CommonAppConfig.getInstance().getToken() + "&package_name=pd"), fragments = new Fragment[]{new GoogleFragment(CommonAppConfig.HOST + "/index.php?g=Appapi&m=Mall&a=googlepaycoin&uid=" + CommonAppConfig.getInstance().getUid() + "&token=" + CommonAppConfig.getInstance().getToken() + "&package_name=pd"),
new GoogleFragment(this, CommonAppConfig.HOST + "/index.php?g=Appapi&m=Mall&a=googlepaygole&uid=" + CommonAppConfig.getInstance().getUid() + "&token=" + CommonAppConfig.getInstance().getToken() + "&package_name=pd"), new GoogleFragment( CommonAppConfig.HOST + "/index.php?g=Appapi&m=Mall&a=googlepaygole&uid=" + CommonAppConfig.getInstance().getUid() + "&token=" + CommonAppConfig.getInstance().getToken() + "&package_name=pd"),
new WalletFragment(this, CommonAppConfig.HOST + "/index.php?g=Appapi&m=Mall&first_page=1&a=walletbean&uid=" + CommonAppConfig.getInstance().getUid() + "&token=" + CommonAppConfig.getInstance().getToken())}; new WalletFragment(this, CommonAppConfig.HOST + "/index.php?g=Appapi&m=Mall&first_page=1&a=walletbean&uid=" + CommonAppConfig.getInstance().getUid() + "&token=" + CommonAppConfig.getInstance().getToken())};
} }
} else { } else {
if (CommonAppConfig.IS_GOOGLE_PLAY == false) { if (CommonAppConfig.IS_GOOGLE_PLAY == false) {
Log.i("tss", "不是首充"); Log.i("tss", "不是首充");
//链接版本 //链接版本
fragments = new Fragment[]{new GoogleFragment(this, CommonAppConfig.HOST + "/index.php?g=Appapi&m=Mall&a=walletcoin&uid=" + CommonAppConfig.getInstance().getUid() + "&token=" + CommonAppConfig.getInstance().getToken() + "&package_name=pd"), fragments = new Fragment[]{new GoogleFragment(CommonAppConfig.HOST + "/index.php?g=Appapi&m=Mall&a=walletcoin&uid=" + CommonAppConfig.getInstance().getUid() + "&token=" + CommonAppConfig.getInstance().getToken() + "&package_name=pd"),
new GoogleFragment(this, CommonAppConfig.HOST + "/index.php?g=Appapi&m=Mall&a=walletgold&uid=" + CommonAppConfig.getInstance().getUid() + "&token=" + CommonAppConfig.getInstance().getToken() + "&package_name=pd"), new GoogleFragment(CommonAppConfig.HOST + "/index.php?g=Appapi&m=Mall&a=walletgold&uid=" + CommonAppConfig.getInstance().getUid() + "&token=" + CommonAppConfig.getInstance().getToken() + "&package_name=pd"),
new WalletFragment(this, CommonAppConfig.HOST + "/index.php?g=Appapi&m=Mall&a=walletbean&uid=" + CommonAppConfig.getInstance().getUid() + "&token=" + CommonAppConfig.getInstance().getToken() + "&package_name=pd")}; new WalletFragment(this, CommonAppConfig.HOST + "/index.php?g=Appapi&m=Mall&a=walletbean&uid=" + CommonAppConfig.getInstance().getUid() + "&token=" + CommonAppConfig.getInstance().getToken() + "&package_name=pd")};
} else { } else {
rView.setVisibility(View.VISIBLE); rView.setVisibility(View.VISIBLE);
fragments = new Fragment[]{new GoogleFragment(this, CommonAppConfig.HOST + "/index.php?g=Appapi&m=Mall&a=googlepaycoin&uid=" + CommonAppConfig.getInstance().getUid() + "&token=" + CommonAppConfig.getInstance().getToken() + "&package_name=pd"), fragments = new Fragment[]{new GoogleFragment(CommonAppConfig.HOST + "/index.php?g=Appapi&m=Mall&a=googlepaycoin&uid=" + CommonAppConfig.getInstance().getUid() + "&token=" + CommonAppConfig.getInstance().getToken() + "&package_name=pd"),
new GoogleFragment(this, CommonAppConfig.HOST + "/index.php?g=Appapi&m=Mall&a=googlepaygole&uid=" + CommonAppConfig.getInstance().getUid() + "&token=" + CommonAppConfig.getInstance().getToken() + "&package_name=pd"), new GoogleFragment(CommonAppConfig.HOST + "/index.php?g=Appapi&m=Mall&a=googlepaygole&uid=" + CommonAppConfig.getInstance().getUid() + "&token=" + CommonAppConfig.getInstance().getToken() + "&package_name=pd"),
new WalletFragment(this, CommonAppConfig.HOST + "/index.php?g=Appapi&m=Mall&first_page=1&a=walletbean&uid=" + CommonAppConfig.getInstance().getUid() + "&token=" + CommonAppConfig.getInstance().getToken())}; new WalletFragment(this, CommonAppConfig.HOST + "/index.php?g=Appapi&m=Mall&first_page=1&a=walletbean&uid=" + CommonAppConfig.getInstance().getUid() + "&token=" + CommonAppConfig.getInstance().getToken())};
} }
} }

View File

@ -200,7 +200,7 @@ public class MyWebViewActivity extends AbsActivity {
} }
}); });
mWebView.addJavascriptInterface(new JavascriptInterfaceUtils(mContext, mWebView).setPageClose(true), "androidObject"); mWebView.addJavascriptInterface(JavascriptInterfaceUtils.getInstance().setmContext(mContext, mWebView).setPageClose(true), "androidObject");
mWebView.getSettings().setJavaScriptCanOpenWindowsAutomatically(true); // 是否允许JS打开新窗口 mWebView.getSettings().setJavaScriptCanOpenWindowsAutomatically(true); // 是否允许JS打开新窗口
mWebView.getSettings().setJavaScriptEnabled(true); mWebView.getSettings().setJavaScriptEnabled(true);
mWebView.getSettings().setDomStorageEnabled(true); mWebView.getSettings().setDomStorageEnabled(true);

View File

@ -172,7 +172,7 @@ public class MyWebViewActivity2 extends AbsActivity {
} }
}); });
mWebView.addJavascriptInterface(new JavascriptInterfaceUtils(mContext, mWebView) mWebView.addJavascriptInterface(JavascriptInterfaceUtils.getInstance().setmContext(mContext, mWebView)
.setPageClose(true) .setPageClose(true)
.setLiveZhuangBana(false), "androidObject"); .setLiveZhuangBana(false), "androidObject");
mWebView.getSettings().setJavaScriptCanOpenWindowsAutomatically(true); // 是否允许JS打开新窗口 mWebView.getSettings().setJavaScriptCanOpenWindowsAutomatically(true); // 是否允许JS打开新窗口

View File

@ -32,7 +32,7 @@ public class RechargeActivity extends AbsActivity {
webSettings.setJavaScriptCanOpenWindowsAutomatically(true); // 是否允许JS打开新窗口 webSettings.setJavaScriptCanOpenWindowsAutomatically(true); // 是否允许JS打开新窗口
rlWebview.addJavascriptInterface(new JavascriptInterfaceUtils(mContext, rlWebview).setPageClose(true), "androidObject"); rlWebview.addJavascriptInterface(JavascriptInterfaceUtils.getInstance().setmContext(mContext, rlWebview).setPageClose(true), "androidObject");
TestWebViewClient testWebViewClient = new TestWebViewClient(this, rlWebview); TestWebViewClient testWebViewClient = new TestWebViewClient(this, rlWebview);

View File

@ -153,7 +153,7 @@ public class RewardActivity extends AbsActivity {
}); });
mWebView.getSettings().setJavaScriptEnabled(true); // 是否开启JS支持 mWebView.getSettings().setJavaScriptEnabled(true); // 是否开启JS支持
mWebView.getSettings().setJavaScriptCanOpenWindowsAutomatically(true); // 是否允许JS打开新窗口 mWebView.getSettings().setJavaScriptCanOpenWindowsAutomatically(true); // 是否允许JS打开新窗口
mWebView.addJavascriptInterface(new JavascriptInterfaceUtils(mContext, mWebView) mWebView.addJavascriptInterface(JavascriptInterfaceUtils.getInstance().setmContext(mContext, mWebView)
.setPageClose(true) .setPageClose(true)
.setLiveZhuangBana(false), "androidObject"); .setLiveZhuangBana(false), "androidObject");
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {

View File

@ -53,7 +53,7 @@ public class WalletFragment extends Fragment {
webSettings.setJavaScriptCanOpenWindowsAutomatically(true); // 是否允许JS打开新窗口 webSettings.setJavaScriptCanOpenWindowsAutomatically(true); // 是否允许JS打开新窗口
rlWebview.addJavascriptInterface(new JavascriptInterfaceUtils(mContext, rlWebview).setPageClose(true), "androidObject"); rlWebview.addJavascriptInterface(JavascriptInterfaceUtils.getInstance().setmContext(mContext, rlWebview).setPageClose(true), "androidObject");
TestWebViewClient testWebViewClient = new TestWebViewClient(getActivity(), rlWebview); TestWebViewClient testWebViewClient = new TestWebViewClient(getActivity(), rlWebview);

View File

@ -135,7 +135,7 @@ public class WeekWebViewActivity extends AbsActivity {
} }
}); });
mWebView.addJavascriptInterface(new JavascriptInterfaceUtils(mContext, mWebView).setPageClose(true), "androidObject"); mWebView.addJavascriptInterface(JavascriptInterfaceUtils.getInstance().setmContext(mContext, mWebView).setPageClose(true), "androidObject");
mWebView.getSettings().setJavaScriptEnabled(true); mWebView.getSettings().setJavaScriptEnabled(true);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
mWebView.getSettings().setMixedContentMode(WebSettings.MIXED_CONTENT_ALWAYS_ALLOW); mWebView.getSettings().setMixedContentMode(WebSettings.MIXED_CONTENT_ALWAYS_ALLOW);

View File

@ -175,7 +175,7 @@ public class ZhuangBanActivity extends AbsActivity {
mWebView.getSettings().setJavaScriptEnabled(true); // 是否开启JS支持 mWebView.getSettings().setJavaScriptEnabled(true); // 是否开启JS支持
mWebView.getSettings().setJavaScriptCanOpenWindowsAutomatically(true); // 是否允许JS打开新窗口 mWebView.getSettings().setJavaScriptCanOpenWindowsAutomatically(true); // 是否允许JS打开新窗口
mWebView.getSettings().setDomStorageEnabled(true); mWebView.getSettings().setDomStorageEnabled(true);
mWebView.addJavascriptInterface(new JavascriptInterfaceUtils(mContext, mWebView) mWebView.addJavascriptInterface(JavascriptInterfaceUtils.getInstance().setmContext(mContext, mWebView)
.setPageClose(true) .setPageClose(true)
.setLiveZhuangBana(false), "androidObject"); .setLiveZhuangBana(false), "androidObject");
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {

View File

@ -111,7 +111,7 @@ public class MainHomeCommunityViewHolder extends AbsMainHomeChildViewHolder impl
mWebView.getSettings().setCacheMode(WebSettings.LOAD_NO_CACHE);// 不加载缓存内容 mWebView.getSettings().setCacheMode(WebSettings.LOAD_NO_CACHE);// 不加载缓存内容
mWebView.getSettings().setJavaScriptCanOpenWindowsAutomatically(true); // 是否允许JS打开新窗口 mWebView.getSettings().setJavaScriptCanOpenWindowsAutomatically(true); // 是否允许JS打开新窗口
mWebView.addJavascriptInterface(new JavascriptInterfaceUtils(nowMainActivity, mWebView), "androidObject"); mWebView.addJavascriptInterface(JavascriptInterfaceUtils.getInstance().setmContext(nowMainActivity, mWebView), "androidObject");
rootView.addView(mWebView); rootView.addView(mWebView);