Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
唐文
/
AiyoZhuaWaWa
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
56f1988c
authored
Nov 27, 2017
by
chengfengpiaopiao
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
增加H5调起支付宝支付
parent
856c6439
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
68 additions
and
22 deletions
.idea/misc.xml
.idea/modules.xml
app/build.gradle
app/src/main/AndroidManifest.xml
app/src/main/java/com/maile/jingcai/base/Constant.java
app/src/main/java/com/maile/jingcai/module/net/interceptor/RspCheckInterceptor.java
app/src/main/java/com/maile/jingcai/view/activity/MainActivity.java
app/src/main/java/com/maile/jingcai/view/fragment/SimpleCardFragment.java
multi-image-selector/build.gradle
.idea/misc.xml
View file @
56f1988c
<?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"
>
...
...
.idea/modules.xml
View file @
56f1988c
...
...
@@ -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$/DuoBaoJingCai
2.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>
...
...
app/build.gradle
View file @
56f1988c
...
...
@@ -13,12 +13,12 @@ if (customPropsFile.canRead()) {
println
(
"suffixName: "
+
suffixName
[
networkType
])
android
{
compileSdkVersion
2
5
buildToolsVersion
"2
5.0.1
"
compileSdkVersion
2
3
buildToolsVersion
"2
3.0.3
"
defaultConfig
{
applicationId
"com.maile.jingcai"
minSdkVersion
16
targetSdkVersion
2
5
targetSdkVersion
2
3
versionCode
1
versionName
"1.0"
manifestPlaceholders
=
[
UMENG_CHANNEL_VALUE:
"base"
]
//默认名称
...
...
app/src/main/AndroidManifest.xml
View file @
56f1988c
...
...
@@ -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"
/>
<!-- 微信 -->
...
...
app/src/main/java/com/maile/jingcai/base/Constant.java
View file @
56f1988c
...
...
@@ -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"
;
...
...
app/src/main/java/com/maile/jingcai/module/net/interceptor/RspCheckInterceptor.java
View file @
56f1988c
...
...
@@ -67,7 +67,8 @@ public class RspCheckInterceptor implements Interceptor {
return
"错误的用户id"
;
case
10410
:
return
"请先登录"
;
case
1018
:
return
"短信验证码验证失败"
;
}
return
""
;
}
...
...
app/src/main/java/com/maile/jingcai/view/activity/MainActivity.java
View file @
56f1988c
...
...
@@ -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
{
...
...
app/src/main/java/com/maile/jingcai/view/fragment/SimpleCardFragment.java
View file @
56f1988c
...
...
@@ -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
();
...
...
multi-image-selector/build.gradle
View file @
56f1988c
apply
plugin:
'com.android.library'
android
{
compileSdkVersion
2
5
buildToolsVersion
"2
5.0.1
"
compileSdkVersion
2
3
buildToolsVersion
"2
3.0.3
"
defaultConfig
{
minSdkVersion
16
targetSdkVersion
2
5
targetSdkVersion
2
3
versionCode
1
versionName
"1.0"
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment