Skip to content

Commit

Permalink
update readme, recovered androidManifest, updatted dependency, todo: …
Browse files Browse the repository at this point in the history
…update network info check
  • Loading branch information
Luteoos committed Feb 4, 2020
1 parent 3b3ddb5 commit 9e0bde6
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 27 deletions.
20 changes: 11 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,27 +1,29 @@
# Android--MVVMLib with LiveData
Base classes for easier handling MVVM in android/Kotlin

Contains android.arch.lifecycle:extensions:2.0.0
Contains
- android.arch.lifecycle:extensions:2.2.0
- androidx.appcompat:appcompat:1.1.0

```
maven { url 'https://jitpack.io' }
implementation 'com.github.Luteoos:Android--MVVMLib:3.1.0x'
```

### Library implements simple 'bus' between VM and View able to transfer Int-based parameters, to enable it:
### Library implements simple 'event bus' between VM and View able to transfer Event<Int> to listening classes

```kotlin
override fun onVMMessage(msg: Int?){
super.onVMMessage(msg)
override fun onVMMessage(msg: Event<Int>){
when(msg.peek())
...
}
```

- after initialization viewModel invoke `connectToVMMessage()`
- `0` and `null` are values used to flush data, do not use it as your custom parameter value
- using `Event<T>.get()` returns `null` after one use, use `peek()` for multiple uses

### changes in 3.1.0x
- migrated to AndroidX
- changed package scope to more valid
- upgraded arch.lifecycle version
### changes in 4.0.0
- added `Event<T>`
- added `BaseActivityWithoutVM`
- updated appcompat and lifecycle-extensions
- simplified unused imports
9 changes: 2 additions & 7 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
ext.kotlin_version = '1.3.40'
ext.kotlin_version = '1.3.61'
ext.kotlin_plugin_version = "1.2.61"

repositories {
Expand All @@ -10,7 +10,7 @@ buildscript {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.4.1'
classpath 'com.android.tools.build:gradle:3.4.2'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"

// NOTE: Do not place your application dependencies here; they belong
Expand All @@ -34,8 +34,3 @@ allprojects {
task clean(type: Delete) {
delete rootProject.buildDir
}
ext {
rxJava = '2.1.12'
rxAndroid = '2.0.2'
rxBinding = '2.0.0'
}
18 changes: 7 additions & 11 deletions mvvmBaseLib/build.gradle
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
apply plugin: 'kotlin-kapt'
apply plugin: 'com.android.library'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
apply plugin: 'kotlin-kapt'

android {
compileSdkVersion 28
compileSdkVersion 29
defaultConfig {
minSdkVersion 21
targetSdkVersion 28
versionCode 2
versionName "2.0"
targetSdkVersion 29
versionCode 10
versionName "4.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
Expand All @@ -18,17 +18,13 @@ android {
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
ext {
}
productFlavors {
}
}

dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation 'androidx.appcompat:appcompat:1.0.2'
implementation 'androidx.lifecycle:lifecycle-extensions:2.0.0'
implementation 'androidx.appcompat:appcompat:1.1.0'
implementation 'androidx.lifecycle:lifecycle-extensions:2.2.0'

testImplementation 'org.mockito:mockito-core:2.9.0'
testImplementation 'androidx.test:runner:1.2.0'
Expand Down
5 changes: 5 additions & 0 deletions mvvmBaseLib/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.luteoos.kotlin.mvvmbaselib">

<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
</manifest>

0 comments on commit 9e0bde6

Please sign in to comment.