Skip to content

Commit

Permalink
修改minSdk为21
Browse files Browse the repository at this point in the history
增加Fragment基类
  • Loading branch information
Reginer committed Nov 23, 2019
1 parent ab9dbbd commit 00d6f05
Show file tree
Hide file tree
Showing 6 changed files with 67 additions and 5 deletions.
1 change: 1 addition & 0 deletions .idea/codeStyles/Project.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion base/src/main/java/win/regin/base/BaseActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import kotlinx.android.synthetic.main.activity_base_layout.*
/**
* @author :Reginer in 19-6-18 下午6:02.
* 联系方式:QQ:282921012
* 功能描述:
* 功能描述:Activity基类,普通Activity继承
*/
abstract class BaseActivity : AppCompatActivity() {
protected lateinit var mToolBar: Toolbar
Expand Down
28 changes: 28 additions & 0 deletions base/src/main/java/win/regin/base/BaseFragment.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
package win.regin.base

import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import androidx.annotation.LayoutRes
import androidx.fragment.app.Fragment

/**
* @author :Reginer in 2019/11/23 10:00.
* 联系方式:QQ:282921012
* 功能描述:Fragment基类,普通Activity继承
*/
abstract class BaseFragment : Fragment() {
/**
* 获取布局id
*
* @return layoutId
*/
@LayoutRes
protected abstract fun getLayoutId(): Int


override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? {
return inflater.inflate(getLayoutId(), container, false);
}
}
2 changes: 1 addition & 1 deletion base/src/main/java/win/regin/base/BaseVmActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import win.regin.base.ext.getVmClazz
/**
* @author :Reginer in 19-6-18 下午6:05.
* 联系方式:QQ:282921012
* 功能描述:
* 功能描述:ViewModelActivity基类,ViewModelActivity继承
*/

abstract class BaseVmActivity<VM : BaseViewModel> : BaseActivity() {
Expand Down
33 changes: 33 additions & 0 deletions base/src/main/java/win/regin/base/BaseVmFragment.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
package win.regin.base

import android.os.Bundle
import androidx.lifecycle.ViewModelProvider
import win.regin.base.ext.getVmClazz

/**
* @author :Reginer in 2019/11/23 10:11.
* 联系方式:QQ:282921012
* 功能描述:ViewModelFragment基类,ViewModelFragment继承
*/
abstract class BaseVmFragment<VM : BaseViewModel> : BaseFragment() {

protected lateinit var mViewModel: VM

override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
mViewModel = createViewModel()
createObserver()
}

/**
* 创建viewModel
*/
private fun createViewModel(): VM {
return ViewModelProvider(this).get(getVmClazz(this) as Class<VM>)
}

/**
* 创建观察者
*/
protected abstract fun createObserver()
}
6 changes: 3 additions & 3 deletions buildSrc/src/main/java/MvvmExt.kt
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ object AppConfig {
const val buildToolsVersion = "29.0.2"
const val compileSdkVersion = 29
const val targetSdkVersion = 29
const val minSdkVersion = 23
const val minSdkVersion = 21
const val storePassword = "ly9999"
const val keyAlias = "那时年少"
const val storeFile = "../keystore/Young.jks"
Expand All @@ -36,8 +36,8 @@ object Version {
const val materialVersion = "1.2.0-alpha01"
const val objectboxVersion = "2.4.1"
const val loggerVersion = "2.2.0"
const val libVersionCode = 2
const val libVersionName = "1.1"
const val libVersionCode = 3
const val libVersionName = "1.3"
}

object MvvmExt {
Expand Down

0 comments on commit 00d6f05

Please sign in to comment.