跳转到新手第一次体现

This commit is contained in:
renhaoting 2025-12-04 10:39:31 +08:00
parent 0991ab3993
commit 929a95ed9c
6 changed files with 48 additions and 5 deletions

View File

@ -17,10 +17,10 @@
android:theme="@style/Theme.Architectureandroid"> android:theme="@style/Theme.Architectureandroid">
<activity <activity
android:name=".main.MainActivity" android:name=".main.MainActivity"
android:exported="true"> android:exported="true"
android:launchMode="singleTask">
<intent-filter> <intent-filter>
<action android:name="android.intent.action.MAIN" /> <action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" /> <category android:name="android.intent.category.LAUNCHER" />
</intent-filter> </intent-filter>
</activity> </activity>

View File

@ -25,4 +25,11 @@ object VididinEvents {
const val Event_AD_TASK_TYPE_Complement = 804 const val Event_AD_TASK_TYPE_Complement = 804
const val Event_AD_TASK_TYPE_BOX_TASK = 805 const val Event_AD_TASK_TYPE_BOX_TASK = 805
// UI jump related
const val EVENT_JUMP_2_FIRST_WITHDRAW = 900
const val EVENT_JUMP_2_SIGN = 901
} }

View File

@ -1,8 +1,10 @@
package com.gamedog.vididin.main package com.gamedog.vididin.main
import android.app.Activity import android.app.Activity
import com.ama.core.architecture.util.eventbus.NotifyMan
import com.ama.core.architecture.util.setOnClickBatch import com.ama.core.architecture.util.setOnClickBatch
import com.ama.core.architecture.widget.BindingDialog import com.ama.core.architecture.widget.BindingDialog
import com.gamedog.vididin.VididinEvents
import com.gamedog.vididin.databinding.DialogBeginnerGiftBinding import com.gamedog.vididin.databinding.DialogBeginnerGiftBinding
import com.gamedog.vididin.router.Router import com.gamedog.vididin.router.Router
@ -27,6 +29,7 @@ class BeginnerGiftDialog(activity: Activity) : BindingDialog<DialogBeginnerGiftB
if (mActivity is MainActivity) { if (mActivity is MainActivity) {
(mActivity as MainActivity).switchTab(1) (mActivity as MainActivity).switchTab(1)
} }
NotifyMan.instance().sendEvent(VididinEvents.EVENT_JUMP_2_FIRST_WITHDRAW, null)
dismiss() dismiss()
} }
} }

View File

@ -250,10 +250,18 @@ class TasksFragment : AppViewsFragment<ViewBinding, UiState, ViewModel>(), OnTab
VididinEvents.EVENT_DAILY_WATCHED_AD_NUM_CHANGED -> { VididinEvents.EVENT_DAILY_WATCHED_AD_NUM_CHANGED -> {
updateDailyWatchAdUI() updateDailyWatchAdUI()
} }
VididinEvents.EVENT_JUMP_2_FIRST_WITHDRAW -> {
scroll2FirstWithdraw()
}
} }
}, VididinEvents.Event_Sign_State_Changed, VididinEvents.Event_Account_Cash_Changed, }, VididinEvents.Event_Sign_State_Changed, VididinEvents.Event_Account_Cash_Changed,
VididinEvents.Event_Account_Gold_Changed, VididinEvents.EVENT_DAILY_WATCHED_VIDEO_NUM_CHANGED, VididinEvents.Event_Account_Gold_Changed, VididinEvents.EVENT_DAILY_WATCHED_VIDEO_NUM_CHANGED,
VididinEvents.EVENT_DAILY_WATCHED_AD_NUM_CHANGED) VididinEvents.EVENT_DAILY_WATCHED_AD_NUM_CHANGED, VididinEvents.EVENT_JUMP_2_FIRST_WITHDRAW)
}
private fun scroll2FirstWithdraw() {
binding?.newbieContainer?.let { binding?.scrollView?.scroll2ChildView(it) }
} }
private fun updateDailySignButUI() { private fun updateDailySignButUI() {

View File

@ -1,6 +1,7 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<androidx.core.widget.NestedScrollView xmlns:android="http://schemas.android.com/apk/res/android" <com.ama.core.architecture.widget.MyScrollView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools" xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/scroll_view"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:background="#666666" android:background="#666666"
@ -411,6 +412,7 @@
<LinearLayout <LinearLayout
android:id="@+id/newbie_container"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginTop="20dp" android:layout_marginTop="20dp"
@ -494,4 +496,4 @@
</LinearLayout> </LinearLayout>
</androidx.core.widget.NestedScrollView> </com.ama.core.architecture.widget.MyScrollView>

View File

@ -0,0 +1,23 @@
package com.ama.core.architecture.widget
import android.content.Context
import android.graphics.Rect
import android.util.AttributeSet
import android.view.View
import androidx.core.widget.NestedScrollView
class MyScrollView @JvmOverloads constructor(
context: Context,
attrs: AttributeSet? = null,
defStyleAttr: Int = 0
) : NestedScrollView(context, attrs, defStyleAttr) {
fun scroll2ChildView(child: View) {
val tempRect = Rect()
child.getDrawingRect(tempRect)
offsetDescendantRectToMyCoords(child, tempRect)
val scrollDelta: Int = computeScrollDeltaToGetChildRectOnScreen(tempRect)
smoothScrollTo(0, tempRect.top)
}
}