Skip to content

Commit 13af737

Browse files
committed
Initial commit
0 parents  commit 13af737

File tree

76 files changed

+3210
-0
lines changed

Some content is hidden

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

76 files changed

+3210
-0
lines changed

.gitignore

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
*.iml
2+
.gradle
3+
/local.properties
4+
/.idea/caches
5+
/.idea/libraries
6+
/.idea/modules.xml
7+
/.idea/workspace.xml
8+
/.idea/navEditor.xml
9+
/.idea/assetWizardSettings.xml
10+
.DS_Store
11+
/build
12+
/captures
13+
.externalNativeBuild
14+
.cxx

.idea/.name

+1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/codeStyles/Project.xml

+125
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/codeStyles/codeStyleConfig.xml

+5
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/gradle.xml

+19
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/misc.xml

+9
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/runConfigurations.xml

+12
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

app/.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/build

app/build.gradle

+67
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
apply plugin: 'com.android.application'
2+
3+
apply plugin: 'kotlin-android'
4+
apply plugin: 'kotlin-kapt'
5+
apply plugin: 'kotlin-android-extensions'
6+
apply plugin: 'androidx.navigation.safeargs'
7+
8+
9+
10+
android {
11+
compileSdkVersion 29
12+
buildToolsVersion "29.0.2"
13+
dataBinding{
14+
enabled = true
15+
}
16+
compileOptions {
17+
sourceCompatibility JavaVersion.VERSION_1_8
18+
targetCompatibility JavaVersion.VERSION_1_8
19+
}
20+
androidExtensions {
21+
experimental = true
22+
}
23+
defaultConfig {
24+
applicationId "com.example.recipehelper"
25+
minSdkVersion 19
26+
targetSdkVersion 29
27+
versionCode 1
28+
versionName "1.0"
29+
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
30+
}
31+
buildTypes {
32+
release {
33+
minifyEnabled false
34+
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
35+
}
36+
}
37+
}
38+
39+
dependencies {
40+
implementation fileTree(dir: 'libs', include: ['*.jar'])
41+
implementation"org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
42+
implementation 'androidx.appcompat:appcompat:1.1.0'
43+
implementation 'androidx.core:core-ktx:1.1.0'
44+
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
45+
46+
implementation "androidx.room:room-runtime:$version_room"
47+
implementation "androidx.room:room-ktx:$version_room"
48+
kapt "androidx.room:room-compiler:$version_room"
49+
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:$version_coroutine"
50+
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:$version_coroutine"
51+
implementation "androidx.navigation:navigation-fragment-ktx:$nav_version"
52+
implementation 'androidx.lifecycle:lifecycle-extensions:2.1.0'
53+
implementation 'com.android.support:design:27.1.1'
54+
implementation "androidx.navigation:navigation-ui-ktx:$nav_version"
55+
implementation "com.squareup.moshi:moshi:$version_moshi"
56+
implementation "com.squareup.moshi:moshi-kotlin:$version_moshi"
57+
implementation "com.squareup.retrofit2:retrofit:$version_retrofit"
58+
implementation "com.squareup.retrofit2:converter-moshi:$version_retrofit"
59+
implementation "com.jakewharton.retrofit:retrofit2-kotlin-coroutines-adapter:$version_retrofit_coroutines_adapter"
60+
implementation'com.squareup.retrofit2:converter-gson:2.7.1'
61+
implementation 'com.github.bumptech.glide:glide:4.11.0'
62+
annotationProcessor 'com.github.bumptech.glide:compiler:4.11.0'
63+
64+
testImplementation 'junit:junit:4.12'
65+
androidTestImplementation 'androidx.test.ext:junit:1.1.1'
66+
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
67+
}

app/proguard-rules.pro

+21
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
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
package com.example.recipehelper
2+
3+
import androidx.test.platform.app.InstrumentationRegistry
4+
import androidx.test.ext.junit.runners.AndroidJUnit4
5+
6+
import org.junit.Test
7+
import org.junit.runner.RunWith
8+
9+
import org.junit.Assert.*
10+
11+
/**
12+
* Instrumented test, which will execute on an Android device.
13+
*
14+
* See [testing documentation](http://d.android.com/tools/testing).
15+
*/
16+
@RunWith(AndroidJUnit4::class)
17+
class ExampleInstrumentedTest {
18+
@Test
19+
fun useAppContext() {
20+
// Context of the app under test.
21+
val appContext = InstrumentationRegistry.getInstrumentation().targetContext
22+
assertEquals("com.example.recipehelper", appContext.packageName)
23+
}
24+
}

app/src/main/AndroidManifest.xml

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
3+
package="com.example.recipehelper">
4+
<uses-permission android:name="android.permission.INTERNET" />
5+
6+
<application
7+
android:allowBackup="true"
8+
android:icon="@mipmap/ic_launcher"
9+
android:label="@string/app_name"
10+
android:roundIcon="@mipmap/ic_launcher_round"
11+
android:supportsRtl="true"
12+
android:theme="@style/AppTheme">
13+
<activity android:name=".MainActivity">
14+
<intent-filter>
15+
<action android:name="android.intent.action.MAIN" />
16+
17+
<category android:name="android.intent.category.LAUNCHER" />
18+
</intent-filter>
19+
</activity>
20+
</application>
21+
22+
</manifest>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
package com.example.recipehelper
2+
3+
import androidx.appcompat.app.AppCompatActivity
4+
import android.os.Bundle
5+
6+
class MainActivity : AppCompatActivity() {
7+
8+
override fun onCreate(savedInstanceState: Bundle?) {
9+
super.onCreate(savedInstanceState)
10+
setContentView(R.layout.activity_main)
11+
}
12+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
package com.example.recipehelper.database
2+
3+
import android.content.Context
4+
import androidx.room.Database
5+
import androidx.room.Room
6+
import androidx.room.RoomDatabase
7+
8+
9+
@Database(entities = [User::class, DatabaseRecipe::class, DatabaseIngredient::class], version = 2, exportSchema = false)
10+
abstract class AppDatabase : RoomDatabase(){
11+
abstract val userDao: UserDao
12+
abstract val recipeDao: RecipeDao
13+
abstract val ingredientDao: IngredientDao
14+
companion object {
15+
private var INSTANCE: AppDatabase? = null
16+
fun getInstance(context: Context) : AppDatabase {
17+
synchronized(this){
18+
var instance =
19+
INSTANCE
20+
if(instance == null){
21+
instance = Room.databaseBuilder(context, AppDatabase::class.java, "app_database")
22+
.fallbackToDestructiveMigration()
23+
.build()
24+
INSTANCE = instance
25+
}
26+
return instance
27+
}
28+
29+
}
30+
31+
}
32+
}

0 commit comments

Comments
 (0)