|
@@ -28,143 +28,143 @@ import com.sambath.kunkhmer.view.SettingButtonView
|
|
|
* A simple [Fragment] subclass as the default destination in the navigation.
|
|
|
*/
|
|
|
class MainFragment : BaseFragment(R.layout.fragment_main) {
|
|
|
- private val TAB_TITLES = arrayOf(
|
|
|
- R.string.current_bets,
|
|
|
- R.string.today_report,
|
|
|
- )
|
|
|
- private lateinit var mainViewModel: MainViewModel
|
|
|
- private val shareViewModel = App.injectShareViewModel()
|
|
|
- private val sharePref = App.injectPrefHelper()
|
|
|
- private lateinit var user: User
|
|
|
- private lateinit var btnPlay: SettingButtonView
|
|
|
- private lateinit var btnResult: SettingButtonView
|
|
|
- private lateinit var betTouch: MediaPlayer
|
|
|
- lateinit var result: MediaPlayer
|
|
|
- private var anim: AlphaAnimation? = null
|
|
|
- override fun onCreate(savedInstanceState: Bundle?) {
|
|
|
-// mainViewModel = MainViewModel(App.injectApiService(), App.injectPrefHelper())
|
|
|
- super.onCreate(savedInstanceState)
|
|
|
- //companyInfoId =arguments?.getInt(COM_INTO_ID_KEY) ?: 0
|
|
|
- (requireActivity() as ShareActivity).apply {
|
|
|
- user = userShare
|
|
|
- }
|
|
|
- anim = AlphaAnimation(0.0f, 1.0f)
|
|
|
- anim?.duration = 50 //You can manage the blinking time with this parameter
|
|
|
- anim?.startOffset = 50
|
|
|
- anim?.repeatMode = Animation.REVERSE
|
|
|
- anim?.repeatCount = Animation.INFINITE
|
|
|
- }
|
|
|
-
|
|
|
- @SuppressLint("CheckResult")
|
|
|
- override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
|
|
- super.onViewCreated(view, savedInstanceState)
|
|
|
-// mainViewModel.state.observe(viewLifecycleOwner, androidx.lifecycle.Observer {
|
|
|
-// getMainData(it)
|
|
|
-// })
|
|
|
-// mainViewModel.getMainData()
|
|
|
+// private val TAB_TITLES = arrayOf(
|
|
|
+// R.string.current_bets,
|
|
|
+// R.string.today_report,
|
|
|
+// )
|
|
|
+// private lateinit var mainViewModel: MainViewModel
|
|
|
+// private val shareViewModel = App.injectShareViewModel()
|
|
|
+// private val sharePref = App.injectPrefHelper()
|
|
|
+// private lateinit var user: User
|
|
|
+// private lateinit var btnPlay: SettingButtonView
|
|
|
+// private lateinit var btnResult: SettingButtonView
|
|
|
+// private lateinit var betTouch: MediaPlayer
|
|
|
+// lateinit var result: MediaPlayer
|
|
|
+// private var anim: AlphaAnimation? = null
|
|
|
+// override fun onCreate(savedInstanceState: Bundle?) {
|
|
|
+//// mainViewModel = MainViewModel(App.injectApiService(), App.injectPrefHelper())
|
|
|
+// super.onCreate(savedInstanceState)
|
|
|
+// //companyInfoId =arguments?.getInt(COM_INTO_ID_KEY) ?: 0
|
|
|
// (requireActivity() as ShareActivity).apply {
|
|
|
-// userNameTextView.text = user.userName
|
|
|
+// user = userShare
|
|
|
// }
|
|
|
- val mainPagerAdapter = MainPagerAdapter(requireActivity() as ShareActivity)
|
|
|
- val viewPager: ViewPager2 = view.findViewById(R.id.view_pager)
|
|
|
- viewPager.adapter = mainPagerAdapter
|
|
|
- val tabs: TabLayout = view.findViewById(R.id.tabLayout)
|
|
|
- TabLayoutMediator(
|
|
|
- tabs, viewPager
|
|
|
- ) { tab, position -> // Styling each tab here
|
|
|
- tab.text = getString(TAB_TITLES[position])
|
|
|
- }.attach()
|
|
|
-// shareViewModel.getConnectivityStates.observe(viewLifecycleOwner, Observer {
|
|
|
-// getSocketConectionStatus(it)
|
|
|
-// })
|
|
|
- btnPlay = view.findViewById(R.id.btn_play)
|
|
|
- btnPlay.setOnClickListener {
|
|
|
-// if (!sharePref.getIsMute()) betTouch.start()
|
|
|
- it.btnClick().subscribe {
|
|
|
-// btnPlay.isEnabled = false
|
|
|
- (requireActivity() as? ShareActivity)?.apply {
|
|
|
- supportFragmentManager.beginTransaction()
|
|
|
- .setCustomAnimations(
|
|
|
- R.anim.slide_in,
|
|
|
- R.anim.slide_out,
|
|
|
- R.anim.slide_in_exit,
|
|
|
- R.anim.slide_out_exit
|
|
|
- )
|
|
|
- .add(R.id.container, CfBetFragment().apply {
|
|
|
- arguments =
|
|
|
- Bundle().apply {
|
|
|
- // putInt(Fragment7.COM_INFO_ID_KEY, companyInfoId)
|
|
|
- }
|
|
|
- })
|
|
|
- .addToBackStack(null)
|
|
|
- .commit()
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- btnResult = view.findViewById(R.id.btn_result)
|
|
|
- btnResult.setOnClickListener {
|
|
|
-// if (!sharePref.getIsMute()) betTouch.start()
|
|
|
- it.btnClick().subscribe {
|
|
|
-// btnResult.isEnabled = false
|
|
|
- (requireActivity() as? ShareActivity)?.apply {
|
|
|
- supportFragmentManager.beginTransaction()
|
|
|
- .setCustomAnimations(
|
|
|
- R.anim.slide_in,
|
|
|
- R.anim.slide_out,
|
|
|
- R.anim.slide_in_exit,
|
|
|
- R.anim.slide_out_exit
|
|
|
- )
|
|
|
- .add(R.id.container, CfResultFragment().apply {
|
|
|
- arguments =
|
|
|
- Bundle().apply {
|
|
|
- // putInt(Fragment7.COM_INFO_ID_KEY, companyInfoId)
|
|
|
- }
|
|
|
- })
|
|
|
- .addToBackStack(null)
|
|
|
- .commit()
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- (requireActivity() as? ShareActivity)?.apply {
|
|
|
- groupToolbarIcons.isVisible = true
|
|
|
- layCfStatus.isVisible = true
|
|
|
- settingImageView.setOnClickListener {
|
|
|
-// if (!sharePref.getIsMute()) betTouch.start()
|
|
|
- it.btnClick().subscribe {
|
|
|
- supportFragmentManager.beginTransaction()
|
|
|
- .setCustomAnimations(
|
|
|
- R.anim.slide_in,
|
|
|
- R.anim.slide_out,
|
|
|
- R.anim.slide_in_exit,
|
|
|
- R.anim.slide_out_exit
|
|
|
- )
|
|
|
- .add(R.id.container, SettingFragment())
|
|
|
- .addToBackStack(null)
|
|
|
- .commit()
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- reportImageView.setOnClickListener {
|
|
|
-// if (!sharePref.getIsMute()) betTouch.start()
|
|
|
- layCfStatus.isVisible = true
|
|
|
- it.btnClick().subscribe {
|
|
|
- supportFragmentManager.beginTransaction()
|
|
|
- .setCustomAnimations(
|
|
|
- R.anim.slide_in,
|
|
|
- R.anim.slide_out,
|
|
|
- R.anim.slide_in_exit,
|
|
|
- R.anim.slide_out_exit
|
|
|
- )
|
|
|
- .add(R.id.container, StatementFragment().apply {
|
|
|
- arguments =
|
|
|
- Bundle().apply {
|
|
|
- // putInt(Fragment7.COM_INFO_ID_KEY, companyInfoId)
|
|
|
- }
|
|
|
- })
|
|
|
- .addToBackStack(null)
|
|
|
- .commit()
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
+// anim = AlphaAnimation(0.0f, 1.0f)
|
|
|
+// anim?.duration = 50 //You can manage the blinking time with this parameter
|
|
|
+// anim?.startOffset = 50
|
|
|
+// anim?.repeatMode = Animation.REVERSE
|
|
|
+// anim?.repeatCount = Animation.INFINITE
|
|
|
+// }
|
|
|
+//
|
|
|
+// @SuppressLint("CheckResult")
|
|
|
+// override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
|
|
+// super.onViewCreated(view, savedInstanceState)
|
|
|
+//// mainViewModel.state.observe(viewLifecycleOwner, androidx.lifecycle.Observer {
|
|
|
+//// getMainData(it)
|
|
|
+//// })
|
|
|
+//// mainViewModel.getMainData()
|
|
|
+//// (requireActivity() as ShareActivity).apply {
|
|
|
+//// userNameTextView.text = user.userName
|
|
|
+//// }
|
|
|
+// val mainPagerAdapter = MainPagerAdapter(requireActivity() as ShareActivity)
|
|
|
+// val viewPager: ViewPager2 = view.findViewById(R.id.view_pager)
|
|
|
+// viewPager.adapter = mainPagerAdapter
|
|
|
+// val tabs: TabLayout = view.findViewById(R.id.tabLayout)
|
|
|
+// TabLayoutMediator(
|
|
|
+// tabs, viewPager
|
|
|
+// ) { tab, position -> // Styling each tab here
|
|
|
+// tab.text = getString(TAB_TITLES[position])
|
|
|
+// }.attach()
|
|
|
+//// shareViewModel.getConnectivityStates.observe(viewLifecycleOwner, Observer {
|
|
|
+//// getSocketConectionStatus(it)
|
|
|
+//// })
|
|
|
+// btnPlay = view.findViewById(R.id.btn_play)
|
|
|
+// btnPlay.setOnClickListener {
|
|
|
+//// if (!sharePref.getIsMute()) betTouch.start()
|
|
|
+// it.btnClick().subscribe {
|
|
|
+//// btnPlay.isEnabled = false
|
|
|
+// (requireActivity() as? ShareActivity)?.apply {
|
|
|
+// supportFragmentManager.beginTransaction()
|
|
|
+// .setCustomAnimations(
|
|
|
+// R.anim.slide_in,
|
|
|
+// R.anim.slide_out,
|
|
|
+// R.anim.slide_in_exit,
|
|
|
+// R.anim.slide_out_exit
|
|
|
+// )
|
|
|
+// .add(R.id.container, CfBetFragment().apply {
|
|
|
+// arguments =
|
|
|
+// Bundle().apply {
|
|
|
+// // putInt(Fragment7.COM_INFO_ID_KEY, companyInfoId)
|
|
|
+// }
|
|
|
+// })
|
|
|
+// .addToBackStack(null)
|
|
|
+// .commit()
|
|
|
+// }
|
|
|
+// }
|
|
|
+// }
|
|
|
+// btnResult = view.findViewById(R.id.btn_result)
|
|
|
+// btnResult.setOnClickListener {
|
|
|
+//// if (!sharePref.getIsMute()) betTouch.start()
|
|
|
+// it.btnClick().subscribe {
|
|
|
+//// btnResult.isEnabled = false
|
|
|
+// (requireActivity() as? ShareActivity)?.apply {
|
|
|
+// supportFragmentManager.beginTransaction()
|
|
|
+// .setCustomAnimations(
|
|
|
+// R.anim.slide_in,
|
|
|
+// R.anim.slide_out,
|
|
|
+// R.anim.slide_in_exit,
|
|
|
+// R.anim.slide_out_exit
|
|
|
+// )
|
|
|
+// .add(R.id.container, CfResultFragment().apply {
|
|
|
+// arguments =
|
|
|
+// Bundle().apply {
|
|
|
+// // putInt(Fragment7.COM_INFO_ID_KEY, companyInfoId)
|
|
|
+// }
|
|
|
+// })
|
|
|
+// .addToBackStack(null)
|
|
|
+// .commit()
|
|
|
+// }
|
|
|
+// }
|
|
|
+// }
|
|
|
+// (requireActivity() as? ShareActivity)?.apply {
|
|
|
+// groupToolbarIcons.isVisible = true
|
|
|
+// layCfStatus.isVisible = true
|
|
|
+// settingImageView.setOnClickListener {
|
|
|
+//// if (!sharePref.getIsMute()) betTouch.start()
|
|
|
+// it.btnClick().subscribe {
|
|
|
+// supportFragmentManager.beginTransaction()
|
|
|
+// .setCustomAnimations(
|
|
|
+// R.anim.slide_in,
|
|
|
+// R.anim.slide_out,
|
|
|
+// R.anim.slide_in_exit,
|
|
|
+// R.anim.slide_out_exit
|
|
|
+// )
|
|
|
+// .add(R.id.container, SettingFragment())
|
|
|
+// .addToBackStack(null)
|
|
|
+// .commit()
|
|
|
+// }
|
|
|
+// }
|
|
|
+//
|
|
|
+// reportImageView.setOnClickListener {
|
|
|
+//// if (!sharePref.getIsMute()) betTouch.start()
|
|
|
+// layCfStatus.isVisible = true
|
|
|
+// it.btnClick().subscribe {
|
|
|
+// supportFragmentManager.beginTransaction()
|
|
|
+// .setCustomAnimations(
|
|
|
+// R.anim.slide_in,
|
|
|
+// R.anim.slide_out,
|
|
|
+// R.anim.slide_in_exit,
|
|
|
+// R.anim.slide_out_exit
|
|
|
+// )
|
|
|
+// .add(R.id.container, StatementFragment().apply {
|
|
|
+// arguments =
|
|
|
+// Bundle().apply {
|
|
|
+// // putInt(Fragment7.COM_INFO_ID_KEY, companyInfoId)
|
|
|
+// }
|
|
|
+// })
|
|
|
+// .addToBackStack(null)
|
|
|
+// .commit()
|
|
|
+// }
|
|
|
+// }
|
|
|
+// }
|
|
|
+// }
|
|
|
}
|