From cdf226fc19f12251edaafdd8ff73c071b6158326 Mon Sep 17 00:00:00 2001 From: Dango <282919162@qq.com> Date: Tue, 16 Jan 2024 16:27:58 +0800 Subject: [PATCH] 0.1.1 --- app/src/main/AndroidManifest.xml | 1 + .../java/com/dango/dx/unit/BaseApplication.kt | 2 + .../dx/biz/display/BaseDisplayActivity.kt | 25 +++++++++- .../dx/biz/display/ui/UIDisplayActivity.kt | 20 ++------ .../res/layout/dx_display_activity_base.xml | 2 +- .../res/layout/dx_display_card_display.xml | 3 +- .../java/com/dango/dx/lib/widget/Config.kt | 7 --- .../java/com/dango/dx/lib/widget/DxWidget.kt | 16 +++++++ .../widget/decoration/ItemDecorationUtil.kt | 5 +- .../widget/dialog/BaseBottomSheetDialog.kt | 25 ++++++++++ .../layout/dx_base_bottom_sheet_dialog.xml | 42 +++++++++++++++++ dLib/widget/src/main/res/values/colors.xml | 47 +++++++++++++++++++ dLib/widget/src/main/res/values/themes.xml | 14 +++++- gradle.properties | 2 +- 14 files changed, 181 insertions(+), 30 deletions(-) delete mode 100644 dLib/widget/src/main/java/com/dango/dx/lib/widget/Config.kt create mode 100644 dLib/widget/src/main/java/com/dango/dx/lib/widget/DxWidget.kt create mode 100644 dLib/widget/src/main/java/com/dango/dx/lib/widget/dialog/BaseBottomSheetDialog.kt create mode 100644 dLib/widget/src/main/res/layout/dx_base_bottom_sheet_dialog.xml diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index f468162..fc82b04 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -3,6 +3,7 @@ xmlns:tools="http://schemas.android.com/tools"> ( private inner class InnerAdapter : BaseQuickAdapter(data) { override fun onCreateViewHolder(context: Context, parent: ViewGroup, viewType: Int): InnerViewHolder { val b = DxDisplayCardDisplayBinding.inflate(LayoutInflater.from(context), parent, false) - return InnerViewHolder(b) + return InnerViewHolder(b).apply { + b.root.setOnClickListener { + val i = item ?: return@setOnClickListener + when (i) { + is ActivityDisplayBean -> { + try { + startActivity(Intent(this@BaseDisplayActivity, i.activity)) + } catch (e: Exception) { + e.printStackTrace() + } + } + + is MethodDisplayBean -> { + i.block.invoke() + } + } + } + } } override fun onBindViewHolder(holder: InnerViewHolder, position: Int, item: DisplayBean?) { + holder.item = item holder.binding.tvLabel.text = item?.title } } - private inner class InnerViewHolder(val binding: DxDisplayCardDisplayBinding) : RecyclerView.ViewHolder(binding.root) + private inner class InnerViewHolder(val binding: DxDisplayCardDisplayBinding) : RecyclerView.ViewHolder(binding.root) { + var item: DisplayBean? = null + } } sealed class DisplayBean(var title: String) diff --git a/dBiz/display/src/main/java/com/dango/dx/biz/display/ui/UIDisplayActivity.kt b/dBiz/display/src/main/java/com/dango/dx/biz/display/ui/UIDisplayActivity.kt index 9768826..0cce749 100644 --- a/dBiz/display/src/main/java/com/dango/dx/biz/display/ui/UIDisplayActivity.kt +++ b/dBiz/display/src/main/java/com/dango/dx/biz/display/ui/UIDisplayActivity.kt @@ -1,8 +1,10 @@ package com.dango.dx.biz.display.ui +import android.widget.Toast import com.dango.dx.biz.display.BaseDisplayActivity import com.dango.dx.biz.display.DisplayBean import com.dango.dx.biz.display.MethodDisplayBean +import com.dango.dx.lib.widget.dialog.BaseBottomSheetDialog /** * @author: Dango @@ -14,24 +16,12 @@ import com.dango.dx.biz.display.MethodDisplayBean */ class UIDisplayActivity : BaseDisplayActivity() { override val data: List = listOf( - MethodDisplayBean("Dialog2") { - - }, - MethodDisplayBean("Dialog2") { - - }, - MethodDisplayBean("Dialog2") { - + MethodDisplayBean("BaseBottomSheetDialog") { + BaseBottomSheetDialog(this).show() }, MethodDisplayBean("Dialog2") { - + Toast.makeText(this, "Dialog2", Toast.LENGTH_LONG).show() }, - MethodDisplayBean("Dialog2") { - - }, - MethodDisplayBean("Dialog2") { - - } ) } \ No newline at end of file diff --git a/dBiz/display/src/main/res/layout/dx_display_activity_base.xml b/dBiz/display/src/main/res/layout/dx_display_activity_base.xml index a5750bf..b119c75 100644 --- a/dBiz/display/src/main/res/layout/dx_display_activity_base.xml +++ b/dBiz/display/src/main/res/layout/dx_display_activity_base.xml @@ -18,7 +18,7 @@ + android:background="@color/dx_divider" /> \ No newline at end of file + android:textSize="16dp" /> \ No newline at end of file diff --git a/dLib/widget/src/main/java/com/dango/dx/lib/widget/Config.kt b/dLib/widget/src/main/java/com/dango/dx/lib/widget/Config.kt deleted file mode 100644 index 431475e..0000000 --- a/dLib/widget/src/main/java/com/dango/dx/lib/widget/Config.kt +++ /dev/null @@ -1,7 +0,0 @@ -package com.dango.dx.lib.widget - -class Config { - - val config: String = "" - -} \ No newline at end of file diff --git a/dLib/widget/src/main/java/com/dango/dx/lib/widget/DxWidget.kt b/dLib/widget/src/main/java/com/dango/dx/lib/widget/DxWidget.kt new file mode 100644 index 0000000..2d60720 --- /dev/null +++ b/dLib/widget/src/main/java/com/dango/dx/lib/widget/DxWidget.kt @@ -0,0 +1,16 @@ +package com.dango.dx.lib.widget + +import android.annotation.SuppressLint +import android.content.Context + +@SuppressLint("StaticFieldLeak") +object DxWidget { + + @JvmStatic + internal lateinit var context: Context + + fun init(context: Context) { + this.context = context.applicationContext + } + +} \ No newline at end of file diff --git a/dLib/widget/src/main/java/com/dango/dx/lib/widget/decoration/ItemDecorationUtil.kt b/dLib/widget/src/main/java/com/dango/dx/lib/widget/decoration/ItemDecorationUtil.kt index 8d90cf2..4cdadc5 100644 --- a/dLib/widget/src/main/java/com/dango/dx/lib/widget/decoration/ItemDecorationUtil.kt +++ b/dLib/widget/src/main/java/com/dango/dx/lib/widget/decoration/ItemDecorationUtil.kt @@ -2,7 +2,10 @@ package com.dango.dx.lib.widget.decoration import android.graphics.Color import androidx.annotation.Px +import androidx.core.content.ContextCompat import androidx.recyclerview.widget.RecyclerView +import com.dango.dx.lib.widget.DxWidget +import com.dango.dx.lib.widget.R object ItemDecorationUtil { @@ -18,7 +21,7 @@ object ItemDecorationUtil { return CommonItemDecoration( LinearLayoutProps( dividerWidth = dividerWidth, - colorInt = Color.WHITE, + colorInt = ContextCompat.getColor(DxWidget.context, R.color.dx_divider), startOffset = startOffset, endOffset = endOffset, startPadding = startPadding, diff --git a/dLib/widget/src/main/java/com/dango/dx/lib/widget/dialog/BaseBottomSheetDialog.kt b/dLib/widget/src/main/java/com/dango/dx/lib/widget/dialog/BaseBottomSheetDialog.kt new file mode 100644 index 0000000..70b1a25 --- /dev/null +++ b/dLib/widget/src/main/java/com/dango/dx/lib/widget/dialog/BaseBottomSheetDialog.kt @@ -0,0 +1,25 @@ +package com.dango.dx.lib.widget.dialog + +import android.content.Context +import android.os.Bundle +import com.dango.dx.lib.widget.R +import com.google.android.material.bottomsheet.BottomSheetDialog + +/** + * @author: Dango + * @createTime: 2024/1/16 14:58 + * Description: + * + * Modification History: + * ----------------------------------------------------------------------------------- + */ +class BaseBottomSheetDialog(private val context: Context) : BottomSheetDialog(context, R.style.Dx_BottomSheetDialog) { + init { + + } + + override fun onCreate(savedInstanceState: Bundle?) { + super.onCreate(savedInstanceState) + setContentView(R.layout.dx_base_bottom_sheet_dialog) + } +} \ No newline at end of file diff --git a/dLib/widget/src/main/res/layout/dx_base_bottom_sheet_dialog.xml b/dLib/widget/src/main/res/layout/dx_base_bottom_sheet_dialog.xml new file mode 100644 index 0000000..1b43fe0 --- /dev/null +++ b/dLib/widget/src/main/res/layout/dx_base_bottom_sheet_dialog.xml @@ -0,0 +1,42 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/dLib/widget/src/main/res/values/colors.xml b/dLib/widget/src/main/res/values/colors.xml index 4ea859e..9d86e78 100644 --- a/dLib/widget/src/main/res/values/colors.xml +++ b/dLib/widget/src/main/res/values/colors.xml @@ -9,6 +9,53 @@ #F588A0 #443D60 + + @color/dx_white_45 + + + #FFFFFF + #F2F2F2 + #E5E5E5 + #D9D9D9 + #CCCCCC + #BFBFBF + #B2B2B2 + #A5A5A5 + #999999 + #8C8C8C + #7F7F7F + #737373 + #666666 + #595959 + #4C4C4C + #404040 + #333333 + #262626 + #191919 + #0D0D0D + + + #000000 + #0D0D0D + #1A1A1A + #262626 + #333333 + #404040 + #4D4D4D + #595959 + #666666 + #737373 + #808080 + #8C8C8C + #999999 + #A6A6A6 + #B3B3B3 + #BFBFBF + #CCCCCC + #D9D9D9 + #E6E6E6 + #F2F2F2 + #FFFFFFFF #F2FFFFFF diff --git a/dLib/widget/src/main/res/values/themes.xml b/dLib/widget/src/main/res/values/themes.xml index 6919557..6150f8d 100644 --- a/dLib/widget/src/main/res/values/themes.xml +++ b/dLib/widget/src/main/res/values/themes.xml @@ -19,12 +19,13 @@ @style/Widget.App.BottomNavigationView + + @style/Widget.App.BottomNavigationView - @@ -32,4 +33,15 @@ + + \ No newline at end of file diff --git a/gradle.properties b/gradle.properties index 7b91ab3..4b09be3 100644 --- a/gradle.properties +++ b/gradle.properties @@ -23,7 +23,7 @@ kotlin.code.style=official android.nonTransitiveRClass=true GROUP=io.github.DangoDX -VERSION_NAME=0.1.0 +VERSION_NAME=0.1.1 SONATYPE_HOST=S01 RELEASE_SIGNING_ENABLED=true