Merge branch 'peko_feature/my_car' into develop
This commit is contained in:
@@ -355,6 +355,24 @@
|
||||
android:name=".ui.webview.CommonWebViewActivity"
|
||||
android:screenOrientation="portrait"
|
||||
android:windowSoftInputMode="adjustPan" />
|
||||
<activity
|
||||
android:name=".ui.wallet.PaymentResultActivity"
|
||||
android:exported="true"
|
||||
android:launchMode="singleTask"
|
||||
android:theme="@style/transparent_activity"
|
||||
android:windowSoftInputMode="adjustPan">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.VIEW" />
|
||||
|
||||
<category android:name="android.intent.category.DEFAULT" />
|
||||
<category android:name="android.intent.category.BROWSABLE" />
|
||||
|
||||
<data
|
||||
android:host="payment"
|
||||
android:path="/result"
|
||||
android:scheme="pekoapp" />
|
||||
</intent-filter>
|
||||
</activity>
|
||||
<activity
|
||||
android:name=".ui.webview.SimpleWebViewActivity"
|
||||
android:screenOrientation="portrait" />
|
||||
|
@@ -0,0 +1,55 @@
|
||||
package com.yizhuan.erban.ui.wallet
|
||||
|
||||
import android.app.Activity
|
||||
import android.content.Intent
|
||||
import android.os.Bundle
|
||||
import com.chuhai.utils.log.ILog
|
||||
import com.yizhuan.erban.application.XChatApplication
|
||||
import com.yizhuan.erban.other.activity.SplashActivity
|
||||
import com.yizhuan.xchat_android_core.auth.AuthModel
|
||||
import com.yizhuan.xchat_android_core.pay.PayModel
|
||||
|
||||
/**
|
||||
* Created by Max on 2024/1/31 10:50
|
||||
* Desc:
|
||||
**/
|
||||
class PaymentResultActivity : Activity(), ILog {
|
||||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
logD("onCreate()")
|
||||
handler(intent)
|
||||
}
|
||||
|
||||
private fun handler(intent: Intent?) {
|
||||
val uri = intent?.data
|
||||
logD("handler() uri:${uri}")
|
||||
if (XChatApplication.gStack.activityNum == 1) {
|
||||
logD("handler() open->splash")
|
||||
SplashActivity.start(this)
|
||||
finish()
|
||||
} else {
|
||||
val status = uri?.getQueryParameter("status")?.toIntOrNull()
|
||||
logD("handler() status:$status")
|
||||
if (status == 1) {
|
||||
PayModel.get().getWalletInfo(AuthModel.get().currentUid).subscribe()
|
||||
}
|
||||
}
|
||||
finish()
|
||||
}
|
||||
|
||||
override fun onNewIntent(intent: Intent?) {
|
||||
super.onNewIntent(intent)
|
||||
logD("onNewIntent()")
|
||||
handler(intent)
|
||||
}
|
||||
|
||||
override fun onDestroy() {
|
||||
super.onDestroy()
|
||||
logD("onDestroy()")
|
||||
}
|
||||
|
||||
override fun getLogTag(): String {
|
||||
return super.getLogTag()
|
||||
}
|
||||
}
|
@@ -54,6 +54,7 @@ import com.yizhuan.xchat_android_core.web.bean.WebJsBeanInfo;
|
||||
import com.yizhuan.xchat_android_core.web.event.WebViewRefreshEvent;
|
||||
import com.yizhuan.xchat_android_library.rxbus.RxBus;
|
||||
import com.yizhuan.xchat_android_library.utils.ResUtil;
|
||||
import com.yizhuan.xchat_android_library.utils.SingleToastUtil;
|
||||
|
||||
import org.greenrobot.eventbus.EventBus;
|
||||
import org.greenrobot.eventbus.Subscribe;
|
||||
@@ -195,6 +196,7 @@ public class CommonWebViewActivity extends BaseActivity implements ShareDialog.O
|
||||
|
||||
@SuppressLint("SetJavaScriptEnabled")
|
||||
private void initData() {
|
||||
webView.getSettings().setAllowFileAccess(true);
|
||||
webView.getSettings().setJavaScriptEnabled(true);
|
||||
webView.getSettings().setUseWideViewPort(true);
|
||||
webView.getSettings().setLoadWithOverviewMode(true);
|
||||
@@ -210,14 +212,13 @@ public class CommonWebViewActivity extends BaseActivity implements ShareDialog.O
|
||||
webView.addJavascriptInterface(jsInterface, "androidJsObj");
|
||||
webView.getSettings().setCacheMode(WebSettings.LOAD_NO_CACHE);
|
||||
webView.setWebViewClient(new WebViewClient() {
|
||||
|
||||
String packageName;
|
||||
|
||||
@Override
|
||||
public boolean shouldOverrideUrlLoading(WebView view, String url) {
|
||||
Logger.e("shouldOverrideUrlLoading--------" + url);
|
||||
LogUtil.e("shouldOverrideUrlLoading" + url);
|
||||
targetUrl = url;
|
||||
|
||||
if (url.contains("tel:")) {
|
||||
//删除直接拨打电话的功能
|
||||
return true;
|
||||
@@ -225,6 +226,7 @@ public class CommonWebViewActivity extends BaseActivity implements ShareDialog.O
|
||||
// ------- 处理结束 -------
|
||||
|
||||
if (!(url.startsWith("http") || url.startsWith("https"))) {
|
||||
handleIntent(url);
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -268,6 +270,42 @@ public class CommonWebViewActivity extends BaseActivity implements ShareDialog.O
|
||||
super.onPageStarted(view, url, favicon);
|
||||
mProgressBar.setVisibility(View.VISIBLE);
|
||||
}
|
||||
|
||||
private void handleIntent(String url) {
|
||||
Intent intent;
|
||||
try {
|
||||
if (url.startsWith("intent://")) {
|
||||
//MyCard、Line
|
||||
intent = Intent.parseUri(url, Intent.URI_INTENT_SCHEME);
|
||||
packageName = intent.getPackage();
|
||||
} else { //第三方支付
|
||||
intent = new Intent(Intent.ACTION_VIEW, Uri.parse(url));
|
||||
}
|
||||
startActivity(intent);
|
||||
} catch (Exception e) {
|
||||
handleCatch(e);
|
||||
}
|
||||
}
|
||||
|
||||
private void handleCatch(Exception ex) {
|
||||
if (packageName != null) {
|
||||
toGooglePaly(packageName);
|
||||
} else {
|
||||
SingleToastUtil.showToast(ex.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
private void toGooglePaly(String packageName) {
|
||||
try {
|
||||
startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("market://details?id=" + packageName)));
|
||||
} catch (android.content.ActivityNotFoundException anfe) {
|
||||
try {
|
||||
startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("https://play.google.com/store/apps/details?id=" + packageName)));
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
//获取webviewtitle作为titlebar的title
|
||||
wvcc = new WebChromeClient() {
|
||||
|
Reference in New Issue
Block a user