Skip to content

Commit 01dd7af

Browse files
committed
master
0 parents  commit 01dd7af

File tree

87 files changed

+3340
-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.

87 files changed

+3340
-0
lines changed

.gitignore

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
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

.idea/codeStyles/Project.xml

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

.idea/gradle.xml

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

.idea/misc.xml

+14
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

+65
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
apply plugin: 'com.android.application'
2+
3+
android {
4+
compileSdkVersion 28
5+
defaultConfig {
6+
applicationId "com.codingwithmitch.foodrecipes"
7+
minSdkVersion 21
8+
targetSdkVersion 28
9+
versionCode 1
10+
versionName "1.0"
11+
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
12+
13+
javaCompileOptions {
14+
annotationProcessorOptions {
15+
arguments = ["room.schemaLocation": "$projectDir/schemas".toString()]
16+
}
17+
}
18+
}
19+
buildTypes {
20+
release {
21+
minifyEnabled false
22+
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
23+
}
24+
}
25+
}
26+
27+
dependencies {
28+
def retrofitVersion = "2.5.0"
29+
def lifecycle_version = "1.1.1"
30+
def supportVersion = "28.0.0"
31+
def glideVersion = "4.8.0"
32+
33+
implementation fileTree(dir: 'libs', include: ['*.jar'])
34+
implementation "com.android.support:appcompat-v7:$supportVersion"
35+
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
36+
testImplementation 'junit:junit:4.12'
37+
androidTestImplementation 'com.android.support.test:runner:1.0.2'
38+
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
39+
40+
implementation "com.squareup.retrofit2:retrofit:$retrofitVersion"
41+
42+
implementation "com.squareup.retrofit2:converter-gson:$retrofitVersion"
43+
44+
// ViewModel and LiveData
45+
implementation "android.arch.lifecycle:extensions:$lifecycle_version"
46+
47+
// Cardview
48+
implementation "com.android.support:cardview-v7:$supportVersion"
49+
50+
// Recyclerview
51+
implementation "com.android.support:recyclerview-v7:$supportVersion"
52+
53+
// Design support
54+
implementation "com.android.support:design:$supportVersion"
55+
56+
// Glide
57+
implementation "com.github.bumptech.glide:glide:$glideVersion"
58+
annotationProcessor "com.github.bumptech.glide:compiler:$glideVersion"
59+
60+
implementation 'de.hdodenhof:circleimageview:3.0.0'
61+
62+
// Room
63+
implementation "android.arch.persistence.room:runtime:$lifecycle_version"
64+
annotationProcessor "android.arch.persistence.room:compiler:$lifecycle_version"
65+
}

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,26 @@
1+
package com.codingwithmitch.foodrecipes;
2+
3+
import android.content.Context;
4+
import android.support.test.InstrumentationRegistry;
5+
import android.support.test.runner.AndroidJUnit4;
6+
7+
import org.junit.Test;
8+
import org.junit.runner.RunWith;
9+
10+
import static org.junit.Assert.*;
11+
12+
/**
13+
* Instrumented test, which will execute on an Android device.
14+
*
15+
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
16+
*/
17+
@RunWith(AndroidJUnit4.class)
18+
public class ExampleInstrumentedTest {
19+
@Test
20+
public void useAppContext() {
21+
// Context of the app under test.
22+
Context appContext = InstrumentationRegistry.getTargetContext();
23+
24+
assertEquals("com.codingwithmitch.foodrecipes", appContext.getPackageName());
25+
}
26+
}

app/src/main/AndroidManifest.xml

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
3+
package="com.codingwithmitch.foodrecipes">
4+
5+
<uses-permission android:name="android.permission.INTERNET"/>
6+
7+
<application
8+
android:allowBackup="true"
9+
android:icon="@mipmap/ic_launcher"
10+
android:label="@string/app_name"
11+
android:roundIcon="@mipmap/ic_launcher_round"
12+
android:supportsRtl="true"
13+
android:theme="@style/AppTheme"
14+
android:networkSecurityConfig="@xml/network_security_config">
15+
<activity android:name=".RecipeListActivity">
16+
<intent-filter>
17+
<action android:name="android.intent.action.MAIN" />
18+
19+
<category android:name="android.intent.category.LAUNCHER" />
20+
</intent-filter>
21+
</activity>
22+
<activity android:name=".RecipeActivity" />
23+
</application>
24+
25+
</manifest>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
package com.codingwithmitch.foodrecipes;
2+
3+
import android.os.Handler;
4+
import android.os.Looper;
5+
import android.support.annotation.NonNull;
6+
7+
import java.util.concurrent.Executor;
8+
import java.util.concurrent.Executors;
9+
import java.util.concurrent.ScheduledExecutorService;
10+
11+
public class AppExecutors {
12+
13+
private static AppExecutors instance;
14+
15+
public static AppExecutors getInstance(){
16+
if(instance == null){
17+
instance = new AppExecutors();
18+
}
19+
return instance;
20+
}
21+
22+
private final Executor mDiskIO = Executors.newSingleThreadExecutor(); // Will not use additional threads
23+
24+
private final Executor mMainThreadExecutor = new MainThreadExecutor(); // executes on main thread
25+
26+
public Executor diskIO() {
27+
return mDiskIO;
28+
}
29+
30+
public Executor mainThread(){
31+
return mMainThreadExecutor;
32+
}
33+
34+
35+
private static class MainThreadExecutor implements Executor {
36+
private Handler mainThreadHandler = new Handler(Looper.getMainLooper());
37+
38+
@Override
39+
public void execute(@NonNull Runnable command) {
40+
mainThreadHandler.post(command);
41+
}
42+
}
43+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
package com.codingwithmitch.foodrecipes;
2+
3+
import android.support.constraint.ConstraintLayout;
4+
import android.support.v7.app.AppCompatActivity;
5+
import android.view.View;
6+
import android.widget.FrameLayout;
7+
import android.widget.ProgressBar;
8+
9+
public abstract class BaseActivity extends AppCompatActivity {
10+
11+
public ProgressBar mProgressBar;
12+
13+
@Override
14+
public void setContentView(int layoutResID) {
15+
16+
ConstraintLayout constraintLayout = (ConstraintLayout) getLayoutInflater().inflate(R.layout.activity_base, null);
17+
FrameLayout frameLayout = constraintLayout.findViewById(R.id.activity_content);
18+
mProgressBar = constraintLayout.findViewById(R.id.progress_bar);
19+
20+
getLayoutInflater().inflate(layoutResID, frameLayout, true);
21+
super.setContentView(constraintLayout);
22+
}
23+
24+
public void showProgressBar(boolean visibility){
25+
mProgressBar.setVisibility(visibility ? View.VISIBLE : View.INVISIBLE);
26+
}
27+
}

0 commit comments

Comments
 (0)