1 package com.android.keyguard 2 3 import android.content.Context 4 import android.util.AttributeSet 5 import android.util.FloatProperty 6 import android.widget.LinearLayout 7 import com.android.systemui.res.R 8 import com.android.systemui.statusbar.notification.AnimatableProperty 9 10 class KeyguardStatusAreaView( 11 context: Context, 12 attrs: AttributeSet? = null, 13 ) : LinearLayout(context, attrs) { 14 var translateXFromClockDesign = 0f 15 get() = field 16 set(value) { 17 field = value 18 translationX = translateXFromAod + translateXFromClockDesign + translateXFromUnfold 19 } 20 21 var translateXFromAod = 0f 22 get() = field 23 set(value) { 24 field = value 25 translationX = translateXFromAod + translateXFromClockDesign + translateXFromUnfold 26 } 27 28 var translateXFromUnfold = 0F 29 get() = field 30 set(value) { 31 field = value 32 translationX = translateXFromAod + translateXFromClockDesign + translateXFromUnfold 33 } 34 35 var translateYFromClockSize = 0f 36 get() = field 37 set(value) { 38 field = value 39 translationY = value + translateYFromClockDesign 40 } 41 42 var translateYFromClockDesign = 0f 43 get() = field 44 set(value) { 45 field = value 46 translationY = value + translateYFromClockSize 47 } 48 49 companion object { 50 @JvmField 51 val TRANSLATE_X_CLOCK_DESIGN = 52 AnimatableProperty.from( 53 object : FloatProperty<KeyguardStatusAreaView>("TranslateXClockDesign") { setValuenull54 override fun setValue(view: KeyguardStatusAreaView, value: Float) { 55 view.translateXFromClockDesign = value 56 } 57 getnull58 override fun get(view: KeyguardStatusAreaView): Float { 59 return view.translateXFromClockDesign 60 } 61 }, 62 R.id.translate_x_clock_design_animator_tag, 63 R.id.translate_x_clock_design_animator_start_tag, 64 R.id.translate_x_clock_design_animator_end_tag 65 ) 66 67 @JvmField 68 val TRANSLATE_X_AOD = 69 AnimatableProperty.from( 70 object : FloatProperty<KeyguardStatusAreaView>("TranslateXAod") { setValuenull71 override fun setValue(view: KeyguardStatusAreaView, value: Float) { 72 view.translateXFromAod = value 73 } 74 getnull75 override fun get(view: KeyguardStatusAreaView): Float { 76 return view.translateXFromAod 77 } 78 }, 79 R.id.translate_x_aod_animator_tag, 80 R.id.translate_x_aod_animator_start_tag, 81 R.id.translate_x_aod_animator_end_tag 82 ) 83 84 @JvmField 85 val TRANSLATE_Y_CLOCK_SIZE = 86 AnimatableProperty.from( 87 object : FloatProperty<KeyguardStatusAreaView>("TranslateYClockSize") { setValuenull88 override fun setValue(view: KeyguardStatusAreaView, value: Float) { 89 view.translateYFromClockSize = value 90 } 91 getnull92 override fun get(view: KeyguardStatusAreaView): Float { 93 return view.translateYFromClockSize 94 } 95 }, 96 R.id.translate_y_clock_size_animator_tag, 97 R.id.translate_y_clock_size_animator_start_tag, 98 R.id.translate_y_clock_size_animator_end_tag 99 ) 100 101 @JvmField 102 val TRANSLATE_Y_CLOCK_DESIGN = 103 AnimatableProperty.from( 104 object : FloatProperty<KeyguardStatusAreaView>("TranslateYClockDesign") { setValuenull105 override fun setValue(view: KeyguardStatusAreaView, value: Float) { 106 view.translateYFromClockDesign = value 107 } 108 getnull109 override fun get(view: KeyguardStatusAreaView): Float { 110 return view.translateYFromClockDesign 111 } 112 }, 113 R.id.translate_y_clock_design_animator_tag, 114 R.id.translate_y_clock_design_animator_start_tag, 115 R.id.translate_y_clock_design_animator_end_tag 116 ) 117 } 118 } 119