Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .idea/.name

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

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

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

17 changes: 17 additions & 0 deletions .idea/deploymentTargetDropDown.xml

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

14 changes: 9 additions & 5 deletions .idea/gradle.xml

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

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

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

2 changes: 1 addition & 1 deletion .idea/misc.xml

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

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

This file was deleted.

4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# MVVM-REST-API
Tutorial for implementing an Android app written in Java that integrates with the Google Books API using Retrofit2 while following the Model View ViewModel (MVVM) design pattern

Just to test build triggers.
1 change: 1 addition & 0 deletions app/.gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
/build
google-services.json
5 changes: 3 additions & 2 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ android {
}
buildToolsVersion "29.0.2"
defaultConfig {
applicationId "com.learntodroid.mvvmrestapi"
minSdkVersion 16
applicationId "com.learntodroid.booksearchr"
minSdkVersion 19
targetSdkVersion 29
versionCode 2
versionName "1.1"
Expand All @@ -35,6 +35,7 @@ dependencies {
implementation 'com.squareup.okhttp3:logging-interceptor:4.2.1'
implementation 'com.github.bumptech.glide:glide:4.10.0'
implementation 'com.google.firebase:firebase-analytics:17.2.0'
implementation platform('com.google.firebase:firebase-bom:30.3.2')
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test.ext:junit:1.1.0'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.1'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.learntodroid.mvvmrestapi;
package com.learntodroid.booksearchr;

import android.content.Context;

Expand All @@ -22,6 +22,6 @@ public void useAppContext() {
// Context of the app under test.
Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext();

assertEquals("com.learntodroid.mvvmrestapi", appContext.getPackageName());
assertEquals("com.learntodroid.booksearchr", appContext.getPackageName());
}
}
4 changes: 2 additions & 2 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.learntodroid.mvvmrestapi">
package="com.learntodroid.booksearchr">

<uses-permission android:name="android.permission.INTERNET" />

Expand All @@ -11,7 +11,7 @@
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<activity android:name=".views.MainActivity">
<activity android:name="com.learntodroid.booksearchr.views.MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.learntodroid.mvvmrestapi.adapters;
package com.learntodroid.booksearchr.adapters;

import android.view.LayoutInflater;
import android.view.View;
Expand All @@ -10,9 +10,9 @@
import androidx.recyclerview.widget.RecyclerView;

import com.bumptech.glide.Glide;
import com.learntodroid.mvvmrestapi.R;
import com.learntodroid.mvvmrestapi.models.Volume;
import com.learntodroid.mvvmrestapi.util.Util;
import com.learntodroid.booksearchr.R;
import com.learntodroid.booksearchr.models.Volume;
import com.learntodroid.booksearchr.util.Util;

import java.util.ArrayList;
import java.util.List;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.learntodroid.mvvmrestapi.apis;
package com.learntodroid.booksearchr.apis;

import com.learntodroid.mvvmrestapi.models.VolumesResponse;
import com.learntodroid.booksearchr.models.VolumesResponse;

import retrofit2.Call;
import retrofit2.http.GET;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.learntodroid.mvvmrestapi.models;
package com.learntodroid.booksearchr.models;

import com.google.gson.annotations.Expose;
import com.google.gson.annotations.SerializedName;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.learntodroid.mvvmrestapi.models;
package com.learntodroid.booksearchr.models;

import com.google.gson.annotations.Expose;
import com.google.gson.annotations.SerializedName;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.learntodroid.mvvmrestapi.models;
package com.learntodroid.booksearchr.models;

import com.google.gson.annotations.Expose;
import com.google.gson.annotations.SerializedName;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.learntodroid.mvvmrestapi.models;
package com.learntodroid.booksearchr.models;

import com.google.gson.annotations.Expose;
import com.google.gson.annotations.SerializedName;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
package com.learntodroid.mvvmrestapi.repositories;

import android.util.Log;
package com.learntodroid.booksearchr.repositories;

import androidx.lifecycle.LiveData;
import androidx.lifecycle.MutableLiveData;

import com.learntodroid.mvvmrestapi.apis.BookSearchService;
import com.learntodroid.mvvmrestapi.models.VolumesResponse;
import com.learntodroid.booksearchr.apis.BookSearchService;
import com.learntodroid.booksearchr.models.VolumesResponse;

import okhttp3.OkHttpClient;
import okhttp3.logging.HttpLoggingInterceptor;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.learntodroid.mvvmrestapi.util;
package com.learntodroid.booksearchr.util;

import java.util.List;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
package com.learntodroid.mvvmrestapi.viewmodels;
package com.learntodroid.booksearchr.viewmodels;

import android.app.Application;

import androidx.annotation.NonNull;
import androidx.lifecycle.AndroidViewModel;
import androidx.lifecycle.LiveData;

import com.learntodroid.mvvmrestapi.models.VolumesResponse;
import com.learntodroid.mvvmrestapi.repositories.BookRepository;
import com.learntodroid.booksearchr.models.VolumesResponse;
import com.learntodroid.booksearchr.repositories.BookRepository;

public class BookSearchViewModel extends AndroidViewModel {
private BookRepository bookRepository;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.learntodroid.mvvmrestapi.views;
package com.learntodroid.booksearchr.views;

import android.os.Bundle;
import android.view.LayoutInflater;
Expand All @@ -15,10 +15,10 @@
import androidx.recyclerview.widget.RecyclerView;

import com.google.android.material.textfield.TextInputEditText;
import com.learntodroid.mvvmrestapi.R;
import com.learntodroid.mvvmrestapi.adapters.BookSearchResultsAdapter;
import com.learntodroid.mvvmrestapi.models.VolumesResponse;
import com.learntodroid.mvvmrestapi.viewmodels.BookSearchViewModel;
import com.learntodroid.booksearchr.R;
import com.learntodroid.booksearchr.adapters.BookSearchResultsAdapter;
import com.learntodroid.booksearchr.models.VolumesResponse;
import com.learntodroid.booksearchr.viewmodels.BookSearchViewModel;

public class BookSearchFragment extends Fragment {
private BookSearchViewModel viewModel;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,10 @@
package com.learntodroid.mvvmrestapi.views;
package com.learntodroid.booksearchr.views;

import androidx.appcompat.app.AppCompatActivity;
import androidx.navigation.NavController;
import androidx.navigation.Navigation;
import androidx.navigation.ui.NavigationUI;

import android.os.Bundle;

import com.google.android.material.bottomnavigation.BottomNavigationView;
import com.learntodroid.mvvmrestapi.R;
import com.learntodroid.booksearchr.R;

public class MainActivity extends AppCompatActivity {

Expand Down
2 changes: 1 addition & 1 deletion app/src/main/res/navigation/mynavgraph.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

<fragment
android:id="@+id/bookSearchFragment"
android:name="com.learntodroid.mvvmrestapi.views.BookSearchFragment"
android:name="com.learntodroid.booksearchr.views.BookSearchFragment"
android:label="fragment_booksearch"
tools:layout="@layout/fragment_booksearch" />
</navigation>
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.learntodroid.mvvmrestapi;
package com.learntodroid.booksearchr;

import org.junit.Test;

Expand Down
7 changes: 3 additions & 4 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,11 @@ buildscript {
repositories {
google()
jcenter()

mavenCentral() // Maven Central repository
}
dependencies {
classpath 'com.android.tools.build:gradle:3.5.3'
classpath 'com.google.gms:google-services:4.3.2'

classpath 'com.google.gms:google-services:4.3.13'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
Expand All @@ -19,7 +18,7 @@ allprojects {
repositories {
google()
jcenter()

mavenCentral() // Maven Central repository
}
}

Expand Down
Empty file modified gradlew
100644 → 100755
Empty file.