Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
A
android_street
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_street
Commits
072dc40d
Commit
072dc40d
authored
Jul 29, 2021
by
mengcuiguang2
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
添加广告,联调微信登录
parent
81959caf
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
41 additions
and
19 deletions
+41
-19
MyFragment.kt
app/src/main/java/com/mints/street/main/my/MyFragment.kt
+1
-1
OpenvipActivity.kt
...src/main/java/com/mints/street/main/my/OpenvipActivity.kt
+3
-1
SplashActivity.kt
app/src/main/java/com/mints/street/splash/SplashActivity.kt
+13
-14
splash_bg.xml
app/src/main/res/drawable/splash_bg.xml
+9
-2
activity_splash.xml
app/src/main/res/layout/activity_splash.xml
+14
-1
styles.xml
library_base/src/main/res/values/styles.xml
+1
-0
No files found.
app/src/main/java/com/mints/street/main/my/MyFragment.kt
View file @
072dc40d
...
...
@@ -101,7 +101,7 @@ class MyFragment : BaseFragment<FragmentMyBinding, MyViewModel>(), OnRefreshList
loginDialog
.
setListener
(
object
:
WxLoginDialog
.
WxLoginListener
{
override
fun
loginSuc
(
wxInfo
:
String
)
{
if
(!
isHidden
)
{
//当前fragment正在显示调用微信登陆接口
viewModel
.
wechatlogin
(
JsonUtil
.
toJson
(
wxInfo
)
)
viewModel
.
wechatlogin
(
wxInfo
)
}
}
})
...
...
app/src/main/java/com/mints/street/main/my/OpenvipActivity.kt
View file @
072dc40d
package
com.mints.street.main.my
import
android.annotation.SuppressLint
import
android.app.Dialog
import
android.graphics.Color
import
android.os.Bundle
...
...
@@ -80,11 +81,12 @@ class OpenvipActivity : BaseActivity<ActivityOpenvipBinding, OpenvipViewModel>()
loginDialog
.
setListener
(
object
:
WxLoginDialog
.
WxLoginListener
{
override
fun
loginSuc
(
wxInfo
:
String
)
{
viewModel
.
wechatlogin
(
JsonUtil
.
toJson
(
wxInfo
)
)
viewModel
.
wechatlogin
(
wxInfo
)
}
})
}
@SuppressLint
(
"InflateParams"
)
private
fun
initView
()
{
val
layoutInflater
=
layoutInflater
...
...
app/src/main/java/com/mints/street/splash/SplashActivity.kt
View file @
072dc40d
...
...
@@ -38,7 +38,6 @@ class SplashActivity : BaseActivity<ActivitySplashBinding, SplashViewModel>() {
private
var
msplash
:
FrameLayout
?
=
null
private
var
mTTSplashAd
:
TTSplashAd
?
=
null
private
val
AD_TIME_OUT
=
4000
private
var
onPaused
=
false
//是否强制跳转到主页面
private
var
mForceGoMain
=
false
...
...
@@ -49,6 +48,8 @@ class SplashActivity : BaseActivity<ActivitySplashBinding, SplashViewModel>() {
override
fun
initVariableId
()
=
BR
.
viewModel
override
fun
getStatusBarHeightView
()=
binding
.
rlSplashRoot
override
fun
initData
()
{
super
.
initData
()
//点击Home键后再点击App图标,会回到原来的界面。今天重新打包后,但是在Debug模式下,一切正常,
...
...
@@ -58,7 +59,7 @@ class SplashActivity : BaseActivity<ActivitySplashBinding, SplashViewModel>() {
return
}
StatusBarUtil
.
immersive
(
this
)
//
StatusBarUtil.immersive(this)
//校验App签名
checkAppSign
()
...
...
@@ -70,10 +71,6 @@ class SplashActivity : BaseActivity<ActivitySplashBinding, SplashViewModel>() {
if
(
mForceGoMain
)
{
goToMainActivity
()
}
if
(
onPaused
)
{
// 这种情况下,百度开屏广告不能在onAdDismiss中跳转,需要自己在onResume中跳转主页。
goToMainActivity
()
}
}
super
.
onResume
()
...
...
@@ -81,7 +78,6 @@ class SplashActivity : BaseActivity<ActivitySplashBinding, SplashViewModel>() {
override
fun
onPause
()
{
super
.
onPause
()
onPaused
=
true
}
override
fun
onStop
()
{
...
...
@@ -106,7 +102,16 @@ class SplashActivity : BaseActivity<ActivitySplashBinding, SplashViewModel>() {
if
(!
deviceInfo
.
signInfo
)
{
finish
()
}
else
{
showPowerDialog
()
// showPowerDialog()
isClickAgree
=
true
try
{
msplash
=
findViewById
(
R
.
id
.
fl_splash
)
//加载开屏广告
loadSplashAd
()
// goToMainActivity()
}
catch
(
e
:
Exception
)
{
goToMainActivity
()
}
}
}
...
...
@@ -130,8 +135,6 @@ class SplashActivity : BaseActivity<ActivitySplashBinding, SplashViewModel>() {
val
ttNetworkRequestInfo
:
TTNetworkRequestInfo
//穿山甲兜底
ttNetworkRequestInfo
=
PangleNetworkRequestInfo
(
CsjGroMoreManager
.
TT_AD_APPID
,
CsjGroMoreManager
.
AD_CSJ_SPLASH_ID
)
//step4:请求广告,调用开屏广告异步请求接口,对请求回调的广告作渲染处理
mTTSplashAd
?.
loadAd
(
adSlot
,
ttNetworkRequestInfo
,
object
:
TTSplashAdLoadCallback
{
// mTTSplashAd.loadAd(adSlot, new TTSplashAdLoadCallback() {
...
...
@@ -161,10 +164,6 @@ class SplashActivity : BaseActivity<ActivitySplashBinding, SplashViewModel>() {
}
override
fun
onAdDismiss
()
{
if
(
onPaused
)
{
// 这种情况下,百度开屏广告不能在onAdDismiss中跳转,需要在onResume中跳转主页。
return
}
goToMainActivity
()
}
}
...
...
app/src/main/res/drawable/splash_bg.xml
View file @
072dc40d
<?xml version="1.0" encoding="utf-8"?>
<layer-list
xmlns:android=
"http://schemas.android.com/apk/res/android"
>
<item
>
<item>
<shape
android:shape=
"rectangle"
>
<solid
android:color=
"@color/white"
/>
</shape>
</item>
<item
android:bottom=
"20dp"
>
<bitmap
android:src=
"@drawable/bg_splash"
/>
android:gravity=
"bottom|center_horizontal"
android:src=
"@mipmap/ic_launcher_main"
/>
</item>
</layer-list>
app/src/main/res/layout/activity_splash.xml
View file @
072dc40d
<?xml version="1.0" encoding="utf-8"?>
<layout
xmlns:android=
"http://schemas.android.com/apk/res/android"
>
<RelativeLayout
android:id=
"@+id/rl_splash_root"
android:layout_width=
"match_parent"
android:background=
"#061b45"
android:layout_height=
"match_parent"
>
<ImageView
android:layout_centerInParent=
"true"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:src=
"@drawable/bg_splash"
/>
<FrameLayout
android:id=
"@+id/fl_splash"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
>
</FrameLayout>
<
data
>
<
/RelativeLayout
>
<data>
<variable
name=
"viewModel"
type=
"com.mints.street.splash.SplashViewModel"
/>
...
...
library_base/src/main/res/values/styles.xml
View file @
072dc40d
...
...
@@ -21,6 +21,7 @@
<style
name=
"NormalSplash"
parent=
"Theme.AppCompat.NoActionBar"
>
<item
name=
"android:windowBackground"
>
@drawable/splash_bg
</item>
<item
name=
"android:windowNoTitle"
>
true
</item>
<item
name=
"android:colorPrimaryDark"
>
@color/white
</item>
<item
name=
"android:windowContentOverlay"
>
@null
</item>
</style>
<style
name=
"AppTheme.NoneTranslucent"
parent=
"AppTheme.Base"
>
...
...
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