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
782a1cf3
Commit
782a1cf3
authored
Dec 28, 2020
by
jyx
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
代码优化
parent
94b1fd50
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
87 additions
and
65 deletions
+87
-65
PreLoadExpressManager.kt
...a/com/mints/goodmoney/ad/express/PreLoadExpressManager.kt
+33
-19
TTPreLoadExpressManager.java
...m/mints/goodmoney/ad/express/TTPreLoadExpressManager.java
+32
-19
YlhPreLoadExpressManager.kt
...om/mints/goodmoney/ad/express/YlhPreLoadExpressManager.kt
+19
-22
AwardActivity.kt
...in/java/com/mints/goodmoney/ui/activitys/AwardActivity.kt
+1
-4
activity_drawcash.xml
GoodMoney/app/src/main/res/layout/activity_drawcash.xml
+2
-1
No files found.
GoodMoney/app/src/main/java/com/mints/goodmoney/ad/express/PreLoadExpressManager.kt
View file @
782a1cf3
package
com.mints.goodmoney.ad.express
import
android.widget.FrameLayout
import
com.mints.goodmoney.MintsApplication
import
com.qq.e.ads.nativ.NativeExpressADView
object
PreLoadExpressManager
{
object
PreLoadExpressManager
:
TTADLoadSuccessListener
,
YLHADLoadSuccessListener
{
// 是否是穿山甲信息流
@Volatile
...
...
@@ -11,39 +13,51 @@ object PreLoadExpressManager {
@Volatile
private
var
mAdFrameLayout
:
FrameLayout
?
=
null
// init {
// YlhPreLoadExpressManager.setListener(this)
// }
init
{
mAdFrameLayout
=
FrameLayout
(
MintsApplication
.
getContext
())
YlhPreLoadExpressManager
.
setListener
(
this
)
TTPreLoadExpressManager
.
getInstance
().
setListener
(
this
)
}
fun
loadADFrameLayout
()
{
mAdFrameLayout
?.
removeAllViews
()
if
(
isTTExpressAd
)
{
TTPreLoadExpressManager
.
getInstance
().
loadTtFrameLayout
()
TTPreLoadExpressManager
.
getInstance
().
loadTtFrameLayout
(
mAdFrameLayout
)
}
else
{
YlhPreLoadExpressManager
.
loadYlhFrameLayout
()
}
}
fun
getADFrameLayout
():
FrameLayout
?
{
mAdFrameLayout
=
if
(
isTTExpressAd
)
{
TTPreLoadExpressManager
.
getInstance
().
ttFrameLayout
}
else
{
YlhPreLoadExpressManager
.
getYlhFrameLayout
()
}
//
mAdFrameLayout = if (isTTExpressAd) {
//
TTPreLoadExpressManager.getInstance().ttFrameLayout
//
} else {
//
YlhPreLoadExpressManager.getYlhFrameLayout()
//
}
isTTExpressAd
=
!
isTTExpressAd
return
mAdFrameLayout
}
// override fun onTTAdLoadSuc(adFrameLayout: FrameLayout?) {
// mAdFrameLayout = adFrameLayout
// }
//
// override fun onYlhAdLoadSuc(adFrameLayout: FrameLayout?) {
// mAdFrameLayout = adFrameLayout
// }
fun
onDestroy
()
{
TTPreLoadExpressManager
.
getInstance
().
onDestroy
()
YlhPreLoadExpressManager
.
onDestroy
()
}
override
fun
onTTAdLoadSuc
(
adFrameLayout
:
FrameLayout
?)
{
mAdFrameLayout
=
adFrameLayout
}
override
fun
onYlhAdLoadSuc
(
adFrameLayout
:
NativeExpressADView
?)
{
mAdFrameLayout
?.
addView
(
adFrameLayout
)
}
}
interface
ADLoadSuccessListener
{
interface
TT
ADLoadSuccessListener
{
fun
onTTAdLoadSuc
(
adFrameLayout
:
FrameLayout
?)
fun
onYlhAdLoadSuc
(
adFrameLayout
:
FrameLayout
?)
}
interface
YLHADLoadSuccessListener
{
fun
onYlhAdLoadSuc
(
view
:
NativeExpressADView
?)
}
\ No newline at end of file
GoodMoney/app/src/main/java/com/mints/goodmoney/ad/express/TTPreLoadExpressManager.java
View file @
782a1cf3
package
com
.
mints
.
goodmoney
.
ad
.
express
;
import
android.content.Context
;
import
android.widget.FrameLayout
;
import
com.mints.goodmoney.MintsApplication
;
import
com.mints.goodmoney.manager.TTNativeExpressManager
;
import
com.mints.goodmoney.manager.TtCsjAdManager
;
...
...
@@ -11,7 +9,7 @@ public class TTPreLoadExpressManager {
private
static
TTPreLoadExpressManager
_inst
;
private
FrameLayout
ttFrameLayout
;
//
private FrameLayout ttFrameLayout;
private
TTNativeExpressManager
ttNativeExpressManager
;
public
static
TTPreLoadExpressManager
getInstance
()
{
...
...
@@ -33,32 +31,47 @@ public class TTPreLoadExpressManager {
}
}
public
FrameLayout
getTtFrameLayout
()
{
return
ttFrameLayout
;
// public FrameLayout getTtFrameLayout() {
// return ttFrameLayout;
// }
private
TTADLoadSuccessListener
mADLoadSuccessListener
;
public
void
setListener
(
TTADLoadSuccessListener
adLoadSuccessListener
)
{
mADLoadSuccessListener
=
adLoadSuccessListener
;
}
/**
* 预加载 信息流
*/
public
void
loadTtFrameLayout
()
{
public
void
loadTtFrameLayout
(
FrameLayout
adFrameLayout
)
{
init
();
Context
context
=
MintsApplication
.
getContext
();
ttFrameLayout
=
null
;
//
Context context = MintsApplication.getContext();
//
ttFrameLayout = null;
try
{
ttFrameLayout
=
new
FrameLayout
(
context
);
ttNativeExpressManager
.
getNativeExpressInit
(
TtCsjAdManager
.
TT_AD_NATIVEEXPRESS_AWARD
,
tt
FrameLayout
,
310
,
0
);
// FrameLayout
ttFrameLayout = new FrameLayout(context);
ttNativeExpressManager
.
getNativeExpressInit
(
TtCsjAdManager
.
TT_AD_NATIVEEXPRESS_AWARD
,
ad
FrameLayout
,
310
,
0
);
ttNativeExpressManager
.
setTTNativeExpressManagerListener
(
view
->
{
if
(
view
==
null
)
{
ttFrameLayout
=
null
;
}
else
{
// if (view == null) {
// ttFrameLayout = null;
// } else {
//
// try {
// ttFrameLayout = view;
// } catch (Exception e) {
// e.printStackTrace();
// ttFrameLayout = null;
// }
// }
try
{
ttFrameLayout
=
view
;
if
(
view
!=
null
)
{
if
(
mADLoadSuccessListener
!=
null
)
{
mADLoadSuccessListener
.
onTTAdLoadSuc
(
view
);
}
}
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
ttFrameLayout
=
null
;
}
}
});
...
...
GoodMoney/app/src/main/java/com/mints/goodmoney/ad/express/YlhPreLoadExpressManager.kt
View file @
782a1cf3
package
com.mints.goodmoney.ad.express
import
android.widget.FrameLayout
import
com.mints.goodmoney.MintsApplication
import
com.mints.goodmoney.manager.YlhAdManager
import
com.mints.goodmoney.utils.LogUtil
import
com.qq.e.ads.nativ.ADSize
import
com.qq.e.ads.nativ.NativeExpressAD
import
com.qq.e.ads.nativ.NativeExpressADView
...
...
@@ -11,27 +9,27 @@ import com.qq.e.comm.util.AdError
object
YlhPreLoadExpressManager
{
private
var
ylhFrameLayout
:
FrameLayout
?
=
null
//
private var ylhFrameLayout: FrameLayout? = null
private
var
nativeExpressAD
:
NativeExpressAD
?
=
null
private
var
nativeExpressADView
:
NativeExpressADView
?
=
null
// private var mADLoadSuccessListener: ADLoadSuccessListener? = null
//
// fun setListener(adLoadSuccessListener: ADLoadSuccessListener) {
// mADLoadSuccessListener = adLoadSuccessListener
// }
private
var
mADLoadSuccessListener
:
YLHADLoadSuccessListener
?
=
null
fun
getYlhFrameLayout
():
FrameLayout
?
{
return
ylhFrameLayout
fun
setListener
(
adLoadSuccessListener
:
YLHADLoadSuccessListener
?)
{
mADLoadSuccessListener
=
adLoadSuccessListener
}
// fun getYlhFrameLayout(): FrameLayout? {
// return ylhFrameLayout
// }
fun
loadYlhFrameLayout
()
{
val
context
=
MintsApplication
.
getContext
()
//
val context = MintsApplication.getContext()
try
{
ylhFrameLayout
=
FrameLayout
(
context
)
//
ylhFrameLayout = FrameLayout(context)
nativeExpressAD
=
NativeExpressAD
(
MintsApplication
.
getContext
(),
ADSize
(
320
,
ADSize
.
AUTO_HEIGHT
),
YlhAdManager
.
YLH_AD_NATIVEEXPRESS_AWARD
,
object
:
NativeExpressAD
.
NativeExpressADListener
{
nativeExpressAD
=
NativeExpressAD
(
MintsApplication
.
getContext
(),
ADSize
(
ADSize
.
FULL_WIDTH
,
ADSize
.
AUTO_HEIGHT
),
YlhAdManager
.
YLH_AD_NATIVEEXPRESS_AWARD
,
object
:
NativeExpressAD
.
NativeExpressADListener
{
override
fun
onNoAD
(
p0
:
AdError
?)
{
}
...
...
@@ -55,17 +53,16 @@ object YlhPreLoadExpressManager {
nativeExpressADView
?.
destroy
()
nativeExpressADView
=
p0
?.
get
(
0
)
if
(
ylhFrameLayout
!!
.
childCount
>
0
)
{
ylhFrameLayout
!!
.
removeAllViews
()
}
// val frameLayout = FrameLayout(context)
// mADLoadSuccessListener?.onYlhAdLoadSuc(frameLayout)
//
// if (ylhFrameLayout!!.childCount > 0) {
// ylhFrameLayout!!.removeAllViews()
// }
// 广告可见才会产生曝光,否则将无法产生收益。
ylhFrameLayout
!!
.
addView
(
nativeExpressADView
)
nativeExpressADView
!!
.
render
()
mADLoadSuccessListener
?.
onYlhAdLoadSuc
(
nativeExpressADView
)
// ylhFrameLayout!!.addView(nativeExpressADView)
nativeExpressADView
?.
render
()
}
override
fun
onADOpenOverlay
(
p0
:
NativeExpressADView
?)
{
...
...
GoodMoney/app/src/main/java/com/mints/goodmoney/ui/activitys/AwardActivity.kt
View file @
782a1cf3
...
...
@@ -10,8 +10,6 @@ import com.mints.goodmoney.ad.video.VedioAdingManager
import
com.mints.goodmoney.common.AppConfig
import
com.mints.goodmoney.common.Constant
import
com.mints.goodmoney.common.DeviceInfo.Companion.instance
import
com.mints.goodmoney.ad.express.TTPreLoadExpressManager
import
com.mints.goodmoney.ad.express.YlhPreLoadExpressManager
import
com.mints.goodmoney.manager.UserManager
import
com.mints.goodmoney.mvp.model.VedioAdingBean
import
com.mints.goodmoney.mvp.presenters.AwardPresenter
...
...
@@ -335,9 +333,8 @@ class AwardActivity : BaseActivity(), AwardView, View.OnClickListener {
}
SoundPoolUtil
.
getInstance
().
onDestory
()
PreLoadExpressManager
.
onDestroy
()
TTPreLoadExpressManager
.
getInstance
().
onDestroy
()
YlhPreLoadExpressManager
.
onDestroy
()
flAwardAd
?.
removeAllViews
()
vedioAdingManager
.
setVedioAdingListener
(
null
)
vedioAdingManager
.
onDestory
()
...
...
GoodMoney/app/src/main/res/layout/activity_drawcash.xml
View file @
782a1cf3
...
...
@@ -114,7 +114,8 @@
android:textSize=
"18sp"
android:textStyle=
"bold"
app:layout_constraintBottom_toBottomOf=
"@+id/textView4"
app:layout_constraintStart_toStartOf=
"@+id/tvDrawWechat"
/>
app:layout_constraintStart_toStartOf=
"@+id/tvDrawWechat"
app:layout_constraintTop_toTopOf=
"@id/textView4"
/>
<TextView
android:id=
"@+id/textView4"
...
...
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