[fea]
[滑动出发动画展示]
This commit is contained in:
yangyakun
2024-09-26 16:21:49 +08:00
parent 04c1930199
commit 87aab03e36
13 changed files with 44 additions and 9 deletions

View File

@@ -33,6 +33,11 @@ class OchCustomViewProvider : IOchCustomViewProvider {
if(temp is FacadeProvider){
commonService = temp.commonService
}
}else{
val temp = ARouter.getInstance().build(FacadeConst.PASSENGER_PATH).navigation(context)
if(temp is FacadeProvider){
commonService = temp.commonService
}
}
}

View File

@@ -61,6 +61,7 @@ dependencies {
implementation rootProject.ext.dependencies.roomRxjava
implementation rootProject.ext.dependencies.androidxrecyclerview
kapt rootProject.ext.dependencies.recyclerviewadapterhelper
implementation rootProject.ext.dependencies.lottie
implementation rootProject.ext.dependencies.androidxroomruntime
kapt rootProject.ext.dependencies.androidxroomcompiler

File diff suppressed because one or more lines are too long

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

File diff suppressed because one or more lines are too long

View File

@@ -71,10 +71,12 @@ class SwitchLineTaskAdapter(
if(checkTask!!.taskId==task.taskId){
checkTask = null
mTaskItemClickListener?.onItemClick(currentPosition,false)
notifyItemChanged(currentPosition)
}else {
resetOther()
checkTask = task
mTaskItemClickListener?.onItemClick(currentPosition,true)
notifyItemChanged(currentPosition)
}
}
@@ -88,6 +90,7 @@ class SwitchLineTaskAdapter(
if(checkTask!=null && result.taskId==checkTask!!.taskId){
checkTask = null
notifyItemChanged(index)
return
}
}
}

View File

@@ -9,8 +9,11 @@ import androidx.appcompat.widget.AppCompatTextView
import androidx.constraintlayout.widget.ConstraintLayout
import androidx.constraintlayout.widget.ConstraintSet
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
import com.mogo.och.common.module.utils.ResourcesUtils
import com.mogo.och.common.module.utils.RxUtils
import com.mogo.och.shuttle.weaknet.R
import kotlinx.android.synthetic.main.shuttle_weak_task_leave_station_view.view.actv_draggable
import kotlinx.android.synthetic.main.shuttle_weak_task_leave_station_view.view.lottie_bg
class BizLeaveStationView @JvmOverloads constructor(
context: Context,
@@ -38,6 +41,7 @@ class BizLeaveStationView @JvmOverloads constructor(
init {
LayoutInflater.from(context).inflate(R.layout.shuttle_weak_task_leave_station_view, this, true)
draggableButton = findViewById(R.id.actv_draggable)
lottie_bg.setImageAssetsFolder("images")
}
override fun onAttachedToWindow() {
@@ -87,7 +91,12 @@ class BizLeaveStationView @JvmOverloads constructor(
duration = 100
}.start()
}else if (draggableButton.translationX>=(width-draggableButton.width)){
slideListener?.slideEnd()
lottie_bg.setAnimation("data.json")
lottie_bg.playAnimation()
actv_draggable.setTextColor(ResourcesUtils.getColor(R.color.shuttle_driver_80FFFFFF))
RxUtils.createSubscribe(1_000) {
slideListener?.slideEnd()
}
}else{
ObjectAnimator.ofFloat(
draggableButton, "translationX", draggableButton.translationX,
@@ -106,6 +115,9 @@ class BizLeaveStationView @JvmOverloads constructor(
override fun onVisibilityAggregated(isVisible: Boolean) {
super.onVisibilityAggregated(isVisible)
if(isVisible){
lottie_bg.setAnimation("slide.json")
lottie_bg.playAnimation()
actv_draggable.setTextColor(ResourcesUtils.getColor(R.color.white))
ObjectAnimator.ofFloat(
draggableButton, "translationX", draggableButton.translationX,
0f

View File

@@ -2,5 +2,5 @@
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<corners android:radius="@dimen/dp_30"/>
<solid android:color="@color/bus_color_4dffffff"/>
<solid android:color="@color/bus_color_4D000000"/>
</shape>

View File

@@ -7,14 +7,24 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<androidx.appcompat.widget.AppCompatImageView
android:id="@+id/aciv_task_leave_station_slide_bg"
app:layout_constraintBottom_toBottomOf="parent"
<!-- <androidx.appcompat.widget.AppCompatImageView-->
<!-- android:id="@+id/aciv_task_leave_station_slide_bg"-->
<!-- app:layout_constraintBottom_toBottomOf="parent"-->
<!-- app:layout_constraintStart_toStartOf="parent"-->
<!-- app:layout_constraintEnd_toEndOf="parent"-->
<!-- android:src="@drawable/bus_task_leave_station_slide_bg"-->
<!-- android:layout_width="@dimen/dp_774"-->
<!-- android:layout_height="@dimen/dp_120"/>-->
<com.airbnb.lottie.LottieAnimationView
android:id="@+id/lottie_bg"
android:layout_width="774px"
android:layout_height="120px"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
android:src="@drawable/bus_task_leave_station_slide_bg"
android:layout_width="@dimen/dp_774"
android:layout_height="@dimen/dp_120"/>
app:layout_constraintTop_toTopOf="parent"
app:lottie_fileName="slide.json"
app:lottie_loop="true"
app:lottie_autoPlay="true"/>
<androidx.appcompat.widget.AppCompatTextView
android:id="@+id/actv_draggable"

View File

@@ -74,4 +74,5 @@
<color name="shuttle_driver_bf0e3dbc">#BF0E3DBC</color>
<color name="shuttle_driver_bf1e2e89">#BF1E2E89</color>
<color name="shuttle_driver_D4D4D4">#D4D4D4</color>
<color name="shuttle_driver_80FFFFFF">#80FFFFFF</color>
</resources>

View File

@@ -20,6 +20,7 @@ ext {
localbroadcastmanager : "androidx.localbroadcastmanager:localbroadcastmanager:1.0.0",
// flexbox
flexbox : 'com.google.android.flexbox:flexbox:3.0.0',
lottie :'com.airbnb.android:lottie:5.2.0',
guava :'com.google.guava:guava:29.0-android',
// 测试
junit : "junit:junit:4.12",