光环助手V3.7.0 DEV(20191019-1820)前端测试汇总(2.3.4.5.6.7.13.14)https://gitlab.ghzs.com/pm/halo-app-issues/issues/670
This commit is contained in:
@ -260,6 +260,14 @@ fun Float.dip2px(): Int {
|
||||
return (this * scale + 0.5f).toInt()
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据手机的分辨率从 px(像素) 的单位 转成为 dip
|
||||
*/
|
||||
fun Float.px2dip(): Int {
|
||||
val scale = HaloApp.getInstance().application.resources.displayMetrics.density
|
||||
return (this / scale + 0.5f).toInt()
|
||||
}
|
||||
|
||||
/**
|
||||
* PopupWindow 自动适配方向
|
||||
*/
|
||||
|
||||
@ -12,6 +12,15 @@ import android.graphics.drawable.StateListDrawable
|
||||
import android.widget.TextView
|
||||
import androidx.annotation.DrawableRes
|
||||
import com.gh.common.util.dip2px
|
||||
import com.j256.ormlite.stmt.query.In
|
||||
import android.graphics.Shader
|
||||
import android.graphics.LinearGradient
|
||||
import android.graphics.drawable.shapes.RectShape
|
||||
import android.graphics.drawable.ShapeDrawable
|
||||
import android.opengl.ETC1.getHeight
|
||||
import com.gh.gamecenter.R
|
||||
import com.lightgame.utils.Utils
|
||||
|
||||
|
||||
object DrawableView {
|
||||
|
||||
@ -70,7 +79,7 @@ object DrawableView {
|
||||
|
||||
@JvmStatic
|
||||
fun setTextDrawable(textView: TextView, @DrawableRes drawableId: Int?, text: String? = null) {
|
||||
val drawable = if (drawableId != null){
|
||||
val drawable = if (drawableId != null) {
|
||||
ContextCompat.getDrawable(HaloApp.getInstance().application, drawableId)
|
||||
} else {
|
||||
null
|
||||
@ -79,4 +88,17 @@ object DrawableView {
|
||||
textView.setCompoundDrawables(drawable, null, null, null)
|
||||
if (text != null) textView.text = text
|
||||
}
|
||||
|
||||
// 需要跳转角度请自行设置 x0,y0,x1,y1
|
||||
@JvmStatic
|
||||
fun getGradientDrawable(width: Int, startColor: Int, endColor: Int): Drawable {
|
||||
val drawable = ShapeDrawable(RectShape())
|
||||
drawable.paint.shader = LinearGradient(0f, 0F, width.toFloat(), 0F, startColor, endColor, Shader.TileMode.REPEAT)
|
||||
return drawable
|
||||
}
|
||||
|
||||
fun convertAlphaKey(percent: Int): String {
|
||||
val hexString = Integer.toHexString(Math.round((255 * percent / 100).toFloat()))
|
||||
return (if (hexString.length < 2) "0" else "") + hexString
|
||||
}
|
||||
}
|
||||
@ -23,6 +23,7 @@ import com.gh.common.exposure.ExposureSource
|
||||
import com.gh.common.exposure.ExposureType
|
||||
import com.gh.common.exposure.IExposable
|
||||
import com.gh.common.util.*
|
||||
import com.gh.common.view.DrawableView
|
||||
import com.gh.gamecenter.*
|
||||
import com.gh.gamecenter.adapter.ImagePagerAdapter
|
||||
import com.gh.gamecenter.adapter.viewholder.*
|
||||
@ -257,7 +258,8 @@ class GameFragmentAdapter(context: Context, model: GameViewModel, var blockName:
|
||||
|
||||
ImageUtils.display(binding.columnIcon, entity?.image)
|
||||
binding.columnTitle.text = entity?.name
|
||||
binding.columnIcon.setOnClickListener {
|
||||
|
||||
val skipListener = View.OnClickListener {
|
||||
DataCollectionUtils.uploadClick(mContext, entity?.name + "-大图", "游戏-专题")
|
||||
MtaHelper.onEvent("游戏专题", "底部图片", entity?.name)
|
||||
val linkEntity = LinkEntity()
|
||||
@ -266,23 +268,25 @@ class GameFragmentAdapter(context: Context, model: GameViewModel, var blockName:
|
||||
DirectUtils.directToLinkPage(mContext, linkEntity, "(游戏-专题:" + entity?.name + "-大图)", "首页游戏")
|
||||
}
|
||||
|
||||
binding.columnIcon.setOnClickListener(skipListener)
|
||||
binding.columnList.addOnScrollListener(object : RecyclerView.OnScrollListener() {
|
||||
override fun onScrollStateChanged(recyclerView: RecyclerView, newState: Int) {
|
||||
if (newState == RecyclerView.SCROLL_STATE_DRAGGING) {
|
||||
binding.columnBackground.setBackgroundColor(Color.BLACK)
|
||||
binding.columnBackground.alpha = 0.9F
|
||||
} else {
|
||||
binding.columnBackground.setBackgroundResource(R.drawable.game_image_slide_item_background)
|
||||
binding.columnBackground.alpha = 1F
|
||||
}
|
||||
|
||||
override fun onScrolled(recyclerView: RecyclerView, dx: Int, dy: Int) {
|
||||
super.onScrolled(recyclerView, dx, dy)
|
||||
val offset = binding.columnList.computeHorizontalScrollOffset().toFloat().px2dip()
|
||||
val index = if (offset > 80) 80 else offset
|
||||
val startColor = "#" + DrawableView.convertAlphaKey(index) + "000000"
|
||||
binding.columnBackground.background = DrawableView.getGradientDrawable(
|
||||
binding.columnBackground.width, Color.parseColor(startColor), Color.BLACK)
|
||||
}
|
||||
})
|
||||
|
||||
if (!entity?.games.isNullOrEmpty()) {
|
||||
binding.columnBackground.visibility = View.VISIBLE
|
||||
binding.columnList.visibility = View.VISIBLE
|
||||
var slideAdapter = binding.columnList.adapter
|
||||
if (slideAdapter == null) {
|
||||
slideAdapter = ImageSlideAdapter(mContext, entity!!)
|
||||
slideAdapter = ImageSlideAdapter(mContext, entity!!,skipListener)
|
||||
(binding.columnList.itemAnimator as DefaultItemAnimator).supportsChangeAnimations = false
|
||||
binding.columnList.layoutManager = LinearLayoutManager(mContext, RecyclerView.HORIZONTAL, false)
|
||||
binding.columnList.adapter = slideAdapter
|
||||
@ -295,6 +299,7 @@ class GameFragmentAdapter(context: Context, model: GameViewModel, var blockName:
|
||||
}
|
||||
} else {
|
||||
binding.columnList.visibility = View.GONE
|
||||
binding.columnBackground.visibility = View.GONE
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -1,7 +1,26 @@
|
||||
package com.gh.gamecenter.game.horizontal
|
||||
|
||||
import android.view.Gravity
|
||||
import android.widget.TextView
|
||||
import androidx.databinding.BindingAdapter
|
||||
import com.gh.base.BaseRecyclerViewHolder
|
||||
import com.gh.gamecenter.databinding.GameHorizontalItemBinding
|
||||
import com.gh.gamecenter.entity.GameEntity
|
||||
|
||||
class GameHorizontalItemViewHolder(val binding: GameHorizontalItemBinding) : BaseRecyclerViewHolder<GameEntity>(binding.root)
|
||||
class GameHorizontalItemViewHolder(val binding: GameHorizontalItemBinding) : BaseRecyclerViewHolder<GameEntity>(binding.root) {
|
||||
|
||||
companion object {
|
||||
@JvmStatic
|
||||
@BindingAdapter("setHorizontalNameAndGravity")
|
||||
fun setHorizontalNameAndGravity(view: TextView, name: String) {
|
||||
view.text = name
|
||||
view.post {
|
||||
view.gravity = if (view.lineCount >= 2) {
|
||||
Gravity.START
|
||||
} else {
|
||||
Gravity.CENTER
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -2,6 +2,7 @@ package com.gh.gamecenter.game.imageslide
|
||||
|
||||
import android.content.Context
|
||||
import android.graphics.Color
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import com.gh.common.util.StringUtils
|
||||
import com.gh.common.util.dip2px
|
||||
@ -11,9 +12,10 @@ import com.gh.gamecenter.databinding.GameHorizontalItemBinding
|
||||
import com.gh.gamecenter.entity.GameEntity
|
||||
import com.gh.gamecenter.game.horizontal.GameHorizontalItemViewHolder
|
||||
import com.lightgame.adapter.BaseRecyclerAdapter
|
||||
import kotlinx.android.synthetic.main.dialog_communities_select_hint.view.*
|
||||
|
||||
class ImageSlideAdapter(context: Context, var subject: GameEntity) : BaseRecyclerAdapter<GameHorizontalItemViewHolder>(context) {
|
||||
class ImageSlideAdapter(context: Context,
|
||||
var subject: GameEntity,
|
||||
val skipListener: View.OnClickListener) : BaseRecyclerAdapter<GameHorizontalItemViewHolder>(context) {
|
||||
|
||||
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): GameHorizontalItemViewHolder {
|
||||
val binding: GameHorizontalItemBinding = GameHorizontalItemBinding.bind(mLayoutInflater.inflate(R.layout.game_horizontal_item, parent, false))
|
||||
@ -36,6 +38,7 @@ class ImageSlideAdapter(context: Context, var subject: GameEntity) : BaseRecycle
|
||||
holder.itemView.isClickable = false
|
||||
holder.binding.gameName.setOnClickListener { skipGameDetail(gameEntity, position) }
|
||||
holder.binding.gameIcon.setOnClickListener { skipGameDetail(gameEntity, position) }
|
||||
holder.itemView.setOnClickListener(skipListener)
|
||||
}
|
||||
|
||||
private fun skipGameDetail(gameEntity: GameEntity?, position: Int) {
|
||||
|
||||
@ -117,9 +117,21 @@ public class GameDetailKaiFuAdapter extends BaseRecyclerAdapter<ViewHolder> {
|
||||
|
||||
private void initView() {
|
||||
|
||||
// 当月存在开服数据则显示提示
|
||||
if (sp.getBoolean("showKaifuDetailHint", true)) {
|
||||
mBinding.serverDetailHint.setVisibility(View.VISIBLE);
|
||||
long curDate = System.currentTimeMillis();
|
||||
SimpleDateFormat formatMonth = new SimpleDateFormat("MM", Locale.CHINA);
|
||||
int curMonth = Integer.parseInt(formatMonth.format(curDate));
|
||||
for (ServerCalendarEntity kaiFuServerEntity : mServerList) { // 判断当月是否有开服
|
||||
long time = kaiFuServerEntity.getTime();
|
||||
int serverMonth = Integer.parseInt(formatMonth.format(time * 1000));
|
||||
if (serverMonth == curMonth) {
|
||||
mBinding.serverDetailHint.setVisibility(View.VISIBLE);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
mBinding.serverDetailBtn.setOnClickListener(v -> {
|
||||
sp.edit().putBoolean("showKaifuDetailHint", false).apply();
|
||||
mBinding.serverDetailHint.setVisibility(View.GONE);
|
||||
|
||||
@ -101,6 +101,8 @@ class QuestionsDetailViewModel(application: Application, val questionId: String)
|
||||
mHeadLiveData.postValue(Resource.success(question))
|
||||
}
|
||||
doRefreshList.postValue(true)
|
||||
|
||||
Utils.toast(getApplication(), "系统将自动邀请活跃玩家为您解答问题")
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
@ -106,7 +106,7 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingLeft="20dp"
|
||||
android:paddingTop="14dp"
|
||||
android:text="请输入正文(最少6个字)"
|
||||
android:text="请输入正文"
|
||||
android:textColor="@color/hint" />
|
||||
</RelativeLayout>
|
||||
|
||||
|
||||
@ -53,11 +53,11 @@
|
||||
|
||||
<TextView
|
||||
android:id="@+id/game_name"
|
||||
setHorizontalNameAndGravity="@{game.name}"
|
||||
android:layout_width="64dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="4dp"
|
||||
android:ellipsize="end"
|
||||
android:gravity="center"
|
||||
android:ellipsize="end"
|
||||
android:includeFontPadding="false"
|
||||
android:lineSpacingExtra="4dp"
|
||||
android:maxLines="2"
|
||||
|
||||
@ -64,8 +64,8 @@
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="10dp"
|
||||
android:layout_marginRight="20dp"
|
||||
android:text="查看更多 >"
|
||||
android:paddingRight="20dp"
|
||||
android:text="全部 >"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="12sp"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
|
||||
@ -13,7 +13,7 @@
|
||||
|
||||
<TextView
|
||||
android:id="@+id/all"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingLeft="20dp"
|
||||
android:paddingTop="16dp"
|
||||
@ -25,7 +25,7 @@
|
||||
|
||||
<TextView
|
||||
android:id="@+id/publish_server"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingLeft="20dp"
|
||||
android:paddingTop="12dp"
|
||||
@ -36,7 +36,7 @@
|
||||
|
||||
<TextView
|
||||
android:id="@+id/not_delete_server"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingLeft="20dp"
|
||||
android:paddingTop="12dp"
|
||||
@ -47,7 +47,7 @@
|
||||
|
||||
<TextView
|
||||
android:id="@+id/delete_server"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingLeft="20dp"
|
||||
android:paddingTop="12dp"
|
||||
|
||||
Reference in New Issue
Block a user