|
|
@@ -7,31 +7,23 @@ import android.content.pm.ActivityInfo
|
|
|
import android.content.res.Configuration
|
|
|
import android.content.res.Resources
|
|
|
import android.os.Bundle
|
|
|
-import android.text.TextUtils
|
|
|
import android.view.ViewGroup
|
|
|
import android.view.inputmethod.InputMethodManager
|
|
|
import android.widget.EditText
|
|
|
import android.widget.LinearLayout
|
|
|
-import android.widget.RadioButton
|
|
|
-import android.widget.RadioGroup
|
|
|
import androidx.databinding.ViewDataBinding
|
|
|
-import androidx.fragment.app.Fragment
|
|
|
import androidx.fragment.app.FragmentActivity
|
|
|
import com.alibaba.android.arouter.launcher.ARouter
|
|
|
import com.scwang.smartrefresh.layout.api.RefreshLayout
|
|
|
import com.scwang.smartrefresh.layout.listener.OnRefreshLoadMoreListener
|
|
|
import com.yingyangfly.baselib.R
|
|
|
-import com.yingyangfly.baselib.bean.MessageBean
|
|
|
import com.yingyangfly.baselib.databinding.ActivityBaseBinding
|
|
|
import com.yingyangfly.baselib.dialog.LoadingDialog
|
|
|
-import com.yingyangfly.baselib.dialog.TaskFragment
|
|
|
import com.yingyangfly.baselib.ext.getDbClass
|
|
|
import com.yingyangfly.baselib.ext.initBar
|
|
|
-import com.yingyangfly.baselib.router.RouterUrlCommon
|
|
|
import com.yingyangfly.baselib.utils.*
|
|
|
import gorden.rxbus2.RxBus
|
|
|
|
|
|
-
|
|
|
/**
|
|
|
* activity基类
|
|
|
*/
|
|
|
@@ -90,7 +82,6 @@ abstract class BaseFragmentActivity<DB : ViewDataBinding> : FragmentActivity(),
|
|
|
initViews()
|
|
|
initListener()
|
|
|
initData()
|
|
|
- initLiveEventBusUtil()
|
|
|
}
|
|
|
|
|
|
protected inline fun binding(block: DB.() -> Unit): DB {
|
|
|
@@ -270,63 +261,6 @@ abstract class BaseFragmentActivity<DB : ViewDataBinding> : FragmentActivity(),
|
|
|
return res
|
|
|
}
|
|
|
|
|
|
- var showFragment: Fragment? = null
|
|
|
- fun showFragment(viewId: Int, f: Fragment) {
|
|
|
- try {
|
|
|
- val ft = supportFragmentManager.beginTransaction()
|
|
|
- if (showFragment != null)
|
|
|
- ft.hide(showFragment!!)
|
|
|
- if (f.isAdded) {
|
|
|
- ft.show(f)
|
|
|
- } else {
|
|
|
- ft.add(viewId, f)
|
|
|
- }
|
|
|
- showFragment = f
|
|
|
- ft.commitAllowingStateLoss()
|
|
|
- supportFragmentManager.executePendingTransactions()// 立即执行
|
|
|
- } catch (e: Exception) {
|
|
|
- e.printStackTrace()
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- @SuppressLint("UseCompatLoadingForDrawables")
|
|
|
- open fun setRadioButton(rg: RadioGroup, with: Int, hight: Int, drawable: IntArray) {
|
|
|
- for (i in 0 until rg.childCount) {
|
|
|
- val rb = rg.getChildAt(i) as RadioButton
|
|
|
- val right = this@BaseFragmentActivity.resources.getDrawable(drawable[i])
|
|
|
-// right.setBounds(0, 0,
|
|
|
-// (with / BaseApplication.instance.getMetricsInfo()).toInt(),
|
|
|
-// (hight / BaseApplication.instance.getHeightmetricsInfo()).toInt())
|
|
|
- rb.setCompoundDrawables(right, null, right, null)
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- private fun initLiveEventBusUtil() {
|
|
|
- //展示任务弹窗
|
|
|
- LiveEventBusUtil.observer<MessageBean>(this, RxBusCodes.SHOWTASKDIALOG) { bean ->
|
|
|
- val taskFragment = TaskFragment()
|
|
|
- taskFragment.setTaskDesn(bean.getMessageData(), "")
|
|
|
- taskFragment.onDialogClickListener = {
|
|
|
- if (TextUtils.isEmpty(bean.ext).not()) {
|
|
|
- if (TextUtils.equals("C", bean.businessID)) {
|
|
|
- JumpUtil.jumpActivityWithUrl(
|
|
|
- RouterUrlCommon.WEB_VIEW_INTERACTION_JS,
|
|
|
- bean.ext,
|
|
|
- mContext
|
|
|
- )
|
|
|
- } else if (TextUtils.equals("D", bean.businessID)) {
|
|
|
- JumpUtil.jumpActivityWithUrl(
|
|
|
- RouterUrlCommon.trainContentDetails,
|
|
|
- bean.ext,
|
|
|
- mContext
|
|
|
- )
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- taskFragment.show(supportFragmentManager, "taskFragment")
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
// override fun onKeyDown(keyCode: Int, event: KeyEvent?): Boolean {
|
|
|
// if (keyCode == KeyEvent.KEYCODE_BACK) {
|
|
|
// return true;
|