日夜间模式的切换(开服表页面) https://git.shanqu.cc/halo/android/assistant-android/-/issues/65
This commit is contained in:
@ -87,8 +87,8 @@ object AddKaiFuBindingAdapter {
|
||||
|
||||
})
|
||||
if (i == list.size - 1) {
|
||||
binding.kaifuAddTime.background = R.drawable.bg_add_kaifu_bottom_left.toDrawable()
|
||||
binding.kaifuAddServerName.background = R.drawable.bg_add_kaifu_bottom_right.toDrawable()
|
||||
binding.kaifuAddTime.background = R.drawable.bg_add_kaifu_bottom_left.toDrawable(view.context)
|
||||
binding.kaifuAddServerName.background = R.drawable.bg_add_kaifu_bottom_right.toDrawable(view.context)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -9,6 +9,7 @@ import android.view.ViewGroup
|
||||
import android.widget.LinearLayout
|
||||
import android.widget.PopupWindow
|
||||
import android.widget.TextView
|
||||
import androidx.annotation.ColorInt
|
||||
import androidx.constraintlayout.widget.ConstraintLayout
|
||||
import androidx.core.content.ContextCompat
|
||||
import androidx.recyclerview.widget.LinearLayoutManager
|
||||
@ -16,6 +17,7 @@ import androidx.recyclerview.widget.RecyclerView
|
||||
import com.gh.gamecenter.common.utils.dip2px
|
||||
import com.gh.gamecenter.common.utils.toColor
|
||||
import com.gh.gamecenter.R
|
||||
import com.gh.gamecenter.common.utils.toDrawable
|
||||
import com.gh.gamecenter.databinding.ItemFilterBinding
|
||||
import com.gh.gamecenter.databinding.LayoutFilterBinding
|
||||
import com.google.android.flexbox.FlexboxLayout
|
||||
@ -34,6 +36,9 @@ class FilterView @JvmOverloads constructor(context: Context, attrs: AttributeSet
|
||||
|
||||
private var mHighlightSubFilterIfItsNotDefault: Boolean = false // 当次 filter 选中非默认的时候高亮显示
|
||||
|
||||
private var mPopupWindow: PopupWindow? = null
|
||||
private var mSubFilterSelectedCallback: ((String) -> Unit)? = null
|
||||
|
||||
init {
|
||||
mBinding = LayoutFilterBinding.inflate(LayoutInflater.from(context), this, true)
|
||||
}
|
||||
@ -47,13 +52,14 @@ class FilterView @JvmOverloads constructor(context: Context, attrs: AttributeSet
|
||||
highlightSubFilterIfNotDefault: Boolean = false) {
|
||||
mMainFilterList = mainFilterList
|
||||
mSubFilterList = subFilterList
|
||||
mSubFilterSelectedCallback = subFilterSelectedCallback
|
||||
|
||||
mHighlightSubFilterIfItsNotDefault = highlightSubFilterIfNotDefault
|
||||
|
||||
mBinding?.subFilterTv?.text = subFilterText
|
||||
mBinding?.subFilterTv?.setOnClickListener {
|
||||
showSelectionPopupWindow(this, it as TextView, mSelectedSubFilter) { selectedText ->
|
||||
subFilterSelectedCallback.invoke(selectedText)
|
||||
mSubFilterSelectedCallback?.invoke(selectedText)
|
||||
}
|
||||
}
|
||||
|
||||
@ -76,9 +82,9 @@ class FilterView @JvmOverloads constructor(context: Context, attrs: AttributeSet
|
||||
mSelectedSubFilter = filter
|
||||
mBinding?.subFilterTv?.text = filter
|
||||
if (filter != mSubFilterList.firstOrNull() && mHighlightSubFilterIfItsNotDefault) {
|
||||
mBinding?.subFilterTv?.setTextColor(R.color.theme_font.toColor())
|
||||
mBinding?.subFilterTv?.setTextColor(R.color.theme_font.toColor(context))
|
||||
} else {
|
||||
mBinding?.subFilterTv?.setTextColor(R.color.text_757575.toColor())
|
||||
mBinding?.subFilterTv?.setTextColor(R.color.text_757575.toColor(context))
|
||||
}
|
||||
}
|
||||
|
||||
@ -101,15 +107,16 @@ class FilterView @JvmOverloads constructor(context: Context, attrs: AttributeSet
|
||||
drawableUp?.setBounds(0, 0, drawableUp.minimumWidth, drawableUp.minimumHeight)
|
||||
drawableDown?.setBounds(0, 0, drawableDown.minimumWidth, drawableDown.minimumHeight)
|
||||
|
||||
subFilterTv.setTextColor(R.color.theme_font.toColor())
|
||||
subFilterTv.setTextColor(R.color.theme_font.toColor(context))
|
||||
subFilterTv.setCompoundDrawables(null, null, drawableUp, null)
|
||||
|
||||
val inflater = LayoutInflater.from(subFilterTv.context)
|
||||
val layout = inflater.inflate(R.layout.layout_filter_size, null)
|
||||
val popupWindow = PopupWindow(
|
||||
layout,
|
||||
LinearLayout.LayoutParams.MATCH_PARENT,
|
||||
LinearLayout.LayoutParams.WRAP_CONTENT)
|
||||
layout,
|
||||
LinearLayout.LayoutParams.MATCH_PARENT,
|
||||
LinearLayout.LayoutParams.WRAP_CONTENT
|
||||
).apply { mPopupWindow = this }
|
||||
|
||||
val flexboxLayout = layout.findViewById<FlexboxLayout>(R.id.flexbox)
|
||||
val backgroundView = layout.findViewById<View>(R.id.background)
|
||||
@ -118,6 +125,7 @@ class FilterView @JvmOverloads constructor(context: Context, attrs: AttributeSet
|
||||
|
||||
backgroundView.setOnClickListener {
|
||||
popupWindow.dismiss()
|
||||
mPopupWindow = null
|
||||
}
|
||||
|
||||
for (filter in mSubFilterList) {
|
||||
@ -160,6 +168,28 @@ class FilterView @JvmOverloads constructor(context: Context, attrs: AttributeSet
|
||||
popupWindow.showAsDropDown(containerView, 0, -6)
|
||||
}
|
||||
|
||||
fun setRootBackgroundColor(@ColorInt color: Int) {
|
||||
mBinding?.root?.setBackgroundColor(color)
|
||||
}
|
||||
|
||||
fun updateFilterRecyclerView() {
|
||||
mBinding?.filterRecyclerView?.adapter?.run {
|
||||
mBinding?.filterRecyclerView?.recycledViewPool?.clear()
|
||||
notifyItemRangeChanged(0, itemCount)
|
||||
}
|
||||
}
|
||||
|
||||
fun updatePopupWindow() {
|
||||
mBinding?.run {
|
||||
if (mPopupWindow != null && mPopupWindow!!.isShowing) {
|
||||
mPopupWindow?.dismiss()
|
||||
showSelectionPopupWindow(this@FilterView, subFilterTv, subFilterTv.text.toString()) { selectedText ->
|
||||
mSubFilterSelectedCallback?.invoke(selectedText)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class FilterAdapter(val context: Context,
|
||||
private val mFilterList: ArrayList<String>,
|
||||
private val mDefaultSelectedFilter: String,
|
||||
@ -180,11 +210,11 @@ class FilterView @JvmOverloads constructor(context: Context, attrs: AttributeSet
|
||||
}
|
||||
|
||||
if (mSelectedFilter == mFilterList[position]) {
|
||||
holder.binding.titleTv.setBackgroundResource(R.drawable.bg_tag_text)
|
||||
holder.binding.titleTv.setTextColor(R.color.white.toColor())
|
||||
holder.binding.titleTv.background = R.drawable.bg_tag_text.toDrawable(context)
|
||||
holder.binding.titleTv.setTextColor(R.color.white.toColor(context))
|
||||
} else {
|
||||
holder.binding.titleTv.setBackgroundColor(R.color.background_white.toColor(holder.binding.root.context))
|
||||
holder.binding.titleTv.setTextColor(R.color.text_777777.toColor())
|
||||
holder.binding.titleTv.setBackgroundColor(R.color.background_white.toColor(context))
|
||||
holder.binding.titleTv.setTextColor(R.color.text_777777.toColor(context))
|
||||
}
|
||||
|
||||
holder.binding.titleTv.text = mFilterList[position]
|
||||
|
||||
@ -6,12 +6,14 @@ import android.os.Bundle
|
||||
import com.gh.gamecenter.common.constant.EntranceConsts
|
||||
import com.gh.gamecenter.NormalActivity
|
||||
import com.gh.gamecenter.R
|
||||
import com.gh.gamecenter.common.utils.updateStatusBarColor
|
||||
|
||||
class GameServerTestActivity : NormalActivity() {
|
||||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
setToolbarMenu(R.menu.menu_download)
|
||||
updateStatusBarColor(R.color.black, R.color.white)
|
||||
}
|
||||
|
||||
override fun showDownloadMenu() = true
|
||||
@ -20,6 +22,11 @@ class GameServerTestActivity : NormalActivity() {
|
||||
return getTargetIntent(this, GameServerTestActivity::class.java, GameServersTestFragment::class.java)
|
||||
}
|
||||
|
||||
override fun onNightModeChange() {
|
||||
super.onNightModeChange()
|
||||
updateStatusBarColor(R.color.black, R.color.white)
|
||||
}
|
||||
|
||||
companion object {
|
||||
fun getIntent(context: Context, id: String, title: String, entrance: String): Intent {
|
||||
val bundle = Bundle()
|
||||
|
||||
@ -18,6 +18,7 @@ import com.gh.gamecenter.core.utils.MtaHelper
|
||||
import com.gh.gamecenter.common.utils.viewModelProviderFromParent
|
||||
import com.gh.gamecenter.common.view.DrawableView
|
||||
import com.gh.gamecenter.R
|
||||
import com.gh.gamecenter.common.utils.updateStatusBarColor
|
||||
import com.halo.assistant.HaloApp
|
||||
import com.lightgame.view.NoScrollableViewPager
|
||||
|
||||
@ -46,6 +47,7 @@ class GameServersActivity : ToolBarActivity() {
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
|
||||
updateStatusBarColor(R.color.black, R.color.white)
|
||||
mServersTest = findViewById(R.id.server_test)
|
||||
mServersPublish = findViewById(R.id.server_publish)
|
||||
mViewpager = findViewById(R.id.viewpager)
|
||||
@ -75,8 +77,8 @@ class GameServersActivity : ToolBarActivity() {
|
||||
|
||||
mToolbar.setNavigationOnClickListener { finish() }
|
||||
mServersPublish?.isChecked = true
|
||||
mServersTest?.setTextColor(DrawableView.getSelectorColorStyle(R.color.black, R.color.theme_font))
|
||||
mServersPublish?.setTextColor(DrawableView.getSelectorColorStyle(R.color.black, R.color.theme_font))
|
||||
mServersTest?.setTextColor(DrawableView.getSelectorColorStyle(R.color.text_black, R.color.theme_font, this))
|
||||
mServersPublish?.setTextColor(DrawableView.getSelectorColorStyle(R.color.text_black, R.color.theme_font, this))
|
||||
mServersTest?.setOnClickListener { mViewpager?.currentItem = mServersTestIndex }
|
||||
mServersPublish?.setOnClickListener { mViewpager?.currentItem = mServersPublishIndex }
|
||||
|
||||
@ -144,6 +146,19 @@ class GameServersActivity : ToolBarActivity() {
|
||||
return true
|
||||
}
|
||||
|
||||
override fun getActivityNameInChinese(): String {
|
||||
return "开服表"
|
||||
}
|
||||
|
||||
override fun isAutoResetViewBackgroundEnabled() = true
|
||||
|
||||
override fun onNightModeChange() {
|
||||
super.onNightModeChange()
|
||||
updateStatusBarColor(R.color.black, R.color.white)
|
||||
mServersTest?.setTextColor(DrawableView.getSelectorColorStyle(R.color.text_black, R.color.theme_font, this))
|
||||
mServersPublish?.setTextColor(DrawableView.getSelectorColorStyle(R.color.text_black, R.color.theme_font, this))
|
||||
}
|
||||
|
||||
companion object {
|
||||
@JvmStatic
|
||||
fun getIntent(context: Context, entrance: String, path: String): Intent {
|
||||
@ -152,8 +167,4 @@ class GameServersActivity : ToolBarActivity() {
|
||||
return intent
|
||||
}
|
||||
}
|
||||
|
||||
override fun getActivityNameInChinese(): String {
|
||||
return "开服表"
|
||||
}
|
||||
}
|
||||
@ -22,6 +22,7 @@ import com.gh.gamecenter.baselist.LoadStatus
|
||||
import com.gh.gamecenter.core.utils.StringUtils
|
||||
import com.gh.gamecenter.common.utils.toBinding
|
||||
import com.gh.gamecenter.common.utils.toColor
|
||||
import com.gh.gamecenter.common.utils.toDrawable
|
||||
import com.gh.gamecenter.core.utils.DisplayUtils
|
||||
import com.gh.gamecenter.entity.GameEntity
|
||||
import com.lightgame.adapter.BaseRecyclerAdapter
|
||||
@ -174,6 +175,8 @@ class GameServersContentAdapter(
|
||||
val serverRemaining = gameEntity.serverRemaining
|
||||
if (serverRemaining != null) {
|
||||
holder.binding.extendContainer.visibility = View.VISIBLE
|
||||
holder.binding.extendContainer.setBackgroundColor(R.color.background_white.toColor(mContext))
|
||||
holder.binding.extendContent.setTextColor(R.color.theme_font.toColor(mContext))
|
||||
holder.binding.extendContent.text = "展开剩余" + serverRemaining.size + "条开服信息"
|
||||
holder.binding.extendContent.setOnClickListener {
|
||||
mViewModel.mergerRemainingData(gameEntity, position)
|
||||
@ -203,6 +206,8 @@ class GameServersContentAdapter(
|
||||
}
|
||||
|
||||
is GameServerTimeViewHolder -> {
|
||||
holder.binding.root.setBackgroundColor(R.color.background_white.toColor(mContext))
|
||||
holder.binding.kaifuItemTimeTv.setTextColor(R.color.text_title.toColor(mContext))
|
||||
if (mIsShowPullDownTip && position == 1) {
|
||||
holder.binding.emptyView.visibility = View.VISIBLE
|
||||
} else {
|
||||
@ -221,7 +226,7 @@ class GameServersContentAdapter(
|
||||
|
||||
is FooterViewHolder -> {
|
||||
holder.run {
|
||||
itemView.setBackgroundColor(R.color.background.toColor())
|
||||
itemView.setBackgroundColor(R.color.background.toColor(mContext))
|
||||
if (position == 0) {
|
||||
when {
|
||||
mPrevIsNetworkError -> {
|
||||
@ -269,6 +274,14 @@ class GameServersContentAdapter(
|
||||
}
|
||||
|
||||
private fun initGameTestViewHolder(gameEntity: GameEntity, viewHolder: GameTestViewHolder) {
|
||||
viewHolder.run {
|
||||
binding.contentContainer.background = R.drawable.reuse_listview_item_style.toDrawable(mContext)
|
||||
gameName.setTextColor(R.color.text_title.toColor(mContext))
|
||||
gameDes.setTextColor(R.color.text_subtitleDesc.toColor(mContext))
|
||||
gameDownloadSpeed.setTextColor(R.color.text_subtitleDesc.toColor(mContext))
|
||||
gameDownloadPercentage.setTextColor(R.color.theme_font.toColor(mContext))
|
||||
}
|
||||
|
||||
viewHolder.gameName.text = gameEntity.name
|
||||
BindingAdapters.setGame(viewHolder.gameThumb, gameEntity)
|
||||
|
||||
@ -311,7 +324,6 @@ class GameServersContentAdapter(
|
||||
}
|
||||
}
|
||||
|
||||
gameEntity.getApk()
|
||||
if (gameEntity.getApk().isEmpty()) {
|
||||
viewHolder.gameDes.text = gameEntity.brief
|
||||
} else {
|
||||
|
||||
@ -58,12 +58,12 @@ class GameServersContentFragment : BaseFragment<Any?>() {
|
||||
if (locationList != null && mIsRefreshDownload) {
|
||||
for (location in locationList) {
|
||||
mViewModel?.listLiveData?.value?.second?.safelyGetInRelease(location)?.let { gameEntity ->
|
||||
DownloadItemUtils.processDate(gameEntity, downloadEntity, mAdapter, location)
|
||||
DownloadItemUtils.processDate(gameEntity, downloadEntity, mAdapter, location + 1)
|
||||
}
|
||||
}
|
||||
if (XapkUnzipStatus.FAILURE.name == downloadEntity.meta[XapkInstaller.XAPK_UNZIP_STATUS]) {
|
||||
for (position in locationList) {
|
||||
val targetView = mLayoutManager?.findViewByPosition(position)
|
||||
val targetView = mLayoutManager?.findViewByPosition(position + 1)
|
||||
if (targetView != null) {
|
||||
DialogUtils.showUnzipFailureDialog(requireContext(), downloadEntity)
|
||||
break
|
||||
@ -364,6 +364,7 @@ class GameServersContentFragment : BaseFragment<Any?>() {
|
||||
// mBinding?.kaifuTimeContainer?.kaifuItemTime?.visibility = View.VISIBLE
|
||||
mSkeleton?.hide()
|
||||
mBinding?.run {
|
||||
root.setBackgroundColor(Color.TRANSPARENT)
|
||||
recyclerView.visibility = View.VISIBLE
|
||||
noConnectionContainer.reuseNoConnection.visibility = View.GONE
|
||||
reuseNoneData.visibility = View.GONE
|
||||
@ -379,6 +380,7 @@ class GameServersContentFragment : BaseFragment<Any?>() {
|
||||
mBinding?.run {
|
||||
root.setBackgroundColor(Color.TRANSPARENT)
|
||||
mSkeleton?.hide()
|
||||
recyclerView.visibility = View.GONE
|
||||
kaifuTimeContainer.kaifuItemTime.visibility = View.GONE
|
||||
noConnectionContainer.reuseNoConnection.visibility = View.VISIBLE
|
||||
reuseNoneData.visibility = View.GONE
|
||||
@ -392,6 +394,7 @@ class GameServersContentFragment : BaseFragment<Any?>() {
|
||||
mBinding?.run {
|
||||
root.setBackgroundColor(Color.TRANSPARENT)
|
||||
mSkeleton?.hide()
|
||||
recyclerView.visibility = View.GONE
|
||||
kaifuTimeContainer.kaifuItemTime.visibility = View.GONE
|
||||
noConnectionContainer.reuseNoConnection.visibility = View.GONE
|
||||
reuseNoneData.visibility = View.VISIBLE
|
||||
@ -407,4 +410,14 @@ class GameServersContentFragment : BaseFragment<Any?>() {
|
||||
mBinding?.kaifuTimeContainer?.kaifuItemTime?.layoutParams = mLlParams
|
||||
}, 10)
|
||||
}
|
||||
|
||||
override fun onNightModeChange() {
|
||||
super.onNightModeChange()
|
||||
mBinding?.recyclerView?.run {
|
||||
recycledViewPool.clear()
|
||||
adapter?.run {
|
||||
notifyItemRangeChanged(0, itemCount)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -96,7 +96,7 @@ class GameServersPublishFragment : LazyFragment() {
|
||||
MtaHelper.onEvent("开服表", "开服Tab-游戏分类", "点击游戏分类")
|
||||
|
||||
v.isChecked = true
|
||||
v.setTextColor(R.color.theme_font.toColor())
|
||||
v.setTextColor(R.color.theme_font.toColor(requireContext()))
|
||||
|
||||
val inflater = LayoutInflater.from(context)
|
||||
val layout = inflater.inflate(R.layout.popup_server_category, null)
|
||||
@ -110,8 +110,8 @@ class GameServersPublishFragment : LazyFragment() {
|
||||
val complete = layout.findViewById<TextView>(R.id.complete)
|
||||
val contentContainer = layout.findViewById<LinearLayout>(R.id.content_container)
|
||||
|
||||
reset.background = DrawableView.getStrokeDrawable(R.color.text_body)
|
||||
complete.background = DrawableView.getOvalDrawable(R.color.theme)
|
||||
reset.background = DrawableView.getStrokeDrawable(R.color.text_body, context = requireContext())
|
||||
complete.background = DrawableView.getOvalDrawable(R.color.theme, context = requireContext())
|
||||
|
||||
contentContainer.removeAllViews()
|
||||
for (entity in mCategoryList) {
|
||||
@ -126,8 +126,8 @@ class GameServersPublishFragment : LazyFragment() {
|
||||
label.gravity = Gravity.CENTER
|
||||
label.textSize = 13F
|
||||
label.text = name
|
||||
label.background = DrawableView.getOvalSelectorStyle(R.color.background, R.color.text_e6f3ff)
|
||||
label.setTextColor(DrawableView.getSelectorColorStyle(R.color.text_title, R.color.theme_font))
|
||||
label.background = DrawableView.getOvalSelectorStyle(R.color.background, R.color.text_e6f3ff, requireContext())
|
||||
label.setTextColor(DrawableView.getSelectorColorStyle(R.color.text_title, R.color.theme_font, requireContext()))
|
||||
label.isSingleLine = true
|
||||
labelsContainer.addView(label)
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) {
|
||||
@ -192,7 +192,7 @@ class GameServersPublishFragment : LazyFragment() {
|
||||
|
||||
popupWindow.setOnDismissListener {
|
||||
v.isChecked = false
|
||||
if (mTags.isNullOrEmpty()) v.setTextColor(R.color.text_title.toColor())
|
||||
if (mTags.isNullOrEmpty()) v.setTextColor(R.color.text_title.toColor(requireContext()))
|
||||
}
|
||||
popupWindow.showAsDropDown(mBinding?.divider)
|
||||
}
|
||||
@ -202,7 +202,7 @@ class GameServersPublishFragment : LazyFragment() {
|
||||
MtaHelper.onEvent("开服表", "开服Tab", "开服时间")
|
||||
|
||||
v.isChecked = true
|
||||
v.setTextColor(R.color.theme_font.toColor())
|
||||
v.setTextColor(R.color.theme_font.toColor(requireContext()))
|
||||
|
||||
val inflater = LayoutInflater.from(v.context)
|
||||
val layout = inflater.inflate(R.layout.popup_server_time, null)
|
||||
@ -240,7 +240,7 @@ class GameServersPublishFragment : LazyFragment() {
|
||||
// position = 0: all
|
||||
val hour = TextView(v.context)
|
||||
hour.textSize = 14F
|
||||
hour.setTextColor(R.color.text_title.toColor())
|
||||
hour.setTextColor(R.color.text_title.toColor(requireContext()))
|
||||
hour.gravity = Gravity.CENTER_VERTICAL
|
||||
hour.setPadding(24F.dip2px(), 0, 0, 0)
|
||||
hourContainer.addView(hour, ViewGroup.LayoutParams.MATCH_PARENT, 43F.dip2px())
|
||||
@ -273,9 +273,9 @@ class GameServersPublishFragment : LazyFragment() {
|
||||
}
|
||||
}
|
||||
|
||||
today.setTextColor(DrawableView.getSelectorColorStyle(R.color.text_title, R.color.theme_font))
|
||||
tomorrow.setTextColor(DrawableView.getSelectorColorStyle(R.color.text_title, R.color.theme_font))
|
||||
after.setTextColor(DrawableView.getSelectorColorStyle(R.color.text_title, R.color.theme_font))
|
||||
today.setTextColor(DrawableView.getSelectorColorStyle(R.color.text_title, R.color.theme_font, requireContext()))
|
||||
tomorrow.setTextColor(DrawableView.getSelectorColorStyle(R.color.text_title, R.color.theme_font, requireContext()))
|
||||
after.setTextColor(DrawableView.getSelectorColorStyle(R.color.text_title, R.color.theme_font, requireContext()))
|
||||
|
||||
layout.setOnClickListener {
|
||||
popupWindow.dismiss()
|
||||
@ -306,7 +306,7 @@ class GameServersPublishFragment : LazyFragment() {
|
||||
|
||||
popupWindow.setOnDismissListener {
|
||||
v.isChecked = false
|
||||
if (mDay.isNullOrEmpty()) v.setTextColor(R.color.text_title.toColor())
|
||||
if (mDay.isNullOrEmpty()) v.setTextColor(R.color.text_title.toColor(requireContext()))
|
||||
}
|
||||
popupWindow.showAsDropDown(mBinding?.divider)
|
||||
}
|
||||
@ -317,8 +317,8 @@ class GameServersPublishFragment : LazyFragment() {
|
||||
mTags = null
|
||||
mBinding?.run {
|
||||
serverTime.text = "开服时间"
|
||||
serverTime.setTextColor(R.color.text_title.toColor())
|
||||
serverStatus.setTextColor(R.color.text_title.toColor())
|
||||
serverTime.setTextColor(R.color.text_title.toColor(requireContext()))
|
||||
serverStatus.setTextColor(R.color.text_title.toColor(requireContext()))
|
||||
}
|
||||
mContentFragment.filterData(mDay, mHour, mType, mTags)
|
||||
}
|
||||
|
||||
@ -18,6 +18,7 @@ import com.gh.gamecenter.GameDetailActivity
|
||||
import com.gh.gamecenter.R
|
||||
import com.gh.gamecenter.adapter.viewholder.FooterViewHolder
|
||||
import com.gh.gamecenter.adapter.viewholder.GameViewHolder
|
||||
import com.gh.gamecenter.common.utils.toColor
|
||||
import com.gh.gamecenter.databinding.ItemTestServerTextBinding
|
||||
import com.gh.gamecenter.entity.GameEntity
|
||||
import com.gh.gamecenter.game.GameItemViewHolder
|
||||
@ -98,7 +99,8 @@ class GameServersTestAdapter(context: Context,
|
||||
initViewHolder(gameEntity, holder)
|
||||
}
|
||||
is GameServerTimeViewHolder -> {
|
||||
// holder.container.setPadding(0, 8F.dip2px(), 0, 4F.dip2px())
|
||||
holder.binding.root.setBackgroundColor(R.color.background_white.toColor(mContext))
|
||||
holder.binding.kaifuItemTimeTv.setTextColor(R.color.text_title.toColor(mContext))
|
||||
holder.binding.kaifuItemHeader.setImageResource(R.drawable.kaifu_time_icon)
|
||||
holder.binding.kaifuItemTimeTv.text = mDataList[position].time
|
||||
}
|
||||
@ -106,6 +108,7 @@ class GameServersTestAdapter(context: Context,
|
||||
initFooterViewHolder(holder)
|
||||
}
|
||||
is TextViewHolder -> {
|
||||
holder.binding.root.setBackgroundColor(R.color.background_white.toColor(mContext))
|
||||
holder.binding.contentTv.text = mDataList[position].text
|
||||
}
|
||||
}
|
||||
|
||||
@ -189,7 +189,7 @@ class GameServersTestFragment : LazyFragment() {
|
||||
mViewModel?.updateTimeFilter(filterDay)
|
||||
mBinding?.filterView?.updateSelectedMainFilter(filterDay)
|
||||
mBinding?.serverTime?.text = filterDay
|
||||
mBinding?.serverTime?.setTextColor(R.color.theme_font.toColor())
|
||||
mBinding?.serverTime?.setTextColor(R.color.theme_font.toColor(requireContext()))
|
||||
}
|
||||
|
||||
// 悬挂的文案
|
||||
@ -219,7 +219,7 @@ class GameServersTestFragment : LazyFragment() {
|
||||
mViewModel?.updateTimeFilter(mSupremeSelectedDay!!)
|
||||
mBinding?.filterView?.updateSelectedMainFilter(mSupremeSelectedDay!!)
|
||||
mBinding?.serverTime?.text = mSupremeSelectedDay
|
||||
mBinding?.serverTime?.setTextColor(R.color.theme_font.toColor())
|
||||
mBinding?.serverTime?.setTextColor(R.color.theme_font.toColor(requireContext()))
|
||||
mSupremeSelectedDay = null
|
||||
}
|
||||
if (newState == RecyclerView.SCROLL_STATE_DRAGGING) {
|
||||
@ -309,7 +309,7 @@ class GameServersTestFragment : LazyFragment() {
|
||||
MtaHelper.onEvent("开服表", "开测Tab", "测试状态")
|
||||
|
||||
v.isChecked = true
|
||||
v.setTextColor(R.color.theme_font.toColor())
|
||||
v.setTextColor(R.color.theme_font.toColor(requireContext()))
|
||||
|
||||
val binding = PopupServerStatusBinding.inflate(LayoutInflater.from(context))
|
||||
val layout = binding.root
|
||||
@ -324,7 +324,7 @@ class GameServersTestFragment : LazyFragment() {
|
||||
for ((index, tv) in tvList.withIndex()) {
|
||||
tv.text = typeList[index]
|
||||
if (tv.text.toString() == mType) {
|
||||
tv.setTextColor(R.color.theme_font.toColor())
|
||||
tv.setTextColor(R.color.theme_font.toColor(requireContext()))
|
||||
}
|
||||
tv.setOnClickListener {
|
||||
callback.invoke(tv.text.toString())
|
||||
@ -342,7 +342,7 @@ class GameServersTestFragment : LazyFragment() {
|
||||
|
||||
popupWindow.setOnDismissListener {
|
||||
v.isChecked = false
|
||||
if (mType == "全部") v.setTextColor(R.color.text_title.toColor())
|
||||
if (mType == "全部") v.setTextColor(R.color.text_title.toColor(requireContext()))
|
||||
}
|
||||
popupWindow.showAsDropDown(v)
|
||||
}
|
||||
@ -351,7 +351,7 @@ class GameServersTestFragment : LazyFragment() {
|
||||
MtaHelper.onEvent("开服表", "开测Tab", "开测时间")
|
||||
|
||||
v.isChecked = true
|
||||
v.setTextColor(R.color.theme_font.toColor())
|
||||
v.setTextColor(R.color.theme_font.toColor(requireContext()))
|
||||
|
||||
val binding = PopupTestTimeBinding.inflate(LayoutInflater.from(v.context))
|
||||
val layout = binding.root
|
||||
@ -363,7 +363,7 @@ class GameServersTestFragment : LazyFragment() {
|
||||
|
||||
for ((index, tv) in tvList.withIndex()) {
|
||||
tv.text = dayList[index]
|
||||
tv.setTextColor(DrawableView.getSelectorColorStyle(R.color.text_title, R.color.theme_font))
|
||||
tv.setTextColor(DrawableView.getSelectorColorStyle(R.color.text_title, R.color.theme_font, requireContext()))
|
||||
tv.isChecked = tv.text == v.text
|
||||
tv.setOnClickListener {
|
||||
callback.invoke(tv.text.toString())
|
||||
@ -382,7 +382,7 @@ class GameServersTestFragment : LazyFragment() {
|
||||
|
||||
popupWindow.setOnDismissListener {
|
||||
v.isChecked = false
|
||||
if (mDay.isNullOrEmpty()) v.setTextColor(R.color.text_title.toColor())
|
||||
if (mDay.isNullOrEmpty()) v.setTextColor(R.color.text_title.toColor(requireContext()))
|
||||
}
|
||||
popupWindow.showAsDropDown(v)
|
||||
}
|
||||
@ -392,8 +392,8 @@ class GameServersTestFragment : LazyFragment() {
|
||||
// mBinding?.serverTime?.text = "开测时间"
|
||||
mBinding?.serverStatus?.text = "测试状态"
|
||||
mBinding?.filterView?.updateSelectedSubFilter(mViewModel!!.typeList.first())
|
||||
mBinding?.serverTime?.setTextColor(R.color.text_title.toColor())
|
||||
mBinding?.serverStatus?.setTextColor(R.color.text_title.toColor())
|
||||
mBinding?.serverTime?.setTextColor(R.color.text_title.toColor(requireContext()))
|
||||
mBinding?.serverStatus?.setTextColor(R.color.text_title.toColor(requireContext()))
|
||||
mSubBinding?.run {
|
||||
reuseNoneData.visibility = View.GONE
|
||||
noConnectionContainer.root.visibility = View.GONE
|
||||
@ -482,6 +482,29 @@ class GameServersTestFragment : LazyFragment() {
|
||||
LogUtils.logServerTestSelectTypeEvent(type, mViewModel!!.testTitle, mViewModel!!.testRemark)
|
||||
}
|
||||
|
||||
override fun onNightModeChange() {
|
||||
super.onNightModeChange()
|
||||
mBinding?.run {
|
||||
root.setBackgroundColor(R.color.background.toColor(requireContext()))
|
||||
filterView.run {
|
||||
setRootBackgroundColor(R.color.background_white.toColor(requireContext()))
|
||||
updateFilterRecyclerView()
|
||||
updatePopupWindow()
|
||||
}
|
||||
}
|
||||
|
||||
mSubBinding?.run {
|
||||
kaifuTimeContainer.run {
|
||||
root.setBackgroundColor(R.color.background_white.toColor(requireContext()))
|
||||
kaifuItemTimeTv.setTextColor(R.color.text_title.toColor(requireContext()))
|
||||
}
|
||||
recyclerView.adapter?.run {
|
||||
recyclerView.recycledViewPool.clear()
|
||||
notifyItemRangeChanged(0, itemCount)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
companion object {
|
||||
const val TEST_COLUMN_ID = "test_column_id"
|
||||
const val TEST_TITLE = "title"
|
||||
|
||||
@ -3,7 +3,6 @@ package com.gh.gamecenter.servers.add
|
||||
import android.app.Activity
|
||||
import android.content.Context
|
||||
import android.content.Intent
|
||||
import android.graphics.Color
|
||||
import android.os.Bundle
|
||||
import android.text.SpannableString
|
||||
import android.text.Spanned
|
||||
@ -12,9 +11,10 @@ import android.text.style.ClickableSpan
|
||||
import android.view.Gravity
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import android.widget.EditText
|
||||
import android.widget.FrameLayout
|
||||
import android.widget.LinearLayout
|
||||
import android.widget.TextView
|
||||
import androidx.core.content.ContextCompat
|
||||
import androidx.lifecycle.ViewModelProviders
|
||||
import com.bigkoo.pickerview.builder.TimePickerBuilder
|
||||
import com.bigkoo.pickerview.listener.OnTimeSelectListener
|
||||
@ -24,6 +24,9 @@ import com.gh.common.databind.AddKaiFuBindingAdapter
|
||||
import com.gh.gamecenter.common.constant.EntranceConsts
|
||||
import com.gh.common.util.HaloWheelViewAdapter
|
||||
import com.gh.gamecenter.R
|
||||
import com.gh.gamecenter.common.utils.safelyGetInRelease
|
||||
import com.gh.gamecenter.common.utils.toColor
|
||||
import com.gh.gamecenter.common.utils.updateStatusBarColor
|
||||
import com.gh.gamecenter.databinding.ActivityKaifuAddBinding
|
||||
import com.gh.gamecenter.entity.ServerCalendarEntity
|
||||
import com.gh.gamecenter.gamedetail.fuli.kaifu.ServersCalendarActivity
|
||||
@ -49,6 +52,7 @@ class AddKaiFuActivity : ToolBarActivity() {
|
||||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
updateStatusBarColor(R.color.black, R.color.white)
|
||||
setNavigationTitle("新增开服")
|
||||
mSelectTime = intent.getLongExtra(EntranceConsts.KEY_KAIFU_SELECT_TIME, 0)
|
||||
|
||||
@ -148,10 +152,10 @@ class AddKaiFuActivity : ToolBarActivity() {
|
||||
.setTitleSize(15)
|
||||
.setOutSideCancelable(false)
|
||||
.isCyclic(false)
|
||||
.setSubmitColor(ContextCompat.getColor(this, R.color.theme_font))
|
||||
.setCancelColor(ContextCompat.getColor(this, R.color.hint))
|
||||
.setTitleBgColor(Color.WHITE)
|
||||
.setBgColor(Color.WHITE)
|
||||
.setSubmitColor(R.color.theme_font.toColor(this))
|
||||
.setCancelColor(R.color.hint.toColor(this))
|
||||
.setTitleBgColor(R.color.background_white.toColor(this))
|
||||
.setBgColor(R.color.background_white.toColor(this))
|
||||
.setDate(selectedDate)
|
||||
.setRangDate(startDate, endDate)
|
||||
.setLabel("年", "月", "日", "时", "分", "")
|
||||
@ -194,6 +198,32 @@ class AddKaiFuActivity : ToolBarActivity() {
|
||||
}
|
||||
}
|
||||
|
||||
override fun isAutoResetViewBackgroundEnabled() = true
|
||||
|
||||
override fun onNightModeChange() {
|
||||
super.onNightModeChange()
|
||||
updateStatusBarColor(R.color.black, R.color.white)
|
||||
mBinding?.run {
|
||||
root.setBackgroundColor(R.color.background.toColor(this@AddKaiFuActivity))
|
||||
container.setBackgroundColor(R.color.background_white.toColor(this@AddKaiFuActivity))
|
||||
kaifuAddContainer.run {
|
||||
for (i in 1 until childCount) {
|
||||
(getChildAt(i) as? LinearLayout)?.run {
|
||||
for (j in 0 until childCount) {
|
||||
(getChildAt(j) as? EditText)?.run {
|
||||
AddKaiFuBindingAdapter.kaiFuTextColor(
|
||||
this,
|
||||
mViewModel?.calendarList?.safelyGetInRelease(i - 1)?.getDataMark() ?: 0,
|
||||
i - 1
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
companion object {
|
||||
fun getIntent(context: Context, entity: ServerCalendarEntity,
|
||||
kaifuList: ArrayList<ServerCalendarEntity>,
|
||||
|
||||
@ -10,6 +10,8 @@ import com.gh.base.ToolBarActivity
|
||||
import com.gh.gamecenter.common.utils.DialogHelper
|
||||
import com.gh.gamecenter.common.constant.EntranceConsts
|
||||
import com.gh.gamecenter.R
|
||||
import com.gh.gamecenter.common.utils.toColor
|
||||
import com.gh.gamecenter.common.utils.updateStatusBarColor
|
||||
import com.gh.gamecenter.databinding.ActivityKaifuPatchBinding
|
||||
import com.gh.gamecenter.entity.ServerCalendarEntity
|
||||
import com.gh.gamecenter.gamedetail.fuli.kaifu.ServersCalendarActivity
|
||||
@ -27,6 +29,7 @@ class PatchKaifuActivity : ToolBarActivity() {
|
||||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
updateStatusBarColor(R.color.black, R.color.white)
|
||||
setNavigationTitle("修改开服")
|
||||
|
||||
mViewModel = ViewModelProviders.of(this).get(PatchKaifuViewModel::class.java)
|
||||
@ -99,6 +102,19 @@ class PatchKaifuActivity : ToolBarActivity() {
|
||||
}
|
||||
}
|
||||
|
||||
override fun isAutoResetViewBackgroundEnabled() = true
|
||||
|
||||
override fun onNightModeChange() {
|
||||
super.onNightModeChange()
|
||||
updateStatusBarColor(R.color.black, R.color.white)
|
||||
mBinding?.run {
|
||||
root.setBackgroundColor(R.color.background.toColor(this@PatchKaifuActivity))
|
||||
kaifuAddItemTitle.root.setBackgroundColor(R.color.title.toColor(this@PatchKaifuActivity))
|
||||
patchName.setHintTextColor(R.color.title.toColor(this@PatchKaifuActivity))
|
||||
patchName.setTextColor(R.color.title.toColor(this@PatchKaifuActivity))
|
||||
}
|
||||
}
|
||||
|
||||
companion object {
|
||||
|
||||
fun getIntent(context: Context, serverEntity: ServerCalendarEntity, gameId: String): Intent {
|
||||
|
||||
Reference in New Issue
Block a user