Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
A
android_goodmoney
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
android
android_goodmoney
Commits
f4c6da2c
Commit
f4c6da2c
authored
Nov 18, 2020
by
mengcuiguang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
添加电魂
parent
77383a63
Changes
9
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
278 additions
and
19 deletions
+278
-19
iReader-release-1.0.1.aar
GoodMoney/app/libs/iReader-release-1.0.1.aar
+0
-0
ZhangyueManager.kt
.../main/java/com/mints/goodmoney/manager/ZhangyueManager.kt
+2
-2
HomePresenter.kt
.../java/com/mints/goodmoney/mvp/presenters/HomePresenter.kt
+1
-1
DhGameFragment.kt
...in/java/com/mints/goodmoney/ui/fragment/DhGameFragment.kt
+140
-4
HorizChannelFragment.kt
...a/com/mints/goodmoney/ui/fragment/HorizChannelFragment.kt
+3
-2
MainFragment.kt
...main/java/com/mints/goodmoney/ui/fragment/MainFragment.kt
+4
-4
ZhangyueFragment.kt
.../java/com/mints/goodmoney/ui/fragment/ZhangyueFragment.kt
+0
-2
URIEncoder.java
...p/src/main/java/com/mints/goodmoney/utils/URIEncoder.java
+98
-1
fragment_main_dh.xml
GoodMoney/app/src/main/res/layout/fragment_main_dh.xml
+30
-3
No files found.
GoodMoney/app/libs/iReader-release-1.0.1.aar
View file @
f4c6da2c
No preview for this file type
GoodMoney/app/src/main/java/com/mints/goodmoney/manager/ZhangyueManager.kt
View file @
f4c6da2c
...
...
@@ -11,11 +11,11 @@ object ZhangyueManager {
const
val
APPID
=
"10054"
fun
onCreateIreader
(
application
:
Application
){
fun
onCreateIreader
(
application
:
Application
)
{
IreaderApi
.
onCreate
(
application
,
APPID
)
}
fun
attachBaseContextIreader
(
application
:
Application
){
fun
attachBaseContextIreader
(
application
:
Application
)
{
IreaderApi
.
attachBaseContext
(
application
)
}
}
\ No newline at end of file
GoodMoney/app/src/main/java/com/mints/goodmoney/mvp/presenters/HomePresenter.kt
View file @
f4c6da2c
...
...
@@ -82,7 +82,7 @@ class HomePresenter : BasePresenter<HomeView>() {
val
message
=
baseResponse
.
getMessage
()
when
(
code
)
{
200
->
view
.
getHallBaseMsgSuc
(
baseResponse
.
getData
())
else
->
{
else
->{
view
.
showToast
(
message
)
}
}
...
...
GoodMoney/app/src/main/java/com/mints/goodmoney/ui/fragment/DhGameFragment.kt
View file @
f4c6da2c
package
com.mints.goodmoney.ui.fragment
import
android.content.Intent
import
android.content.pm.ApplicationInfo
import
android.net.Uri
import
android.os.Build
import
android.view.View
import
android.view.ViewGroup
import
android.webkit.WebSettings
import
android.webkit.WebViewClient
import
com.mints.goodmoney.R
import
com.mints.goodmoney.common.AppConfig
import
com.mints.goodmoney.common.Constant
import
com.mints.goodmoney.manager.UserManager
import
com.mints.goodmoney.ui.fragment.base.LazyLoadBaseFragment
import
com.mints.goodmoney.utils.LogUtil
import
com.mints.goodmoney.utils.MD5
import
com.mints.goodmoney.utils.URIEncoder
import
kotlinx.android.synthetic.main.fragment_main_dh.*
/**
* 描述:电魂游戏
* 作者:孟崔广
*/
class
DhGameFragment
:
LazyLoadBaseFragment
()
{
class
DhGameFragment
:
LazyLoadBaseFragment
(),
View
.
OnClickListener
{
companion
object
{
const
val
CHANNEL
=
"14533"
const
val
KEY
=
"4932d9037fd94f6ba24fa09605203cd6"
const
val
AUTH_URL
=
"http://www.shandw.com/auth/"
}
private
val
TAG
=
DhGameFragment
::
class
.
java
.
simpleName
override
fun
getContentViewLayoutID
()
=
R
.
layout
.
fragment_main_dh
override
fun
initViewsAndEvents
()
{
}
override
fun
onFragmentFirstVisible
()
{
loadH5Game
()
initListener
()
}
override
fun
onDestroy
()
{
super
.
onDestroy
()
dh_webview
?.
let
{
it
.
destroyDrawingCache
()
val
parent
=
it
.
getParent
()
as
ViewGroup
parent
.
removeView
(
it
)
it
.
removeAllViews
()
it
.
destroy
()
}
}
override
fun
onClick
(
v
:
View
)
{
when
(
v
?.
id
)
{
R
.
id
.
ivDhBack
->
{
dh_webview
.
goBack
()
}
R
.
id
.
tvDhRefresh
->
{
loadH5Game
()
}
}
}
/**
* 加载H5Game
*/
private
fun
loadH5Game
()
{
dh_webview
?.
let
{
var
loadUrl
=
getLoadUrl
()
LogUtil
.
d
(
TAG
,
"url-->${loadUrl}"
)
val
settings
=
it
.
settings
// 本地 DOM 存储(解决加载某些网页出现白板现象)
settings
.
domStorageEnabled
=
true
if
(
Build
.
VERSION
.
SDK_INT
>=
Build
.
VERSION_CODES
.
LOLLIPOP
)
{
// 解决 Android 5.0 上 WebView 默认不允许加载 Http 与 Https 混合内容
settings
.
mixedContentMode
=
WebSettings
.
MIXED_CONTENT_ALWAYS_ALLOW
}
settings
.
javaScriptEnabled
=
true
settings
.
javaScriptCanOpenWindowsAutomatically
=
true
it
.
setWebViewClient
(
object
:
WebViewClient
()
{
override
fun
shouldOverrideUrlLoading
(
view
:
android
.
webkit
.
WebView
,
url
:
String
):
Boolean
{
if
(
url
.
startsWith
(
"weixin://wap/pay?"
)
||
url
.
startsWith
(
"alipay"
))
{
val
hasApp
:
Boolean
hasApp
=
if
(
url
.
startsWith
(
"weixin://wap/pay?"
))
{
isAppExist
(
"com.tencent.mm"
)
}
else
{
(
isAppExist
(
"com.eg.android.AlipayGphone"
)
||
isAppExist
(
"com.alipay.android.app"
))
}
if
(
hasApp
)
{
val
intent
=
Intent
()
intent
.
action
=
Intent
.
ACTION_VIEW
intent
.
data
=
Uri
.
parse
(
url
)
activity
?.
startActivity
(
intent
)
}
else
{
showToast
(
"客官,请先安装支付App哦~"
)
}
return
true
}
if
(
url
.
startsWith
(
"https"
))
{
val
map
=
HashMap
<
String
,
String
>()
map
[
"Referer"
]
=
"http://www.shandw.com"
it
.
loadUrl
(
url
,
map
)
}
return
super
.
shouldOverrideUrlLoading
(
view
,
url
)
}
})
it
.
loadUrl
(
loadUrl
)
}
}
/**
* 获取拼接url
*/
fun
getLoadUrl
():
String
{
val
currentTimeMillis
=
System
.
currentTimeMillis
()
/
1000
var
loadUrl
=
"${AUTH_URL}?"
+
"channel=${CHANNEL}&"
+
"openid=${URIEncoder.encodeURIComponent(UserManager.getInstance().userID)}&"
+
"time=${currentTimeMillis}&"
+
"nick=${URIEncoder.encodeURIComponent(UserManager.getInstance().userID)}&"
+
"avatar=${URIEncoder.encodeURIComponent("
https
:
//mints-pkg.oss-cn-beijing.aliyuncs.com/pkg_goodmoney/img/ic_my.png")}&" +
"sex=${0}&"
+
"phone=${UserManager.getInstance().mobile}&"
+
"sdw_simple=${2}&"
+
"sign=${getSignStr(currentTimeMillis)}"
return
loadUrl
}
/**
* 获取签名
*/
fun
getSignStr
(
currentTimeMillis
:
Long
):
String
{
val
signStr
=
"channel=${CHANNEL}&"
+
"openid=${URIEncoder.encodeURIComponent(UserManager.getInstance().userID)}&"
+
"time=${currentTimeMillis}&"
+
"nick=${UserManager.getInstance().userID}&"
+
"avatar=https://mints-pkg.oss-cn-beijing.aliyuncs.com/pkg_goodmoney/img/ic_my.png&"
+
"sex=${0}&"
+
"phone=${UserManager.getInstance().mobile}${KEY}"
return
MD5
.
GetMD5Code
(
signStr
).
toLowerCase
()
}
fun
isAppExist
(
pkgName
:
String
):
Boolean
{
var
info
:
ApplicationInfo
?
=
null
try
{
context
?.
getPackageManager
()
!!
.
getApplicationInfo
(
pkgName
,
0
)
context
!!
.
startActivity
(
context
!!
.
packageManager
.
getLaunchIntentForPackage
(
pkgName
))
}
catch
(
e
:
Exception
)
{
}
return
if
(
info
!=
null
)
true
else
false
}
private
fun
initListener
()
{
ivDhBack
.
setOnClickListener
(
this
)
tvDhRefresh
.
setOnClickListener
(
this
)
}
}
\ No newline at end of file
GoodMoney/app/src/main/java/com/mints/goodmoney/ui/fragment/HorizChannelFragment.kt
View file @
f4c6da2c
...
...
@@ -46,8 +46,6 @@ class HorizChannelFragment : BaseFragment(), HorizChannelView, View.OnClickListe
initChannelFragment
()
initListener
()
// 调用金币视频信息接口
horizChannelPresenter
.
getSmallHomeVedioBaseMsg
()
}
private
fun
initListener
()
{
...
...
@@ -172,6 +170,9 @@ class HorizChannelFragment : BaseFragment(), HorizChannelView, View.OnClickListe
super
.
onResume
()
if
(
AppConfig
.
fragmentClickFlag
==
Constant
.
FRAGMENT_CLICK_CHANNEL
)
{
// 调用金币视频信息接口
horizChannelPresenter
.
getSmallHomeVedioBaseMsg
()
channelFragment
?.
onResume
()
}
}
...
...
GoodMoney/app/src/main/java/com/mints/goodmoney/ui/fragment/MainFragment.kt
View file @
f4c6da2c
...
...
@@ -118,7 +118,6 @@ class MainFragment : BaseFragment(), HomeView, View.OnClickListener {
super
.
onPause
()
littleVideoFragment
?.
onPause
()
// pauseDownloadTime()
}
override
fun
setUserVisibleHint
(
isVisibleToUser
:
Boolean
)
{
...
...
@@ -130,7 +129,6 @@ class MainFragment : BaseFragment(), HomeView, View.OnClickListener {
super
.
onDestroy
()
cdvvYilanTime
?.
setCountDownVedioListener
(
null
)
// littleVideoFragment?.setUserCallBack(null)
YLPlayerConfig
.
config
().
unRegisterPlayerCallback
()
homePresenter
.
detachView
()
...
...
@@ -183,7 +181,7 @@ class MainFragment : BaseFragment(), HomeView, View.OnClickListener {
if
(
isToCreateReward
)
{
// 防止界面切换 重置倒计时
//
第一次能过 isFirstLoadVedio 判断好兔先加载视频
//
好兔视频已加载 且 红包已转满 且 奖励已领过
if
(!
isFirstLoadVedio
&&
!
cdvvYilanTime
.
isPlaying
&&
!
isAward
)
{
cdvvYilanTime
?.
reset
()
cdvvYilanTime
?.
start
()
...
...
@@ -196,6 +194,7 @@ class MainFragment : BaseFragment(), HomeView, View.OnClickListener {
override
fun
onClick
(
v
:
View
)
{
when
(
v
.
id
)
{
R
.
id
.
cdvvYilanTime
->
{
// 视频已转满 且 服务返回可以领奖励
if
(
isAward
&&
isToCreateReward
)
{
isAward
=
false
...
...
@@ -264,6 +263,7 @@ class MainFragment : BaseFragment(), HomeView, View.OnClickListener {
}
override
fun
onStop
(
p0
:
String
?,
p1
:
String
?,
p2
:
String
?)
{
pauseDownloadTime
()
}
})
}
else
{
...
...
@@ -301,6 +301,7 @@ class MainFragment : BaseFragment(), HomeView, View.OnClickListener {
return
}
// 视频未转满 且 界面切换时可继续加进度
if
(!
isAward
)
{
cdvvYilanTime
?.
resume
()
}
...
...
@@ -311,7 +312,6 @@ class MainFragment : BaseFragment(), HomeView, View.OnClickListener {
* 停止转动
*/
private
fun
stopDownloadTime
()
{
// 暂停
cdvvYilanTime
?.
stop
()
}
...
...
GoodMoney/app/src/main/java/com/mints/goodmoney/ui/fragment/ZhangyueFragment.kt
View file @
f4c6da2c
...
...
@@ -15,8 +15,6 @@ import com.mints.goodmoney.ui.fragment.base.LazyLoadBaseFragment
import
com.mints.goodmoney.utils.SpanUtils
import
kotlinx.android.synthetic.main.fragment_main_zy.*
private
val
TAG
=
ZhangyueFragment
::
class
.
java
.
simpleName
/**
* 描述:掌阅书城
* 作者:孟崔广
...
...
GoodMoney/app/src/main/java/com/mints/goodmoney/utils/URIEncoder.java
View file @
f4c6da2c
package
com
.
mints
.
goodmoney
.
utils
;
public
class
URIEncoder
{
import
java.io.UnsupportedEncodingException
;
/*
* 文件名:URIEncode.java
*/
public
class
URIEncoder
{
public
static
final
String
ALLOWED_CHARS
=
"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-_.!~*'()"
;
/**
* Description:
*
* @param str
* @return
* @throws UnsupportedEncodingException
* @see
*/
public
static
String
encodeURI
(
String
str
)
throws
UnsupportedEncodingException
{
String
isoStr
=
new
String
(
str
.
getBytes
(
"UTF8"
),
"ISO-8859-1"
);
char
[]
chars
=
isoStr
.
toCharArray
();
StringBuffer
sb
=
new
StringBuffer
();
for
(
int
i
=
0
;
i
<
chars
.
length
;
i
++
)
{
if
((
chars
[
i
]
<=
'z'
&&
chars
[
i
]
>=
'a'
)
||
(
chars
[
i
]
<=
'Z'
&&
chars
[
i
]
>=
'A'
)
||
chars
[
i
]
==
'-'
||
chars
[
i
]
==
'_'
||
chars
[
i
]
==
'.'
||
chars
[
i
]
==
'!'
||
chars
[
i
]
==
'~'
||
chars
[
i
]
==
'*'
||
chars
[
i
]
==
'\''
||
chars
[
i
]
==
'('
||
chars
[
i
]
==
')'
||
chars
[
i
]
==
';'
||
chars
[
i
]
==
'/'
||
chars
[
i
]
==
'?'
||
chars
[
i
]
==
':'
||
chars
[
i
]
==
'@'
||
chars
[
i
]
==
'&'
||
chars
[
i
]
==
'='
||
chars
[
i
]
==
'+'
||
chars
[
i
]
==
'$'
||
chars
[
i
]
==
','
||
chars
[
i
]
==
'#'
||
(
chars
[
i
]
<=
'9'
&&
chars
[
i
]
>=
'0'
))
{
sb
.
append
(
chars
[
i
]);
}
else
{
sb
.
append
(
"%"
);
sb
.
append
(
Integer
.
toHexString
(
chars
[
i
]));
}
}
return
sb
.
toString
();
}
/**
* Description:
*
* @param input
* @return
* @see
*/
public
static
String
encodeURIComponent
(
String
input
)
{
if
(
null
==
input
||
""
.
equals
(
input
.
trim
()))
{
return
input
;
}
int
l
=
input
.
length
();
StringBuilder
o
=
new
StringBuilder
(
l
*
3
);
try
{
for
(
int
i
=
0
;
i
<
l
;
i
++
)
{
String
e
=
input
.
substring
(
i
,
i
+
1
);
if
(
ALLOWED_CHARS
.
indexOf
(
e
)
==
-
1
)
{
byte
[]
b
=
e
.
getBytes
(
"utf-8"
);
o
.
append
(
getHex
(
b
));
continue
;
}
o
.
append
(
e
);
}
return
o
.
toString
();
}
catch
(
UnsupportedEncodingException
e
)
{
e
.
printStackTrace
();
}
return
input
;
}
private
static
String
getHex
(
byte
buf
[])
{
StringBuilder
o
=
new
StringBuilder
(
buf
.
length
*
3
);
for
(
int
i
=
0
;
i
<
buf
.
length
;
i
++
)
{
int
n
=
(
int
)
buf
[
i
]
&
0xff
;
o
.
append
(
"%"
);
if
(
n
<
0x10
)
{
o
.
append
(
"0"
);
}
o
.
append
(
Long
.
toString
(
n
,
16
).
toUpperCase
());
}
return
o
.
toString
();
}
}
GoodMoney/app/src/main/res/layout/fragment_main_dh.xml
View file @
f4c6da2c
...
...
@@ -6,10 +6,37 @@
android:background=
"@color/white"
android:orientation=
"vertical"
>
<
ImageView
<
RelativeLayout
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:src=
"@mipmap/ic_launcher"
/>
android:layout_height=
"wrap_content"
>
<ImageView
android:id=
"@+id/ivDhBack"
android:layout_width=
"30dp"
android:layout_height=
"30dp"
android:layout_centerVertical=
"true"
android:layout_marginLeft=
"10dp"
android:src=
"@mipmap/ic_arrow_back"
/>
<TextView
android:id=
"@+id/tvDhRefresh"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_centerVertical=
"true"
android:layout_toEndOf=
"@id/ivDhBack"
android:paddingLeft=
"10dp"
android:paddingRight=
"30dp"
android:text=
"重新加载"
android:textColor=
"@color/black"
android:textSize=
"16sp"
/>
</RelativeLayout>
<WebView
android:id=
"@+id/dh_webview"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
android:fadingEdge=
"none"
android:overScrollMode=
"never"
/>
</LinearLayout>
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