|
@@ -5,6 +5,7 @@ import android.content.Context
|
|
|
import android.content.Intent
|
|
import android.content.Intent
|
|
|
import android.content.IntentFilter
|
|
import android.content.IntentFilter
|
|
|
import android.graphics.drawable.Drawable
|
|
import android.graphics.drawable.Drawable
|
|
|
|
|
+import android.os.Handler
|
|
|
import android.text.InputType
|
|
import android.text.InputType
|
|
|
import android.util.Log
|
|
import android.util.Log
|
|
|
import android.view.MotionEvent
|
|
import android.view.MotionEvent
|
|
@@ -21,11 +22,13 @@ import com.jld.vod.R
|
|
|
import com.jld.vod.base.BaseActivity
|
|
import com.jld.vod.base.BaseActivity
|
|
|
import com.jld.vod.config.Config
|
|
import com.jld.vod.config.Config
|
|
|
import com.jld.vod.model.bean.*
|
|
import com.jld.vod.model.bean.*
|
|
|
|
|
+import com.jld.vod.service.MyAccessibilityService
|
|
|
import com.jld.vod.utils.DateUtils
|
|
import com.jld.vod.utils.DateUtils
|
|
|
import com.jld.vod.utils.LogUtils
|
|
import com.jld.vod.utils.LogUtils
|
|
|
import com.jld.vod.utils.PopupUtils
|
|
import com.jld.vod.utils.PopupUtils
|
|
|
import com.jld.vod.utils.SharedPrefUtils
|
|
import com.jld.vod.utils.SharedPrefUtils
|
|
|
import com.jld.vod.view.fragment.*
|
|
import com.jld.vod.view.fragment.*
|
|
|
|
|
+import com.jld.vod.view.widget.CustomGEOAdDialog
|
|
|
import com.jld.vod.view.widget.UpCircleMenuLayout
|
|
import com.jld.vod.view.widget.UpCircleMenuLayout
|
|
|
import com.jld.vod.viewmodel.MainViewModel
|
|
import com.jld.vod.viewmodel.MainViewModel
|
|
|
import com.xuexiang.xpage.enums.CoreAnim
|
|
import com.xuexiang.xpage.enums.CoreAnim
|
|
@@ -35,6 +38,7 @@ import com.xuexiang.xui.widget.dialog.materialdialog.MaterialDialog
|
|
|
import com.xuexiang.xui.widget.popupwindow.popup.XUIListPopup
|
|
import com.xuexiang.xui.widget.popupwindow.popup.XUIListPopup
|
|
|
import com.xuexiang.xui.widget.popupwindow.popup.XUIPopup
|
|
import com.xuexiang.xui.widget.popupwindow.popup.XUIPopup
|
|
|
import kotlinx.android.synthetic.main.activity_main.*
|
|
import kotlinx.android.synthetic.main.activity_main.*
|
|
|
|
|
+import org.greenrobot.eventbus.EventBus
|
|
|
import java.util.*
|
|
import java.util.*
|
|
|
|
|
|
|
|
|
|
|
|
@@ -54,6 +58,7 @@ class MainActivity : BaseActivity() {
|
|
|
private var mAllModularRotateImgBean:List<AllModularRotateImgBean> ?=null
|
|
private var mAllModularRotateImgBean:List<AllModularRotateImgBean> ?=null
|
|
|
private val password : String = "123456"
|
|
private val password : String = "123456"
|
|
|
private var pos = 0
|
|
private var pos = 0
|
|
|
|
|
+ private val mHandler = Handler()
|
|
|
|
|
|
|
|
private val mItemTexts = arrayOf(
|
|
private val mItemTexts = arrayOf(
|
|
|
"电影", "音乐", "游戏",
|
|
"电影", "音乐", "游戏",
|
|
@@ -76,7 +81,8 @@ class MainActivity : BaseActivity() {
|
|
|
pos = bundle!!.getInt("pos")
|
|
pos = bundle!!.getInt("pos")
|
|
|
|
|
|
|
|
mUpCircleMenuLayout = findViewById(R.id.id_mymenulayout) as UpCircleMenuLayout
|
|
mUpCircleMenuLayout = findViewById(R.id.id_mymenulayout) as UpCircleMenuLayout
|
|
|
- viewModel = ViewModelProvider.AndroidViewModelFactory(application).create(MainViewModel::class.java)
|
|
|
|
|
|
|
+ viewModel = ViewModelProvider.
|
|
|
|
|
+ AndroidViewModelFactory(application).create(MainViewModel::class.java)
|
|
|
|
|
|
|
|
|
|
|
|
|
//初始化车牌号
|
|
//初始化车牌号
|
|
@@ -110,8 +116,8 @@ class MainActivity : BaseActivity() {
|
|
|
viewModel.getLanguage()
|
|
viewModel.getLanguage()
|
|
|
//获取全部模块
|
|
//获取全部模块
|
|
|
viewModel.getAllModular()
|
|
viewModel.getAllModular()
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
|
|
+ //获取固定广告
|
|
|
|
|
+ viewModel.findPositionAdvert()
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
override fun initData() {
|
|
override fun initData() {
|
|
@@ -127,19 +133,53 @@ class MainActivity : BaseActivity() {
|
|
|
initIconRes()
|
|
initIconRes()
|
|
|
//初始化模块id
|
|
//初始化模块id
|
|
|
initMid()
|
|
initMid()
|
|
|
|
|
+ //初始化广告模块
|
|
|
|
|
+ initAdVert()
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 初始化广告模块
|
|
|
|
|
+ */
|
|
|
|
|
+ private fun initAdVert() {
|
|
|
|
|
+ viewModel.findPositionAdvertLiveData.observe(this) {res->
|
|
|
|
|
+ LogUtils.logD("findPositionAdvertLiveData"+res.data)
|
|
|
|
|
+ when (res?.code) {
|
|
|
|
|
+ BaseBean.SUCCESS -> {
|
|
|
|
|
+ if (res.data!!.size != 0)
|
|
|
|
|
+ {
|
|
|
|
|
+ val isFirstShowAds = SharedPrefUtils.getBoolean(this,"isFirstShowAds",true)
|
|
|
|
|
+ if (isFirstShowAds)
|
|
|
|
|
+ {
|
|
|
|
|
+ mHandler.postDelayed(Runnable {
|
|
|
|
|
+ EventBus.getDefault().post(res.data)
|
|
|
|
|
+ SharedPrefUtils.putBoolean(this,"isFirstShowAds",false)
|
|
|
|
|
+ },5000)
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ finishLoading()
|
|
|
|
|
+ }
|
|
|
|
|
+ BaseBean.ERROR -> {
|
|
|
|
|
+ finishLoading()
|
|
|
|
|
+ Toast.makeText(this, res.message, Toast.LENGTH_SHORT).show()
|
|
|
|
|
+ }
|
|
|
|
|
+ BaseBean.LOADING -> showLoading()
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
override fun initEvent() {
|
|
override fun initEvent() {
|
|
|
super.initEvent()
|
|
super.initEvent()
|
|
|
|
|
|
|
|
mUpCircleMenuLayout!!.setOnMenuItemClickListener(object :UpCircleMenuLayout.OnMenuItemClickListener{
|
|
mUpCircleMenuLayout!!.setOnMenuItemClickListener(object :UpCircleMenuLayout.OnMenuItemClickListener{
|
|
|
-
|
|
|
|
|
override fun itemClick(pos: Int) {
|
|
override fun itemClick(pos: Int) {
|
|
|
//根据网络判断数据选择功能
|
|
//根据网络判断数据选择功能
|
|
|
if (mAllModularRotateImgBean!!.size != 0)
|
|
if (mAllModularRotateImgBean!!.size != 0)
|
|
|
{
|
|
{
|
|
|
var modelType = mAllModularRotateImgBean!![pos].mid
|
|
var modelType = mAllModularRotateImgBean!![pos].mid
|
|
|
var gardenType = mAllModularRotateImgBean!![pos].garden
|
|
var gardenType = mAllModularRotateImgBean!![pos].garden
|
|
|
- //LogUtils.logD("gardenType"+gardenType)
|
|
|
|
|
|
|
+
|
|
|
|
|
+ LogUtils.logD("gardenType"+modelType)
|
|
|
//加载半圆图标
|
|
//加载半圆图标
|
|
|
Glide.with(applicationContext)
|
|
Glide.with(applicationContext)
|
|
|
.load(Config.ApiBaseUrl + "/synchronization/previewImg?imgUrl=" + gardenType)
|
|
.load(Config.ApiBaseUrl + "/synchronization/previewImg?imgUrl=" + gardenType)
|
|
@@ -147,48 +187,62 @@ class MainActivity : BaseActivity() {
|
|
|
if (modelType.equals("RES_MOVIE")) {
|
|
if (modelType.equals("RES_MOVIE")) {
|
|
|
// openPage(MovieFragment::class.java)
|
|
// openPage(MovieFragment::class.java)
|
|
|
openPage("MovieFragment", null, CoreAnim.none,false)
|
|
openPage("MovieFragment", null, CoreAnim.none,false)
|
|
|
|
|
+ //changePage("MovieFragment", null, CoreAnim.none)
|
|
|
// changePage(MovieFragment::class.java)
|
|
// changePage(MovieFragment::class.java)
|
|
|
}else if (modelType.equals("RES_MUSIC")) {
|
|
}else if (modelType.equals("RES_MUSIC")) {
|
|
|
// openPage(MusicFragment::class.java)
|
|
// openPage(MusicFragment::class.java)
|
|
|
openPage("MusicFragment",null, CoreAnim.none,false)
|
|
openPage("MusicFragment",null, CoreAnim.none,false)
|
|
|
|
|
+ //changePage("MusicFragment", null, CoreAnim.none)
|
|
|
// changePage(MusicFragment::class.java)
|
|
// changePage(MusicFragment::class.java)
|
|
|
}else if (modelType.equals("RES_GAME")) {
|
|
}else if (modelType.equals("RES_GAME")) {
|
|
|
// openPage(GameFragment::class.java)
|
|
// openPage(GameFragment::class.java)
|
|
|
openPage("GameFragment", null, CoreAnim.none,false)
|
|
openPage("GameFragment", null, CoreAnim.none,false)
|
|
|
|
|
+ //changePage("GameFragment", null, CoreAnim.none)
|
|
|
}else if (modelType.equals("RES_NETWORK")) {
|
|
}else if (modelType.equals("RES_NETWORK")) {
|
|
|
// openPage(BrowserFragment::class.java)
|
|
// openPage(BrowserFragment::class.java)
|
|
|
openPage("BrowserFragment", null, CoreAnim.none,false)
|
|
openPage("BrowserFragment", null, CoreAnim.none,false)
|
|
|
|
|
+ //changePage("BrowserFragment", null, CoreAnim.none)
|
|
|
}else if (modelType.equals("RES_MAP")) {
|
|
}else if (modelType.equals("RES_MAP")) {
|
|
|
// openPage(MapsFragment::class.java)
|
|
// openPage(MapsFragment::class.java)
|
|
|
openPage("MapsFragment", null, CoreAnim.none,false)
|
|
openPage("MapsFragment", null, CoreAnim.none,false)
|
|
|
|
|
+ //changePage("MapsFragment", null, CoreAnim.none)
|
|
|
}else if (modelType.equals("RES_ABOUT")) {
|
|
}else if (modelType.equals("RES_ABOUT")) {
|
|
|
//openPage(AboutFragment::class.java)
|
|
//openPage(AboutFragment::class.java)
|
|
|
openPage("AboutFragment", null, CoreAnim.none,false)
|
|
openPage("AboutFragment", null, CoreAnim.none,false)
|
|
|
|
|
+ //changePage("AboutFragment", null, CoreAnim.none)
|
|
|
|
|
+ }else if(modelType.equals("RES_ORDER")){
|
|
|
|
|
+ openPage("OrderFragment", null, CoreAnim.none,false)
|
|
|
}
|
|
}
|
|
|
}else{
|
|
}else{
|
|
|
if (mItemTexts[pos].equals("电影")) {
|
|
if (mItemTexts[pos].equals("电影")) {
|
|
|
// openPage(MovieFragment::class.java)
|
|
// openPage(MovieFragment::class.java)
|
|
|
openPage("MovieFragment", null, CoreAnim.none,false)
|
|
openPage("MovieFragment", null, CoreAnim.none,false)
|
|
|
|
|
+ //changePage("MovieFragment", null, CoreAnim.none)
|
|
|
iv_mymenu_center.setImageResource(R.mipmap.round_moive)
|
|
iv_mymenu_center.setImageResource(R.mipmap.round_moive)
|
|
|
}else if (mItemTexts[pos].equals("音乐")) {
|
|
}else if (mItemTexts[pos].equals("音乐")) {
|
|
|
// openPage(MusicFragment::class.java)
|
|
// openPage(MusicFragment::class.java)
|
|
|
openPage("MusicFragment",null, CoreAnim.none,false)
|
|
openPage("MusicFragment",null, CoreAnim.none,false)
|
|
|
|
|
+ //changePage("MusicFragment", null, CoreAnim.none)
|
|
|
iv_mymenu_center.setImageResource(R.mipmap.round_music)
|
|
iv_mymenu_center.setImageResource(R.mipmap.round_music)
|
|
|
}else if (mItemTexts[pos].equals("游戏")) {
|
|
}else if (mItemTexts[pos].equals("游戏")) {
|
|
|
// openPage(GameFragment::class.java)
|
|
// openPage(GameFragment::class.java)
|
|
|
openPage("GameFragment",null, CoreAnim.none,false)
|
|
openPage("GameFragment",null, CoreAnim.none,false)
|
|
|
|
|
+ //changePage("GameFragment", null, CoreAnim.none)
|
|
|
iv_mymenu_center.setImageResource(R.mipmap.round_game)
|
|
iv_mymenu_center.setImageResource(R.mipmap.round_game)
|
|
|
}else if (mItemTexts[pos].equals("浏览器")) {
|
|
}else if (mItemTexts[pos].equals("浏览器")) {
|
|
|
//openPage(BrowserFragment::class.java)
|
|
//openPage(BrowserFragment::class.java)
|
|
|
openPage("BrowserFragment",null, CoreAnim.none,false)
|
|
openPage("BrowserFragment",null, CoreAnim.none,false)
|
|
|
|
|
+ //changePage("BrowserFragment", null, CoreAnim.none)
|
|
|
iv_mymenu_center.setImageResource(R.mipmap.round_network)
|
|
iv_mymenu_center.setImageResource(R.mipmap.round_network)
|
|
|
}else if (mItemTexts[pos].equals("地图")) {
|
|
}else if (mItemTexts[pos].equals("地图")) {
|
|
|
//openPage(MapsFragment::class.java)
|
|
//openPage(MapsFragment::class.java)
|
|
|
openPage("MapsFragment",null, CoreAnim.none,false)
|
|
openPage("MapsFragment",null, CoreAnim.none,false)
|
|
|
|
|
+ //changePage("MapsFragment", null, CoreAnim.none)
|
|
|
iv_mymenu_center.setImageResource(R.mipmap.round_maps)
|
|
iv_mymenu_center.setImageResource(R.mipmap.round_maps)
|
|
|
}else if (mItemTexts[pos].equals("关于")) {
|
|
}else if (mItemTexts[pos].equals("关于")) {
|
|
|
// openPage(AboutFragment::class.java)
|
|
// openPage(AboutFragment::class.java)
|
|
|
openPage("AboutFragment",null, CoreAnim.none,false)
|
|
openPage("AboutFragment",null, CoreAnim.none,false)
|
|
|
|
|
+ //changePage("AboutFragment", null, CoreAnim.none)
|
|
|
iv_mymenu_center.setImageResource(R.mipmap.round_settings)
|
|
iv_mymenu_center.setImageResource(R.mipmap.round_settings)
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
@@ -286,34 +340,37 @@ class MainActivity : BaseActivity() {
|
|
|
*/
|
|
*/
|
|
|
private fun initIconRes() {
|
|
private fun initIconRes() {
|
|
|
viewModel.findAllModularRotateImgBeanLiveData.observe(this){it->
|
|
viewModel.findAllModularRotateImgBeanLiveData.observe(this){it->
|
|
|
- LogUtils.logD("main"+it)
|
|
|
|
|
|
|
+ //LogUtils.logD("initIconRes"+it)
|
|
|
if(it.data!!.size != 0) {
|
|
if(it.data!!.size != 0) {
|
|
|
mUpCircleMenuLayout!!.setMenuItemIconsAndTexts(it.data)
|
|
mUpCircleMenuLayout!!.setMenuItemIconsAndTexts(it.data)
|
|
|
mAllModularRotateImgBean = it.data
|
|
mAllModularRotateImgBean = it.data
|
|
|
- //LogUtils.logD("AllModularRotateImgBean"+it.data+"==" + it.data.get(pos)+"=="+pos)
|
|
|
|
|
|
|
+ //LogUtils.logD("AllModularRotateImgBean"+it.data+"==" + it.data.get(pos).mid+"=="+pos)
|
|
|
//加载半圆图标
|
|
//加载半圆图标
|
|
|
Glide.with(this)
|
|
Glide.with(this)
|
|
|
.load(Config.ApiBaseUrl + "/synchronization/previewImg?imgUrl=" + it.data.get(9).garden)
|
|
.load(Config.ApiBaseUrl + "/synchronization/previewImg?imgUrl=" + it.data.get(9).garden)
|
|
|
.into(iv_mymenu_center)
|
|
.into(iv_mymenu_center)
|
|
|
- when (pos) {
|
|
|
|
|
- 0 -> {
|
|
|
|
|
|
|
+ when (it.data.get(pos).mid) {
|
|
|
|
|
+ "RES_MOVIE" -> {
|
|
|
openPage(MovieFragment::class.java)
|
|
openPage(MovieFragment::class.java)
|
|
|
}
|
|
}
|
|
|
- 1 -> {
|
|
|
|
|
|
|
+ "RES_MUSIC" -> {
|
|
|
openPage(MusicFragment::class.java)
|
|
openPage(MusicFragment::class.java)
|
|
|
}
|
|
}
|
|
|
- 2 -> {
|
|
|
|
|
|
|
+ "RES_GAME" -> {
|
|
|
openPage(GameFragment::class.java)
|
|
openPage(GameFragment::class.java)
|
|
|
}
|
|
}
|
|
|
- 3 -> {
|
|
|
|
|
|
|
+ "RES_BROWSER" -> {
|
|
|
openPage(BrowserFragment::class.java)
|
|
openPage(BrowserFragment::class.java)
|
|
|
}
|
|
}
|
|
|
- 4 -> {
|
|
|
|
|
|
|
+ "RES_MAP" -> {
|
|
|
openPage(MapsFragment::class.java)
|
|
openPage(MapsFragment::class.java)
|
|
|
}
|
|
}
|
|
|
- 5 -> {
|
|
|
|
|
|
|
+ "RES_ABOUT" -> {
|
|
|
openPage(AboutFragment::class.java)
|
|
openPage(AboutFragment::class.java)
|
|
|
}
|
|
}
|
|
|
|
|
+ "RES_ORDER" -> {
|
|
|
|
|
+ openPage(OrderFragment::class.java)
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|