游戏详情页补充优化
This commit is contained in:
@ -371,4 +371,6 @@ public class EntranceConsts {
|
||||
public static final String KEY_HAS_MULTI_ZONE = "has_multi_zone";
|
||||
public static final String KEY_SPEED_TYPE = "speed_type";
|
||||
public static final String KEY_ACCELERATOR_REQUEST = "accelerator_request";
|
||||
|
||||
public static final String KEY_PERFORM_CONTENT_CARD_CLICK_TYPE = "perform_content_card_click_type";
|
||||
}
|
||||
|
||||
@ -1770,12 +1770,37 @@ fun ViewStub.inflateOrShow(): View? =
|
||||
}
|
||||
|
||||
fun TextView.marqueeOnce() {
|
||||
ellipsize = TextUtils.TruncateAt.MARQUEE
|
||||
marqueeRepeatLimit = 1
|
||||
setSingleLine()
|
||||
isSelected = true
|
||||
isFocusable = true
|
||||
isFocusableInTouchMode = true
|
||||
setSingleLine()
|
||||
marqueeRepeatLimit = 1
|
||||
ellipsize = TextUtils.TruncateAt.MARQUEE
|
||||
isSelected = true
|
||||
}
|
||||
|
||||
fun TextView.marqueeAgain() {
|
||||
if (!isMarqueeRunning()) {
|
||||
if (isSelected) isSelected = false
|
||||
isSelected = true
|
||||
}
|
||||
}
|
||||
|
||||
fun TextView.isMarqueeRunning(): Boolean = try {
|
||||
val marqueeField = TextView::class.java.getDeclaredField("mMarquee")
|
||||
marqueeField.isAccessible = true
|
||||
val marquee = marqueeField.get(this)
|
||||
|
||||
if (marquee != null) {
|
||||
val marqueeClass = marquee.javaClass
|
||||
val isRunningMethod = marqueeClass.getDeclaredMethod("isRunning")
|
||||
isRunningMethod.isAccessible = true
|
||||
isRunningMethod.invoke(marquee) as Boolean
|
||||
} else {
|
||||
false
|
||||
}
|
||||
} catch (e: Exception) {
|
||||
e.printStackTrace()
|
||||
false
|
||||
}
|
||||
|
||||
fun SimpleDraweeView.updateRoundingParams(block: RoundingParams.() -> Unit) {
|
||||
@ -1784,4 +1809,13 @@ fun SimpleDraweeView.updateRoundingParams(block: RoundingParams.() -> Unit) {
|
||||
block(roundingParams)
|
||||
}
|
||||
hierarchy.roundingParams = roundingParams
|
||||
}
|
||||
|
||||
// 设置默认 position 避免 position 为 0 的 fragment 被先加载显示再跳转至具体页面
|
||||
fun ViewPager.setRestoredCurItem(defaultPosition: Int) {
|
||||
tryCatchInRelease {
|
||||
val field = ViewPager::class.java.getDeclaredField("mRestoredCurItem")
|
||||
field.isAccessible = true
|
||||
field.set(this, defaultPosition)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user