From e6094e9a3374de7fcf16cd629170833d9835133f Mon Sep 17 00:00:00 2001 From: kaixed Date: Tue, 29 Oct 2024 22:35:49 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E5=AE=8C=E5=96=84=E8=81=8A=E5=A4=A9?= =?UTF-8?q?=E7=95=8C=E9=9D=A2=E5=8A=9F=E8=83=BD=E9=9D=A2=E6=9D=BF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 完善聊天界面功能面板 --- app/build.gradle.kts | 3 + app/proguard-rules.pro | 24 +------ .../kaixed/kchat/ExampleInstrumentedTest.kt | 33 ++++----- .../com/kaixed/kchat/model/FunctionItem.kt | 10 +++ .../activity/ApproveContactRequestActivity.kt | 2 +- .../ui/activity/ApproveDetailActivity.kt | 18 +++-- .../kaixed/kchat/ui/activity/ChatActivity.kt | 33 ++++++--- .../kaixed/kchat/ui/activity/MainActivity.kt | 1 + .../kchat/ui/activity/ProfileActivity.kt | 17 ++--- .../kchat/ui/adapter/FunctionPanelAdapter.kt | 9 +-- .../kchat/ui/adapter/MessageListAdapter.kt | 17 +++-- .../kchat/ui/widget/MyBottomSheetFragment.kt | 71 +++++++++++++++++++ .../res/drawable/bac_chat_function_panel.xml | 2 +- .../main/res/drawable/ic_filled_camera.xml | 12 ++++ .../main/res/drawable/ic_filled_favorites.xml | 11 +++ .../main/res/drawable/ic_filled_location.xml | 12 ++++ .../main/res/drawable/ic_filled_personal.xml | 14 ++++ .../main/res/drawable/ic_filled_picture.xml | 11 +++ .../main/res/drawable/ic_filled_transfer.xml | 12 ++++ .../res/drawable/ic_filled_voiceinput.xml | 12 ++++ .../main/res/drawable/ic_folder_filled.xml | 12 ++++ app/src/main/res/layout/activity_chat.xml | 3 +- app/src/main/res/layout/activity_login.xml | 1 + .../main/res/layout/bottom_sheet_layout.xml | 42 +++++++++++ .../main/res/layout/function_grid_item.xml | 18 +++-- app/src/main/res/values/styles.xml | 8 +++ .../main/res/xml/data_extraction_rules.xml | 2 +- .../java/com/kaixed/kchat/ExampleUnitTest.kt | 17 +++-- gradle.properties | 4 +- gradle/libs.versions.toml | 4 ++ settings.gradle.kts | 3 + 31 files changed, 332 insertions(+), 106 deletions(-) create mode 100644 app/src/main/java/com/kaixed/kchat/model/FunctionItem.kt create mode 100644 app/src/main/java/com/kaixed/kchat/ui/widget/MyBottomSheetFragment.kt create mode 100644 app/src/main/res/drawable/ic_filled_camera.xml create mode 100644 app/src/main/res/drawable/ic_filled_favorites.xml create mode 100644 app/src/main/res/drawable/ic_filled_location.xml create mode 100644 app/src/main/res/drawable/ic_filled_personal.xml create mode 100644 app/src/main/res/drawable/ic_filled_picture.xml create mode 100644 app/src/main/res/drawable/ic_filled_transfer.xml create mode 100644 app/src/main/res/drawable/ic_filled_voiceinput.xml create mode 100644 app/src/main/res/drawable/ic_folder_filled.xml create mode 100644 app/src/main/res/layout/bottom_sheet_layout.xml diff --git a/app/build.gradle.kts b/app/build.gradle.kts index c5961a8..67b3271 100644 --- a/app/build.gradle.kts +++ b/app/build.gradle.kts @@ -69,6 +69,9 @@ dependencies { implementation(libs.kotlinx.coroutines.core) implementation(libs.kotlinx.coroutines.android) + implementation(libs.shapeview) + implementation(libs.shapedrawable) + // implementation(libs.therouter) // ksp(libs.therouter.ksp) } diff --git a/app/proguard-rules.pro b/app/proguard-rules.pro index d18b1f5..103d0f0 100644 --- a/app/proguard-rules.pro +++ b/app/proguard-rules.pro @@ -20,26 +20,4 @@ # hide the original source file name. #-renamesourcefileattribute SourceFile -# TheRouter -# need add for Fragment page route -# -keep public class * extends android.app.Fragment -# -keep public class * extends androidx.fragment.app.Fragment -# -keep public class * extends android.support.v4.app.Fragment - --keep class androidx.annotation.Keep --keep @androidx.annotation.Keep class * {*;} --keepclassmembers class * { - @androidx.annotation.Keep *; -} --keepclasseswithmembers class * { - @androidx.annotation.Keep ; -} --keepclasseswithmembers class * { - @androidx.annotation.Keep ; -} --keepclasseswithmembers class * { - @androidx.annotation.Keep (...); -} --keepclasseswithmembers class * { - @com.therouter.router.Autowired ; -} \ No newline at end of file +-keep class com.hjq.shape.** {*;} \ No newline at end of file diff --git a/app/src/androidTest/java/com/kaixed/kchat/ExampleInstrumentedTest.kt b/app/src/androidTest/java/com/kaixed/kchat/ExampleInstrumentedTest.kt index 7f6680d..042cf81 100644 --- a/app/src/androidTest/java/com/kaixed/kchat/ExampleInstrumentedTest.kt +++ b/app/src/androidTest/java/com/kaixed/kchat/ExampleInstrumentedTest.kt @@ -1,26 +1,17 @@ -package com.kaixed.kchat; +package com.kaixed.kchat -import android.content.Context; +import androidx.test.ext.junit.runners.AndroidJUnit4 +import androidx.test.platform.app.InstrumentationRegistry +import org.junit.Assert +import org.junit.Test +import org.junit.runner.RunWith -import androidx.test.platform.app.InstrumentationRegistry; -import androidx.test.ext.junit.runners.AndroidJUnit4; - -import org.junit.Test; -import org.junit.runner.RunWith; - -import static org.junit.Assert.*; - -/** - * Instrumented test, which will execute on an Android device. - * - * @see Testing documentation - */ -@RunWith(AndroidJUnit4.class) -public class ExampleInstrumentedTest { +@RunWith(AndroidJUnit4::class) +class ExampleInstrumentedTest { @Test - public void useAppContext() { + fun useAppContext() { // Context of the app under test. - Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext(); - assertEquals("com.kaixed.kchat", appContext.getPackageName()); + val appContext = InstrumentationRegistry.getInstrumentation().targetContext + Assert.assertEquals("com.kaixed.kchat", appContext.packageName) } -} \ No newline at end of file +} diff --git a/app/src/main/java/com/kaixed/kchat/model/FunctionItem.kt b/app/src/main/java/com/kaixed/kchat/model/FunctionItem.kt new file mode 100644 index 0000000..a8ef812 --- /dev/null +++ b/app/src/main/java/com/kaixed/kchat/model/FunctionItem.kt @@ -0,0 +1,10 @@ +package com.kaixed.kchat.model + +/** + * @Author: kaixed + * @Date: 2024/10/29 13:02 + */ +data class FunctionItem( + val itemName: String, + val iconResId: Int +) diff --git a/app/src/main/java/com/kaixed/kchat/ui/activity/ApproveContactRequestActivity.kt b/app/src/main/java/com/kaixed/kchat/ui/activity/ApproveContactRequestActivity.kt index d3aa755..8139771 100644 --- a/app/src/main/java/com/kaixed/kchat/ui/activity/ApproveContactRequestActivity.kt +++ b/app/src/main/java/com/kaixed/kchat/ui/activity/ApproveContactRequestActivity.kt @@ -32,7 +32,7 @@ class ApproveContactRequestActivity : BaseActivity() { val nickname = intent.getStringExtra("nickname") val message = intent.getStringExtra("message") binding.etRemark.setText(nickname) - binding.tvMessage.text = "“$message”" + binding.tvMessage.text = "$message" } private fun setOnClickListener() { diff --git a/app/src/main/java/com/kaixed/kchat/ui/activity/ApproveDetailActivity.kt b/app/src/main/java/com/kaixed/kchat/ui/activity/ApproveDetailActivity.kt index 17ea745..dd4eac7 100644 --- a/app/src/main/java/com/kaixed/kchat/ui/activity/ApproveDetailActivity.kt +++ b/app/src/main/java/com/kaixed/kchat/ui/activity/ApproveDetailActivity.kt @@ -1,8 +1,10 @@ package com.kaixed.kchat.ui.activity import android.content.Intent +import android.os.Build import android.os.Bundle import androidx.activity.enableEdgeToEdge +import androidx.annotation.RequiresApi import androidx.appcompat.app.AppCompatActivity import com.bumptech.glide.Glide import com.kaixed.kchat.databinding.ActivityApproveDetailBinding @@ -14,15 +16,15 @@ class ApproveDetailActivity : AppCompatActivity() { private var request: FriendRequestItem? = null + @RequiresApi(Build.VERSION_CODES.TIRAMISU) override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) enableEdgeToEdge() binding = ActivityApproveDetailBinding.inflate(layoutInflater) setContentView(binding.root) - request = intent.getParcelableExtra("request") as? FriendRequestItem + request = intent.getParcelableExtra("request", FriendRequestItem::class.java) - setContent() setOnClick() } @@ -44,10 +46,12 @@ class ApproveDetailActivity : AppCompatActivity() { } binding.rlGotoVerify.setOnClickListener { - startActivity(Intent(this, ApproveContactRequestActivity::class.java).apply { - putExtra("nickname", request?.nickname) - putExtra("message", request?.message) - }) + startActivity( + Intent(this, ApproveContactRequestActivity::class.java).apply { + putExtra("nickname", request?.nickname) + putExtra("message", request?.message) + } + ) } } -} \ No newline at end of file +} diff --git a/app/src/main/java/com/kaixed/kchat/ui/activity/ChatActivity.kt b/app/src/main/java/com/kaixed/kchat/ui/activity/ChatActivity.kt index 6d6bbc4..089ace3 100644 --- a/app/src/main/java/com/kaixed/kchat/ui/activity/ChatActivity.kt +++ b/app/src/main/java/com/kaixed/kchat/ui/activity/ChatActivity.kt @@ -23,10 +23,12 @@ import androidx.core.widget.addTextChangedListener import androidx.recyclerview.widget.GridLayoutManager import androidx.recyclerview.widget.LinearLayoutManager import androidx.recyclerview.widget.RecyclerView +import com.kaixed.kchat.R import com.kaixed.kchat.data.objectbox.ObjectBox.get import com.kaixed.kchat.data.objectbox.entity.Messages import com.kaixed.kchat.data.objectbox.entity.Messages_ import com.kaixed.kchat.databinding.ActivityChatBinding +import com.kaixed.kchat.model.FunctionItem import com.kaixed.kchat.service.WebSocketService import com.kaixed.kchat.service.WebSocketService.LocalBinder import com.kaixed.kchat.ui.adapter.ChatAdapter @@ -327,17 +329,28 @@ class ChatActivity : BaseActivity(), OnItemClickListener { val gridLayoutManager = GridLayoutManager(this, 7) binding.rvEmoji.layoutManager = gridLayoutManager - val strings1: MutableList = ArrayList() - strings1.add("相册") - strings1.add("拍摄") - strings1.add("位置") - strings1.add("名片") - strings1.add("红包") - strings1.add("转账") - strings1.add("文件") - strings1.add("我的收藏") + val map: MutableMap = mutableMapOf() - val functionPanelAdapter = FunctionPanelAdapter(strings1, this) + map["相册"] = R.drawable.ic_filled_picture + map["拍摄"] = R.drawable.ic_filled_camera + map["位置"] = R.drawable.ic_filled_location + map["名片"] = R.drawable.ic_filled_personal + map["转账"] = R.drawable.ic_filled_transfer + map["文件"] = R.drawable.ic_folder_filled + map["语音输入"] = R.drawable.ic_filled_voiceinput + map["我的收藏"] = R.drawable.ic_filled_favorites + + val functionItems = mutableListOf() + for (i in map.keys) { + functionItems.add( + FunctionItem( + i, + map[i]!! + ) + ) + } + + val functionPanelAdapter = FunctionPanelAdapter(functionItems, this) binding.gvFunctionPanel.adapter = functionPanelAdapter } diff --git a/app/src/main/java/com/kaixed/kchat/ui/activity/MainActivity.kt b/app/src/main/java/com/kaixed/kchat/ui/activity/MainActivity.kt index 4899b67..2e3dad0 100644 --- a/app/src/main/java/com/kaixed/kchat/ui/activity/MainActivity.kt +++ b/app/src/main/java/com/kaixed/kchat/ui/activity/MainActivity.kt @@ -85,6 +85,7 @@ class MainActivity : AppCompatActivity(), OnChatListItemClickListener { startActivity(intent) } } + private fun flipImage(v: View) { val flipAnimation = if (isFlipped) { ObjectAnimator.ofFloat(v, "rotationX", 180f, 0f) diff --git a/app/src/main/java/com/kaixed/kchat/ui/activity/ProfileActivity.kt b/app/src/main/java/com/kaixed/kchat/ui/activity/ProfileActivity.kt index 3621c3a..d87ef29 100644 --- a/app/src/main/java/com/kaixed/kchat/ui/activity/ProfileActivity.kt +++ b/app/src/main/java/com/kaixed/kchat/ui/activity/ProfileActivity.kt @@ -5,6 +5,7 @@ import android.os.Bundle import androidx.activity.enableEdgeToEdge import androidx.appcompat.app.AppCompatActivity import com.kaixed.kchat.databinding.ActivityProfileBinding +import com.kaixed.kchat.ui.widget.MyBottomSheetFragment class ProfileActivity : AppCompatActivity() { @@ -20,18 +21,8 @@ class ProfileActivity : AppCompatActivity() { } binding.rlSetting.setOnClickListener { -// val intent = Intent(this, SettingActivity::class.java) -// startActivity(intent) -// supportFragmentManager -// .beginTransaction() -// .replace( -// binding.fragmentContainer.id, -// SettingsFragment() -// ) // fragment_container 是你的布局中的容器ID -// .commit() -// binding.clProfile.visibility = View.GONE -// binding.llSettingItems.visibility = View.GONE - + val bottomSheetFragment = MyBottomSheetFragment() + bottomSheetFragment.show(supportFragmentManager, bottomSheetFragment.tag) } } -} \ No newline at end of file +} diff --git a/app/src/main/java/com/kaixed/kchat/ui/adapter/FunctionPanelAdapter.kt b/app/src/main/java/com/kaixed/kchat/ui/adapter/FunctionPanelAdapter.kt index eafb272..b2d066a 100644 --- a/app/src/main/java/com/kaixed/kchat/ui/adapter/FunctionPanelAdapter.kt +++ b/app/src/main/java/com/kaixed/kchat/ui/adapter/FunctionPanelAdapter.kt @@ -6,17 +6,18 @@ import android.view.View import android.view.ViewGroup import android.widget.BaseAdapter import com.kaixed.kchat.databinding.FunctionGridItemBinding +import com.kaixed.kchat.model.FunctionItem /** * @Author: kaixed * @Date: 2024/10/27 18:29 */ class FunctionPanelAdapter( - private val strings: List?, + private val items: List, private val context: Context ) : BaseAdapter() { - override fun getCount(): Int = strings?.size ?: 0 + override fun getCount(): Int = items.size override fun getItem(position: Int): Any? { return null } @@ -39,8 +40,8 @@ class FunctionPanelAdapter( // convertView 不为空时,直接复用已有的 View binding = convertView.tag as FunctionGridItemBinding } - binding.tvItemName.text = strings?.get(position) - + binding.tvItemName.text = items[position].itemName + binding.ivItem.setImageResource(items[position].iconResId) return convertView } } diff --git a/app/src/main/java/com/kaixed/kchat/ui/adapter/MessageListAdapter.kt b/app/src/main/java/com/kaixed/kchat/ui/adapter/MessageListAdapter.kt index de1d92e..cda9c9f 100644 --- a/app/src/main/java/com/kaixed/kchat/ui/adapter/MessageListAdapter.kt +++ b/app/src/main/java/com/kaixed/kchat/ui/adapter/MessageListAdapter.kt @@ -34,7 +34,6 @@ class MessageListAdapter(private val items: MutableList, val override fun getItemCount(): Int = items.size override fun onBindViewHolder(holder: MyViewHolder, position: Int) { - holder.binding.root.setOnClickListener { val intent = Intent(context, ApproveDetailActivity::class.java) intent.putExtra("request", items[position]) @@ -42,11 +41,13 @@ class MessageListAdapter(private val items: MutableList, val } holder.binding.tvAdd.setOnClickListener { - context.startActivity(Intent(context, ApproveContactRequestActivity::class.java).apply { - putExtra("nickname", items[position].nickname) - putExtra("contactId", items[position].username) - putExtra("message", items[position].message) - }) + context.startActivity( + Intent(context, ApproveContactRequestActivity::class.java).apply { + putExtra("nickname", items[position].nickname) + putExtra("contactId", items[position].username) + putExtra("message", items[position].message) + } + ) } holder.binding.top.visibility = if (position == 0) View.GONE else View.VISIBLE @@ -56,7 +57,5 @@ class MessageListAdapter(private val items: MutableList, val Glide.with(context).load(items[position].avatarUrl).into(holder.binding.ifvAvatar) holder.binding.tvMessage.text = items[position].message holder.binding.tvNickname.text = items[position].nickname - } - -} \ No newline at end of file +} diff --git a/app/src/main/java/com/kaixed/kchat/ui/widget/MyBottomSheetFragment.kt b/app/src/main/java/com/kaixed/kchat/ui/widget/MyBottomSheetFragment.kt new file mode 100644 index 0000000..cb1bd5f --- /dev/null +++ b/app/src/main/java/com/kaixed/kchat/ui/widget/MyBottomSheetFragment.kt @@ -0,0 +1,71 @@ +package com.kaixed.kchat.ui.widget + + +import android.content.Intent +import android.os.Bundle +import android.view.LayoutInflater +import android.view.View +import android.view.ViewGroup +import com.google.android.material.bottomsheet.BottomSheetDialogFragment +import com.kaixed.kchat.R +import com.kaixed.kchat.databinding.BottomSheetLayoutBinding +import com.kaixed.kchat.ui.activity.LoginActivity +import com.kaixed.kchat.utils.Constants.MMKV_USER_SESSION +import com.tencent.mmkv.MMKV + +/** + * @Author: kaixed + * @Date: 2024/10/29 13:45 + */ +class MyBottomSheetFragment : BottomSheetDialogFragment() { + + private var _binding: BottomSheetLayoutBinding? = null + private val binding get() = _binding!! + + override fun onCreateView( + inflater: LayoutInflater, + container: ViewGroup?, + savedInstanceState: Bundle? + ): View { + _binding = BottomSheetLayoutBinding.inflate(inflater, container, false) + return binding.root + } + + override fun onCreate(savedInstanceState: Bundle?) { + super.onCreate(savedInstanceState) + setStyle(STYLE_NORMAL, R.style.MyBottomSheetDialogStyle) + } + + override fun onViewCreated(view: View, savedInstanceState: Bundle?) { + super.onViewCreated(view, savedInstanceState) + + binding.tvQuitAccount.setOnClickListener { + val mmkv = MMKV.mmkvWithID(MMKV_USER_SESSION) + mmkv.clearAll() + activity?.finish() + + activity?.startActivity( + Intent( + activity, + LoginActivity::class.java + ).apply { + flags = Intent.FLAG_ACTIVITY_NEW_TASK or Intent.FLAG_ACTIVITY_CLEAR_TASK + } + ) + } + + binding.tvCancel.setOnClickListener { + dismiss() + } + + binding.tvQuitApp.setOnClickListener { + activity?.finishAffinity() + } + + } + + override fun onDestroyView() { + super.onDestroyView() + _binding = null + } +} diff --git a/app/src/main/res/drawable/bac_chat_function_panel.xml b/app/src/main/res/drawable/bac_chat_function_panel.xml index 1ee8b5f..17ed7f7 100644 --- a/app/src/main/res/drawable/bac_chat_function_panel.xml +++ b/app/src/main/res/drawable/bac_chat_function_panel.xml @@ -2,7 +2,7 @@ - + diff --git a/app/src/main/res/drawable/ic_filled_camera.xml b/app/src/main/res/drawable/ic_filled_camera.xml new file mode 100644 index 0000000..e3d723a --- /dev/null +++ b/app/src/main/res/drawable/ic_filled_camera.xml @@ -0,0 +1,12 @@ + + + diff --git a/app/src/main/res/drawable/ic_filled_favorites.xml b/app/src/main/res/drawable/ic_filled_favorites.xml new file mode 100644 index 0000000..c0363dc --- /dev/null +++ b/app/src/main/res/drawable/ic_filled_favorites.xml @@ -0,0 +1,11 @@ + + + diff --git a/app/src/main/res/drawable/ic_filled_location.xml b/app/src/main/res/drawable/ic_filled_location.xml new file mode 100644 index 0000000..be77ceb --- /dev/null +++ b/app/src/main/res/drawable/ic_filled_location.xml @@ -0,0 +1,12 @@ + + + diff --git a/app/src/main/res/drawable/ic_filled_personal.xml b/app/src/main/res/drawable/ic_filled_personal.xml new file mode 100644 index 0000000..5050db3 --- /dev/null +++ b/app/src/main/res/drawable/ic_filled_personal.xml @@ -0,0 +1,14 @@ + + + + diff --git a/app/src/main/res/drawable/ic_filled_picture.xml b/app/src/main/res/drawable/ic_filled_picture.xml new file mode 100644 index 0000000..b753d12 --- /dev/null +++ b/app/src/main/res/drawable/ic_filled_picture.xml @@ -0,0 +1,11 @@ + + + diff --git a/app/src/main/res/drawable/ic_filled_transfer.xml b/app/src/main/res/drawable/ic_filled_transfer.xml new file mode 100644 index 0000000..02843c2 --- /dev/null +++ b/app/src/main/res/drawable/ic_filled_transfer.xml @@ -0,0 +1,12 @@ + + + diff --git a/app/src/main/res/drawable/ic_filled_voiceinput.xml b/app/src/main/res/drawable/ic_filled_voiceinput.xml new file mode 100644 index 0000000..58bc462 --- /dev/null +++ b/app/src/main/res/drawable/ic_filled_voiceinput.xml @@ -0,0 +1,12 @@ + + + diff --git a/app/src/main/res/drawable/ic_folder_filled.xml b/app/src/main/res/drawable/ic_folder_filled.xml new file mode 100644 index 0000000..64096fa --- /dev/null +++ b/app/src/main/res/drawable/ic_folder_filled.xml @@ -0,0 +1,12 @@ + + + diff --git a/app/src/main/res/layout/activity_chat.xml b/app/src/main/res/layout/activity_chat.xml index 6d3f6f7..85fca05 100644 --- a/app/src/main/res/layout/activity_chat.xml +++ b/app/src/main/res/layout/activity_chat.xml @@ -4,7 +4,7 @@ xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" - android:background="@color/gray" + android:background="#F7F7F7" android:fitsSystemWindows="true" android:orientation="vertical"> @@ -161,7 +161,6 @@ android:id="@+id/gv_function_panel" android:layout_width="0dp" android:layout_height="250dp" - android:background="@color/gray" android:numColumns="4" android:visibility="invisible" app:layout_constraintBottom_toBottomOf="parent" diff --git a/app/src/main/res/layout/activity_login.xml b/app/src/main/res/layout/activity_login.xml index 6dd3834..0558f20 100644 --- a/app/src/main/res/layout/activity_login.xml +++ b/app/src/main/res/layout/activity_login.xml @@ -83,6 +83,7 @@ android:layout_marginStart="35dp" android:background="@null" android:hint="请填写密码" + android:inputType="textPassword" android:textCursorDrawable="@drawable/cursor" app:layout_constraintBottom_toTopOf="@id/view2" app:layout_constraintEnd_toEndOf="parent" diff --git a/app/src/main/res/layout/bottom_sheet_layout.xml b/app/src/main/res/layout/bottom_sheet_layout.xml new file mode 100644 index 0000000..5328a10 --- /dev/null +++ b/app/src/main/res/layout/bottom_sheet_layout.xml @@ -0,0 +1,42 @@ + + + + + + + + diff --git a/app/src/main/res/layout/function_grid_item.xml b/app/src/main/res/layout/function_grid_item.xml index 4d75727..3d419f0 100644 --- a/app/src/main/res/layout/function_grid_item.xml +++ b/app/src/main/res/layout/function_grid_item.xml @@ -6,7 +6,7 @@ android:padding="20dp"> + + + app:layout_constraintEnd_toEndOf="@id/iv_bg" + app:layout_constraintStart_toStartOf="@id/iv_bg" + app:layout_constraintTop_toBottomOf="@id/iv_bg" /> \ No newline at end of file diff --git a/app/src/main/res/values/styles.xml b/app/src/main/res/values/styles.xml index 9110e87..39d6e6b 100644 --- a/app/src/main/res/values/styles.xml +++ b/app/src/main/res/values/styles.xml @@ -8,4 +8,12 @@ + + \ No newline at end of file diff --git a/app/src/main/res/xml/data_extraction_rules.xml b/app/src/main/res/xml/data_extraction_rules.xml index 9ee9997..6cebe05 100644 --- a/app/src/main/res/xml/data_extraction_rules.xml +++ b/app/src/main/res/xml/data_extraction_rules.xml @@ -5,7 +5,7 @@ --> - diff --git a/app/src/test/java/com/kaixed/kchat/ExampleUnitTest.kt b/app/src/test/java/com/kaixed/kchat/ExampleUnitTest.kt index 1b37cda..4756306 100644 --- a/app/src/test/java/com/kaixed/kchat/ExampleUnitTest.kt +++ b/app/src/test/java/com/kaixed/kchat/ExampleUnitTest.kt @@ -1,17 +1,16 @@ -package com.kaixed.kchat; +package com.kaixed.kchat -import org.junit.Test; - -import static org.junit.Assert.*; +import org.junit.Assert +import org.junit.Test /** * Example local unit test, which will execute on the development machine (host). * - * @see Testing documentation + * @see [Testing documentation](http://d.android.com/tools/testing) */ -public class ExampleUnitTest { +class ExampleUnitTest { @Test - public void addition_isCorrect() { - assertEquals(4, 2 + 2); + fun addition_isCorrect() { + Assert.assertEquals(4, (2 + 2).toLong()) } -} \ No newline at end of file +} diff --git a/gradle.properties b/gradle.properties index 20e2a01..20d54b2 100644 --- a/gradle.properties +++ b/gradle.properties @@ -20,4 +20,6 @@ kotlin.code.style=official # Enables namespacing of each library's R class so that its R class includes only the # resources declared in the library itself and none from the library's dependencies, # thereby reducing the size of the R class for that library -android.nonTransitiveRClass=true \ No newline at end of file +android.nonTransitiveRClass=true + +android.enableJetifier = true \ No newline at end of file diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index cd07d58..cb5dc8c 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -16,6 +16,8 @@ constraintlayout = "2.1.4" mmkv = "1.3.9" okhttp = "4.12.0" preference = "1.2.1" +shapedrawable = "3.2" +shapeview = "9.2" therouter = "1.2.2" window = "1.3.0" #noinspection GradleDependency @@ -27,6 +29,8 @@ objectbox = "4.0.2" androidx-core-ktx = { group = "androidx.core", name = "core-ktx", version.ref = "coreKtx" } kotlinx-coroutines-android = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-android", version.ref = "kotlinxCoroutinesCore" } kotlinx-coroutines-core = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-core", version.ref = "kotlinxCoroutinesCore" } +shapedrawable = { module = "com.github.getActivity:ShapeDrawable", version.ref = "shapedrawable" } +shapeview = { module = "com.github.getActivity:ShapeView", version.ref = "shapeview" } therouter-ksp = { module = "cn.therouter:apt", version.ref = "therouter" } objectbox-android-objectbrowser = { group = "io.objectbox", name = "objectbox-android-objectbrowser", version.ref = "objectbox" } objectbox-android = { group = "io.objectbox", name = "objectbox-android", version.ref = "objectbox" } diff --git a/settings.gradle.kts b/settings.gradle.kts index 376e34c..3c7ddc4 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -16,6 +16,9 @@ dependencyResolutionManagement { repositories { google() mavenCentral() + maven { + url = uri("https://jitpack.io") + } } }