pop menu布局调整油化
This commit is contained in:
parent
7459af2f0a
commit
89eb7a13fa
|
|
@ -19,17 +19,11 @@ class InputPanel @JvmOverloads constructor(context: Context, attrs: AttributeSet
|
||||||
binding = inflate(ChatInputpanelBinding::inflate)
|
binding = inflate(ChatInputpanelBinding::inflate)
|
||||||
binding?.run {
|
binding?.run {
|
||||||
chatPopMenu.setMenuList(mutableListOf(
|
chatPopMenu.setMenuList(mutableListOf(
|
||||||
PopMenuIconView.MenuItem(R.mipmap.ic_launcher) {
|
PopMenuIconView.MenuItem(R.mipmap.chat_ai_talk) {
|
||||||
Toast.makeText(context, "首页", Toast.LENGTH_SHORT).show()
|
Toast.makeText(context, "聊天", Toast.LENGTH_SHORT).show()
|
||||||
},
|
},
|
||||||
PopMenuIconView.MenuItem(R.mipmap.ic_launcher) {
|
PopMenuIconView.MenuItem(R.mipmap.chat_ai_phone) {
|
||||||
Toast.makeText(context, "设置", Toast.LENGTH_SHORT).show()
|
Toast.makeText(context, "通话", Toast.LENGTH_SHORT).show()
|
||||||
},
|
|
||||||
PopMenuIconView.MenuItem(R.mipmap.ic_launcher) {
|
|
||||||
Toast.makeText(context, "分享", Toast.LENGTH_SHORT).show()
|
|
||||||
},
|
|
||||||
PopMenuIconView.MenuItem(R.mipmap.ic_launcher) {
|
|
||||||
Toast.makeText(context, "收藏", Toast.LENGTH_SHORT).show()
|
|
||||||
}
|
}
|
||||||
))
|
))
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
package com.remax.visualnovel.ui.Chat
|
package com.remax.visualnovel.ui.Chat
|
||||||
|
|
||||||
|
|
||||||
|
import android.animation.Animator
|
||||||
import android.animation.AnimatorSet
|
import android.animation.AnimatorSet
|
||||||
import android.animation.ValueAnimator
|
import android.animation.ValueAnimator
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
|
|
@ -29,7 +30,7 @@ class PopMenuIconView @JvmOverloads constructor(
|
||||||
)
|
)
|
||||||
|
|
||||||
private val mMenuItemList = mutableListOf<MenuItem>()
|
private val mMenuItemList = mutableListOf<MenuItem>()
|
||||||
private var isMenuShowing = true
|
private var isMenuShowing = false
|
||||||
private var itemSpacing = 0
|
private var itemSpacing = 0
|
||||||
private var itemSize = 0
|
private var itemSize = 0
|
||||||
|
|
||||||
|
|
@ -62,7 +63,7 @@ class PopMenuIconView @JvmOverloads constructor(
|
||||||
setImageResource(menuItem.iconResId)
|
setImageResource(menuItem.iconResId)
|
||||||
|
|
||||||
layoutParams = LinearLayout.LayoutParams(itemSize, itemSize).apply {
|
layoutParams = LinearLayout.LayoutParams(itemSize, itemSize).apply {
|
||||||
if (index < mMenuItemList.size - 1) {
|
if (/*index < mMenuItemList.size - 1*/true) {
|
||||||
bottomMargin = itemSpacing
|
bottomMargin = itemSpacing
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -72,7 +73,7 @@ class PopMenuIconView @JvmOverloads constructor(
|
||||||
dismissMenu()
|
dismissMenu()
|
||||||
}
|
}
|
||||||
|
|
||||||
mBinding!!.llMenuContainer.addView(this)
|
mBinding!!.llMenuContainer.addView(this, 0)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -86,6 +87,7 @@ class PopMenuIconView @JvmOverloads constructor(
|
||||||
isMenuShowing = true
|
isMenuShowing = true
|
||||||
|
|
||||||
mBinding?.run {
|
mBinding?.run {
|
||||||
|
divider.visibility = VISIBLE
|
||||||
llMenuContainer.visibility = VISIBLE
|
llMenuContainer.visibility = VISIBLE
|
||||||
ivTrigger.setImageResource(R.mipmap.chat_down)
|
ivTrigger.setImageResource(R.mipmap.chat_down)
|
||||||
|
|
||||||
|
|
@ -131,6 +133,25 @@ class PopMenuIconView @JvmOverloads constructor(
|
||||||
duration = 300
|
duration = 300
|
||||||
interpolator = DecelerateInterpolator()
|
interpolator = DecelerateInterpolator()
|
||||||
playTogether(valueYAnim)
|
playTogether(valueYAnim)
|
||||||
|
addListener(object: Animator.AnimatorListener{
|
||||||
|
override fun onAnimationCancel(animation: Animator) {
|
||||||
|
llMenuContainer.visibility = GONE
|
||||||
|
divider.visibility = GONE
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onAnimationEnd(animation: Animator) {
|
||||||
|
llMenuContainer.visibility = GONE
|
||||||
|
divider.visibility = GONE
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onAnimationRepeat(animation: Animator) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onAnimationStart(animation: Animator) {
|
||||||
|
|
||||||
|
}
|
||||||
|
})
|
||||||
start()
|
start()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -2,13 +2,13 @@
|
||||||
<com.remax.visualnovel.widget.uitoken.view.UITokenLinearLayout
|
<com.remax.visualnovel.widget.uitoken.view.UITokenLinearLayout
|
||||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="@dimen/dp_44"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:orientation="vertical"
|
android:orientation="vertical"
|
||||||
android:gravity="center_horizontal"
|
android:gravity="center_horizontal"
|
||||||
app:radiusToken="@string/radius_pill"
|
app:radiusToken="@string/radius_pill"
|
||||||
|
android:paddingVertical="@dimen/dp_7"
|
||||||
app:backgroundColorToken="@string/color_surface_element_normal"
|
app:backgroundColorToken="@string/color_surface_element_normal"
|
||||||
android:padding="@dimen/dp_14"
|
|
||||||
>
|
>
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:id="@+id/ll_menu_container"
|
android:id="@+id/ll_menu_container"
|
||||||
|
|
@ -17,13 +17,25 @@
|
||||||
android:orientation="vertical"
|
android:orientation="vertical"
|
||||||
android:gravity="center_horizontal"
|
android:gravity="center_horizontal"
|
||||||
android:layout_gravity="bottom|center_horizontal"
|
android:layout_gravity="bottom|center_horizontal"
|
||||||
android:layout_marginBottom="@dimen/dp_20">
|
android:visibility="gone"
|
||||||
|
>
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
|
<View
|
||||||
|
android:id="@+id/divider"
|
||||||
|
android:layout_width="@dimen/dp_10"
|
||||||
|
android:layout_height="@dimen/dp_1"
|
||||||
|
android:background="@color/white_p70"
|
||||||
|
android:layout_marginBottom="@dimen/dp_14"
|
||||||
|
android:visibility="gone"
|
||||||
|
/>
|
||||||
|
|
||||||
<com.remax.visualnovel.widget.uitoken.view.UITokenImageView
|
<com.remax.visualnovel.widget.uitoken.view.UITokenImageView
|
||||||
android:id="@+id/iv_trigger"
|
android:id="@+id/iv_trigger"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:src="@mipmap/chat_up"
|
android:src="@mipmap/chat_up"
|
||||||
|
android:layout_gravity="center_horizontal"
|
||||||
|
android:paddingVertical="@dimen/dp_7"
|
||||||
/>
|
/>
|
||||||
</com.remax.visualnovel.widget.uitoken.view.UITokenLinearLayout>
|
</com.remax.visualnovel.widget.uitoken.view.UITokenLinearLayout>
|
||||||
Loading…
Reference in New Issue