Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP: Add room Support #3

Open
wants to merge 16 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 16 additions & 3 deletions .idea/codeStyles/Project.xml

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

25 changes: 25 additions & 0 deletions .idea/jarRepositories.xml

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

1 change: 0 additions & 1 deletion app/.gitignore

This file was deleted.

85 changes: 62 additions & 23 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,68 +5,107 @@ apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'

apply plugin: "kotlin-kapt"

apply plugin: 'com.google.gms.google-services'

android {
compileSdkVersion 29
buildToolsVersion "29.0.2"
compileSdkVersion 30
defaultConfig {
applicationId "com.androiddevs.newsflash"
minSdkVersion 21
targetSdkVersion 29
targetSdkVersion 30
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
buildConfigField("String", "API_KEY", API_KEY)
}

testOptions {
unitTests.returnDefaultValues = true
}

buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}

dataBinding {
enabled = true
compileOptions {
sourceCompatibility 1.8
targetCompatibility 1.8
}
buildFeatures {
dataBinding = true
}
configurations.all {
resolutionStrategy {
exclude group: "org.jetbrains.kotlinx", module: "kotlinx-coroutines-debug"
}
}
sourceSets {
debug {
assets {
srcDirs 'src/debug/assets'
}
}
}
}


dependencies {

def retrofitVersion = "2.6.1"
def rxAndroidVersion = "2.1.1"
def okHttpVersion = "4.2.2"
def navVersion = "2.1.0"
def retrofitVersion = "2.9.0"
def okHttpVersion = '4.8.1'
def navVersion = "2.3.0"
def lifecycle_version = "2.2.0"
def room_version = "2.2.5"
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.appcompat:appcompat:1.2.0'
implementation 'androidx.core:core-ktx:1.3.1'
implementation 'androidx.constraintlayout:constraintlayout:2.0.0'
implementation 'androidx.recyclerview:recyclerview:1.1.0'
implementation 'androidx.cardview:cardview:1.0.0'

// ROOM
implementation "androidx.room:room-runtime:$room_version"
kapt "androidx.room:room-compiler:$room_version"

// NAVIGATION COMPONENT
implementation "androidx.navigation:navigation-fragment-ktx:$navVersion"
implementation "androidx.navigation:navigation-ui-ktx:$navVersion"

// RX ANDROID
implementation "io.reactivex.rxjava2:rxandroid:$rxAndroidVersion"

// RETROFIT
implementation "com.squareup.retrofit2:adapter-rxjava2:$retrofitVersion"
implementation "com.squareup.retrofit2:retrofit:$retrofitVersion"
implementation "com.squareup.retrofit2:converter-gson:$retrofitVersion"
implementation 'com.google.code.gson:gson:2.8.6'
implementation 'com.squareup.retrofit2:converter-gson:2.9.0'

// OK HTTP
implementation "com.squareup.okhttp3:okhttp:$okHttpVersion"
implementation "com.squareup.okhttp3:logging-interceptor:$okHttpVersion"

// TESTING
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test.ext:junit:1.1.1'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
testImplementation 'junit:junit:4.13'
testImplementation 'org.mockito:mockito-core:3.0.0'
testImplementation "androidx.arch.core:core-testing:2.1.0"

// DAGGER
implementation 'com.google.dagger:dagger:2.28.3'
kapt 'com.google.dagger:dagger-compiler:2.28.3'
kaptTest 'com.google.dagger:dagger-compiler:2.28.3'
annotationProcessor 'com.google.dagger:dagger-compiler:2.28.3'


//VIEW-MODEL AND LIVE DATA
implementation "androidx.lifecycle:lifecycle-viewmodel-ktx:$lifecycle_version"
implementation "androidx.lifecycle:lifecycle-livedata-ktx:$lifecycle_version"
implementation "androidx.lifecycle:lifecycle-common-java8:$lifecycle_version"
implementation "androidx.lifecycle:lifecycle-viewmodel-savedstate:$lifecycle_version"

implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:1.3.8"
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:1.3.8"
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-test:1.3.8"

//FIREBASE AUTH
implementation 'com.google.firebase:firebase-auth:19.3.2'
implementation 'com.google.android.gms:play-services-auth:18.1.0'
}
48 changes: 48 additions & 0 deletions app/src/debug/google-services.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
{
"project_info": {
"project_number": "346374230003",
"firebase_url": "https://newsflash-d9f16.firebaseio.com",
"project_id": "newsflash-d9f16",
"storage_bucket": "newsflash-d9f16.appspot.com"
},
"client": [
{
"client_info": {
"mobilesdk_app_id": "1:346374230003:android:7a60be2dafbcbab4784c86",
"android_client_info": {
"package_name": "com.androiddevs.newsflash"
}
},
"oauth_client": [
{
"client_id": "346374230003-43hiooahke19pg4oj04bgj28cst8hbv4.apps.googleusercontent.com",
"client_type": 1,
"android_info": {
"package_name": "com.androiddevs.newsflash",
"certificate_hash": "ee06eced07e8378ceeb12f98b6c0318cf7489cbc"
}
},
{
"client_id": "346374230003-34cu38csb8ni5gh7jtni7dl7gp2ebbus.apps.googleusercontent.com",
"client_type": 3
}
],
"api_key": [
{
"current_key": "AIzaSyB4XWpA-Ok3AOz5V4hMv1ipVF_c-Tm4pB0"
}
],
"services": {
"appinvite_service": {
"other_platform_oauth_client": [
{
"client_id": "346374230003-34cu38csb8ni5gh7jtni7dl7gp2ebbus.apps.googleusercontent.com",
"client_type": 3
}
]
}
}
}
],
"configuration_version": "1"
}
3 changes: 2 additions & 1 deletion app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,9 @@
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:name=".NewsFlashApplication"
android:theme="@style/AppTheme">
<activity android:name=".view.MainActivity">
<activity android:name=".ui.MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
package com.androiddevs.newsflash

import android.app.Application
import com.androiddevs.newsflash.di.CoreInjector
import com.androiddevs.newsflash.di.components.DaggerAppComponent


class NewsFlashApplication : Application() {

override fun onCreate() {
super.onCreate()
CoreInjector.injector = DaggerAppComponent.builder()
.application(this).build()
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
package com.androiddevs.newsflash.constants

const val API_KEY = ""
const val RC_SIGN_IN = 123
15 changes: 0 additions & 15 deletions app/src/main/java/com/androiddevs/newsflash/data/NewsError.kt

This file was deleted.

44 changes: 0 additions & 44 deletions app/src/main/java/com/androiddevs/newsflash/data/NewsResult.kt

This file was deleted.

32 changes: 0 additions & 32 deletions app/src/main/java/com/androiddevs/newsflash/data/NewsSources.kt

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
package com.androiddevs.newsflash.data.database

import androidx.room.Dao
import androidx.room.Delete
import androidx.room.Insert
import androidx.room.OnConflictStrategy

@Dao
interface NewsDao {

@Insert(onConflict = OnConflictStrategy.REPLACE)
suspend fun insert()

@Delete
suspend fun delete()
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
package com.androiddevs.newsflash.data.database

import androidx.room.RoomDatabase

abstract class NewsDatabase: RoomDatabase() {
}
Loading