Skip to content

Commit

Permalink
0.1.1
Browse files Browse the repository at this point in the history
  • Loading branch information
dango2887 committed Jan 16, 2024
1 parent da04722 commit cdf226f
Show file tree
Hide file tree
Showing 14 changed files with 181 additions and 30 deletions.
1 change: 1 addition & 0 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
xmlns:tools="http://schemas.android.com/tools">

<application
android:name=".BaseApplication"
android:allowBackup="true"
android:dataExtractionRules="@xml/data_extraction_rules"
android:fullBackupContent="@xml/backup_rules"
Expand Down
2 changes: 2 additions & 0 deletions app/src/main/java/com/dango/dx/unit/BaseApplication.kt
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,12 @@ package com.dango.dx.unit

import android.app.Application
import com.dango.dx.lib.kit.logDev
import com.dango.dx.lib.widget.DxWidget

class BaseApplication : Application() {
override fun onCreate() {
super.onCreate()
logDev { "Application onCreate" }
DxWidget.init(this)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package com.dango.dx.biz.display

import android.app.Activity
import android.content.Context
import android.content.Intent
import android.view.LayoutInflater
import android.view.ViewGroup
import androidx.recyclerview.widget.RecyclerView
Expand Down Expand Up @@ -44,15 +45,35 @@ abstract class BaseDisplayActivity : BaseActivity<DxDisplayActivityBaseBinding>(
private inner class InnerAdapter : BaseQuickAdapter<DisplayBean, InnerViewHolder>(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)
Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -14,24 +16,12 @@ import com.dango.dx.biz.display.MethodDisplayBean
*/
class UIDisplayActivity : BaseDisplayActivity() {
override val data: List<DisplayBean> = 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") {

}
)

}
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
<View
android:layout_width="match_parent"
android:layout_height="1px"
android:background="#b2b2b2" />
android:background="@color/dx_divider" />

<androidx.recyclerview.widget.RecyclerView
android:id="@+id/display_recycler"
Expand Down
3 changes: 1 addition & 2 deletions dBiz/display/src/main/res/layout/dx_display_card_display.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,4 @@
android:layout_margin="16dp"
android:text="Base Display"
android:textColor="@color/white"
android:textSize="24dp"
android:textStyle="bold" />
android:textSize="16dp" />
7 changes: 0 additions & 7 deletions dLib/widget/src/main/java/com/dango/dx/lib/widget/Config.kt

This file was deleted.

16 changes: 16 additions & 0 deletions dLib/widget/src/main/java/com/dango/dx/lib/widget/DxWidget.kt
Original file line number Diff line number Diff line change
@@ -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
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -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 {

Expand All @@ -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,
Expand Down
Original file line number Diff line number Diff line change
@@ -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)
}
}
42 changes: 42 additions & 0 deletions dLib/widget/src/main/res/layout/dx_base_bottom_sheet_dialog.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">

<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="16dp"
android:text="Base Display"
android:textColor="@color/dx_white_alpha95"
android:textSize="24dp"
android:textStyle="bold" />

<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="16dp"
android:text="Base Display"
android:textColor="@color/dx_white_alpha95"
android:textSize="24dp"
android:textStyle="bold" />

<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="16dp"
android:text="Base Display"
android:textColor="@color/dx_white_alpha95"
android:textSize="24dp"
android:textStyle="bold" />

<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="16dp"
android:text="Base Display"
android:textColor="@color/dx_white_alpha95"
android:textSize="24dp"
android:textStyle="bold" />
</LinearLayout>
47 changes: 47 additions & 0 deletions dLib/widget/src/main/res/values/colors.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,53 @@
<color name="dx_color_4">#F588A0</color>
<color name="dx_color_5">#443D60</color>

<!-- 功能色 -->
<color name="dx_divider">@color/dx_white_45</color>

<!-- 标准 white -->
<color name="dx_white_100">#FFFFFF</color>
<color name="dx_white_95">#F2F2F2</color>
<color name="dx_white_90">#E5E5E5</color>
<color name="dx_white_85">#D9D9D9</color>
<color name="dx_white_80">#CCCCCC</color>
<color name="dx_white_75">#BFBFBF</color>
<color name="dx_white_70">#B2B2B2</color>
<color name="dx_white_65">#A5A5A5</color>
<color name="dx_white_60">#999999</color>
<color name="dx_white_55">#8C8C8C</color>
<color name="dx_white_50">#7F7F7F</color>
<color name="dx_white_45">#737373</color>
<color name="dx_white_40">#666666</color>
<color name="dx_white_35">#595959</color>
<color name="dx_white_30">#4C4C4C</color>
<color name="dx_white_25">#404040</color>
<color name="dx_white_20">#333333</color>
<color name="dx_white_15">#262626</color>
<color name="dx_white_10">#191919</color>
<color name="dx_white_05">#0D0D0D</color>

<!-- 标准 black -->
<color name="dx_black_100">#000000</color>
<color name="dx_black_95">#0D0D0D</color>
<color name="dx_black_90">#1A1A1A</color>
<color name="dx_black_85">#262626</color>
<color name="dx_black_80">#333333</color>
<color name="dx_black_75">#404040</color>
<color name="dx_black_70">#4D4D4D</color>
<color name="dx_black_65">#595959</color>
<color name="dx_black_60">#666666</color>
<color name="dx_black_55">#737373</color>
<color name="dx_black_50">#808080</color>
<color name="dx_black_45">#8C8C8C</color>
<color name="dx_black_40">#999999</color>
<color name="dx_black_35">#A6A6A6</color>
<color name="dx_black_30">#B3B3B3</color>
<color name="dx_black_25">#BFBFBF</color>
<color name="dx_black_20">#CCCCCC</color>
<color name="dx_black_15">#D9D9D9</color>
<color name="dx_black_10">#E6E6E6</color>
<color name="dx_black_05">#F2F2F2</color>

<!-- 标准不透明度值 white -->
<color name="dx_white_alpha100">#FFFFFFFF</color>
<color name="dx_white_alpha95">#F2FFFFFF</color>
Expand Down
14 changes: 13 additions & 1 deletion dLib/widget/src/main/res/values/themes.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,17 +19,29 @@

<!--BottomNavigation -->
<item name="bottomNavigationStyle">@style/Widget.App.BottomNavigationView</item>
<!--bottomSheetDialogTheme -->
<item name="bottomSheetDialogTheme">@style/Widget.App.BottomNavigationView</item>

<!-- Customize your light theme here. -->
<!-- <item name="colorPrimary">@color/my_light_primary</item> -->
</style>


<style name="Widget.App.BottomNavigationView" parent="Widget.Material3.BottomNavigationView">
<item name="materialThemeOverlay">@style/ThemeOverlay.App.BottomNavigationView</item>
</style>

<style name="ThemeOverlay.App.BottomNavigationView" parent="">
<item name="colorSurface">#1A1A1A</item>
</style>

<style name="Dx.BottomSheetDialog" parent="Theme.Material3.Dark.BottomSheetDialog">
<!-- <item name="android:background">@color/dx_transparent</item>-->
<!-- <item name="colorOnBackground">@color/dx_color_4</item>-->
<!-- <item name="shapeAppearance">@null</item>-->
<!-- <item name="shapeAppearanceOverlay">@null</item>-->
<!-- <item name="android:windowNoTitle">true</item>-->
<!-- <item name="android:windowFullscreen">true</item>-->
<!-- <item name="android:windowIsFloating">true</item>-->
<!-- <item name="android:backgroundDimEnabled">true</item>-->
</style>
</resources>
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit cdf226f

Please sign in to comment.