Commit 4013873d authored by mengcuiguang's avatar mengcuiguang

代码优化

parent 7883e3a1
......@@ -187,6 +187,7 @@ object Constant {
const val HOT_ACTIVITY_DHGAME = "dhGame"
const val HOT_ACTIVITY_SHARE_NEWS = "TO_SHARE_NEWS"
const val HOT_ACTIVITY_CPD = "TO_CPD"
const val HOT_ACTIVITY_CALLSHOW = "TO_CALLSHOW"
// 打开激活
const val FIRST_DEVICE_FLAG = "first_device_flag"
......@@ -213,11 +214,12 @@ object Constant {
const val MERGE_KEY = "merge_key"
// wrapper type 0-新闻 1-小说 2-平台分红
// wrapper type 0-新闻 1-小说 2-平台分红 3-来电秀
const val WRAPPER_TYPE = "wrapper_type"
const val WRAPPER_TYPE_NEWS = 0
const val WRAPPER_TYPE_BOOK = 1
const val WRAPPER_TYPE_FRIENDS = 2
const val WRAPPER_TYPE_KYL = 3
//1登录,2提现,3任务
const val RISK_EVENT_ID_LOGIN = 1
......
......@@ -2,10 +2,12 @@ package com.mints.goodmoney.ui.activitys
import android.os.Bundle
import android.view.View
import androidx.fragment.app.Fragment
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.FriendsFragment
import com.mints.goodmoney.ui.fragment.KuYinYueFragment
import com.mints.goodmoney.ui.fragment.MyZhangyueFragment
import com.mints.goodmoney.ui.fragment.RsNewsFragment
import kotlinx.android.synthetic.main.header_layout.*
......@@ -45,34 +47,30 @@ class WrapperActivity : BaseActivity(), View.OnClickListener {
}
private fun initPage() {
var currentFragment: Fragment? = null
when (wrapperType) {
Constant.WRAPPER_TYPE_NEWS -> {
tv_title.text = "新闻"
val rsNewsFragment = RsNewsFragment()
if (!rsNewsFragment.isAdded) {
// 提交事务
supportFragmentManager.beginTransaction()
.add(R.id.flWrapper, rsNewsFragment).commitAllowingStateLoss()
}
currentFragment = RsNewsFragment()
}
Constant.WRAPPER_TYPE_BOOK -> {
tv_title.text = "书城"
val zhangyueFragment = MyZhangyueFragment()
if (!zhangyueFragment.isAdded) {
// 提交事务
supportFragmentManager.beginTransaction()
.add(R.id.flWrapper, zhangyueFragment).commit()
}
currentFragment = MyZhangyueFragment()
}
Constant.WRAPPER_TYPE_FRIENDS -> {
tv_title.text = "瓜分百万现金福利"
val friendsFragment = FriendsFragment()
if (!friendsFragment.isAdded) {
// 提交事务
supportFragmentManager.beginTransaction()
.add(R.id.flWrapper, friendsFragment).commit()
}
currentFragment = FriendsFragment()
}
Constant.WRAPPER_TYPE_KYL -> {
tv_title.text = "来电秀"
currentFragment = KuYinYueFragment()
}
}
if (!currentFragment!!.isAdded) {
// 提交事务
supportFragmentManager.beginTransaction()
.add(R.id.flWrapper, currentFragment!!).commitAllowingStateLoss()
}
}
......
......@@ -910,6 +910,11 @@ class MyFragment : BaseFragment(),
}
}
}
Constant.HOT_ACTIVITY_CALLSHOW -> {
val bundle = Bundle()
bundle.putInt(Constant.WRAPPER_TYPE, Constant.WRAPPER_TYPE_KYL)
readyGo(WrapperActivity::class.java, bundle)
}
else -> {
if (!TextUtils.isEmpty(hotBean.url) && !TextUtils.isEmpty(hotBean.title)) {
val bundle = Bundle()
......
......@@ -7,7 +7,7 @@
<com.androidkun.xtablayout.XTabLayout
android:id="@+id/xtFragmentKyl"
android:paddingTop="22dp"
android:paddingTop="14dp"
android:visibility="invisible"
android:layout_width="match_parent"
android:layout_height="wrap_content"
......
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