From d29c9ae169c3879ee618ad030c82bdbe526d73ce Mon Sep 17 00:00:00 2001 From: peterluo3131 Date: Sun, 11 Jun 2023 03:23:08 -0400 Subject: [PATCH] feature(#22): update chat ui --- app/build.gradle | 4 +- .../chatgptwrapper/fragments/ChatFragment.kt | 32 ++--- .../chatgptwrapper/widgets/ChatToolItem.kt | 46 +++++++ .../chatgptwrapper/widgets/ChatToolsWidget.kt | 85 ++++++++++++ .../widgets/HelpCommandEditText.kt | 2 +- .../widgets/HelpPromptWidget.kt | 3 +- .../widgets/ImagePickerWidget.kt | 53 -------- ....xml => background_chat_widget_button.xml} | 3 - ...ml => background_chat_widget_edittext.xml} | 3 +- .../background_common_rounded_button.xml | 2 +- .../res/drawable/background_content_top.xml | 6 +- .../background_control_button_common.xml | 6 - .../background_control_common_button.xml | 7 + .../background_control_input_message.xml | 7 + .../main/res/drawable/background_header.xml | 7 + .../drawable/background_item_chat_tool.xml | 8 ++ .../drawable/background_received_message.xml | 6 +- .../res/drawable/background_sent_message.xml | 2 +- ...ker.xml => background_view_chat_tools.xml} | 4 +- .../background_view_help_prompt_edittext.xml | 13 +- app/src/main/res/drawable/ic_camera.xml | 4 + app/src/main/res/drawable/ic_gallery.xml | 4 + app/src/main/res/drawable/ic_microphone.xml | 4 + app/src/main/res/layout/fragment_chat.xml | 10 +- app/src/main/res/layout/item_chat_tool.xml | 38 ++++++ .../item_container_received_message.xml | 8 +- .../layout/item_container_sent_message.xml | 6 +- app/src/main/res/layout/view_chat_tools.xml | 18 +++ app/src/main/res/layout/view_controls.xml | 124 ++++++++---------- app/src/main/res/layout/view_header.xml | 2 +- app/src/main/res/layout/view_help_prompt.xml | 13 +- app/src/main/res/layout/view_image_picker.xml | 45 ------- app/src/main/res/layout/view_sms_editor.xml | 12 +- app/src/main/res/values/attrs.xml | 7 + app/src/main/res/values/colors.xml | 62 ++++++--- app/src/main/res/values/dimen.xml | 92 +++++++------ app/src/main/res/values/strings.xml | 4 +- 37 files changed, 446 insertions(+), 306 deletions(-) create mode 100644 app/src/main/java/com/matthaigh27/chatgptwrapper/widgets/ChatToolItem.kt create mode 100644 app/src/main/java/com/matthaigh27/chatgptwrapper/widgets/ChatToolsWidget.kt delete mode 100644 app/src/main/java/com/matthaigh27/chatgptwrapper/widgets/ImagePickerWidget.kt rename app/src/main/res/drawable/{background_sms_rounded_button.xml => background_chat_widget_button.xml} (62%) rename app/src/main/res/drawable/{background_sms_edittext.xml => background_chat_widget_edittext.xml} (82%) delete mode 100644 app/src/main/res/drawable/background_control_button_common.xml create mode 100644 app/src/main/res/drawable/background_control_common_button.xml create mode 100644 app/src/main/res/drawable/background_control_input_message.xml create mode 100644 app/src/main/res/drawable/background_header.xml create mode 100644 app/src/main/res/drawable/background_item_chat_tool.xml rename app/src/main/res/drawable/{background_view_image_picker.xml => background_view_chat_tools.xml} (53%) create mode 100644 app/src/main/res/drawable/ic_camera.xml create mode 100644 app/src/main/res/drawable/ic_gallery.xml create mode 100644 app/src/main/res/drawable/ic_microphone.xml create mode 100644 app/src/main/res/layout/item_chat_tool.xml create mode 100644 app/src/main/res/layout/view_chat_tools.xml delete mode 100644 app/src/main/res/layout/view_image_picker.xml create mode 100644 app/src/main/res/values/attrs.xml diff --git a/app/build.gradle b/app/build.gradle index 77fcacd..50089d9 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -21,11 +21,11 @@ android { buildTypes { debug { - buildConfigField "String", "BASE_URL", "\"https://smartphone.herokuapp.com/\"" + buildConfigField "String", "BASE_URL", "\"https://ttt246-brain.hf.space/\"" } release { // Use your desired server address for the release version - buildConfigField "String", "BASE_URL", "\"https://chatgptphone.herokuapp.com/\"" + buildConfigField "String", "BASE_URL", "\"https://ttt246-brain.hf.space/\"" minifyEnabled true shrinkResources true diff --git a/app/src/main/java/com/matthaigh27/chatgptwrapper/fragments/ChatFragment.kt b/app/src/main/java/com/matthaigh27/chatgptwrapper/fragments/ChatFragment.kt index 783270d..3d77a0b 100644 --- a/app/src/main/java/com/matthaigh27/chatgptwrapper/fragments/ChatFragment.kt +++ b/app/src/main/java/com/matthaigh27/chatgptwrapper/fragments/ChatFragment.kt @@ -6,7 +6,6 @@ import android.view.LayoutInflater import android.view.View import android.view.ViewGroup import android.annotation.SuppressLint -import android.app.ActionBar.LayoutParams import android.content.* import android.graphics.Bitmap import android.graphics.BitmapFactory @@ -24,7 +23,6 @@ import android.view.animation.AlphaAnimation import android.view.animation.Animation import android.view.animation.LinearInterpolator import android.view.animation.RotateAnimation -import android.view.animation.TranslateAnimation import android.widget.* import androidx.annotation.RequiresApi import androidx.recyclerview.widget.LinearLayoutManager @@ -35,8 +33,8 @@ import com.matthaigh27.chatgptwrapper.R import com.matthaigh27.chatgptwrapper.adapters.ChatAdapter import com.matthaigh27.chatgptwrapper.database.MyDatabase import com.matthaigh27.chatgptwrapper.database.entity.ImageEntity -import com.matthaigh27.chatgptwrapper.widgets.ImagePickerWidget -import com.matthaigh27.chatgptwrapper.widgets.ImagePickerWidget.OnPositiveButtonClickListener +import com.matthaigh27.chatgptwrapper.widgets.ChatToolsWidget +import com.matthaigh27.chatgptwrapper.widgets.ChatToolsWidget.OnPositiveButtonClickListener import com.matthaigh27.chatgptwrapper.models.* import com.matthaigh27.chatgptwrapper.models.common.HelpCommandModel import com.matthaigh27.chatgptwrapper.models.common.HelpPromptModel @@ -94,7 +92,7 @@ class ChatFragment : Fragment(), OnClickListener, HttpRisingInterface { * 'image_uplaod' when user is going to upload image * 'image_picker' when user is going to pick image for prompting */ - private lateinit var mImagePickerWidget: ImagePickerWidget + private lateinit var mChatToolsWidget: ChatToolsWidget private var mImagePickerType: String = "" /** HttpClient for restful apis */ @@ -207,7 +205,6 @@ class ChatFragment : Fragment(), OnClickListener, HttpRisingInterface { return@setOnKeyListener false } - rootView.findViewById(R.id.btn_send_message).setOnClickListener(this) rootView.findViewById(R.id.btn_image_upload).setOnClickListener(this) rootView.findViewById(R.id.btn_image_picker).setOnClickListener(this) @@ -256,7 +253,6 @@ class ChatFragment : Fragment(), OnClickListener, HttpRisingInterface { private fun setDisableActivity(enable: Boolean) { runOnUIThread { mEtMessage.isEnabled = enable - rootView.findViewById(R.id.btn_send_message).isEnabled = enable rootView.findViewById(R.id.btn_image_upload).isEnabled = enable rootView.findViewById(R.id.btn_image_picker).isEnabled = enable } @@ -507,10 +503,6 @@ class ChatFragment : Fragment(), OnClickListener, HttpRisingInterface { override fun onClick(view: View) { when (view.id) { - R.id.btn_send_message -> { - addMessage(mEtMessage.text.toString(), true) - } - R.id.btn_image_upload -> { mImagePickerType = PICKERTYPE_IMAGE_UPLOAD if(rootView.findViewById(R.id.ll_toolbar).visibility == View.VISIBLE) @@ -577,7 +569,7 @@ class ChatFragment : Fragment(), OnClickListener, HttpRisingInterface { * A picked image converts into bytearray data and upload to firebase storage. */ private fun initImagePickerWidget() { - mImagePickerWidget = ImagePickerWidget(mContext!!) + mChatToolsWidget = ChatToolsWidget(mContext!!) val myImplementation = object : OnPositiveButtonClickListener { override fun onPositiveBtnClick(isCamera: Boolean?) { @@ -616,10 +608,10 @@ class ChatFragment : Fragment(), OnClickListener, HttpRisingInterface { } } - mImagePickerWidget.setOnClickListener(myImplementation) + mChatToolsWidget.setOnClickListener(myImplementation) val slidingWidget = rootView.findViewById(R.id.ll_toolbar) - slidingWidget.addView(mImagePickerWidget) + slidingWidget.addView(mChatToolsWidget) } private fun uploadSearchImage(imageByteArray: ByteArray) { @@ -844,20 +836,18 @@ class ChatFragment : Fragment(), OnClickListener, HttpRisingInterface { private fun showSlidingWidget() { val slidingWidget = rootView.findViewById(R.id.ll_toolbar) - - val dy = slidingWidget.measuredHeight.toFloat() slidingWidget.visibility = View.VISIBLE - val anim = TranslateAnimation(0f, 0f, dy, 0f).apply { - duration = 150 // Set the animation duration, e.g., 300ms + val anim = AlphaAnimation(0f, 1f).apply { + duration = 200 // Set the animation duration, e.g., 300ms interpolator = AccelerateDecelerateInterpolator() setAnimationListener(object : Animation.AnimationListener { - override fun onAnimationStart(animation: Animation?) { + override fun onAnimationStart(animation: Animation?) {} + + override fun onAnimationEnd(animation: Animation?) { slidingWidget.visibility = View.VISIBLE } - override fun onAnimationEnd(animation: Animation?) {} - override fun onAnimationRepeat(animation: Animation?) {} }) } diff --git a/app/src/main/java/com/matthaigh27/chatgptwrapper/widgets/ChatToolItem.kt b/app/src/main/java/com/matthaigh27/chatgptwrapper/widgets/ChatToolItem.kt new file mode 100644 index 0000000..f01d254 --- /dev/null +++ b/app/src/main/java/com/matthaigh27/chatgptwrapper/widgets/ChatToolItem.kt @@ -0,0 +1,46 @@ +package com.matthaigh27.chatgptwrapper.widgets + +import android.content.Context +import android.util.AttributeSet +import android.view.LayoutInflater +import android.view.ViewGroup +import android.widget.ImageView +import android.widget.LinearLayout +import android.widget.TextView +import androidx.constraintlayout.widget.ConstraintLayout +import com.matthaigh27.chatgptwrapper.R +import com.matthaigh27.chatgptwrapper.R.styleable.ChatToolLayout + +class ChatToolItem(context: Context, attrs: AttributeSet? = null) : LinearLayout(context, attrs) { + private lateinit var mContext:Context + private lateinit var mIvToolIcon: ImageView + private lateinit var mTvToolName: TextView + private lateinit var mClToolIcon: ConstraintLayout + + init { + initView(context, attrs) + } + + private fun initView(context: Context, attrs: AttributeSet?) { + LayoutInflater.from(context).inflate(R.layout.item_chat_tool, this, true) + + val layoutParams = LayoutParams( + ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT + ) + val itemMargin = context.resources.getDimensionPixelSize(R.dimen.item_chat_tool_margin) + layoutParams.setMargins(itemMargin, itemMargin, itemMargin, itemMargin) + this.layoutParams = layoutParams + + mContext = context + mIvToolIcon = findViewById(R.id.iv_chat_tool) + mClToolIcon = findViewById(R.id.cl_chat_tool) + mTvToolName = findViewById(R.id.tv_chat_tool_description) + + } + + fun setTool(drawableId: Int, size: Int, name: String) { + mIvToolIcon.setImageResource(drawableId) + mClToolIcon.layoutParams = LayoutParams(size, size) + mTvToolName.text = name + } +} \ No newline at end of file diff --git a/app/src/main/java/com/matthaigh27/chatgptwrapper/widgets/ChatToolsWidget.kt b/app/src/main/java/com/matthaigh27/chatgptwrapper/widgets/ChatToolsWidget.kt new file mode 100644 index 0000000..fc172ae --- /dev/null +++ b/app/src/main/java/com/matthaigh27/chatgptwrapper/widgets/ChatToolsWidget.kt @@ -0,0 +1,85 @@ +package com.matthaigh27.chatgptwrapper.widgets + +import android.content.Context +import android.view.LayoutInflater +import android.view.View +import android.view.View.OnClickListener +import android.view.ViewGroup +import android.widget.GridLayout +import android.widget.LinearLayout +import com.matthaigh27.chatgptwrapper.R + + +class ChatToolsWidget(context: Context) : LinearLayout(context), OnClickListener { + + private lateinit var mClickListener: OnPositiveButtonClickListener + private lateinit var mGlTools: GridLayout + private var isInitFlag = true + + val TOOL_ICONS = arrayOf( + R.drawable.ic_camera, + R.drawable.ic_gallery, + ) + + val TOOL_NAMES = arrayOf( + "Camera", + "Gallery" + ) + + val TOOL_COUNT = 2 + + init { + initView() + } + + fun setOnClickListener(listener: OnPositiveButtonClickListener) { + mClickListener = listener + } + + private fun initView() { + LayoutInflater.from(context).inflate(R.layout.view_chat_tools, this, true) + + layoutParams = LayoutParams( + ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT + ) + + mGlTools = findViewById(R.id.gl_tools) + + this.addOnLayoutChangeListener { _, _, _, _, _, _, _, _, _ -> + if (!isInitFlag) return@addOnLayoutChangeListener + isInitFlag = false + + val width: Int = this.width + + for (i in 0 until TOOL_COUNT) { + val cameraTool = ChatToolItem(context) + val itemMargin = + context.resources.getDimensionPixelSize(R.dimen.item_chat_tool_margin) + cameraTool.setTool(TOOL_ICONS[i], width / 4 - itemMargin * 2, TOOL_NAMES[i]) + mGlTools.addView(cameraTool) + + cameraTool.setTag(TOOL_NAMES[i]) + cameraTool.setOnClickListener(this@ChatToolsWidget) + } + } + } + + override fun onClick(view: View?) { + when (view?.tag) { + "Camera" -> { + mClickListener.onPositiveBtnClick(true) + } + + "Gallery" -> { + mClickListener.onPositiveBtnClick(false) + } + } + } + + /** + * callback function invoked when filepickerdialog buttons are pressed + */ + interface OnPositiveButtonClickListener { + fun onPositiveBtnClick(isCamera: Boolean?) + } +} \ No newline at end of file diff --git a/app/src/main/java/com/matthaigh27/chatgptwrapper/widgets/HelpCommandEditText.kt b/app/src/main/java/com/matthaigh27/chatgptwrapper/widgets/HelpCommandEditText.kt index 32fb8af..0e97ebf 100644 --- a/app/src/main/java/com/matthaigh27/chatgptwrapper/widgets/HelpCommandEditText.kt +++ b/app/src/main/java/com/matthaigh27/chatgptwrapper/widgets/HelpCommandEditText.kt @@ -32,7 +32,7 @@ class HelpCommandEditText(context: Context) : EditText(context) { context.resources.getDimensionPixelSize(R.dimen.view_help_prompt_edittext_fontsize) .toFloat() ) - setTextColor(context.getColor(R.color.primary)) + setTextColor(context.getColor(R.color.view_help_prompt_common_textcolor)) setHintTextColor(context.getColor(R.color.view_help_prompt_edittext_hint_color)) background = context.getDrawable(R.drawable.background_view_help_prompt_edittext) } diff --git a/app/src/main/java/com/matthaigh27/chatgptwrapper/widgets/HelpPromptWidget.kt b/app/src/main/java/com/matthaigh27/chatgptwrapper/widgets/HelpPromptWidget.kt index 6708ac9..7c62e41 100644 --- a/app/src/main/java/com/matthaigh27/chatgptwrapper/widgets/HelpPromptWidget.kt +++ b/app/src/main/java/com/matthaigh27/chatgptwrapper/widgets/HelpPromptWidget.kt @@ -4,6 +4,7 @@ import android.app.Dialog import android.content.Context import android.os.Bundle import android.util.Log +import android.view.LayoutInflater import android.view.View import android.view.ViewGroup import android.view.Window @@ -36,7 +37,7 @@ class HelpPromptWidget(context: Context, model: HelpPromptModel) : ConstraintLay } private fun initView() { - inflate(context, R.layout.view_help_prompt, this) + LayoutInflater.from(context).inflate(R.layout.view_help_prompt, this, true) layoutParams = LayoutParams( ViewGroup.LayoutParams.MATCH_PARENT, diff --git a/app/src/main/java/com/matthaigh27/chatgptwrapper/widgets/ImagePickerWidget.kt b/app/src/main/java/com/matthaigh27/chatgptwrapper/widgets/ImagePickerWidget.kt deleted file mode 100644 index 1cf63e1..0000000 --- a/app/src/main/java/com/matthaigh27/chatgptwrapper/widgets/ImagePickerWidget.kt +++ /dev/null @@ -1,53 +0,0 @@ -package com.matthaigh27.chatgptwrapper.widgets - -import android.content.Context -import android.view.View -import android.view.View.OnClickListener -import android.view.ViewGroup -import android.widget.LinearLayout -import androidx.constraintlayout.widget.ConstraintLayout -import com.matthaigh27.chatgptwrapper.R - - -class ImagePickerWidget(context: Context) : LinearLayout(context), OnClickListener { - - private lateinit var mClickListener: OnPositiveButtonClickListener - - init { - initView() - } - - fun setOnClickListener(listener: OnPositiveButtonClickListener) { - mClickListener = listener - } - - private fun initView() { - inflate(context, R.layout.view_image_picker, this) - - layoutParams = ConstraintLayout.LayoutParams( - ViewGroup.LayoutParams.MATCH_PARENT, - ViewGroup.LayoutParams.WRAP_CONTENT - ) - - findViewById(R.id.lytCameraPick).setOnClickListener(this) - findViewById(R.id.lytGalleryPick).setOnClickListener(this) - } - - override fun onClick(view: View?) { - when (view?.id) { - R.id.lytCameraPick -> { - mClickListener.onPositiveBtnClick(true) - } - R.id.lytGalleryPick -> { - mClickListener.onPositiveBtnClick(false) - } - } - } - - /** - * callback function invoked when filepickerdialog buttons are pressed - */ - interface OnPositiveButtonClickListener { - fun onPositiveBtnClick(isCamera: Boolean?) - } -} \ No newline at end of file diff --git a/app/src/main/res/drawable/background_sms_rounded_button.xml b/app/src/main/res/drawable/background_chat_widget_button.xml similarity index 62% rename from app/src/main/res/drawable/background_sms_rounded_button.xml rename to app/src/main/res/drawable/background_chat_widget_button.xml index 8b6c8df..df5ae6f 100644 --- a/app/src/main/res/drawable/background_sms_rounded_button.xml +++ b/app/src/main/res/drawable/background_chat_widget_button.xml @@ -1,8 +1,5 @@ - \ No newline at end of file diff --git a/app/src/main/res/drawable/background_sms_edittext.xml b/app/src/main/res/drawable/background_chat_widget_edittext.xml similarity index 82% rename from app/src/main/res/drawable/background_sms_edittext.xml rename to app/src/main/res/drawable/background_chat_widget_edittext.xml index f615e37..e51b997 100644 --- a/app/src/main/res/drawable/background_sms_edittext.xml +++ b/app/src/main/res/drawable/background_chat_widget_edittext.xml @@ -1,8 +1,9 @@ + - \ No newline at end of file + diff --git a/app/src/main/res/drawable/background_common_rounded_button.xml b/app/src/main/res/drawable/background_common_rounded_button.xml index dee126a..cf8cb35 100644 --- a/app/src/main/res/drawable/background_common_rounded_button.xml +++ b/app/src/main/res/drawable/background_common_rounded_button.xml @@ -2,5 +2,5 @@ - + \ No newline at end of file diff --git a/app/src/main/res/drawable/background_content_top.xml b/app/src/main/res/drawable/background_content_top.xml index f61d513..5718ea5 100644 --- a/app/src/main/res/drawable/background_content_top.xml +++ b/app/src/main/res/drawable/background_content_top.xml @@ -1,8 +1,8 @@ - + + android:bottomLeftRadius="@dimen/chat_main_content_top_radius" + android:bottomRightRadius="@dimen/chat_main_content_top_radius" /> \ No newline at end of file diff --git a/app/src/main/res/drawable/background_control_button_common.xml b/app/src/main/res/drawable/background_control_button_common.xml deleted file mode 100644 index 4563eea..0000000 --- a/app/src/main/res/drawable/background_control_button_common.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - - \ No newline at end of file diff --git a/app/src/main/res/drawable/background_control_common_button.xml b/app/src/main/res/drawable/background_control_common_button.xml new file mode 100644 index 0000000..c6b7adf --- /dev/null +++ b/app/src/main/res/drawable/background_control_common_button.xml @@ -0,0 +1,7 @@ + + + + + + \ No newline at end of file diff --git a/app/src/main/res/drawable/background_control_input_message.xml b/app/src/main/res/drawable/background_control_input_message.xml new file mode 100644 index 0000000..11bc4fe --- /dev/null +++ b/app/src/main/res/drawable/background_control_input_message.xml @@ -0,0 +1,7 @@ + + + + + + \ No newline at end of file diff --git a/app/src/main/res/drawable/background_header.xml b/app/src/main/res/drawable/background_header.xml new file mode 100644 index 0000000..3827f2f --- /dev/null +++ b/app/src/main/res/drawable/background_header.xml @@ -0,0 +1,7 @@ + + + + \ No newline at end of file diff --git a/app/src/main/res/drawable/background_item_chat_tool.xml b/app/src/main/res/drawable/background_item_chat_tool.xml new file mode 100644 index 0000000..9f4576e --- /dev/null +++ b/app/src/main/res/drawable/background_item_chat_tool.xml @@ -0,0 +1,8 @@ + + + + + \ No newline at end of file diff --git a/app/src/main/res/drawable/background_received_message.xml b/app/src/main/res/drawable/background_received_message.xml index 13fff37..9da8db8 100644 --- a/app/src/main/res/drawable/background_received_message.xml +++ b/app/src/main/res/drawable/background_received_message.xml @@ -1,10 +1,8 @@ - + + android:radius="@dimen/chat_message_item_radius" /> \ No newline at end of file diff --git a/app/src/main/res/drawable/background_sent_message.xml b/app/src/main/res/drawable/background_sent_message.xml index 80311db..035b580 100644 --- a/app/src/main/res/drawable/background_sent_message.xml +++ b/app/src/main/res/drawable/background_sent_message.xml @@ -1,7 +1,7 @@ - + - - + + \ No newline at end of file diff --git a/app/src/main/res/drawable/background_view_help_prompt_edittext.xml b/app/src/main/res/drawable/background_view_help_prompt_edittext.xml index f615e37..bf22c3e 100644 --- a/app/src/main/res/drawable/background_view_help_prompt_edittext.xml +++ b/app/src/main/res/drawable/background_view_help_prompt_edittext.xml @@ -1,8 +1,9 @@ - - - \ No newline at end of file +android:shape="rectangle"> + + + + diff --git a/app/src/main/res/drawable/ic_camera.xml b/app/src/main/res/drawable/ic_camera.xml new file mode 100644 index 0000000..49f5e41 --- /dev/null +++ b/app/src/main/res/drawable/ic_camera.xml @@ -0,0 +1,4 @@ + + + diff --git a/app/src/main/res/drawable/ic_gallery.xml b/app/src/main/res/drawable/ic_gallery.xml new file mode 100644 index 0000000..ca27c08 --- /dev/null +++ b/app/src/main/res/drawable/ic_gallery.xml @@ -0,0 +1,4 @@ + + + diff --git a/app/src/main/res/drawable/ic_microphone.xml b/app/src/main/res/drawable/ic_microphone.xml new file mode 100644 index 0000000..6e54853 --- /dev/null +++ b/app/src/main/res/drawable/ic_microphone.xml @@ -0,0 +1,4 @@ + + + diff --git a/app/src/main/res/layout/fragment_chat.xml b/app/src/main/res/layout/fragment_chat.xml index efbec80..0335c15 100644 --- a/app/src/main/res/layout/fragment_chat.xml +++ b/app/src/main/res/layout/fragment_chat.xml @@ -5,7 +5,7 @@ android:layout_width="match_parent" android:layout_height="match_parent" android:animateLayoutChanges="true" - android:background="@color/fragment_chat_bg_color" + android:background="@color/chat_main_fragment_bg_color" tools:context=".activites.HomeActivity"> @@ -17,7 +17,8 @@ android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="vertical" - app:layout_constraintBottom_toBottomOf="parent"> + app:layout_constraintBottom_toBottomOf="parent" + android:background="@color/chat_main_tools_bgcolor"> @@ -27,7 +28,7 @@ android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="horizontal" - android:background="@color/grey_100" + android:background="@color/chat_main_tools_bgcolor" android:visibility="gone" app:layout_constraintBottom_toBottomOf="parent"> @@ -37,9 +38,10 @@ diff --git a/app/src/main/res/layout/item_chat_tool.xml b/app/src/main/res/layout/item_chat_tool.xml new file mode 100644 index 0000000..d3caf3c --- /dev/null +++ b/app/src/main/res/layout/item_chat_tool.xml @@ -0,0 +1,38 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/item_container_received_message.xml b/app/src/main/res/layout/item_container_received_message.xml index 1bd6289..53aa4f5 100644 --- a/app/src/main/res/layout/item_container_received_message.xml +++ b/app/src/main/res/layout/item_container_received_message.xml @@ -24,14 +24,16 @@ android:id="@+id/imgMessage" android:layout_width="@dimen/chat_message_item_imageview_width" android:layout_height="@dimen/chat_message_item_imageview_height" - android:visibility="gone" /> + android:visibility="gone" + android:scaleType="centerCrop"/> + android:textColor="@color/chat_message_text_color" + android:textSize="@dimen/chat_message_item_fontsize" + android:lineSpacingExtra="@dimen/chat_message_line_space"/> + android:visibility="gone" + android:scaleType="centerCrop"/> + + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/view_controls.xml b/app/src/main/res/layout/view_controls.xml index cc8e355..dddae89 100644 --- a/app/src/main/res/layout/view_controls.xml +++ b/app/src/main/res/layout/view_controls.xml @@ -1,81 +1,71 @@ - + android:background="@color/chat_main_control_bgcolor" + android:orientation="vertical"> - + - - - - - - - + + android:layout_width="@dimen/control_common_button_width" + android:layout_height="@dimen/control_common_button_height" + android:background="@drawable/background_control_common_button" + android:padding="@dimen/control_common_button_padding" + android:src="@drawable/ic_microphone" + app:layout_constraintBottom_toBottomOf="parent" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toTopOf="parent" + app:tint="@color/control_common_button_icon_bgcolor" /> + + + app:layout_constraintBottom_toBottomOf="parent" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintTop_toTopOf="parent" + app:tint="@color/control_common_button_icon_bgcolor" /> + + + + - - \ No newline at end of file + \ No newline at end of file diff --git a/app/src/main/res/layout/view_header.xml b/app/src/main/res/layout/view_header.xml index 0d04a8e..14917b4 100644 --- a/app/src/main/res/layout/view_header.xml +++ b/app/src/main/res/layout/view_header.xml @@ -4,7 +4,7 @@ android:id="@+id/header" android:layout_width="match_parent" android:layout_height="wrap_content" - android:background="@color/head_bgcolor" + android:background="@drawable/background_header" android:paddingTop="@dimen/header_padding_top" android:paddingBottom="@dimen/header_padding_bottom"> diff --git a/app/src/main/res/layout/view_help_prompt.xml b/app/src/main/res/layout/view_help_prompt.xml index 944c39d..917b263 100644 --- a/app/src/main/res/layout/view_help_prompt.xml +++ b/app/src/main/res/layout/view_help_prompt.xml @@ -40,11 +40,8 @@ android:id="@+id/ll_prompt_keys" android:layout_width="match_parent" android:layout_height="wrap_content" - android:orientation="vertical" /> - - + android:orientation="vertical" + android:layout_marginBottom="@dimen/view_help_prompt_command_list_margin_bottom"/> @@ -66,7 +64,8 @@ android:id="@+id/btn_ok" android:layout_width="wrap_content" android:layout_height="@dimen/common_button_height" - android:background="@drawable/background_common_rounded_button" + android:background="@drawable/background_chat_widget_button" + android:textColor="@color/view_help_prompt_button_text_color" android:text="@string/help_prompt_command_ok" android:textAllCaps="false" android:textSize="@dimen/common_button_fontsize" /> diff --git a/app/src/main/res/layout/view_image_picker.xml b/app/src/main/res/layout/view_image_picker.xml deleted file mode 100644 index c9c6ea7..0000000 --- a/app/src/main/res/layout/view_image_picker.xml +++ /dev/null @@ -1,45 +0,0 @@ - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/app/src/main/res/layout/view_sms_editor.xml b/app/src/main/res/layout/view_sms_editor.xml index 0004645..6f76024 100644 --- a/app/src/main/res/layout/view_sms_editor.xml +++ b/app/src/main/res/layout/view_sms_editor.xml @@ -31,10 +31,12 @@ android:layout_height="@dimen/sms_edittext_height" android:gravity="center_vertical" android:layout_marginBottom="@dimen/sms_edittext_margin_bottom" - android:background="@drawable/background_sms_edittext" + android:background="@drawable/background_chat_widget_edittext" android:ems="10" android:hint="@string/sms_hint_to" android:inputType="textPersonName" + android:paddingVertical="@dimen/sms_edittext_padding_vertical" + android:paddingHorizontal="@dimen/sms_edittext_padding_horizontal" android:textColor="@color/sms_button_edittext_color" android:textColorHint="@color/sms_button_edittext_hint_color" android:textSize="@dimen/sms_edittext_font_size" /> @@ -44,10 +46,12 @@ android:layout_width="match_parent" android:layout_height="@dimen/sms_edittext_height" android:layout_marginBottom="16dp" - android:background="@drawable/background_sms_edittext" + android:background="@drawable/background_chat_widget_edittext" android:ems="10" android:gravity="center_vertical" android:hint="@string/sms_hint_message" + android:paddingVertical="@dimen/sms_edittext_padding_vertical" + android:paddingHorizontal="@dimen/sms_edittext_padding_horizontal" android:inputType="textMultiLine" android:textColor="@color/sms_button_edittext_color" android:textColorHint="@color/sms_button_edittext_hint_color" @@ -62,7 +66,7 @@ android:id="@+id/btn_cancel" android:layout_width="wrap_content" android:layout_height="@dimen/sms_button_height" - android:background="@drawable/background_sms_rounded_button" + android:background="@drawable/background_chat_widget_button" android:text="@string/sms_cancel" android:textAllCaps="false" android:textColor="@color/sms_button_text_color" @@ -73,7 +77,7 @@ android:layout_width="wrap_content" android:layout_height="@dimen/sms_button_height" android:layout_marginLeft="@dimen/sms_button_margin_horizontal" - android:background="@drawable/background_sms_rounded_button" + android:background="@drawable/background_chat_widget_button" android:text="@string/sms_confirm" android:textAllCaps="false" android:textColor="@color/sms_button_text_color" diff --git a/app/src/main/res/values/attrs.xml b/app/src/main/res/values/attrs.xml new file mode 100644 index 0000000..dfe7d6a --- /dev/null +++ b/app/src/main/res/values/attrs.xml @@ -0,0 +1,7 @@ + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/values/colors.xml b/app/src/main/res/values/colors.xml index 43879ec..1618173 100644 --- a/app/src/main/res/values/colors.xml +++ b/app/src/main/res/values/colors.xml @@ -21,10 +21,17 @@ #f5f5f5 #222222 #444444 + #323232 + #424242 + #EBEBEB + #707070 + #d0d0d0 #FF000000 #FFFFFFFF + #008000 + #99DBA7 #00000000 #bb000000 @@ -32,14 +39,19 @@ @color/primary + @color/grey_1100 - @color/white - @color/primary + @color/white + @color/primary + @color/grey_900 + @color/grey_400 + @color/grey_400 - @color/primary - @color/grey_100 + @color/white + @color/green_100 + @color/black @color/primary @@ -48,10 +60,10 @@ @color/grey_400 - @color/white + @color/grey_500 @color/grey_300 @color/primary - @color/primary + @color/grey_500 @color/grey_200 @@ -63,29 +75,36 @@ @color/primary - @color/primary + @color/grey_600 + @color/grey_700 @color/white @color/white - @color/primary_dark - @color/white - @color/secondary_text - @color/white - - - @color/transparent - @color/primary_light - @color/primary_light + @color/common_divier_color + @color/transparent + @color/grey_1000 + @color/grey_1000 + @color/grey_500 + @color/grey_1000 + @color/grey_900 + @color/grey_1000 + + + @color/transparent + @color/primary_light + @color/primary_light @color/transparent - @color/primary_light + @color/grey_500 @color/grey_200 @color/primary_light @color/white - @color/primary_light - @color/grey_200 + @color/grey_1000 + @color/grey_1000 + @color/grey_900 + @color/grey_500 @color/white @@ -110,4 +129,9 @@ @color/transparent @color/primary_light + + @color/grey_1000 + @color/grey_1000 + @color/grey_1000 + \ No newline at end of file diff --git a/app/src/main/res/values/dimen.xml b/app/src/main/res/values/dimen.xml index b42d8d3..3a16830 100644 --- a/app/src/main/res/values/dimen.xml +++ b/app/src/main/res/values/dimen.xml @@ -3,7 +3,7 @@ 20sp 16sp - 13sp + 14sp 10sp @@ -16,7 +16,7 @@ 7dp 5dp 3dp - 1dp + 2dp 40dp @@ -32,12 +32,13 @@ 4dp - 13dp + @dimen/font_normal 30dp 1dp - 10dp + 10dp + 8dp 12dp @@ -49,7 +50,7 @@ 30dp 8dp 8dp - 20sp + 18sp 10dp @@ -59,13 +60,15 @@ 20dp 16dp + 2dp @dimen/font_normal - 30dp + 38dp -2dp -2dp -2dp 1dp 1dp + 5dp 20dp 1dp @@ -86,50 +89,39 @@ 8dp - 8dp - 40dp - 40dp - 12dp - 16dp - 8dp - 4dp - 48dp - 4dp - 8dp - 12dp - 16dp - 16dp - 20sp - 40dp - 4dp - 12dp - 40dp - 2dp - 8dp - 40dp - 8dp - 24dp - - - 10dp - 0dp - 10dp - 48dp - 70dp - 3dp + 30dp + 30dp + 7dp + 40dp + @dimen/radius_small + 1dp + 38dp + 10dp + 10dp + 2dp + 3dp + 6dp + + + 0dp + 10dp + 48dp + 70dp + 3dp 8dp 4dp - 20dp + @dimen/radius_small 8dp @dimen/font_normal - 70dp - 70dp + 120dp + 120dp 15dp 15dp 8dp - 10dp + 5dp + @dimen/line_spacing_small 8dp @@ -144,9 +136,9 @@ 2dp - 15dp - 15sp - 4dp + 10dp + 17sp + 6dp 7dp @dimen/font_normal 8dp @@ -154,18 +146,19 @@ 12sp 30dp 10dp - 5dp + @dimen/radius_small 1dp 10dp @dimen/font_normal - 30dp + 38dp 5dp + 5dp 5dp 10dp 8dp - 10dp + @dimen/radius_small 5dp 100dp 100dp @@ -213,5 +206,10 @@ 20dp @dimen/font_normal + + @dimen/radius_small + 1dp + @dimen/font_normal + 15dp \ No newline at end of file diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index d8fe5aa..0dc7101 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -11,7 +11,7 @@ Cancel to load photo - Confirm + OK Cancel To Message @@ -20,7 +20,7 @@ Prompt Command Select Prompt Command Prompt Command Keys - Ok + OK Cancel