Skip to content

Commit 8fae7df

Browse files
feat: added viewmodelarch example
1 parent ec91c97 commit 8fae7df

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+837
-1
lines changed

RealmDB/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ apply plugin: 'realm-android'
1111
<br><br>
1212
From the the latest version Realm has added Kotlin support which has various new features: with support of extension functions many new extensions have been added which make code more easy to write and understandable.
1313
The whole changes can be look out here from:
14-
<br>
14+
<br><br>
1515
<b>Link:</b> https://realm.io/blog/realm-4-3-0-released-w-first-class-support-for-kotlin/
1616
<br><br>
1717
Screenshots:

ViewModelAndroidArch/.gitignore

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
*.iml
2+
.gradle
3+
/local.properties
4+
/.idea/workspace.xml
5+
/.idea/libraries
6+
.DS_Store
7+
/build
8+
/captures
9+
.externalNativeBuild

ViewModelAndroidArch/.idea/gradle.xml

Lines changed: 18 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

ViewModelAndroidArch/.idea/misc.xml

Lines changed: 33 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

ViewModelAndroidArch/.idea/modules.xml

Lines changed: 9 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

ViewModelAndroidArch/.idea/runConfigurations.xml

Lines changed: 12 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

ViewModelAndroidArch/README.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# ViewModel
2+
This an example of how Viewmodel which is added in the Android Architecture Component helps to survive configuration change. You can look out for the reason of surviving the change in the diagram below:
3+
<br><br>
4+
<img src="viewmodel-lifecycle.png"/>
5+
<br><br>
6+
Screenshots:
7+
<br><br>
8+
<img src="viewmodel.gif"/>

ViewModelAndroidArch/app/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/build

ViewModelAndroidArch/app/build.gradle

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
apply plugin: 'com.android.application'
2+
3+
apply plugin: 'kotlin-android'
4+
5+
apply plugin: 'kotlin-android-extensions'
6+
7+
8+
android {
9+
compileSdkVersion 26
10+
defaultConfig {
11+
applicationId "com.developers.viewmodelandroidarch"
12+
minSdkVersion 19
13+
targetSdkVersion 26
14+
versionCode 1
15+
versionName "1.0"
16+
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
17+
}
18+
buildTypes {
19+
release {
20+
minifyEnabled false
21+
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
22+
}
23+
}
24+
}
25+
26+
dependencies {
27+
implementation fileTree(dir: 'libs', include: ['*.jar'])
28+
implementation"org.jetbrains.kotlin:kotlin-stdlib-jre7:$kotlin_version"
29+
implementation 'com.android.support:appcompat-v7:26.1.0'
30+
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
31+
testImplementation 'junit:junit:4.12'
32+
androidTestImplementation 'com.android.support.test:runner:1.0.1'
33+
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
34+
implementation "android.arch.lifecycle:runtime:1.1.0"
35+
implementation "android.arch.lifecycle:extensions:1.1.0"
36+
implementation 'com.android.support:design:26.1.0'
37+
annotationProcessor "android.arch.lifecycle:compiler:1.1.0"
38+
}
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# Add project specific ProGuard rules here.
2+
# You can control the set of applied configuration files using the
3+
# proguardFiles setting in build.gradle.
4+
#
5+
# For more details, see
6+
# http://developer.android.com/guide/developing/tools/proguard.html
7+
8+
# If your project uses WebView with JS, uncomment the following
9+
# and specify the fully qualified class name to the JavaScript interface
10+
# class:
11+
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
12+
# public *;
13+
#}
14+
15+
# Uncomment this to preserve the line number information for
16+
# debugging stack traces.
17+
#-keepattributes SourceFile,LineNumberTable
18+
19+
# If you keep the line number information, uncomment this to
20+
# hide the original source file name.
21+
#-renamesourcefileattribute SourceFile

0 commit comments

Comments
 (0)