Skip to content

Commit

Permalink
日常修改:2024-06-20.
Browse files Browse the repository at this point in the history
  • Loading branch information
walgr committed Jun 20, 2024
1 parent f1b74b5 commit 62fc404
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 12 deletions.
6 changes: 2 additions & 4 deletions Quick/src/main/java/com/wpf/app/quick/ability/QuickView.kt
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
@file:Suppress("LeakingThis")

package com.wpf.app.quick.ability

import android.content.Context
Expand Down Expand Up @@ -59,10 +61,6 @@ open class QuickView @JvmOverloads constructor(
childView = it.generateContentView(this, childView!!)
}
addView(childView)
}

override fun onAttachedToWindow() {
super.onAttachedToWindow()
abilityList.filterIsInstance<QuickGenerateViewAbility>().forEach {
it.afterGenerateContentView(this, childView!!)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -146,14 +146,14 @@ fun <T : View> T.marginBottom(margin: Int): T {
return this
}

fun <T : View> T.widget(widget: Float): T {
fun <T : View> T.weight(weight: Float): T {
parent()?.forceTo<LinearLayout>()?.let {
if (it.orientation == LinearLayout.VERTICAL) {
this@widget.layoutParams.height = 0
this@weight.layoutParams.height = 0
} else {
this@widget.layoutParams.width = 0
this@weight.layoutParams.width = 0
}
this@widget.layoutParams.forceTo<LayoutParams>().weight = widget
this@weight.layoutParams.forceTo<LayoutParams>().weight = weight
}
return this
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import com.wpf.app.quickutil.helper.paddingHorizontal
import com.wpf.app.quickutil.helper.reset
import com.wpf.app.quickutil.helper.sp
import com.wpf.app.quickutil.helper.toColor
import com.wpf.app.quickutil.helper.widget
import com.wpf.app.quickutil.helper.weight
import com.wpf.app.quickwidget.wheel.WheelItemData
import com.wpf.app.quickwidget.wheel.WheelView
import com.wpf.app.quickwork.ability.helper.text
Expand Down Expand Up @@ -59,7 +59,7 @@ class BottomSheetDialogTestActivity : QuickActivity(
textSize = 18f.sp,
text = "",
textColor = R.color.colorPrimary.toColor()
).widget(1f)
).weight(1f)
text(
textSize = 16f.sp,
text = "取消",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import com.wpf.app.base.ability.helper.viewGroupCreate
import com.wpf.app.quickutil.helper.dp
import com.wpf.app.quickutil.helper.matchWrapMarginLayoutParams
import com.wpf.app.quickutil.helper.padding
import com.wpf.app.quickutil.helper.widget
import com.wpf.app.quickutil.helper.weight
import com.wpf.app.quickwidget.wheel.WheelItemData
import com.wpf.app.quickwidget.wheel.WheelView
import com.wpf.app.quickwork.ability.helper.title
Expand All @@ -24,7 +24,7 @@ class WheelViewTestActivity: QuickActivity(

}
addView(self.wheelView!!, matchWrapMarginLayoutParams())
}.widget(1f)
}.weight(1f)
}
) {

Expand Down

0 comments on commit 62fc404

Please sign in to comment.