Skip to content

Commit

Permalink
日常修改:2024-07-01.
Browse files Browse the repository at this point in the history
  • Loading branch information
walgr committed Jul 1, 2024
1 parent c7f0ea1 commit a10474b
Show file tree
Hide file tree
Showing 8 changed files with 96 additions and 61 deletions.
23 changes: 15 additions & 8 deletions Quick/src/main/java/com/wpf/app/quick/ability/QuickActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package com.wpf.app.quick.ability
import android.content.Intent
import android.os.Bundle
import android.view.View
import android.widget.FrameLayout
import androidx.annotation.CallSuper
import androidx.lifecycle.ViewModel
import com.wpf.app.base.ability.base.QuickAbility
Expand All @@ -20,14 +21,20 @@ open class QuickActivity(
private val abilityList: MutableList<QuickAbility> = mutableListOf(),
) : QuickBaseActivity(
layoutViewCreate = {
val inflateAbility = abilityList.first { ability -> ability is QuickInflateViewAbility }
.forceTo<QuickInflateViewAbility>()
InitViewHelper.init(
this,
inflateAbility.layoutId(),
inflateAbility.layoutView(),
inflateAbility.layoutViewCreate()
)
val inflateAbility =
abilityList.firstOrNull { ability -> ability is QuickInflateViewAbility }
?.forceTo<QuickInflateViewAbility>()
if (inflateAbility != null) {
InitViewHelper.init(
this,
inflateAbility.layoutId(),
inflateAbility.layoutView(),
inflateAbility.layoutViewCreate()
)
} else {
//恢复时能力丢失返回空页面
FrameLayout(this)
}
}
), BindViewModel<ViewModel> {
@Suppress("unused")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package com.wpf.app.quick.ability
import android.content.Context
import android.os.Bundle
import android.view.View
import android.widget.FrameLayout
import androidx.annotation.CallSuper
import androidx.annotation.StyleRes
import com.wpf.app.base.ability.base.QuickAbility
Expand All @@ -19,14 +20,20 @@ open class QuickBottomSheetDialog(
@StyleRes themeId: Int = 0,
private val abilityList: MutableList<QuickAbility> = mutableListOf(),
) : QuickBaseBottomSheetDialog(context = context, themeId = themeId, layoutViewCreate = {
val inflateAbility = abilityList.first { ability -> ability is QuickInflateViewAbility }
.forceTo<QuickInflateViewAbility>()
InitViewHelper.init(
this,
inflateAbility.layoutId(),
inflateAbility.layoutView(),
inflateAbility.layoutViewCreate()
)
val inflateAbility =
abilityList.firstOrNull { ability -> ability is QuickInflateViewAbility }
?.forceTo<QuickInflateViewAbility>()
if (inflateAbility != null) {
InitViewHelper.init(
this,
inflateAbility.layoutId(),
inflateAbility.layoutView(),
inflateAbility.layoutViewCreate()
)
} else {
//恢复时能力丢失返回空页面
FrameLayout(this)
}
}) {
@Suppress("unused")
val extraParameter: LinkedHashMap<String, Any> = linkedMapOf()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package com.wpf.app.quick.ability
import android.content.Intent
import android.os.Bundle
import android.view.View
import android.widget.FrameLayout
import androidx.annotation.CallSuper
import androidx.lifecycle.ViewModel
import com.wpf.app.base.ability.base.QuickAbility
Expand All @@ -17,18 +18,24 @@ import com.wpf.app.quickutil.helper.InitViewHelper
import com.wpf.app.quickutil.other.asTo
import com.wpf.app.quickutil.other.forceTo

open class QuickBottomSheetDialogFragment(
open class QuickBottomSheetDialogFragment @JvmOverloads constructor(
private val abilityList: MutableList<QuickAbility> = mutableListOf()
) : QuickBaseBottomSheetDialogFragment(
layoutViewCreate = {
val inflateAbility = abilityList.first { ability -> ability is QuickInflateViewAbility }
.forceTo<QuickInflateViewAbility>()
InitViewHelper.init(
this,
inflateAbility.layoutId(),
inflateAbility.layoutView(),
inflateAbility.layoutViewCreate()
)
val inflateAbility =
abilityList.firstOrNull { ability -> ability is QuickInflateViewAbility }
?.forceTo<QuickInflateViewAbility>()
if (inflateAbility != null) {
InitViewHelper.init(
this,
inflateAbility.layoutId(),
inflateAbility.layoutView(),
inflateAbility.layoutViewCreate()
)
} else {
//恢复时能力丢失返回空页面
FrameLayout(this)
}
}
), BindViewModel<ViewModel> {
@Suppress("unused")
Expand Down
23 changes: 15 additions & 8 deletions Quick/src/main/java/com/wpf/app/quick/ability/QuickDialog.kt
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package com.wpf.app.quick.ability
import android.content.Context
import android.os.Bundle
import android.view.View
import android.widget.FrameLayout
import androidx.annotation.CallSuper
import androidx.annotation.StyleRes
import androidx.lifecycle.ViewModel
Expand All @@ -22,14 +23,20 @@ open class QuickDialog(
@StyleRes themeId: Int = 0,
val abilityList: MutableList<QuickAbility> = mutableListOf(),
) : QuickBaseDialog(context = context, themeId = themeId, layoutViewCreate = {
val inflateAbility = abilityList.first { ability -> ability is QuickInflateViewAbility }
.forceTo<QuickInflateViewAbility>()
InitViewHelper.init(
this,
inflateAbility.layoutId(),
inflateAbility.layoutView(),
inflateAbility.layoutViewCreate()
)
val inflateAbility =
abilityList.firstOrNull { ability -> ability is QuickInflateViewAbility }
?.forceTo<QuickInflateViewAbility>()
if (inflateAbility != null) {
InitViewHelper.init(
this,
inflateAbility.layoutId(),
inflateAbility.layoutView(),
inflateAbility.layoutViewCreate()
)
} else {
//恢复时能力丢失返回空页面
FrameLayout(this)
}
}), BindViewModel<ViewModel> {
val extraParameter: LinkedHashMap<String, Any> = linkedMapOf()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package com.wpf.app.quick.ability
import android.content.Intent
import android.os.Bundle
import android.view.View
import android.widget.FrameLayout
import androidx.annotation.CallSuper
import androidx.lifecycle.ViewModel
import com.wpf.app.base.ability.base.QuickAbility
Expand All @@ -17,18 +18,24 @@ import com.wpf.app.quickutil.helper.InitViewHelper
import com.wpf.app.quickutil.other.asTo
import com.wpf.app.quickutil.other.forceTo

open class QuickDialogFragment(
open class QuickDialogFragment @JvmOverloads constructor(
private val abilityList: MutableList<QuickAbility> = mutableListOf()
) : QuickBaseDialogFragment(
layoutViewCreate = {
val inflateAbility = abilityList.first { ability -> ability is QuickInflateViewAbility }
.forceTo<QuickInflateViewAbility>()
InitViewHelper.init(
this,
inflateAbility.layoutId(),
inflateAbility.layoutView(),
inflateAbility.layoutViewCreate()
)
val inflateAbility =
abilityList.firstOrNull { ability -> ability is QuickInflateViewAbility }
?.forceTo<QuickInflateViewAbility>()
if (inflateAbility != null) {
InitViewHelper.init(
this,
inflateAbility.layoutId(),
inflateAbility.layoutView(),
inflateAbility.layoutViewCreate()
)
} else {
//恢复时能力丢失返回空页面
FrameLayout(this)
}
}
), BindViewModel<ViewModel> {
@Suppress("unused")
Expand Down
35 changes: 17 additions & 18 deletions Quick/src/main/java/com/wpf/app/quick/ability/QuickFragment.kt
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package com.wpf.app.quick.ability
import android.content.Intent
import android.os.Bundle
import android.view.View
import android.widget.FrameLayout
import androidx.annotation.CallSuper
import androidx.lifecycle.ViewModel
import com.wpf.app.base.ability.base.QuickAbility
Expand All @@ -17,18 +18,24 @@ import com.wpf.app.quickutil.helper.InitViewHelper
import com.wpf.app.quickutil.other.asTo
import com.wpf.app.quickutil.other.forceTo

open class QuickFragment(
private val abilityList: MutableList<QuickAbility> = mutableListOf()
open class QuickFragment @JvmOverloads constructor(
private val abilityList: MutableList<QuickAbility> = mutableListOf(),
) : QuickBaseFragment(
layoutViewCreate = {
val inflateAbility = abilityList.first { ability -> ability is QuickInflateViewAbility }
.forceTo<QuickInflateViewAbility>()
InitViewHelper.init(
this,
inflateAbility.layoutId(),
inflateAbility.layoutView(),
inflateAbility.layoutViewCreate()
)
val inflateAbility =
abilityList.firstOrNull { ability -> ability is QuickInflateViewAbility }
?.forceTo<QuickInflateViewAbility>()
if (inflateAbility != null) {
InitViewHelper.init(
this,
inflateAbility.layoutId(),
inflateAbility.layoutView(),
inflateAbility.layoutViewCreate()
)
} else {
//恢复时能力丢失返回空页面
FrameLayout(this)
}
}
), BindViewModel<ViewModel> {
@Suppress("unused")
Expand Down Expand Up @@ -106,14 +113,6 @@ open class QuickFragment(
}
}

// override fun onSaveInstanceState(outState: Bundle) {
// super.onSaveInstanceState(outState)
// abilityList.filterIsInstance<QuickLifecycleAbility>().forEach {
// it.onSaveInstanceState(outState)
// }
// outState.putSerializable("abilityList", abilityList.toTypedArray())
// }

@CallSuper
@Suppress("DEPRECATION")
@Deprecated("Deprecated by Android")
Expand Down
1 change: 1 addition & 0 deletions Quick/src/main/java/com/wpf/app/quick/ability/QuickView.kt
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import com.wpf.app.quickutil.other.forceTo
import com.wpf.app.quickutil.widget.wishLayoutParams
import kotlinx.coroutines.Job

@Suppress("CanBeParameter")
open class QuickView @JvmOverloads constructor(
context: Context,
attrs: AttributeSet? = null,
Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ org.gradle.jvmargs=-Xmx4096m -Dfile.encoding=UTF-8

IS_REMOTE=true
GROUP=com.wpf.app.quick
VERSION_NAME=0.10.6
VERSION_NAME=0.10.7

POM_DESCRIPTION=Quick Android.

Expand Down

0 comments on commit a10474b

Please sign in to comment.