Skip to content

Commit

Permalink
Simple user profile example to elleborate the Implementation of MVVM …
Browse files Browse the repository at this point in the history
…architecture with the help of Koin for dependency injection, used Firebase as database.
  • Loading branch information
Malik Dawar committed Nov 6, 2019
1 parent 7201c0a commit a76bc42
Show file tree
Hide file tree
Showing 49 changed files with 1,336 additions and 0 deletions.
14 changes: 14 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
*.iml
.gradle
/local.properties
/.idea/caches
/.idea/libraries
/.idea/modules.xml
/.idea/workspace.xml
/.idea/navEditor.xml
/.idea/assetWizardSettings.xml
.DS_Store
/build
/captures
.externalNativeBuild
.cxx
122 changes: 122 additions & 0 deletions .idea/codeStyles/Project.xml

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

5 changes: 5 additions & 0 deletions .idea/codeStyles/codeStyleConfig.xml

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

19 changes: 19 additions & 0 deletions .idea/gradle.xml

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

9 changes: 9 additions & 0 deletions .idea/misc.xml

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

12 changes: 12 additions & 0 deletions .idea/runConfigurations.xml

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

6 changes: 6 additions & 0 deletions .idea/vcs.xml

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

1 change: 1 addition & 0 deletions app/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/build
48 changes: 48 additions & 0 deletions app/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
apply plugin: 'com.android.application'

apply plugin: 'kotlin-android'

apply plugin: 'kotlin-android-extensions'
apply plugin: 'com.google.gms.google-services'

android {
compileSdkVersion 29
defaultConfig {
applicationId "com.dawar.sparknetwork"
minSdkVersion 23
targetSdkVersion 29
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
}

dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation 'androidx.appcompat:appcompat:1.1.0'
implementation 'androidx.core:core-ktx:1.1.0'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
implementation 'androidx.lifecycle:lifecycle-extensions:2.1.0'
implementation 'androidx.lifecycle:lifecycle-viewmodel-ktx:2.1.0'
implementation 'com.google.firebase:firebase-database:19.2.0'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test:runner:1.2.0'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
// For activity rules
androidTestImplementation 'androidx.test:rules:1.2.0'
// for fragment testing
implementation 'androidx.fragment:fragment-testing:1.2.0-rc01'

implementation 'com.github.bumptech.glide:glide:4.9.0'

// or Koin for Android Architecture ViewModel
implementation 'org.koin:koin-androidx-viewmodel:2.0.1'

}
48 changes: 48 additions & 0 deletions app/google-services.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
{
"project_info": {
"project_number": "936486760126",
"firebase_url": "https://sparknetwork-8a4c5.firebaseio.com",
"project_id": "sparknetwork-8a4c5",
"storage_bucket": "sparknetwork-8a4c5.appspot.com"
},
"client": [
{
"client_info": {
"mobilesdk_app_id": "1:936486760126:android:a9dba482344d1eb41978ef",
"android_client_info": {
"package_name": "com.dawar.sparknetwork"
}
},
"oauth_client": [
{
"client_id": "936486760126-fecc7vl57bisjd2mvfo7ivvbs9pu1phn.apps.googleusercontent.com",
"client_type": 1,
"android_info": {
"package_name": "com.dawar.sparknetwork",
"certificate_hash": "97766a16950abdbc0f2be1ef5f8828248d26bd96"
}
},
{
"client_id": "936486760126-tpp36861fk3lb56dkj42i98egvt902k6.apps.googleusercontent.com",
"client_type": 3
}
],
"api_key": [
{
"current_key": "AIzaSyBJIhTaoBwdWVBjLo4G52qCGscQP8innuE"
}
],
"services": {
"appinvite_service": {
"other_platform_oauth_client": [
{
"client_id": "936486760126-tpp36861fk3lb56dkj42i98egvt902k6.apps.googleusercontent.com",
"client_type": 3
}
]
}
}
}
],
"configuration_version": "1"
}
21 changes: 21 additions & 0 deletions app/proguard-rules.pro
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Add project specific ProGuard rules here.
# You can control the set of applied configuration files using the
# proguardFiles setting in build.gradle.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html

# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
# public *;
#}

# Uncomment this to preserve the line number information for
# debugging stack traces.
#-keepattributes SourceFile,LineNumberTable

# If you keep the line number information, uncomment this to
# hide the original source file name.
#-renamesourcefileattribute SourceFile
25 changes: 25 additions & 0 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.dawar.sparknetwork">

<uses-permission android:name="android.permission.INTERNET" />
<application
android:allowBackup="false"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<activity android:name="com.dawar.sparknetwork.ui.main.MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />

<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.VIEW" />
</intent-filter>
</activity>
</application>

</manifest>
12 changes: 12 additions & 0 deletions app/src/main/java/com/dawar/sparknetwork/models/User.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
package com.dawar.sparknetwork.models


data class User(var name: String? = null) {
var image: String? = null
var phone: String? = null
var email: String? = null

var address: String? = null
}


Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
package com.dawar.sparknetwork.ui.main

import androidx.fragment.app.Fragment

abstract class BaseFragment:Fragment()
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package com.dawar.sparknetwork.ui.main

import com.dawar.sparknetwork.ui.main.database.AppDatabase

abstract class BaseRepository {
protected val mAppDatabase = AppDatabase.getInstance()
}
Loading

0 comments on commit a76bc42

Please sign in to comment.