Commit 56f1988c by chengfengpiaopiao

增加H5调起支付宝支付

parent 856c6439
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="EntryPointsManager">
<entry_points version="2.0" />
</component>
<component name="NullableNotNullManager">
<option name="myDefaultNullable" value="android.support.annotation.Nullable" />
<option name="myDefaultNotNull" value="android.support.annotation.NonNull" />
......@@ -24,7 +27,7 @@
</value>
</option>
</component>
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" default="true" project-jdk-name="1.8" project-jdk-type="JavaSDK">
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" default="true" assert-keyword="true" jdk-15="true" project-jdk-name="1.8" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/build/classes" />
</component>
<component name="ProjectType">
......
......@@ -2,7 +2,7 @@
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/DuoBaoJingCai.iml" filepath="$PROJECT_DIR$/DuoBaoJingCai.iml" />
<module fileurl="file://$PROJECT_DIR$/DuoBaoJingCai2.iml" filepath="$PROJECT_DIR$/DuoBaoJingCai2.iml" />
<module fileurl="file://$PROJECT_DIR$/app/app.iml" filepath="$PROJECT_DIR$/app/app.iml" />
<module fileurl="file://$PROJECT_DIR$/multi-image-selector/multi-image-selector.iml" filepath="$PROJECT_DIR$/multi-image-selector/multi-image-selector.iml" />
</modules>
......
......@@ -13,12 +13,12 @@ if (customPropsFile.canRead()) {
println("suffixName: " + suffixName[networkType])
android {
compileSdkVersion 25
buildToolsVersion "25.0.1"
compileSdkVersion 23
buildToolsVersion "23.0.3"
defaultConfig {
applicationId "com.maile.jingcai"
minSdkVersion 16
targetSdkVersion 25
targetSdkVersion 23
versionCode 1
versionName "1.0"
manifestPlaceholders = [UMENG_CHANNEL_VALUE: "base"] //默认名称
......
......@@ -71,7 +71,7 @@
android:name=".view.activity.MainActivity"
android:exported="true"
android:launchMode="singleTask"
android:theme="@style/Theme.AppCompat.Light.NoActionBar"
android:theme="@android:style/Theme.Translucent"
android:screenOrientation="portrait">
<intent-filter>
<action android:name="android.intent.action.VIEW" />
......@@ -88,6 +88,8 @@
<!-- 个人信息页面设置的activity -->
<activity
android:theme="@android:style/Theme.Translucent.NoTitleBar"
android:fitsSystemWindows="true"
android:name=".view.activity.ImageCropHeadActivity"
android:screenOrientation="portrait" />
<!-- 微信 -->
......
......@@ -18,7 +18,7 @@ public class Constant {
public static final boolean DEBUG = true;
public static final String BASE_URL = "http://192.168.1.250:81";
public static final String BASE_URL = "http://api.7peng.cn";
public static final String WEIXIN_APP_ID = "wxac811a3942bd3638";
public static final String WEIXIN_APP_SECRET = "182ad59bb146ed391f7d6c8ce5664903";
......
......@@ -67,7 +67,8 @@ public class RspCheckInterceptor implements Interceptor {
return "错误的用户id";
case 10410:
return "请先登录";
case 1018:
return "短信验证码验证失败";
}
return "";
}
......
......@@ -17,6 +17,7 @@ import android.support.v4.app.FragmentPagerAdapter;
import android.support.v4.view.ViewPager;
import android.text.TextUtils;
import android.util.Log;
import android.view.Gravity;
import android.view.KeyEvent;
import android.view.View;
import android.view.Window;
......@@ -27,6 +28,7 @@ import com.flyco.tablayout.CommonTabLayout;
import com.flyco.tablayout.listener.CustomTabEntity;
import com.flyco.tablayout.listener.OnTabSelectListener;
import com.maile.jingcai.R;
import com.maile.jingcai.base.BaseApplication;
import com.maile.jingcai.base.Constant;
import com.maile.jingcai.commponent.PicModeSelectView;
import com.maile.jingcai.commponent.ToastTopBar;
......@@ -103,7 +105,11 @@ public class MainActivity extends FragmentActivity implements IWebView ,Activity
private WebView mWebView;
private String mWebURL;
private String[] urls = {"http://h5.test.7peng.cn/","http://192.168.1.250:81/shop","http://h5.test.7peng.cn/profile.html"};
//h5.7peng.cn 大厅
//http://api.7peng.cn/shop 商城
//http://h5.7peng.cn/profile.html 个人主页
//
private String[] urls = {"http://h5.7peng.cn/","http://api.7peng.cn/shop","http://h5.7peng.cn/profile.html"};
private String uid;
......@@ -122,7 +128,7 @@ public class MainActivity extends FragmentActivity implements IWebView ,Activity
IPreferencesIds.DEFAULT_SHAREPREFERENCES_FILE,
Context.MODE_PRIVATE);
final String token = preferencesManager.getString(IPreferencesIds.TOKEN, "");
urls[0] = "http://h5.test.7peng.cn/" + "?token=" +token + "&platform=android" ;
urls[0] = "http://h5.7peng.cn/" + "?token=" +token + "&platform=android" ; //大厅
Log.i("tangwen", "urls " + urls.toString());
......@@ -252,7 +258,15 @@ public class MainActivity extends FragmentActivity implements IWebView ,Activity
if (!fragment.tryWebViewGoBack()) {
Long now = System.currentTimeMillis();
if (now - exitTime > 1000) {
PublicUtils.showToast("再按一次退出");
runOnUiThread(new Runnable() {
@Override
public void run() {
//PublicUtils.showToast("再按一次退出");
Toast toast = Toast.makeText(MainActivity.this, "再按一次退出" + "", Toast.LENGTH_SHORT);
toast.setGravity(Gravity.CENTER, 0, 0);
toast.show();
}
});
exitTime = now;
} else if (now - exitTime > 300) {
finish();
......@@ -382,12 +396,12 @@ public class MainActivity extends FragmentActivity implements IWebView ,Activity
/**
* 直接拉起相册库--》去除dialog
*/
if (!NetUtils.isNetworkOK(this)) { //网络未连接
if (!NetUtils.isNetworkOK(this)) {
mToastBar.showErrorBar(R.string.network_not_ok);
} else {
//mPicSelectView.show(true);拉起activity
Intent intent;
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {//19版本
//19版本
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
Intent intentHead = new Intent(MainActivity.this, ImageCropHeadActivity.class);
startActivityForResult(intentHead, IMAGE_HEAD);
} else {
......
......@@ -108,7 +108,7 @@ public class SimpleCardFragment extends BaseFragment implements FragmentCompat.
if (isVisibleToUser) {
Log.i("tangwen", "onResume: " + mUrl);
if (mUrl.equals("http://192.168.1.250:81/shop") || mUrl.equals("http://h5.test.7peng.cn/profile.html")) {
if (mUrl.equals("http://api.7peng.cn/shop") || mUrl.equals("http://h5.7peng.cn/profile.html")) {
//Log.i("tangwen", "onResume: " + "第二页");
mWebView.loadUrl(mUrl);
}
......@@ -194,8 +194,21 @@ public class SimpleCardFragment extends BaseFragment implements FragmentCompat.
@Override
public boolean shouldOverrideUrlLoading(WebView view, String url) {
//返回值是true的时候控制去WebView打开,为false调用系统浏览器或第三方浏览器
view.loadUrl(url);
/// return super.shouldOverrideUrlLoading(view, url);
// view.loadUrl(url);
// return true;
if (url.contains(" alipays://platformapi/startapp")) {
startAlipayActivity(url);
// android 6.0 两种方式获取intent都可以跳转支付宝成功,7.1测试不成功
} else if ((Build.VERSION.SDK_INT > Build.VERSION_CODES.M)
&& (url.contains("platformapi") && url.contains("startapp"))) {
startAlipayActivity(url);
} else {
mWebView.loadUrl(url);
}
return true;
}
@Override
......@@ -257,6 +270,21 @@ public class SimpleCardFragment extends BaseFragment implements FragmentCompat.
}
});
}
// 调起支付宝并跳转到指定页面
private void startAlipayActivity(String url) {
Intent intent;
try {
intent = Intent.parseUri(url,
Intent.URI_INTENT_SCHEME);
intent.addCategory(Intent.CATEGORY_BROWSABLE);
intent.setComponent(null);
startActivity(intent);
} catch (Exception e) {
e.printStackTrace();
}
}
class JavaScriptInterface{
private Context mContext;
......@@ -285,9 +313,6 @@ public class SimpleCardFragment extends BaseFragment implements FragmentCompat.
public void editUserHeadImage(String uid){
Log.d("editUserHeadImage", "uid: " + uid);
mUid = uid;
requirePermission();
}
......@@ -320,6 +345,7 @@ public class SimpleCardFragment extends BaseFragment implements FragmentCompat.
private PermissionUtils.PermissionGrant mPermissionGrant = new PermissionUtils.PermissionGrant() {
@Override
public void onPermissionGranted(int requestCode) {
Log.d("tangwen", "onPermissionGranted: requestCode = " + requestCode);
switch (requestCode) {
case PermissionUtils.CODE_RECORD_AUDIO:
Toast.makeText(getActivity(), "Result Permission Grant CODE_RECORD_AUDIO", Toast.LENGTH_SHORT).show();
......
apply plugin: 'com.android.library'
android {
compileSdkVersion 25
buildToolsVersion "25.0.1"
compileSdkVersion 23
buildToolsVersion "23.0.3"
defaultConfig {
minSdkVersion 16
targetSdkVersion 25
targetSdkVersion 23
versionCode 1
versionName "1.0"
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment