Commit ae26efe5 authored by mengcuiguang's avatar mengcuiguang

优化游戏切换

parent 506fe389
...@@ -80,7 +80,7 @@ class LoginActivity : BaseActivity() ...@@ -80,7 +80,7 @@ class LoginActivity : BaseActivity()
override fun onKeyDown(keyCode: Int, event: KeyEvent): Boolean { override fun onKeyDown(keyCode: Int, event: KeyEvent): Boolean {
return if (keyCode == KeyEvent.KEYCODE_BACK) { return if (keyCode == KeyEvent.KEYCODE_BACK) {
val channel = CommonUtils.getAppMetaData(MintsApplication.getContext(), "CHANNEL_NAME") val channel = CommonUtils.getAppMetaData(MintsApplication.getContext(), "CHANNEL_NAME")
if (!TextUtils.equals(channel, Constant.CHANNEL_SHARE)) { if (!TextUtils.equals(channel, Constant.CHANNEL_SHARE) && !loginFlag) {
finish() finish()
} }
true true
...@@ -93,7 +93,7 @@ class LoginActivity : BaseActivity() ...@@ -93,7 +93,7 @@ class LoginActivity : BaseActivity()
when (v?.id) { when (v?.id) {
R.id.ivLoginBack -> { R.id.ivLoginBack -> {
val channel = CommonUtils.getAppMetaData(MintsApplication.getContext(), "CHANNEL_NAME") val channel = CommonUtils.getAppMetaData(MintsApplication.getContext(), "CHANNEL_NAME")
if (!TextUtils.equals(channel, Constant.CHANNEL_SHARE)) { if (!TextUtils.equals(channel, Constant.CHANNEL_SHARE) && !loginFlag) {
finish() finish()
} }
} }
...@@ -193,7 +193,7 @@ class LoginActivity : BaseActivity() ...@@ -193,7 +193,7 @@ class LoginActivity : BaseActivity()
} }
val channel = CommonUtils.getAppMetaData(MintsApplication.getContext(), "CHANNEL_NAME") val channel = CommonUtils.getAppMetaData(MintsApplication.getContext(), "CHANNEL_NAME")
if (TextUtils.equals(channel, Constant.CHANNEL_SHARE)) { if (TextUtils.equals(channel, Constant.CHANNEL_SHARE) && !loginFlag) {
readyGo(MainActivity::class.java) readyGo(MainActivity::class.java)
} }
......
...@@ -5,11 +5,14 @@ import android.content.Intent ...@@ -5,11 +5,14 @@ import android.content.Intent
import android.content.pm.ApplicationInfo import android.content.pm.ApplicationInfo
import android.net.Uri import android.net.Uri
import android.os.Build import android.os.Build
import android.text.TextUtils
import android.view.View import android.view.View
import android.view.ViewGroup import android.view.ViewGroup
import android.webkit.WebSettings import android.webkit.WebSettings
import android.webkit.WebViewClient import android.webkit.WebViewClient
import com.mints.goodmoney.R import com.mints.goodmoney.R
import com.mints.goodmoney.common.AppConfig
import com.mints.goodmoney.common.Constant
import com.mints.goodmoney.manager.UserManager import com.mints.goodmoney.manager.UserManager
import com.mints.goodmoney.ui.fragment.base.LazyLoadBaseFragment import com.mints.goodmoney.ui.fragment.base.LazyLoadBaseFragment
import com.mints.goodmoney.utils.LogUtil import com.mints.goodmoney.utils.LogUtil
......
...@@ -19,6 +19,7 @@ import java.util.* ...@@ -19,6 +19,7 @@ import java.util.*
class MoneyFragment : BaseFragment(), XTabLayout.OnTabSelectedListener { class MoneyFragment : BaseFragment(), XTabLayout.OnTabSelectedListener {
private var mainFragment: MainFragment? = null private var mainFragment: MainFragment? = null
private var dhGameFragment: DhGameFragment? = null
private var curPosition = 0//当前标签选中的下标 private var curPosition = 0//当前标签选中的下标
...@@ -31,6 +32,8 @@ class MoneyFragment : BaseFragment(), XTabLayout.OnTabSelectedListener { ...@@ -31,6 +32,8 @@ class MoneyFragment : BaseFragment(), XTabLayout.OnTabSelectedListener {
override fun onHiddenChanged(hidden: Boolean) { override fun onHiddenChanged(hidden: Boolean) {
if (curPosition == 0) { if (curPosition == 0) {
mainFragment?.onHiddenChanged(hidden) mainFragment?.onHiddenChanged(hidden)
} else if (curPosition == 2) {
dhGameFragment?.onHiddenChanged(hidden)
} }
super.onHiddenChanged(hidden) super.onHiddenChanged(hidden)
} }
...@@ -50,9 +53,10 @@ class MoneyFragment : BaseFragment(), XTabLayout.OnTabSelectedListener { ...@@ -50,9 +53,10 @@ class MoneyFragment : BaseFragment(), XTabLayout.OnTabSelectedListener {
val fragments: MutableList<Fragment> = ArrayList() val fragments: MutableList<Fragment> = ArrayList()
mainFragment = MainFragment() mainFragment = MainFragment()
dhGameFragment = DhGameFragment()
fragments.add(mainFragment!!) fragments.add(mainFragment!!)
fragments.add(ZhangyueFragment()) fragments.add(ZhangyueFragment())
fragments.add(DhGameFragment()) fragments.add(dhGameFragment!!)
//去除两侧应阴影 //去除两侧应阴影
vpFragmentMoney.overScrollMode = ViewPager.OVER_SCROLL_NEVER vpFragmentMoney.overScrollMode = ViewPager.OVER_SCROLL_NEVER
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment