|
@@ -14,6 +14,7 @@ import com.module.backstage.R
|
|
|
import com.module.backstage.adapter.TestAdapter
|
|
|
import com.module.backstage.databinding.BackstageFragmentSystemSettingsBinding
|
|
|
import com.module.backstage.dialog.OKCancelDialog
|
|
|
+import com.module.backstage.listener.UpdateClickListener
|
|
|
import com.quyunshuo.sbm10.common.listener.AdapterClickListener
|
|
|
import com.module.backstage.vm.SystemSettingsFragmentVM
|
|
|
import com.module.backstage.weight.HorizontalSpaceItemDecoration
|
|
@@ -29,7 +30,8 @@ import dagger.hilt.android.AndroidEntryPoint
|
|
|
* @since 2021/8/1 11:46 下午
|
|
|
*/
|
|
|
@AndroidEntryPoint
|
|
|
-class SystemSettingsFragment : BaseFragment<BackstageFragmentSystemSettingsBinding, SystemSettingsFragmentVM>() {
|
|
|
+class SystemSettingsFragment : BaseFragment<BackstageFragmentSystemSettingsBinding, SystemSettingsFragmentVM>(),
|
|
|
+ AdapterClickListener, UpdateClickListener {
|
|
|
|
|
|
private val TAG = "GeneralParamFragment"
|
|
|
var okCancelDialog: OKCancelDialog? = null
|
|
@@ -42,34 +44,58 @@ class SystemSettingsFragment : BaseFragment<BackstageFragmentSystemSettingsBindi
|
|
|
mBinding.generalRvProduct.adapter = null
|
|
|
super.onDestroyView()
|
|
|
}
|
|
|
+ var functionIndex=0
|
|
|
|
|
|
override fun BackstageFragmentSystemSettingsBinding.initView() {
|
|
|
- with(generalRvProduct){
|
|
|
- //设置布局排列方式,默认垂直排列
|
|
|
- val gridLayoutManager: GridLayoutManager =
|
|
|
- GridLayoutManager(this@SystemSettingsFragment.context, 1, GridLayoutManager.VERTICAL, false)
|
|
|
- layoutManager = gridLayoutManager
|
|
|
- val functionIndex = arguments?.getInt("FUNCTION")
|
|
|
+ if (arguments!=null){
|
|
|
+ functionIndex = arguments?.getInt("FUNCTION")!!
|
|
|
+ }
|
|
|
+ functionIndex.let { initRcy(it) }
|
|
|
|
|
|
- otherAdapter = TestAdapter(mViewModel.getGeneralParamData(functionIndex))
|
|
|
- otherAdapter!!.setItemListener(object : AdapterClickListener {
|
|
|
- override fun onClickListener(view: View?, position: Int, data: String?) {
|
|
|
-// if (data==null) {
|
|
|
-// addAllKeyboardView(view)
|
|
|
+// with(generalRvProduct){
|
|
|
+// //设置布局排列方式,默认垂直排列
|
|
|
+// val gridLayoutManager: GridLayoutManager =
|
|
|
+// GridLayoutManager(this@SystemSettingsFragment.context, 1, GridLayoutManager.VERTICAL, false)
|
|
|
+// layoutManager = gridLayoutManager
|
|
|
+// val functionIndex = arguments?.getInt("FUNCTION")
|
|
|
+//
|
|
|
+// otherAdapter = TestAdapter(mViewModel.getGeneralParamData(functionIndex))
|
|
|
+// otherAdapter!!.setItemListener(object : AdapterClickListener {
|
|
|
+// override fun onClickListener(view: View?, position: Int, data: String?) {
|
|
|
+//// if (data==null) {
|
|
|
+//// addAllKeyboardView(view)
|
|
|
+//// return
|
|
|
+//// }
|
|
|
+// if ("".equals(data)) {
|
|
|
+// ToastUtil.switchToastStyleToWarn(UiUtil.getStringRes(R.string.backstage_data_null_tips))
|
|
|
// return
|
|
|
// }
|
|
|
- if ("".equals(data)) {
|
|
|
- ToastUtil.switchToastStyleToWarn(UiUtil.getStringRes(R.string.backstage_data_null_tips))
|
|
|
- return
|
|
|
- }
|
|
|
- if (data != null) {
|
|
|
- showOkCancelDialog(position,data)
|
|
|
- }
|
|
|
- }
|
|
|
- })
|
|
|
- adapter = otherAdapter
|
|
|
- addItemDecoration(HorizontalSpaceItemDecoration(10))
|
|
|
+// if (data != null) {
|
|
|
+// showOkCancelDialog(position,data)
|
|
|
+// }
|
|
|
+// }
|
|
|
+// })
|
|
|
+// adapter = otherAdapter
|
|
|
+// addItemDecoration(HorizontalSpaceItemDecoration(10))
|
|
|
+// }
|
|
|
+ }
|
|
|
+
|
|
|
+ fun initRcy(functionIndex:Int) {
|
|
|
+ mBinding.generalRvProduct.let {
|
|
|
+ val gridLayoutManager: GridLayoutManager =
|
|
|
+ GridLayoutManager(
|
|
|
+ this@SystemSettingsFragment.context,
|
|
|
+ 1,
|
|
|
+ GridLayoutManager.VERTICAL,
|
|
|
+ false
|
|
|
+ )
|
|
|
+ it.layoutManager = gridLayoutManager
|
|
|
+ otherAdapter = TestAdapter(mViewModel.getGeneralParamData(functionIndex))
|
|
|
+ otherAdapter!!.setItemListener(this)
|
|
|
+ it.adapter = otherAdapter
|
|
|
+ // it.addItemDecoration(HorizontalSpaceItemDecoration(100))
|
|
|
}
|
|
|
+ otherAdapter?.setOnLongClickListener(this)
|
|
|
}
|
|
|
|
|
|
override fun initObserve() {
|
|
@@ -95,4 +121,25 @@ class SystemSettingsFragment : BaseFragment<BackstageFragmentSystemSettingsBindi
|
|
|
})
|
|
|
okCancelDialog?.show()
|
|
|
}
|
|
|
+
|
|
|
+ override fun setOnLongClickListener(type: Int, position: Int, data: String?) {
|
|
|
+ /* otherAdapter = TestAdapter(mViewModel.getGeneralParamData(functionIndex))
|
|
|
+ rvOtherSearch.adapter = otherAdapter*/
|
|
|
+ initRcy(functionIndex)
|
|
|
+ // otherAdapter?.setData(mViewModel.getGeneralParamData(functionIndex))
|
|
|
+ }
|
|
|
+
|
|
|
+ override fun onClickListener(view: View?, position: Int, data: String?) {
|
|
|
+ if (data == null) {
|
|
|
+ addAllKeyboardView(view)
|
|
|
+ return
|
|
|
+ }
|
|
|
+ if ("".equals(data)) {
|
|
|
+ ToastUtil.switchToastStyleToWarn(
|
|
|
+ UiUtil.getStringRes(com.module.backstage.R.string.backstage_data_null_tips)
|
|
|
+ )
|
|
|
+ return
|
|
|
+ }
|
|
|
+ showOkCancelDialog(position, data)
|
|
|
+ }
|
|
|
}
|