Skip to content

Commit

Permalink
1.2.2
Browse files Browse the repository at this point in the history
feature-增加BaseDialogFragment类
  • Loading branch information
wxw-9527 committed Jan 11, 2023
1 parent 9540bc4 commit 2013a63
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 3 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,6 @@ dependencyResolutionManagement {

```groovy
dependencies {
implementation 'com.github.wxw-9527:MvpArms:1.2.1'
implementation 'com.github.wxw-9527:MvpArms:1.2.2'
}
```
4 changes: 2 additions & 2 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ android {
applicationId "com.rouxinpai.demo"
minSdk 21
targetSdk 33
versionCode 121
versionName "1.2.1"
versionCode 122
versionName "1.2.2"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
package com.rouxinpai.arms.base.fragment

import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import androidx.fragment.app.DialogFragment
import androidx.viewbinding.ViewBinding

/**
* author : Saxxhw
* email : [email protected]
* time : 2023/1/11 10:28
* desc :
*/
abstract class BaseDialogFragment<VB: ViewBinding>: DialogFragment() {

private var mBinding: VB? = null
val binding: VB get() = mBinding!!

override fun onCreateView(
inflater: LayoutInflater,
container: ViewGroup?,
savedInstanceState: Bundle?
): View? {
mBinding = onCreateViewBinding(inflater, container)
return mBinding?.root
}

override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
// 初始化
onInit(savedInstanceState)
}

override fun onDestroyView() {
super.onDestroyView()
mBinding = null
}

protected abstract fun onCreateViewBinding(inflater: LayoutInflater, parent: ViewGroup?): VB

protected open fun onInit(savedInstanceState: Bundle?) = Unit
}

0 comments on commit 2013a63

Please sign in to comment.