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
68b4b32d
Commit
68b4b32d
authored
Dec 21, 2020
by
mengcuiguang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
添加听书模块
parent
8b5dd9be
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
98 additions
and
72 deletions
+98
-72
build.gradle
GoodMoney/app/build.gradle
+2
-2
WrapperActivity.kt
.../java/com/mints/goodmoney/ui/activitys/WrapperActivity.kt
+1
-1
LiebaoGameFragment.kt
...ava/com/mints/goodmoney/ui/fragment/LiebaoGameFragment.kt
+4
-1
MoneyFragment.kt
...ain/java/com/mints/goodmoney/ui/fragment/MoneyFragment.kt
+15
-4
XmlyFragment.kt
...main/java/com/mints/goodmoney/ui/fragment/XmlyFragment.kt
+24
-46
XmlyPageFragment.kt
.../java/com/mints/goodmoney/ui/fragment/XmlyPageFragment.kt
+26
-0
fragment_main_xmly.xml
GoodMoney/app/src/main/res/layout/fragment_main_xmly.xml
+19
-18
fragment_main_xmly_page.xml
...Money/app/src/main/res/layout/fragment_main_xmly_page.xml
+7
-0
No files found.
GoodMoney/app/build.gradle
View file @
68b4b32d
...
...
@@ -9,8 +9,8 @@ android {
applicationId
"com.mints.goodmoney"
minSdkVersion
rootProject
.
ext
.
androidMinSdkVersion
targetSdkVersion
rootProject
.
ext
.
androidTargetSdkVersion
versionCode
8
versionName
"1.0.
7
"
versionCode
9
versionName
"1.0.
8
"
flavorDimensions
"default"
// dex突破65535的限制
...
...
GoodMoney/app/src/main/java/com/mints/goodmoney/ui/activitys/WrapperActivity.kt
View file @
68b4b32d
...
...
@@ -57,7 +57,7 @@ class WrapperActivity : BaseActivity(), View.OnClickListener {
}
Constant
.
WRAPPER_TYPE_BOOK
->
{
tv_title
.
text
=
"书城"
val
zhangyueFragment
=
ZhangyueFragment
()
val
zhangyueFragment
=
My
ZhangyueFragment
()
if
(!
zhangyueFragment
.
isAdded
())
{
// 提交事务
supportFragmentManager
.
beginTransaction
()
...
...
GoodMoney/app/src/main/java/com/mints/goodmoney/ui/fragment/LiebaoGameFragment.kt
View file @
68b4b32d
...
...
@@ -14,6 +14,7 @@ import com.mints.goodmoney.mvp.presenters.GamePresenter
import
com.mints.goodmoney.mvp.views.GameView
import
com.mints.goodmoney.ui.activitys.AwardActivity
import
com.mints.goodmoney.ui.fragment.base.LazyLoadBaseFragment
import
com.mints.goodmoney.utils.LogUtil
import
com.mints.goodmoney.utils.SpanUtils
import
com.mints.library.utils.json.JsonUtil
import
kotlinx.android.synthetic.main.activity_liebao_game.*
...
...
@@ -52,12 +53,15 @@ class LiebaoGameFragment : LazyLoadBaseFragment(), GameView,
override
fun
onFragmentResume
()
{
super
.
onFragmentResume
()
if
(
AppConfig
.
fragmentClickFlag
==
Constant
.
FRAGMENT_CLICK_MAIN
)
{
gvGameLiebao
.
inflate
(
activity
)
LogUtil
.
d
(
"LiebaoGameFragment"
,
"onFragmentResume"
)
gamePresenter
.
getGameInfo
()
}
}
override
fun
onDestroy
()
{
super
.
onDestroy
()
LogUtil
.
d
(
"LiebaoGameFragment"
,
"LiebaoGameFragment"
)
CmGameSdk
.
removeGameClickCallback
()
CmGameSdk
.
setMoveView
(
null
)
CmGameSdk
.
removeGamePlayTimeCallback
()
...
...
@@ -66,7 +70,6 @@ class LiebaoGameFragment : LazyLoadBaseFragment(), GameView,
}
private
fun
initListener
()
{
gvGameLiebao
.
inflate
(
activity
)
// 默认游戏中心页面,点击游戏试,触发回调
CmGameSdk
.
setGameClickCallback
(
this
)
// 点击游戏右上角或物理返回键,退出游戏时触发回调,并返回游戏时长
...
...
GoodMoney/app/src/main/java/com/mints/goodmoney/ui/fragment/MoneyFragment.kt
View file @
68b4b32d
...
...
@@ -20,6 +20,7 @@ class MoneyFragment : BaseFragment(), XTabLayout.OnTabSelectedListener {
const
val
FRAGMENT_TAG_BOOKSTORE
=
"FRAGMENT_TAG_BOOKSTORE"
const
val
FRAGMENT_TAG_NEWS
=
"FRAGMENT_TAG_NEWS"
const
val
FRAGMENT_TAG_GAME
=
"FRAGMENT_TAG_GAME"
const
val
FRAGMENT_TAG_XMLY
=
"FRAGMENT_TAG_XMLY"
}
// private var mainFragment: MainFragment? = null
...
...
@@ -29,6 +30,7 @@ class MoneyFragment : BaseFragment(), XTabLayout.OnTabSelectedListener {
private
var
mainFragment
:
Fragment
?
=
null
private
var
bookStoreFragment
:
Fragment
?
=
null
private
var
newsFragment
:
Fragment
?
=
null
private
var
xmlyGameFragment
:
Fragment
?
=
null
private
var
liebaoGameFragment
:
Fragment
?
=
null
private
var
curPosition
=
0
//当前标签选中的下标
...
...
@@ -42,7 +44,7 @@ class MoneyFragment : BaseFragment(), XTabLayout.OnTabSelectedListener {
override
fun
onHiddenChanged
(
hidden
:
Boolean
)
{
if
(
curPosition
==
0
)
{
mainFragment
?.
onHiddenChanged
(
hidden
)
}
else
if
(
curPosition
==
3
)
{
}
else
if
(
curPosition
==
4
)
{
liebaoGameFragment
?.
onHiddenChanged
(
hidden
)
}
super
.
onHiddenChanged
(
hidden
)
...
...
@@ -88,7 +90,7 @@ class MoneyFragment : BaseFragment(), XTabLayout.OnTabSelectedListener {
currentFragment
=
mainFragment
}
xtFragmentMoney
.
setxTabDisplayNum
(
4
)
xtFragmentMoney
.
setxTabDisplayNum
(
5
)
val
newTab1
=
xtFragmentMoney
.
newTab
()
newTab1
.
text
=
"视频"
val
newTab2
=
xtFragmentMoney
.
newTab
()
...
...
@@ -96,11 +98,14 @@ class MoneyFragment : BaseFragment(), XTabLayout.OnTabSelectedListener {
val
newTab3
=
xtFragmentMoney
.
newTab
()
newTab3
.
text
=
"新闻"
val
newTab4
=
xtFragmentMoney
.
newTab
()
newTab4
.
text
=
"游戏"
newTab4
.
text
=
"听书"
val
newTab5
=
xtFragmentMoney
.
newTab
()
newTab5
.
text
=
"游戏"
xtFragmentMoney
.
addTab
(
newTab1
)
xtFragmentMoney
.
addTab
(
newTab2
)
xtFragmentMoney
.
addTab
(
newTab3
)
xtFragmentMoney
.
addTab
(
newTab4
)
xtFragmentMoney
.
addTab
(
newTab5
)
xtFragmentMoney
.
addOnTabSelectedListener
(
this
)
}
...
...
@@ -163,7 +168,7 @@ class MoneyFragment : BaseFragment(), XTabLayout.OnTabSelectedListener {
}
1
->
{
if
(
bookStoreFragment
==
null
)
{
bookStoreFragment
=
My
ZhangyueFragment
()
bookStoreFragment
=
ZhangyueFragment
()
}
addOrShowFragment
(
childFragmentManager
,
bookStoreFragment
!!
,
FRAGMENT_TAG_BOOKSTORE
)
}
...
...
@@ -174,6 +179,12 @@ class MoneyFragment : BaseFragment(), XTabLayout.OnTabSelectedListener {
addOrShowFragment
(
childFragmentManager
,
newsFragment
!!
,
FRAGMENT_TAG_NEWS
)
}
3
->
{
if
(
xmlyGameFragment
==
null
)
{
xmlyGameFragment
=
XmlyFragment
()
}
addOrShowFragment
(
childFragmentManager
,
xmlyGameFragment
!!
,
FRAGMENT_TAG_XMLY
)
}
4
->
{
if
(
liebaoGameFragment
==
null
)
{
liebaoGameFragment
=
LiebaoGameFragment
()
}
...
...
GoodMoney/app/src/main/java/com/mints/goodmoney/ui/fragment/XmlyFragment.kt
View file @
68b4b32d
package
com.mints.goodmoney.ui.fragment
import
android.os.Build
import
android.view.View
import
android.webkit.WebSettings
import
androidx.fragment.app.Fragment
import
androidx.viewpager.widget.ViewPager
import
com.mints.goodmoney.R
import
com.mints.goodmoney.mvp.presenters.BookPresenter
import
com.mints.goodmoney.common.AppConfig
import
com.mints.goodmoney.common.Constant
import
com.mints.goodmoney.ui.adapter.MessageFragAdapter
import
com.mints.goodmoney.ui.fragment.base.LazyLoadBaseFragment
import
kotlinx.android.synthetic.main.fragment_main_xmly.*
...
...
@@ -12,64 +13,41 @@ import kotlinx.android.synthetic.main.fragment_main_xmly.*
* 描述:喜马拉雅
* 作者:孟崔广
*/
class
XmlyFragment
:
LazyLoadBaseFragment
(),
View
.
OnClickListener
{
private
val
bookPresenter
by
lazy
{
BookPresenter
()
}
class
XmlyFragment
:
LazyLoadBaseFragment
()
{
override
fun
getContentViewLayoutID
()
=
R
.
layout
.
fragment_main_xmly
override
fun
initViewsAndEvents
()
{
// bookPresenter.attachView(this)
}
override
fun
onFragmentFirstVisible
()
{
loadUrl
()
initListener
()
super
.
onFragmentFirstVisible
()
// 获取tab
initView
()
}
override
fun
onFragmentResume
()
{
super
.
onFragmentResume
()
// if (AppConfig.fragmentClickFlag == Constant.FRAGMENT_CLICK_MAIN) {
// bookPresenter.getReadInfo()
// }
}
override
fun
onClick
(
v
:
View
)
{
when
(
v
.
id
)
{
R
.
id
.
ivXmlyBack
->
{
xmly_webview
.
goBack
()
}
if
(
AppConfig
.
fragmentClickFlag
==
Constant
.
FRAGMENT_CLICK_MAIN
)
{
}
}
override
fun
onDestroy
()
{
super
.
onDestroy
()
// bookPresenter.detachView()
}
/**
* 加载H5Game
*/
private
fun
loadUrl
()
{
xmly_webview
?.
let
{
val
loadUrl
=
"http://open.ximalaya.com/new-site/#index/448/ff71a11162f20808f9f349452dd9e141"
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
.
loadUrl
(
loadUrl
)
private
fun
initView
()
{
val
tabs
:
MutableList
<
String
>
=
ArrayList
()
val
fragments
:
MutableList
<
Fragment
>
=
ArrayList
()
for
(
i
in
1
..
10
)
{
tabs
.
add
(
"视频"
+
i
)
fragments
.
add
(
XmlyPageFragment
(
i
))
}
}
private
fun
initListener
()
{
ivXmlyBack
.
setOnClickListener
(
this
)
//去除两侧应阴影
xtFragmentXmly
.
overScrollMode
=
ViewPager
.
OVER_SCROLL_NEVER
vpFragmentXmly
.
offscreenPageLimit
=
tabs
.
size
+
3
val
adapter
=
MessageFragAdapter
(
childFragmentManager
,
fragments
,
tabs
)
vpFragmentXmly
.
adapter
=
adapter
xtFragmentXmly
.
setxTabDisplayNum
(
tabs
.
size
)
xtFragmentXmly
.
setupWithViewPager
(
vpFragmentXmly
)
}
}
\ No newline at end of file
GoodMoney/app/src/main/java/com/mints/goodmoney/ui/fragment/XmlyPageFragment.kt
0 → 100644
View file @
68b4b32d
package
com.mints.goodmoney.ui.fragment
import
com.mints.goodmoney.R
import
com.mints.goodmoney.ui.fragment.base.LazyLoadBaseFragment
/**
* 描述:喜马拉雅封面
* 作者:孟崔广
*/
class
XmlyPageFragment
(
val
data
:
Int
)
:
LazyLoadBaseFragment
()
{
override
fun
getContentViewLayoutID
()
=
R
.
layout
.
fragment_main_xmly_page
override
fun
initViewsAndEvents
()
{
}
override
fun
onFragmentFirstVisible
()
{
super
.
onFragmentFirstVisible
()
showToast
(
""
+
data
)
//recyclerview 加载封面
//recyclerview 事件监听
}
}
\ No newline at end of file
GoodMoney/app/src/main/res/layout/fragment_main_xmly.xml
View file @
68b4b32d
...
...
@@ -2,26 +2,27 @@
<LinearLayout
xmlns:android=
"http://schemas.android.com/apk/res/android"
xmlns:app=
"http://schemas.android.com/apk/res-auto"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
android:background=
"@color/white"
android:layout_height=
"wrap_content"
android:orientation=
"vertical"
>
<TextView
android:id=
"@+id/ivXmlyBack"
android:layout_width=
"wrap_content"
<com.androidkun.xtablayout.XTabLayout
android:id=
"@+id/xtFragmentXmly"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:gravity=
"center_vertical"
android:padding=
"6dp"
android:text=
"返回"
android:textColor=
"@color/black"
android:textSize=
"14sp"
/>
app:xTabIndicatorColor=
"#F28335"
app:xTabIndicatorHeight=
"4dp"
app:xTabIndicatorRoundX=
"30dp"
app:xTabIndicatorRoundY=
"30dp"
app:xTabIndicatorWidth=
"20dp"
app:xTabMode=
"scrollable"
app:xTabSelectedTextColor=
"@color/color_FF9837"
app:xTabSelectedTextSize=
"18sp"
app:xTabTextColor=
"#000"
app:xTabTextSize=
"14sp"
/>
<WebView
android:id=
"@+id/xmly_webview"
<com.mints.goodmoney.ui.widgets.MyViewPager
android:id=
"@+id/vpFragmentXmly"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
android:fadingEdge=
"none"
android:overScrollMode=
"never"
/>
</LinearLayout>
\ No newline at end of file
android:layout_height=
"wrap_content"
/>
</LinearLayout>
GoodMoney/app/src/main/res/layout/fragment_main_xmly_page.xml
0 → 100755
View file @
68b4b32d
<?xml version="1.0" encoding="utf-8"?>
<com.mints.goodmoney.ui.widgets.MyViewPager
xmlns:android=
"http://schemas.android.com/apk/res/android"
xmlns:app=
"http://schemas.android.com/apk/res-auto"
android:id=
"@+id/vpFragmentXmly"
android:background=
"#0f0"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
/>
\ No newline at end of file
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