Compare commits
2 Commits
e36722ced8
...
08a09d8cf3
| Author | SHA1 | Date |
|---|---|---|
|
|
08a09d8cf3 | |
|
|
75a7355665 |
|
|
@ -9,7 +9,8 @@ import androidx.activity.viewModels
|
|||
import androidx.core.view.ViewCompat
|
||||
import androidx.core.view.WindowInsetsCompat
|
||||
import androidx.core.view.updatePadding
|
||||
import com.ama.core.architecture.appBase.AppViewsActivity
|
||||
import androidx.lifecycle.lifecycleScope
|
||||
import com.ama.core.architecture.appBase.AppViewsEmptyViewModelActivity
|
||||
import com.ama.core.architecture.util.AndroidUtil
|
||||
import com.ama.core.architecture.util.eventbus.NotifyMan
|
||||
import com.gamedog.vididin.VidiConst
|
||||
|
|
@ -17,17 +18,18 @@ import com.gamedog.vididin.VididinEvents
|
|||
import com.gamedog.vididin.beans.WatchAdNotifyBean
|
||||
import com.gamedog.vididin.main.interfaces.OnTabStyleListener
|
||||
import com.gamedog.vididin.manager.WithdrawItemBean
|
||||
import com.remax.bill.ads.AdResult
|
||||
import com.remax.bill.ads.ext.AdShowExt
|
||||
import dagger.hilt.android.AndroidEntryPoint
|
||||
import kotlinx.coroutines.launch
|
||||
import kotlin.getValue
|
||||
import com.vididin.real.money.game.databinding.ActivityWatchAdBinding as ViewBinding
|
||||
import com.gamedog.vididin.main.MainUiState as UiState
|
||||
import com.gamedog.vididin.main.MainViewModel as ViewModel
|
||||
|
||||
|
||||
|
||||
@AndroidEntryPoint
|
||||
class WatchAdActivity : AppViewsActivity<ViewBinding, UiState, ViewModel>(), OnTabStyleListener {
|
||||
class WatchAdActivity : AppViewsEmptyViewModelActivity<ViewBinding>(), OnTabStyleListener {
|
||||
|
||||
override val mViewModel: ViewModel by viewModels()
|
||||
override fun inflateViewBinding(inflater: LayoutInflater) = ViewBinding.inflate(inflater)
|
||||
|
||||
|
||||
|
|
@ -150,15 +152,35 @@ class WatchAdActivity : AppViewsActivity<ViewBinding, UiState, ViewModel>(), OnT
|
|||
//TODO("Not yet implemented")
|
||||
}
|
||||
|
||||
override fun ViewBinding.onUiStateCollect(uiState: UiState) {
|
||||
//TODO("Not yet implemented")
|
||||
}
|
||||
|
||||
override fun onTabIsDarkFont(isDarkFont: Boolean) {
|
||||
//TODO("Not yet implemented")
|
||||
}
|
||||
|
||||
|
||||
private fun showVideoAd(callback: () -> Unit) {
|
||||
lifecycleScope.launch {
|
||||
try {
|
||||
when (val result = AdShowExt.showInterstitialAd(this@WatchAdActivity)) {
|
||||
is AdResult.Success -> {
|
||||
callback.invoke()
|
||||
}
|
||||
|
||||
is AdResult.Failure -> {
|
||||
callback.invoke()
|
||||
}
|
||||
|
||||
AdResult.Loading -> {
|
||||
}
|
||||
}
|
||||
|
||||
} catch (e: Exception) {
|
||||
callback.invoke()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
companion object {
|
||||
private val KEY_TASK_TYPE = "KEY_TASK_TYPE"
|
||||
private val KEY_TASK_DATA = "KEY_TASK_DATA"
|
||||
|
|
|
|||
|
|
@ -15,6 +15,7 @@ import androidx.viewpager2.widget.ViewPager2
|
|||
import android.view.LayoutInflater
|
||||
import androidx.activity.addCallback
|
||||
import androidx.activity.viewModels
|
||||
import androidx.lifecycle.lifecycleScope
|
||||
import com.ama.core.architecture.appBase.AppViewsActivity
|
||||
import com.ama.core.architecture.appBase.OnFragmentBackgroundListener
|
||||
import com.ama.core.architecture.ext.toast
|
||||
|
|
@ -27,11 +28,13 @@ import com.gamedog.vididin.VidiConst
|
|||
import com.gamedog.vididin.VididinEvents
|
||||
import com.gamedog.vididin.adapter.MainTabsAdapter
|
||||
import com.gamedog.vididin.adapter.MainViewPagerAdapter
|
||||
import com.gamedog.vididin.features.winrecords.WinRecordsActivity
|
||||
import com.gamedog.vididin.main.fragments.task.DailySignSuccessDialog
|
||||
import com.gamedog.vididin.main.interfaces.OnTabStyleListener
|
||||
import com.gamedog.vididin.manager.DateChangeReceiver
|
||||
import com.remax.bill.ads.AdResult
|
||||
import com.remax.bill.ads.ext.AdShowExt
|
||||
import dagger.hilt.android.AndroidEntryPoint
|
||||
import kotlinx.coroutines.launch
|
||||
import kotlin.getValue
|
||||
import com.vididin.real.money.game.databinding.ActivityMainBinding as ViewBinding
|
||||
import com.gamedog.vididin.main.MainUiState as UiState
|
||||
|
|
@ -53,22 +56,11 @@ class MainActivity : AppViewsActivity<ViewBinding, UiState, ViewModel>(), OnTabS
|
|||
override fun inflateViewBinding(inflater: LayoutInflater) = ViewBinding.inflate(inflater)
|
||||
|
||||
override fun ViewBinding.initWindowInsets() {
|
||||
ViewCompat.setOnApplyWindowInsetsListener(magicIndicator) { v, insets ->
|
||||
val systemBars =
|
||||
insets.getInsets(WindowInsetsCompat.Type.navigationBars() or WindowInsetsCompat.Type.displayCutout())
|
||||
v.setPadding(
|
||||
systemBars.left,
|
||||
36,
|
||||
systemBars.right,
|
||||
systemBars.bottom + 36
|
||||
)
|
||||
insets
|
||||
}
|
||||
setImmerseRootView(adContainer)
|
||||
}
|
||||
|
||||
|
||||
override fun ViewBinding.initViews() {
|
||||
content.foreground.alpha = 0
|
||||
navigatorAdapter = MainTabsAdapter(
|
||||
this@MainActivity, viewPager2, fragmentStateAdapter, magicIndicator
|
||||
)
|
||||
|
|
@ -132,7 +124,7 @@ class MainActivity : AppViewsActivity<ViewBinding, UiState, ViewModel>(), OnTabS
|
|||
}
|
||||
|
||||
override fun ViewBinding.initObservers() {
|
||||
|
||||
loadBannerAd()
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -159,6 +151,26 @@ class MainActivity : AppViewsActivity<ViewBinding, UiState, ViewModel>(), OnTabS
|
|||
binding.viewPager2.setCurrentItem(itemIndex, false)
|
||||
}
|
||||
|
||||
private fun loadBannerAd() {
|
||||
lifecycleScope.launch {
|
||||
try {
|
||||
when (AdShowExt.showBannerAd(this@MainActivity, binding.adContainer)) {
|
||||
is AdResult.Success<*> -> {
|
||||
|
||||
}
|
||||
|
||||
is AdResult.Failure -> {
|
||||
|
||||
}
|
||||
|
||||
AdResult.Loading -> {
|
||||
}
|
||||
}
|
||||
} catch (e: Exception) {
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
companion object {
|
||||
internal fun startActivity(activity: Activity) {
|
||||
|
|
|
|||
|
|
@ -81,10 +81,8 @@ class HomeFragment : AppViewsFragment<ViewBinding, UiState, ViewModel>(), OnSwit
|
|||
mWatchedVideoTotal ++
|
||||
|
||||
if (mWatchedVideoTotal % VIDEO_NUM_GAP_FOR_AD == 0) {
|
||||
lifecycleScope.launch {
|
||||
showInterstitialAd {
|
||||
// TODO - need do anything for ad show
|
||||
}
|
||||
showInterstitialAd {
|
||||
// TODO - need do anything for ad show
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -141,20 +139,6 @@ class HomeFragment : AppViewsFragment<ViewBinding, UiState, ViewModel>(), OnSwit
|
|||
}
|
||||
|
||||
override fun ViewBinding.onUiStateCollect(uiState: UiState) {
|
||||
/*val videoList = mutableListOf<YoutubeVideo>()
|
||||
if (uiState.playLists == null) {
|
||||
videoList.add(YoutubeVideo("TegalxCm1LA", "111", "bbbbb"))
|
||||
videoList.add(YoutubeVideo("KA54UCs3E_4", "222", "bbbbb"))
|
||||
videoList.add(YoutubeVideo("_bAxHM7O_9k", "333", "bbbbb"))
|
||||
videoList.add(YoutubeVideo("6vAYPVTGs90", "444", "bbbbb"))
|
||||
videoList.add(YoutubeVideo("bLAfi6cWcoI", "555", "bbbbb"))
|
||||
videoList.add(YoutubeVideo("WX1MvqCzQ2k", "666", "bbbbb"))
|
||||
videoList.add(YoutubeVideo("nkRPma2F4s4", "777", "bbbbb"))
|
||||
videoList.add(YoutubeVideo("ssosMzYpQgc", "888", "bbbbb"))
|
||||
videoList.add(YoutubeVideo("1sXHOCQcbwc", "999", "bbbbb"))
|
||||
mViewPagerAdapter.submitList(videoList)
|
||||
return
|
||||
}*/
|
||||
mViewPagerAdapter.submitList(uiState.playLists)
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,17 +1,10 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:id="@+id/drawerLayout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:id="@+id/content"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:foreground="@color/main_content_foreground">
|
||||
|
||||
<androidx.viewpager2.widget.ViewPager2
|
||||
android:id="@+id/viewPager2"
|
||||
android:layout_width="match_parent"
|
||||
|
|
@ -31,8 +24,13 @@
|
|||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingTop="30dp"
|
||||
app:layout_constraintBottom_toTopOf="@+id/ad_container" />
|
||||
|
||||
<net.lucode.hackware.magicindicator.MagicIndicator
|
||||
android:id="@+id/ad_container"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
app:layout_constraintBottom_toBottomOf="parent" />
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
</FrameLayout>
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue