Merge branch 'level'

This commit is contained in:
pc 2024-07-30 18:14:26 +08:00
commit b9101d881c
3 changed files with 51 additions and 31 deletions

View File

@ -371,6 +371,9 @@ class NewMainActivity : BaseActivity() {
val lastNotice = val lastNotice =
MMKV.defaultMMKV().decodeString(BZYConstants.MMKV_KEY_NOTICE_READ, "") MMKV.defaultMMKV().decodeString(BZYConstants.MMKV_KEY_NOTICE_READ, "")
val data = it.data val data = it.data
if(data?.notice!=null){
initMainPageHorseRaceLamp(data.notice)
}
if (data?.notice != null && lastNotice != data.notice) { if (data?.notice != null && lastNotice != data.notice) {
val notice = data.notice!! val notice = data.notice!!
val dialog = DialogNotice(this@NewMainActivity, notice, data.downloadUrl) val dialog = DialogNotice(this@NewMainActivity, notice, data.downloadUrl)
@ -508,26 +511,23 @@ class NewMainActivity : BaseActivity() {
startActivity(Intent(CommonUtils.getApp(), ActivityActivity::class.java)) startActivity(Intent(CommonUtils.getApp(), ActivityActivity::class.java))
} }
setSometion() setSometion()
initMainPageHorseRaceLamp()
} }
private fun initMainPageHorseRaceLamp() { private fun initMainPageHorseRaceLamp(noticeData: String) {
val mainPageHorseRaceLamp=findViewById<TextView>(R.id.mainPageHorseRaceLamp) val mainPageHorseRaceLamp = findViewById<TextView>(R.id.mainPageHorseRaceLamp)
val notice = if (noticeData.length > 20) {
MMKV.defaultMMKV().decodeString(BZYConstants.MMKV_KEY_NOTICE_READ, "暂无新通知") mainPageHorseRaceLamp.text = noticeData
val noticeIsRead = mainPageHorseRaceLamp.requestFocus()
MMKV.defaultMMKV().decodeString(BZYConstants.MMKV_KEY_NOTICE_DOWNLOAD_READ, "") mainPageHorseRaceLamp.marqueeRepeatLimit = Integer.MAX_VALUE
if(!notice.equals("暂无新通知")){ mainPageHorseRaceLamp.isFocusable = true
mainPageHorseRaceLamp.text=notice mainPageHorseRaceLamp.ellipsize = TextUtils.TruncateAt.MARQUEE
mainPageHorseRaceLamp.requestFocus() mainPageHorseRaceLamp.setSingleLine()
mainPageHorseRaceLamp.marqueeRepeatLimit = Integer.MAX_VALUE mainPageHorseRaceLamp.isFocusableInTouchMode = true
mainPageHorseRaceLamp.isFocusable = true mainPageHorseRaceLamp.setHorizontallyScrolling(true)
mainPageHorseRaceLamp.ellipsize = TextUtils.TruncateAt.MARQUEE } else {
mainPageHorseRaceLamp.setSingleLine() val llNoticeBackground = findViewById<LinearLayout>(R.id.llNoticeBackground)
mainPageHorseRaceLamp.isFocusableInTouchMode = true llNoticeBackground.visibility = View.GONE
mainPageHorseRaceLamp.setHorizontallyScrolling(true) }
Log.d("noticeIsRead==>${noticeIsRead}")
}
} }

View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<gradient android:startColor="#00DFB786" android:centerColor="#66DFB786"
android:endColor="#00DFB786" />
</shape>

View File

@ -69,21 +69,35 @@
<!-- android:text="点我充值"--> <!-- android:text="点我充值"-->
<!-- android:textColor="@color/white" />--> <!-- android:textColor="@color/white" />-->
<com.yingmao.clash.util.MarqueeTextView <LinearLayout
android:id="@+id/mainPageHorseRaceLamp" android:id="@+id/llNoticeBackground"
android:layout_width="wrap_content" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:singleLine="true"
android:scrollHorizontally="true"
android:ellipsize="marquee"
android:focusable="true"
android:focusableInTouchMode="true"
android:marqueeRepeatLimit="marquee_forever"
android:layout_below="@+id/ll_activity" android:layout_below="@+id/ll_activity"
android:layout_toStartOf="@+id/ll_activity" android:layout_marginEnd="30dp"
android:padding="10dp" android:layout_marginStart="30dp"
android:textColor="@color/white" android:orientation="horizontal"
/> android:background="@drawable/shape_notice_background"
android:gravity="center"
>
<com.yingmao.clash.util.MarqueeTextView
android:id="@+id/mainPageHorseRaceLamp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:singleLine="true"
android:scrollHorizontally="true"
android:ellipsize="marquee"
android:focusable="true"
android:focusableInTouchMode="true"
android:marqueeRepeatLimit="marquee_forever"
android:padding="10dp"
android:textColor="@color/white"
android:text=""
android:textSize="17sp"
android:layout_marginEnd="50dp"
android:layout_marginStart="50dp"
/>
</LinearLayout>
</RelativeLayout> </RelativeLayout>
<LinearLayout <LinearLayout