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
cb20f0ca
Commit
cb20f0ca
authored
Mar 29, 2021
by
mengcuiguang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
代码优化
parent
284e3ca2
Changes
5
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
616 additions
and
581 deletions
+616
-581
MintsApplication.java
...p/src/main/java/com/mints/goodmoney/MintsApplication.java
+3
-0
ReaderManager.java
.../main/java/com/mints/goodmoney/manager/ReaderManager.java
+31
-47
ToutiaoAD.java
.../src/main/java/com/mints/goodmoney/manager/ToutiaoAD.java
+506
-521
WrapperActivity.kt
.../java/com/mints/goodmoney/ui/activitys/WrapperActivity.kt
+34
-13
ReaderFragment.kt
...in/java/com/mints/goodmoney/ui/fragment/ReaderFragment.kt
+42
-0
No files found.
GoodMoney/app/src/main/java/com/mints/goodmoney/MintsApplication.java
View file @
cb20f0ca
...
...
@@ -16,6 +16,7 @@ import com.mints.goodmoney.manager.KsManager;
import
com.mints.goodmoney.manager.LiebaoManager
;
import
com.mints.goodmoney.manager.MhManager
;
import
com.mints.goodmoney.manager.MiitHelper
;
import
com.mints.goodmoney.manager.ReaderManager
;
import
com.mints.goodmoney.manager.RsNewsManager
;
import
com.mints.goodmoney.manager.TtCsjAdManager
;
import
com.mints.goodmoney.manager.TzManager
;
...
...
@@ -148,6 +149,8 @@ public class MintsApplication extends MultiDexApplication {
// 自定义logger
bindLogger
();
ReaderManager
.
init
(
this
);
// 子线程初始化三方SDK
String
processName
=
SystemUtils
.
INSTANCE
.
getProcessName
(
this
,
android
.
os
.
Process
.
myPid
());
...
...
GoodMoney/app/src/main/java/com/mints/goodmoney/manager/ReaderManager.java
View file @
cb20f0ca
...
...
@@ -28,42 +28,26 @@ import kotlin.jvm.functions.Function0;
public
class
ReaderManager
{
public
static
void
init
(
Application
applicationContext
)
{
ChineseAllReaderApplication
.
Companion
.
install
(
applicationContext
,
"1209"
,
"asdf!@"
,
"6"
,
"0"
,
new
AdProvider
()
{
ToutiaoAD
ad
=
new
ToutiaoAD
();
ChineseAllReaderApplication
.
Companion
.
install
(
applicationContext
,
"1242"
,
"hzq@1242"
,
"32"
,
"0"
,
new
AdProvider
()
{
@Override
public
void
onAdDialogPositiveClick
(
@Nullable
Dialog
dialog
,
@NotNull
Function0
<
Unit
>
function0
)
{
if
(
NetworkUtil
.
isNetworkAvailable
(
applicationContext
)
&&
!
NetworkUtil
.
INSTANCE
.
isWifiConnected
(
applicationContext
)
)
{
// 网络可用&&wifi没有连接 kotlin 写法
// AlertDialog.Builder(ActivityStackManager.getInstance().getTopActivity())
// .setTitle("温馨提示")
// .setMessage("当前处于移动网络,播放视频会消耗流量,确定播放?")
// .setPositiveButton("观看视频") { d, _ ->
// d.dismiss()
// ad.showVideo(ActivityStackManager.getInstance().getTopActivity()) {
// block()
// }
// }
// .setNegativeButton("取消") { d, _ ->
// d.dismiss()
// }.create().show()
// return
new
AlertDialog
.
Builder
(
ActivityStackManager
.
getInstance
().
getTopActivity
())
.
setTitle
(
"温馨提示"
)
.
setMessage
(
"当前处于移动网络,播放视频会消耗流量,确定播放?"
)
.
setPositiveButton
(
"观看视频"
,
new
DialogInterface
.
OnClickListener
()
{
@Override
public
void
onClick
(
DialogInterface
dialog
,
int
which
)
{
//
ad.showVideo(ActivityStackManager.getInstance().getTopActivity(), new ToutiaoAD.OnVideoCloseCallBack() {
//
@Override
//
public void onClose() {
//
function0.invoke();
//
}
//
});
ad
.
showVideo
(
ActivityStackManager
.
getInstance
().
getTopActivity
(),
new
ToutiaoAD
.
OnVideoCloseCallBack
()
{
@Override
public
void
onClose
()
{
function0
.
invoke
();
}
});
}
}).
setNegativeButton
(
"取消"
,
new
DialogInterface
.
OnClickListener
()
{
@Override
...
...
@@ -80,40 +64,40 @@ public class ReaderManager {
@Override
public
void
getReaderScreenAd
(
@NotNull
View
view
,
@NotNull
OnAdViewReceiver
receiver
,
@Nullable
Dialog
dialog
)
{
//
ad.loadAD(applicationContext, receiver, 320, 260, new ToutiaoAD.OnClickListener() {
//
@Override
//
public void onClick() {
//
dialog.dismiss();
//
}
//
});
ad
.
loadAD
(
applicationContext
,
receiver
,
320
,
260
,
new
ToutiaoAD
.
OnClickListener
()
{
@Override
public
void
onClick
()
{
dialog
.
dismiss
();
}
});
}
@Override
public
void
getReaderPageAd
(
@NotNull
OnAdViewReceiver
receiver
)
{
//
ad.loadAD(applicationContext, receiver, DensityUtil.px2dip(applicationContext, ScreenUtils.getScreenWidth(applicationContext) - DensityUtil.dip2px(applicationContext, 30f)), DensityUtil.px2dip(applicationContext, 854f), null);
ad
.
loadAD
(
applicationContext
,
receiver
,
DensityUtil
.
px2dip
(
applicationContext
,
ScreenUtils
.
getScreenWidth
(
applicationContext
)
-
DensityUtil
.
dip2px
(
applicationContext
,
30
f
)),
DensityUtil
.
px2dip
(
applicationContext
,
854
f
),
null
);
}
@Override
public
void
getReaderDialogAd
(
@NotNull
View
view
,
@NotNull
OnAdViewReceiver
receiver
,
@Nullable
Dialog
dialog
)
{
//
ad.loadVideoAd(ActivityStackManager.getInstance().getTopActivity(), receiver);
ad
.
loadVideoAd
(
ActivityStackManager
.
getInstance
().
getTopActivity
(),
receiver
);
}
});
ChineseAllReaderApplication
.
Companion
.
setOnReadCallBack
(
new
OnReadCallBack
()
{
/**
* "time" : 阅读总时长
* "bookName" : 书名
* "chapterName" : 当前章节名
* "pageInChapter" : 当前章节内阅读页码
* "chapterTotalPages" : 当前章节总页数
*/
@Override
public
void
onReceive
(
@NotNull
Map
<
String
,
?>
map
)
{
Object
time
=
map
.
get
(
"time"
);
ToastUtil
.
toast
(
time
+
""
);
}
},
30
*
1000
);
//间隔30秒 回调一次 间隔任意设置
//
ChineseAllReaderApplication.Companion.setOnReadCallBack(new OnReadCallBack() {
//
/**
//
* "time" : 阅读总时长
//
* "bookName" : 书名
//
* "chapterName" : 当前章节名
//
* "pageInChapter" : 当前章节内阅读页码
//
* "chapterTotalPages" : 当前章节总页数
//
*/
//
@Override
//
public void onReceive(@NotNull Map<String, ?> map) {
//
Object time = map.get("time");
////
ToastUtil.toast(time + "");
//
//
}
//
}, 30 * 1000);//间隔30秒 回调一次 间隔任意设置
}
}
GoodMoney/app/src/main/java/com/mints/goodmoney/manager/ToutiaoAD.java
View file @
cb20f0ca
This diff is collapsed.
Click to expand it.
GoodMoney/app/src/main/java/com/mints/goodmoney/ui/activitys/WrapperActivity.kt
View file @
cb20f0ca
...
...
@@ -3,12 +3,15 @@ package com.mints.goodmoney.ui.activitys
import
android.os.Bundle
import
android.view.View
import
androidx.fragment.app.Fragment
import
com.fly.scenemodule.fragment.IdiomFragment
import
androidx.fragment.app.FragmentTransaction
import
com.chineseall.reader17ksdk.feature.main.bookshop.wellchosen.WellChosenFragment
import
com.mints.goodmoney.R
import
com.mints.goodmoney.common.Constant
import
com.mints.goodmoney.ui.activitys.base.BaseActivity
import
com.mints.goodmoney.ui.fragment.*
import
com.mints.goodmoney.ui.widgets.seekbar.BubbleUtils
import
com.mints.goodmoney.ui.fragment.FriendsFragment
import
com.mints.goodmoney.ui.fragment.KuYinYueFragment
import
com.mints.goodmoney.ui.fragment.WzFragment
import
dagger.hilt.android.AndroidEntryPoint
import
kotlinx.android.synthetic.main.activity_wrapper.*
import
kotlinx.android.synthetic.main.header_layout.*
...
...
@@ -17,6 +20,7 @@ import kotlinx.android.synthetic.main.header_layout.*
* 作者:孟崔广
* 时间:2020/12/10 12:39
*/
@AndroidEntryPoint
class
WrapperActivity
:
BaseActivity
(),
View
.
OnClickListener
{
private
var
wrapperType
=
Constant
.
WRAPPER_TYPE_NEWS
...
...
@@ -50,11 +54,28 @@ class WrapperActivity : BaseActivity(), View.OnClickListener {
var
currentFragment
:
Fragment
?
when
(
wrapperType
)
{
Constant
.
WRAPPER_TYPE_NEWS
->
{
layoutWrapper
.
visibility
=
View
.
INVISIBLE
val
layoutParams
=
layoutWrapper
.
layoutParams
layoutParams
.
height
=
BubbleUtils
.
dp2px
(
30
)
tv_title
.
text
=
"新闻"
currentFragment
=
RsNewsFragment
()
// layoutWrapper.visibility = View.INVISIBLE
// val layoutParams = layoutWrapper.layoutParams
// layoutParams.height = BubbleUtils.dp2px(30)
// tv_title.text = "新闻"
// currentFragment = RsNewsFragment()
// val wellChosenFragment = WellChosenFragment("home")
// val transaction: FragmentTransaction = supportFragmentManager.beginTransaction()
// transaction.add(R.id.flWrapper, wellChosenFragment, WellChosenFragment::class.java.simpleName)
// transaction.show(wellChosenFragment)
// transaction.commitAllowingStateLoss()
// ViewPager viewPager = findViewById(R.id.view_pager);
// TabLayout tabLayout = findViewById(R.id.tabs);
//
// viewPager.setAdapter(new MyViewPageAdapter(getSupportFragmentManager()));
// tabLayout.setupWithViewPager(viewPager);
val
wellChosenFragment
=
WellChosenFragment
(
"home"
)
val
transaction
=
supportFragmentManager
.
beginTransaction
()
transaction
.
add
(
R
.
id
.
flWrapper
,
wellChosenFragment
,
WellChosenFragment
::
class
.
java
.
toString
())
transaction
.
show
(
wellChosenFragment
)
transaction
.
commitAllowingStateLoss
()
}
Constant
.
WRAPPER_TYPE_FRIENDS
->
{
tv_title
.
text
=
"瓜分百万现金福利"
...
...
@@ -74,11 +95,11 @@ class WrapperActivity : BaseActivity(), View.OnClickListener {
}
}
if
(!
currentFragment
.
isAdded
)
{
// 提交事务
supportFragmentManager
.
beginTransaction
()
.
add
(
R
.
id
.
flWrapper
,
currentFragment
).
commitAllowingStateLoss
()
}
//
if (!currentFragment.isAdded) {
//
// 提交事务
//
supportFragmentManager.beginTransaction()
// .add(R.id.flWrapper, currentFragment,currentFragment.tag
).commitAllowingStateLoss()
//
}
}
private
fun
initListener
()
{
...
...
GoodMoney/app/src/main/java/com/mints/goodmoney/ui/fragment/ReaderFragment.kt
0 → 100644
View file @
cb20f0ca
package
com.mints.goodmoney.ui.fragment
import
androidx.fragment.app.FragmentTransaction
import
com.chineseall.reader17ksdk.feature.main.bookshop.wellchosen.WellChosenFragment
import
com.mints.goodmoney.R
import
com.mints.goodmoney.mvp.presenters.RsNewsPresenter
import
com.mints.goodmoney.mvp.views.RsNewsView
import
com.mints.goodmoney.ui.fragment.base.LazyLoadBaseFragment
/**
* 描述:听读
* 作者:孟崔广
* 时间:2020/12/9 10:55
*/
class
ReaderFragment
:
LazyLoadBaseFragment
(),
RsNewsView
{
private
val
wellChosenFragment
by
lazy
{
WellChosenFragment
(
"home"
)
}
private
val
rsNewsPresenter
by
lazy
{
RsNewsPresenter
()
}
override
fun
getContentViewLayoutID
()
=
R
.
layout
.
fragment_main_zy
override
fun
initViewsAndEvents
()
{}
override
fun
onFragmentFirstVisible
()
{
rsNewsPresenter
.
attachView
(
this
)
val
transaction
:
FragmentTransaction
=
supportFragmentManager
.
beginTransaction
()
transaction
.
add
(
R
.
id
.
fragment
,
wellChosenFragment
,
ReaderFragment
::
class
.
java
.
simpleName
)
transaction
.
show
(
wellChosenFragment
)
transaction
.
commitAllowingStateLoss
()
}
override
fun
onDestroy
()
{
super
.
onDestroy
()
rsNewsPresenter
.
detachView
()
}
override
fun
readSecondsSuc
(
coin
:
Int
,
video
:
Int
,
supr
:
Int
)
{
}
}
\ 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