加入输入框布局
This commit is contained in:
parent
89eb7a13fa
commit
e120975f26
|
|
@ -0,0 +1,18 @@
|
||||||
|
package com.remax.visualnovel.ui.Chat
|
||||||
|
|
||||||
|
import android.content.Context
|
||||||
|
import android.util.AttributeSet
|
||||||
|
import com.remax.visualnovel.R
|
||||||
|
import com.remax.visualnovel.widget.uitoken.view.UITokenEditView
|
||||||
|
|
||||||
|
|
||||||
|
class ChatEditView @JvmOverloads constructor(context: Context, attrs: AttributeSet? = null, defStyleAttr: Int = 0)
|
||||||
|
: UITokenEditView(context, attrs, defStyleAttr) {
|
||||||
|
|
||||||
|
|
||||||
|
init {
|
||||||
|
setBackgroundResource(R.color.transparent)
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -12,12 +12,18 @@ import com.remax.visualnovel.databinding.ChatInputpanelBinding
|
||||||
class InputPanel @JvmOverloads constructor(context: Context, attrs: AttributeSet? = null, defStyleAttr: Int = 0)
|
class InputPanel @JvmOverloads constructor(context: Context, attrs: AttributeSet? = null, defStyleAttr: Int = 0)
|
||||||
: FrameLayout(context, attrs, defStyleAttr) {
|
: FrameLayout(context, attrs, defStyleAttr) {
|
||||||
|
|
||||||
private var binding: ChatInputpanelBinding? = null
|
private var binding: ChatInputpanelBinding
|
||||||
|
private var mMode = MODE_TEXT
|
||||||
|
|
||||||
|
companion object {
|
||||||
|
private const val MODE_TEXT = 1;
|
||||||
|
private const val MODE_VOICE = 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
init {
|
init {
|
||||||
binding = inflate(ChatInputpanelBinding::inflate)
|
binding = inflate(ChatInputpanelBinding::inflate)
|
||||||
binding?.run {
|
binding.run {
|
||||||
chatPopMenu.setMenuList(mutableListOf(
|
chatPopMenu.setMenuList(mutableListOf(
|
||||||
PopMenuIconView.MenuItem(R.mipmap.chat_ai_talk) {
|
PopMenuIconView.MenuItem(R.mipmap.chat_ai_talk) {
|
||||||
Toast.makeText(context, "聊天", Toast.LENGTH_SHORT).show()
|
Toast.makeText(context, "聊天", Toast.LENGTH_SHORT).show()
|
||||||
|
|
@ -26,10 +32,39 @@ class InputPanel @JvmOverloads constructor(context: Context, attrs: AttributeSet
|
||||||
Toast.makeText(context, "通话", Toast.LENGTH_SHORT).show()
|
Toast.makeText(context, "通话", Toast.LENGTH_SHORT).show()
|
||||||
}
|
}
|
||||||
))
|
))
|
||||||
|
|
||||||
|
ivChatModeSwitcher.setOnClickListener {
|
||||||
|
switchMode(if (mMode == MODE_TEXT) MODE_VOICE else MODE_TEXT)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
switchMode(mMode)
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private fun switchMode(newMode: Int) {
|
||||||
|
if (newMode != mMode) {
|
||||||
|
mMode = newMode
|
||||||
|
|
||||||
|
binding.run {
|
||||||
|
when (mMode) {
|
||||||
|
MODE_TEXT-> {
|
||||||
|
ivChatModeSwitcher.setImageResource(R.mipmap.chat_voice_b)
|
||||||
|
ivChatSend.visibility = VISIBLE
|
||||||
|
ivHold2talk.visibility = GONE
|
||||||
|
chatEditView.visibility = VISIBLE
|
||||||
|
}
|
||||||
|
|
||||||
|
MODE_VOICE-> {
|
||||||
|
ivChatModeSwitcher.setImageResource(R.mipmap.chat_keyboard)
|
||||||
|
ivChatSend.visibility = GONE
|
||||||
|
ivHold2talk.visibility = VISIBLE
|
||||||
|
chatEditView.visibility = GONE
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
@ -7,19 +7,6 @@
|
||||||
android:padding="@dimen/dp_20" >
|
android:padding="@dimen/dp_20" >
|
||||||
|
|
||||||
|
|
||||||
<!--<com.remax.visualnovel.widget.uitoken.view.UITokenImageView
|
|
||||||
android:id="@+id/chat_expand"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:src="@mipmap/chat_up"
|
|
||||||
app:layout_constraintBottom_toBottomOf="parent"
|
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
|
||||||
app:layout_constraintTop_toTopOf="parent"
|
|
||||||
android:padding="@dimen/dp_12"
|
|
||||||
app:radiusToken="@string/radius_pill"
|
|
||||||
app:backgroundColorToken="@string/color_surface_element_normal"
|
|
||||||
/>-->
|
|
||||||
|
|
||||||
<com.remax.visualnovel.ui.Chat.PopMenuIconView
|
<com.remax.visualnovel.ui.Chat.PopMenuIconView
|
||||||
android:id="@+id/chat_pop_menu"
|
android:id="@+id/chat_pop_menu"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
|
|
@ -38,8 +25,24 @@
|
||||||
app:radiusToken="@string/radius_40"
|
app:radiusToken="@string/radius_40"
|
||||||
app:backgroundColorToken="@string/color_surface_element_normal"
|
app:backgroundColorToken="@string/color_surface_element_normal"
|
||||||
>
|
>
|
||||||
|
<com.remax.visualnovel.widget.uitoken.view.UITokenTextView
|
||||||
|
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:text="@string/hold_to_talk"
|
||||||
|
android:textStyle="bold"
|
||||||
|
android:textColor="@color/white"
|
||||||
|
android:textSize="@dimen/sp_15"
|
||||||
|
android:gravity="center"
|
||||||
|
android:visibility="gone"
|
||||||
|
/>
|
||||||
|
|
||||||
<com.remax.visualnovel.widget.uitoken.view.UITokenImageView
|
<com.remax.visualnovel.widget.uitoken.view.UITokenImageView
|
||||||
android:id="@+id/iv_chat_voice"
|
android:id="@+id/iv_chat_mode_switcher"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:src="@mipmap/chat_voice_b"
|
android:src="@mipmap/chat_voice_b"
|
||||||
|
|
@ -49,7 +52,6 @@
|
||||||
android:padding="@dimen/dp_12"
|
android:padding="@dimen/dp_12"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
|
|
||||||
<com.remax.visualnovel.widget.uitoken.view.UITokenImageView
|
<com.remax.visualnovel.widget.uitoken.view.UITokenImageView
|
||||||
android:id="@+id/iv_chat_send"
|
android:id="@+id/iv_chat_send"
|
||||||
android:layout_width="@dimen/dp_60"
|
android:layout_width="@dimen/dp_60"
|
||||||
|
|
@ -64,6 +66,24 @@
|
||||||
app:backgroundColorToken="@string/color_surface_float_hover"
|
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"
|
||||||
|
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"
|
||||||
|
/>
|
||||||
|
|
||||||
|
|
||||||
</com.remax.visualnovel.widget.uitoken.view.UITokenConstraintLayout>
|
</com.remax.visualnovel.widget.uitoken.view.UITokenConstraintLayout>
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -337,7 +337,6 @@
|
||||||
<string name="prompt">Prompt</string>
|
<string name="prompt">Prompt</string>
|
||||||
<string name="heart_member_unlock">Heart member unlock</string>
|
<string name="heart_member_unlock">Heart member unlock</string>
|
||||||
<string name="member_unlock">Member unlock</string>
|
<string name="member_unlock">Member unlock</string>
|
||||||
<string name="hold_to_talk">Hold to Talk</string>
|
|
||||||
<string name="release_to_send">Release to send</string>
|
<string name="release_to_send">Release to send</string>
|
||||||
<string name="my_chat_personal">My Chat Personal</string>
|
<string name="my_chat_personal">My Chat Personal</string>
|
||||||
<string name="chat_setting">Chat Setting</string>
|
<string name="chat_setting">Chat Setting</string>
|
||||||
|
|
@ -464,5 +463,8 @@
|
||||||
<string name="all">All</string>
|
<string name="all">All</string>
|
||||||
|
|
||||||
<string name="from">from</string>
|
<string name="from">from</string>
|
||||||
|
<string name="hold_to_talk">Hold to Talk</string>
|
||||||
|
<string name="type_msg_hint">Type a message</string>
|
||||||
|
|
||||||
|
|
||||||
</resources>
|
</resources>
|
||||||
Loading…
Reference in New Issue