加入抽屉侧滑菜单1
This commit is contained in:
parent
2e51ad024d
commit
7948a130a8
|
|
@ -3,6 +3,7 @@ package com.remax.visualnovel.ui.chat
|
|||
|
||||
import android.graphics.Point
|
||||
import androidx.activity.viewModels
|
||||
import androidx.core.view.GravityCompat
|
||||
import androidx.core.view.marginTop
|
||||
import androidx.lifecycle.Observer
|
||||
import androidx.lifecycle.lifecycleScope
|
||||
|
|
@ -52,7 +53,9 @@ class ChatActivity : BaseBindingActivity<ActivityActorChat2Binding>() {
|
|||
StatusBarUtils.setStatusBarAndNavBarIsLight(this, false)
|
||||
StatusBarUtils.setTransparent(this)
|
||||
binding.root.setMargin(topMargin = StatusBarUtils.statusBarHeight)
|
||||
binding.toolbar.addRightIcon(R.mipmap.chat_title_setting)
|
||||
binding.toolbar.addRightIcon(R.mipmap.chat_title_setting) {
|
||||
binding.drawerMenu.openDrawer(GravityCompat.END)
|
||||
}
|
||||
|
||||
|
||||
with(binding) {
|
||||
|
|
|
|||
|
|
@ -0,0 +1,25 @@
|
|||
package com.remax.visualnovel.ui.chat.ui
|
||||
|
||||
|
||||
import android.content.Context
|
||||
import android.util.AttributeSet
|
||||
import android.view.LayoutInflater
|
||||
import android.widget.LinearLayout
|
||||
import com.remax.visualnovel.R
|
||||
import com.remax.visualnovel.databinding.LayoutChatMenuViewBinding
|
||||
|
||||
class ChatSettingView @JvmOverloads constructor(
|
||||
context: Context,
|
||||
attrs: AttributeSet? = null,
|
||||
defStyleAttr: Int = 0
|
||||
) : LinearLayout(context, attrs, defStyleAttr) {
|
||||
|
||||
private lateinit var mBinding: LayoutChatMenuViewBinding
|
||||
|
||||
|
||||
init {
|
||||
mBinding = LayoutChatMenuViewBinding.inflate(LayoutInflater.from(context))
|
||||
LayoutInflater.from(context).inflate(R.layout.base_toolbar_layout, this, true)
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -91,6 +91,25 @@ class BaseToolbar @JvmOverloads constructor(
|
|||
return imageView
|
||||
}
|
||||
|
||||
fun addRightIcon(@DrawableRes resId: Int, onClick: ()->Unit) {
|
||||
val imageView = ImageView(context).apply {
|
||||
setImageResource(resId)
|
||||
scaleType = ImageView.ScaleType.CENTER_INSIDE
|
||||
layoutParams = LinearLayout.LayoutParams(
|
||||
LayoutParams.WRAP_CONTENT,
|
||||
LayoutParams.WRAP_CONTENT
|
||||
).apply {
|
||||
setMargins(16, 0, 16, 0)
|
||||
setOnClickListener {
|
||||
onClick.invoke()
|
||||
}
|
||||
}
|
||||
this.tag = tag
|
||||
}
|
||||
llRight.addView(imageView)
|
||||
setupClickListener(imageView)
|
||||
}
|
||||
|
||||
/**
|
||||
* 向右侧区域添加自定义视图
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -1,71 +1,72 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
<androidx.drawerlayout.widget.DrawerLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:id="@+id/drawer_menu"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@mipmap/bg_level_1_page"
|
||||
android:orientation="vertical">
|
||||
|
||||
<com.remax.visualnovel.widget.toolbar.BaseToolbar
|
||||
android:id="@+id/toolbar"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
/>
|
||||
|
||||
android:fitsSystemWindows="true" >
|
||||
|
||||
<!-- 页面内容 -->
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:id="@+id/content"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/toolbar"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
>
|
||||
android:layout_height="match_parent"
|
||||
android:background="@mipmap/bg_level_1_page"
|
||||
android:orientation="vertical">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/iv_actor_bg"
|
||||
<com.remax.visualnovel.widget.toolbar.BaseToolbar
|
||||
android:id="@+id/toolbar"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:scaleType="centerCrop"
|
||||
android:src="@mipmap/splash_bg"
|
||||
/>
|
||||
|
||||
<com.remax.visualnovel.widget.uitoken.view.UITokenTextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center"
|
||||
android:textSize="@dimen/sp_18"
|
||||
android:padding="@dimen/dp_10"
|
||||
android:text="Chat"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
|
||||
app:backgroundColorToken="@string/color_surface_element_normal"
|
||||
app:radiusToken="@string/radius_pill"
|
||||
app:strokeColorToken="@string/color_surface_top_normal"
|
||||
app:strokeWidthToken="@string/border_divider"
|
||||
app:textColorToken="@string/color_txt_secondary_press"
|
||||
/>
|
||||
|
||||
|
||||
<com.remax.visualnovel.ui.chat.InputPanel
|
||||
android:id="@+id/input_panel"
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:id="@+id/content"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
|
||||
android:layout_height="0dp"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/toolbar"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
/>
|
||||
>
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/iv_actor_bg"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:scaleType="centerCrop"
|
||||
android:src="@mipmap/splash_bg"
|
||||
/>
|
||||
|
||||
<com.remax.visualnovel.ui.chat.InputPanel
|
||||
android:id="@+id/input_panel"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
/>
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
|
||||
<!-- drawer 菜单view -->
|
||||
<!-- 右侧抽屉菜单 -->
|
||||
<LinearLayout
|
||||
android:layout_width="240dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_gravity="end"
|
||||
android:background="#FFFFFF"
|
||||
android:orientation="vertical">
|
||||
<com.remax.visualnovel.ui.chat.ui.ChatSettingView
|
||||
android:id="@+id/setting_view"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
/>
|
||||
</LinearLayout>
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
</androidx.drawerlayout.widget.DrawerLayout>
|
||||
|
|
@ -12,7 +12,7 @@
|
|||
android:layout_width="wrap_content"
|
||||
android:layout_height="0dp"
|
||||
android:scaleType="centerInside"
|
||||
android:src="@mipmap/icon_checked"
|
||||
android:src="@mipmap/icon_back_white"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
|
|
|
|||
|
|
@ -6,105 +6,94 @@
|
|||
android:layout_height="wrap_content"
|
||||
android:padding="@dimen/dp_20" >
|
||||
|
||||
<com.remax.visualnovel.ui.chat.PopMenuIconView
|
||||
android:id="@+id/chat_pop_menu"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
android:layout_marginBottom="@dimen/dp_2"
|
||||
/>
|
||||
|
||||
<com.remax.visualnovel.widget.uitoken.view.UITokenConstraintLayout
|
||||
android:id="@+id/cl_most_bottom_container"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintStart_toEndOf="@+id/chat_pop_menu"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
android:layout_marginStart="@dimen/dp_10"
|
||||
app:radiusToken="@string/radius_40"
|
||||
app:backgroundColorToken="@string/color_surface_element_normal"
|
||||
>
|
||||
<com.remax.visualnovel.ui.chat.PopMenuIconView
|
||||
android:id="@+id/chat_pop_menu"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
/>
|
||||
|
||||
<com.remax.visualnovel.widget.uitoken.view.UITokenConstraintLayout
|
||||
<RelativeLayout
|
||||
android:id="@+id/iv_hold2talk"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
app:layout_constraintStart_toEndOf="@id/chat_pop_menu"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
android:layout_height="match_parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
android:layout_marginStart="@dimen/dp_10"
|
||||
app:radiusToken="@string/radius_40"
|
||||
app:backgroundColorToken="@string/color_surface_element_normal"
|
||||
>
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/iv_hold2talk"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
android:visibility="gone">
|
||||
<com.remax.visualnovel.widget.uitoken.view.UITokenTextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/hold_to_talk"
|
||||
app:drawableLeftCompat="@mipmap/chat_voice_s"
|
||||
android:layout_centerInParent="true"
|
||||
android:textStyle="bold"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="@dimen/sp_15"
|
||||
android:gravity="center"
|
||||
android:drawablePadding="@dimen/dp_5"
|
||||
/>
|
||||
</RelativeLayout>
|
||||
|
||||
<com.remax.visualnovel.widget.uitoken.view.UITokenImageView
|
||||
android:id="@+id/iv_chat_mode_switcher"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
android:visibility="gone">
|
||||
<com.remax.visualnovel.widget.uitoken.view.UITokenTextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:src="@mipmap/chat_voice_b"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
android:paddingHorizontal="@dimen/dp_12"
|
||||
android:padding="@dimen/dp_12"
|
||||
/>
|
||||
|
||||
<com.remax.visualnovel.widget.uitoken.view.UITokenImageView
|
||||
android:id="@+id/iv_chat_send"
|
||||
android:layout_width="@dimen/dp_60"
|
||||
android:layout_height="@dimen/dp_44"
|
||||
android:src="@mipmap/chat_send"
|
||||
android:padding="@dimen/dp_12"
|
||||
android:layout_margin="@dimen/dp_3"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:radiusToken="@string/radius_xxl"
|
||||
app:backgroundColorToken="@string/color_surface_float_hover"
|
||||
/>
|
||||
|
||||
|
||||
|
||||
<com.remax.visualnovel.ui.chat.ChatEditView
|
||||
android:id="@+id/chat_edit_view"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"
|
||||
android:focusable="true"
|
||||
android:focusableInTouchMode="true"
|
||||
android:clickable="true"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintStart_toEndOf="@id/iv_chat_mode_switcher"
|
||||
app:layout_constraintEnd_toStartOf="@id/iv_chat_send"
|
||||
android:layout_marginEnd="@dimen/dp_12"
|
||||
android:background="@color/transparent"
|
||||
android:hint="@string/type_msg_hint"
|
||||
android:textSize="@dimen/sp_12"
|
||||
android:text="@string/hold_to_talk"
|
||||
app:drawableLeftCompat="@mipmap/chat_voice_s"
|
||||
android:layout_centerInParent="true"
|
||||
android:textStyle="bold"
|
||||
android:textColor="@color/white"
|
||||
android:maxLines="8"
|
||||
android:textSize="@dimen/sp_15"
|
||||
android:gravity="center"
|
||||
android:drawablePadding="@dimen/dp_5"
|
||||
/>
|
||||
</RelativeLayout>
|
||||
|
||||
<com.remax.visualnovel.widget.uitoken.view.UITokenImageView
|
||||
android:id="@+id/iv_chat_mode_switcher"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:src="@mipmap/chat_voice_b"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
android:paddingHorizontal="@dimen/dp_12"
|
||||
android:padding="@dimen/dp_12"
|
||||
/>
|
||||
|
||||
<com.remax.visualnovel.widget.uitoken.view.UITokenImageView
|
||||
android:id="@+id/iv_chat_send"
|
||||
android:layout_width="@dimen/dp_60"
|
||||
android:layout_height="@dimen/dp_44"
|
||||
android:src="@mipmap/chat_send"
|
||||
android:padding="@dimen/dp_12"
|
||||
android:layout_margin="@dimen/dp_3"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:radiusToken="@string/radius_xxl"
|
||||
app:backgroundColorToken="@string/color_surface_float_hover"
|
||||
/>
|
||||
|
||||
|
||||
|
||||
<com.remax.visualnovel.ui.chat.ChatEditView
|
||||
android:id="@+id/chat_edit_view"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"
|
||||
android:focusable="true"
|
||||
android:focusableInTouchMode="true"
|
||||
android:clickable="true"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintStart_toEndOf="@id/iv_chat_mode_switcher"
|
||||
app:layout_constraintEnd_toStartOf="@id/iv_chat_send"
|
||||
android:layout_marginEnd="@dimen/dp_12"
|
||||
android:background="@color/transparent"
|
||||
android:hint="@string/type_msg_hint"
|
||||
android:textSize="@dimen/sp_12"
|
||||
android:textColor="@color/white"
|
||||
android:maxLines="8"
|
||||
/>
|
||||
|
||||
</com.remax.visualnovel.widget.uitoken.view.UITokenConstraintLayout>
|
||||
</com.remax.visualnovel.widget.uitoken.view.UITokenConstraintLayout>
|
||||
|
||||
|
||||
|
|
@ -115,7 +104,6 @@
|
|||
android:orientation="horizontal"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintBottom_toTopOf="@id/cl_most_bottom_container"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
android:layout_marginBottom="@dimen/dp_20"
|
||||
>
|
||||
|
||||
|
|
|
|||
Binary file not shown.
|
After Width: | Height: | Size: 758 B |
Binary file not shown.
|
After Width: | Height: | Size: 770 B |
|
|
@ -38,6 +38,8 @@ android.nonFinalResIds=false
|
|||
|
||||
# Test flags for improve compile speed
|
||||
org.gradle.configureondemand=true
|
||||
org.gradle.workers.max=16
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue