├── app ├── .gitignore ├── src │ ├── main │ │ ├── res │ │ │ ├── drawable-hdpi │ │ │ │ ├── ic_add.png │ │ │ │ ├── ic_delete.png │ │ │ │ ├── ic_done.png │ │ │ │ ├── ic_edit.png │ │ │ │ ├── ic_email.png │ │ │ │ ├── ic_phone.png │ │ │ │ ├── ic_add_circle.png │ │ │ │ ├── ic_network_check.png │ │ │ │ ├── ic_remove_circle.png │ │ │ │ └── ic_image_black_24dp.png │ │ │ ├── drawable-mdpi │ │ │ │ ├── ic_add.png │ │ │ │ ├── ic_delete.png │ │ │ │ ├── ic_done.png │ │ │ │ ├── ic_edit.png │ │ │ │ ├── ic_email.png │ │ │ │ ├── ic_phone.png │ │ │ │ ├── ic_add_circle.png │ │ │ │ ├── ic_network_check.png │ │ │ │ ├── ic_remove_circle.png │ │ │ │ └── ic_image_black_24dp.png │ │ │ ├── drawable-xhdpi │ │ │ │ ├── ic_add.png │ │ │ │ ├── ic_done.png │ │ │ │ ├── ic_edit.png │ │ │ │ ├── ic_email.png │ │ │ │ ├── ic_phone.png │ │ │ │ ├── ic_delete.png │ │ │ │ ├── ic_add_circle.png │ │ │ │ ├── ic_network_check.png │ │ │ │ ├── ic_remove_circle.png │ │ │ │ └── ic_image_black_24dp.png │ │ │ ├── drawable-xxhdpi │ │ │ │ ├── ic_add.png │ │ │ │ ├── ic_done.png │ │ │ │ ├── ic_edit.png │ │ │ │ ├── ic_delete.png │ │ │ │ ├── ic_email.png │ │ │ │ ├── ic_phone.png │ │ │ │ ├── ic_add_circle.png │ │ │ │ ├── ic_network_check.png │ │ │ │ ├── ic_remove_circle.png │ │ │ │ └── ic_image_black_24dp.png │ │ │ ├── drawable-xxxhdpi │ │ │ │ ├── ic_add.png │ │ │ │ ├── ic_done.png │ │ │ │ ├── ic_edit.png │ │ │ │ ├── ic_email.png │ │ │ │ ├── ic_phone.png │ │ │ │ ├── ic_delete.png │ │ │ │ ├── ic_add_circle.png │ │ │ │ ├── ic_network_check.png │ │ │ │ ├── ic_remove_circle.png │ │ │ │ └── ic_image_black_24dp.png │ │ │ ├── mipmap-hdpi │ │ │ │ ├── ic_launcher.png │ │ │ │ └── ic_launcher_round.png │ │ │ ├── mipmap-mdpi │ │ │ │ ├── ic_launcher.png │ │ │ │ └── ic_launcher_round.png │ │ │ ├── mipmap-xhdpi │ │ │ │ ├── ic_launcher.png │ │ │ │ └── ic_launcher_round.png │ │ │ ├── mipmap-xxhdpi │ │ │ │ ├── ic_launcher.png │ │ │ │ └── ic_launcher_round.png │ │ │ ├── mipmap-xxxhdpi │ │ │ │ ├── ic_launcher.png │ │ │ │ └── ic_launcher_round.png │ │ │ ├── mipmap-anydpi-v26 │ │ │ │ ├── ic_launcher.xml │ │ │ │ └── ic_launcher_round.xml │ │ │ ├── drawable │ │ │ │ ├── circle_button_add.xml │ │ │ │ ├── circle_button_remove.xml │ │ │ │ ├── gradient_button_remove.xml │ │ │ │ ├── gradient_button_add.xml │ │ │ │ └── ic_launcher_background.xml │ │ │ ├── menu │ │ │ │ ├── menu_editor.xml │ │ │ │ ├── menu_catalog.xml │ │ │ │ └── menu_detail.xml │ │ │ ├── layout │ │ │ │ ├── activity_isbn.xml │ │ │ │ ├── dialog_isbn.xml │ │ │ │ ├── activity_main.xml │ │ │ │ ├── card_item.xml │ │ │ │ ├── activity_editor.xml │ │ │ │ └── activity_detail.xml │ │ │ ├── values │ │ │ │ ├── dimens.xml │ │ │ │ ├── colors.xml │ │ │ │ ├── styles.xml │ │ │ │ └── strings.xml │ │ │ └── drawable-v24 │ │ │ │ └── ic_launcher_foreground.xml │ │ ├── java │ │ │ └── com │ │ │ │ └── example │ │ │ │ └── android │ │ │ │ └── inventory │ │ │ │ ├── BookLoader.java │ │ │ │ ├── Book.java │ │ │ │ ├── utils │ │ │ │ ├── Constants.java │ │ │ │ └── QueryUtils.java │ │ │ │ ├── data │ │ │ │ ├── ProductDbHelper.java │ │ │ │ ├── ProductContract.java │ │ │ │ └── ProductProvider.java │ │ │ │ ├── EmptyRecyclerView.java │ │ │ │ ├── activity │ │ │ │ ├── IsbnActivity.java │ │ │ │ ├── MainActivity.java │ │ │ │ └── DetailActivity.java │ │ │ │ └── ProductCursorAdapter.java │ │ └── AndroidManifest.xml │ ├── test │ │ └── java │ │ │ └── com │ │ │ └── example │ │ │ └── android │ │ │ └── inventory │ │ │ └── ExampleUnitTest.java │ └── androidTest │ │ └── java │ │ └── com │ │ └── example │ │ └── android │ │ └── inventory │ │ └── ExampleInstrumentedTest.java ├── proguard-rules.pro └── build.gradle ├── settings.gradle ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── .gitignore ├── .idea ├── vcs.xml ├── modules.xml ├── runConfigurations.xml ├── gradle.xml └── misc.xml ├── gradle.properties ├── LICENSE ├── README.md ├── gradlew.bat └── gradlew /app/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /settings.gradle: -------------------------------------------------------------------------------- 1 | include ':app' 2 | -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sooshin/android-inventory-app/HEAD/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /app/src/main/res/drawable-hdpi/ic_add.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sooshin/android-inventory-app/HEAD/app/src/main/res/drawable-hdpi/ic_add.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-mdpi/ic_add.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sooshin/android-inventory-app/HEAD/app/src/main/res/drawable-mdpi/ic_add.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-hdpi/ic_delete.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sooshin/android-inventory-app/HEAD/app/src/main/res/drawable-hdpi/ic_delete.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-hdpi/ic_done.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sooshin/android-inventory-app/HEAD/app/src/main/res/drawable-hdpi/ic_done.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-hdpi/ic_edit.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sooshin/android-inventory-app/HEAD/app/src/main/res/drawable-hdpi/ic_edit.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-hdpi/ic_email.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sooshin/android-inventory-app/HEAD/app/src/main/res/drawable-hdpi/ic_email.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-hdpi/ic_phone.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sooshin/android-inventory-app/HEAD/app/src/main/res/drawable-hdpi/ic_phone.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-mdpi/ic_delete.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sooshin/android-inventory-app/HEAD/app/src/main/res/drawable-mdpi/ic_delete.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-mdpi/ic_done.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sooshin/android-inventory-app/HEAD/app/src/main/res/drawable-mdpi/ic_done.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-mdpi/ic_edit.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sooshin/android-inventory-app/HEAD/app/src/main/res/drawable-mdpi/ic_edit.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-mdpi/ic_email.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sooshin/android-inventory-app/HEAD/app/src/main/res/drawable-mdpi/ic_email.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-mdpi/ic_phone.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sooshin/android-inventory-app/HEAD/app/src/main/res/drawable-mdpi/ic_phone.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xhdpi/ic_add.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sooshin/android-inventory-app/HEAD/app/src/main/res/drawable-xhdpi/ic_add.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xhdpi/ic_done.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sooshin/android-inventory-app/HEAD/app/src/main/res/drawable-xhdpi/ic_done.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xhdpi/ic_edit.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sooshin/android-inventory-app/HEAD/app/src/main/res/drawable-xhdpi/ic_edit.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xhdpi/ic_email.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sooshin/android-inventory-app/HEAD/app/src/main/res/drawable-xhdpi/ic_email.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xhdpi/ic_phone.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sooshin/android-inventory-app/HEAD/app/src/main/res/drawable-xhdpi/ic_phone.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxhdpi/ic_add.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sooshin/android-inventory-app/HEAD/app/src/main/res/drawable-xxhdpi/ic_add.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxhdpi/ic_done.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sooshin/android-inventory-app/HEAD/app/src/main/res/drawable-xxhdpi/ic_done.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxhdpi/ic_edit.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sooshin/android-inventory-app/HEAD/app/src/main/res/drawable-xxhdpi/ic_edit.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxxhdpi/ic_add.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sooshin/android-inventory-app/HEAD/app/src/main/res/drawable-xxxhdpi/ic_add.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sooshin/android-inventory-app/HEAD/app/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sooshin/android-inventory-app/HEAD/app/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xhdpi/ic_delete.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sooshin/android-inventory-app/HEAD/app/src/main/res/drawable-xhdpi/ic_delete.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxhdpi/ic_delete.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sooshin/android-inventory-app/HEAD/app/src/main/res/drawable-xxhdpi/ic_delete.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxhdpi/ic_email.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sooshin/android-inventory-app/HEAD/app/src/main/res/drawable-xxhdpi/ic_email.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxhdpi/ic_phone.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sooshin/android-inventory-app/HEAD/app/src/main/res/drawable-xxhdpi/ic_phone.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxxhdpi/ic_done.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sooshin/android-inventory-app/HEAD/app/src/main/res/drawable-xxxhdpi/ic_done.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxxhdpi/ic_edit.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sooshin/android-inventory-app/HEAD/app/src/main/res/drawable-xxxhdpi/ic_edit.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxxhdpi/ic_email.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sooshin/android-inventory-app/HEAD/app/src/main/res/drawable-xxxhdpi/ic_email.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxxhdpi/ic_phone.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sooshin/android-inventory-app/HEAD/app/src/main/res/drawable-xxxhdpi/ic_phone.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sooshin/android-inventory-app/HEAD/app/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sooshin/android-inventory-app/HEAD/app/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-hdpi/ic_add_circle.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sooshin/android-inventory-app/HEAD/app/src/main/res/drawable-hdpi/ic_add_circle.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-mdpi/ic_add_circle.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sooshin/android-inventory-app/HEAD/app/src/main/res/drawable-mdpi/ic_add_circle.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xhdpi/ic_add_circle.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sooshin/android-inventory-app/HEAD/app/src/main/res/drawable-xhdpi/ic_add_circle.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxxhdpi/ic_delete.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sooshin/android-inventory-app/HEAD/app/src/main/res/drawable-xxxhdpi/ic_delete.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sooshin/android-inventory-app/HEAD/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-hdpi/ic_network_check.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sooshin/android-inventory-app/HEAD/app/src/main/res/drawable-hdpi/ic_network_check.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-hdpi/ic_remove_circle.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sooshin/android-inventory-app/HEAD/app/src/main/res/drawable-hdpi/ic_remove_circle.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-mdpi/ic_network_check.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sooshin/android-inventory-app/HEAD/app/src/main/res/drawable-mdpi/ic_network_check.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-mdpi/ic_remove_circle.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sooshin/android-inventory-app/HEAD/app/src/main/res/drawable-mdpi/ic_remove_circle.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxhdpi/ic_add_circle.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sooshin/android-inventory-app/HEAD/app/src/main/res/drawable-xxhdpi/ic_add_circle.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxxhdpi/ic_add_circle.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sooshin/android-inventory-app/HEAD/app/src/main/res/drawable-xxxhdpi/ic_add_circle.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-hdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sooshin/android-inventory-app/HEAD/app/src/main/res/mipmap-hdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-mdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sooshin/android-inventory-app/HEAD/app/src/main/res/mipmap-mdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sooshin/android-inventory-app/HEAD/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-hdpi/ic_image_black_24dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sooshin/android-inventory-app/HEAD/app/src/main/res/drawable-hdpi/ic_image_black_24dp.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-mdpi/ic_image_black_24dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sooshin/android-inventory-app/HEAD/app/src/main/res/drawable-mdpi/ic_image_black_24dp.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xhdpi/ic_network_check.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sooshin/android-inventory-app/HEAD/app/src/main/res/drawable-xhdpi/ic_network_check.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xhdpi/ic_remove_circle.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sooshin/android-inventory-app/HEAD/app/src/main/res/drawable-xhdpi/ic_remove_circle.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxhdpi/ic_network_check.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sooshin/android-inventory-app/HEAD/app/src/main/res/drawable-xxhdpi/ic_network_check.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxhdpi/ic_remove_circle.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sooshin/android-inventory-app/HEAD/app/src/main/res/drawable-xxhdpi/ic_remove_circle.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxxhdpi/ic_network_check.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sooshin/android-inventory-app/HEAD/app/src/main/res/drawable-xxxhdpi/ic_network_check.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxxhdpi/ic_remove_circle.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sooshin/android-inventory-app/HEAD/app/src/main/res/drawable-xxxhdpi/ic_remove_circle.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sooshin/android-inventory-app/HEAD/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sooshin/android-inventory-app/HEAD/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | *.iml 2 | .gradle 3 | /local.properties 4 | /.idea/workspace.xml 5 | /.idea/libraries 6 | .DS_Store 7 | /build 8 | /captures 9 | .externalNativeBuild 10 | -------------------------------------------------------------------------------- /app/src/main/res/drawable-xhdpi/ic_image_black_24dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sooshin/android-inventory-app/HEAD/app/src/main/res/drawable-xhdpi/ic_image_black_24dp.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxhdpi/ic_image_black_24dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sooshin/android-inventory-app/HEAD/app/src/main/res/drawable-xxhdpi/ic_image_black_24dp.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxxhdpi/ic_image_black_24dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sooshin/android-inventory-app/HEAD/app/src/main/res/drawable-xxxhdpi/ic_image_black_24dp.png -------------------------------------------------------------------------------- /.idea/vcs.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionBase=GRADLE_USER_HOME 2 | distributionPath=wrapper/dists 3 | distributionUrl=https\://services.gradle.org/distributions/gradle-4.6-all.zip 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | -------------------------------------------------------------------------------- /app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /.idea/modules.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /app/src/test/java/com/example/android/inventory/ExampleUnitTest.java: -------------------------------------------------------------------------------- 1 | package com.example.android.inventory; 2 | 3 | import org.junit.Test; 4 | 5 | import static org.junit.Assert.*; 6 | 7 | /** 8 | * Example local unit test, which will execute on the development machine (host). 9 | * 10 | * @see Testing documentation 11 | */ 12 | public class ExampleUnitTest { 13 | @Test 14 | public void addition_isCorrect() throws Exception { 15 | assertEquals(4, 2 + 2); 16 | } 17 | } -------------------------------------------------------------------------------- /app/src/main/res/drawable/circle_button_add.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/circle_button_remove.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /.idea/runConfigurations.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 11 | 12 | -------------------------------------------------------------------------------- /app/src/main/res/menu/menu_editor.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 12 | 13 | 17 | -------------------------------------------------------------------------------- /app/src/main/res/menu/menu_catalog.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 11 | 12 | 16 | 17 | -------------------------------------------------------------------------------- /app/src/main/res/menu/menu_detail.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 12 | 13 | 18 | 19 | -------------------------------------------------------------------------------- /.idea/gradle.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 18 | 19 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/gradient_button_remove.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 10 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /gradle.properties: -------------------------------------------------------------------------------- 1 | # Project-wide Gradle settings. 2 | 3 | # IDE (e.g. Android Studio) users: 4 | # Gradle settings configured through the IDE *will override* 5 | # any settings specified in this file. 6 | 7 | # For more details on how to configure your build environment visit 8 | # http://www.gradle.org/docs/current/userguide/build_environment.html 9 | 10 | # Specifies the JVM arguments used for the daemon process. 11 | # The setting is particularly useful for tweaking memory settings. 12 | org.gradle.jvmargs=-Xmx1536m 13 | 14 | # When configured, Gradle will run in incubating parallel mode. 15 | # This option should only be used with decoupled projects. More details, visit 16 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects 17 | # org.gradle.parallel=true 18 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/gradient_button_add.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 10 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /app/proguard-rules.pro: -------------------------------------------------------------------------------- 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 22 | -------------------------------------------------------------------------------- /app/src/androidTest/java/com/example/android/inventory/ExampleInstrumentedTest.java: -------------------------------------------------------------------------------- 1 | package com.example.android.inventory; 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 Testing documentation 16 | */ 17 | @RunWith(AndroidJUnit4.class) 18 | public class ExampleInstrumentedTest { 19 | @Test 20 | public void useAppContext() throws Exception { 21 | // Context of the app under test. 22 | Context appContext = InstrumentationRegistry.getTargetContext(); 23 | 24 | assertEquals("com.example.android.inventory", appContext.getPackageName()); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_isbn.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | 15 | 16 | 17 | 23 | 24 | -------------------------------------------------------------------------------- /app/src/main/res/layout/dialog_isbn.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | 13 | 14 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2018 Soojeong Shin 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /app/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.application' 2 | 3 | android { 4 | compileSdkVersion 27 5 | defaultConfig { 6 | applicationId "com.example.android.inventory" 7 | minSdkVersion 16 8 | targetSdkVersion 27 9 | versionCode 1 10 | versionName "1.0" 11 | testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" 12 | } 13 | buildTypes { 14 | release { 15 | minifyEnabled false 16 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 17 | } 18 | } 19 | } 20 | 21 | dependencies { 22 | implementation fileTree(dir: 'libs', include: ['*.jar']) 23 | implementation 'com.android.support:appcompat-v7:27.1.1' 24 | implementation 'com.android.support.constraint:constraint-layout:1.0.2' 25 | testImplementation 'junit:junit:4.12' 26 | androidTestImplementation 'com.android.support.test:runner:1.0.1' 27 | androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1' 28 | 29 | implementation 'com.android.support:design:27.1.1' 30 | 31 | implementation 'pub.devrel:easypermissions:0.2.1' 32 | 33 | implementation 'com.jakewharton:butterknife:8.8.1' 34 | annotationProcessor 'com.jakewharton:butterknife-compiler:8.8.1' 35 | 36 | implementation 'com.android.support:recyclerview-v7:27.1.1' 37 | implementation 'com.android.support:cardview-v7:27.1.1' 38 | } 39 | -------------------------------------------------------------------------------- /app/src/main/java/com/example/android/inventory/BookLoader.java: -------------------------------------------------------------------------------- 1 | package com.example.android.inventory; 2 | 3 | import android.content.AsyncTaskLoader; 4 | import android.content.Context; 5 | 6 | import com.example.android.inventory.utils.QueryUtils; 7 | 8 | import java.util.List; 9 | 10 | /** 11 | * Loads a list of books by using an AsyncTask to perform the network request to the given URL. 12 | */ 13 | 14 | public class BookLoader extends AsyncTaskLoader> { 15 | 16 | /** Tag for log messages */ 17 | private static final String LOG_TAG = BookLoader.class.getName(); 18 | 19 | /** Query URL */ 20 | private String mUrl; 21 | 22 | /** 23 | * Constructs a new {@link BookLoader}. 24 | * 25 | * @param context of the activity 26 | * @param url to load data from 27 | */ 28 | public BookLoader(Context context, String url) { 29 | super(context); 30 | mUrl = url; 31 | } 32 | 33 | @Override 34 | protected void onStartLoading() { 35 | // Trigger the loadInBackground() method to execute. 36 | forceLoad(); 37 | } 38 | 39 | /** 40 | * This is on a background thread. 41 | */ 42 | @Override 43 | public List loadInBackground() { 44 | if (mUrl == null) { 45 | return null; 46 | } 47 | 48 | // Perform the network request, parse the response, and extract a list of books. 49 | return QueryUtils.fetchBookData(mUrl); 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /app/src/main/res/values/dimens.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 16dp 5 | 6 | 7 | 16dp 8 | 9 | 8dp 10 | 4dp 11 | 8dp 12 | 2dp 13 | 14 | 15 | 8dp 16 | 72dp 17 | 48dp 18 | 2dp 19 | 100dp 20 | 80dp 21 | 90dp 22 | 23 | 24 | 120dp 25 | 80dp 26 | 5dp 27 | 28 | 29 | 45dp 30 | 31 | 32 | 46dp 33 | 5dp 34 | 2dp 35 | 10dp 36 | -------------------------------------------------------------------------------- /app/src/main/java/com/example/android/inventory/Book.java: -------------------------------------------------------------------------------- 1 | package com.example.android.inventory; 2 | 3 | /** 4 | * An {@link Book} object contains information related to a single book. 5 | */ 6 | 7 | public class Book { 8 | 9 | /** Title of the book */ 10 | private String mTitle; 11 | 12 | /** Author of the book */ 13 | private String mAuthor; 14 | 15 | /** ISBN, the International Standard Book Number, of the book */ 16 | private String mIsbn; 17 | 18 | /** Publisher of the book */ 19 | private String mPublisher; 20 | 21 | /** 22 | * Constructs a new{@link Book} object. 23 | * @param title is the title of the book. 24 | * @param author is the author of the book. 25 | * @param isbn is the ISBN of the book. 26 | * @param publisher is the publisher of the book. 27 | */ 28 | public Book(String title, String author, String isbn, String publisher) { 29 | mTitle = title; 30 | mAuthor = author; 31 | mIsbn = isbn; 32 | mPublisher = publisher; 33 | } 34 | 35 | /** 36 | * Returns the title of the book. 37 | */ 38 | public String getBookTitle() { 39 | return mTitle; 40 | } 41 | 42 | /** 43 | * Returns the author of the book. 44 | */ 45 | public String getAuthor() { 46 | return mAuthor; 47 | } 48 | 49 | /** 50 | * Returns the ISBN of the book. 51 | */ 52 | public String getIsbn() { 53 | return mIsbn; 54 | } 55 | 56 | /** 57 | * Returns the publisher of the book. 58 | */ 59 | public String getPublisher() { 60 | return mPublisher; 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /.idea/misc.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 17 | 27 | 28 | 29 | 30 | 31 | 32 | 34 | -------------------------------------------------------------------------------- /app/src/main/java/com/example/android/inventory/utils/Constants.java: -------------------------------------------------------------------------------- 1 | package com.example.android.inventory.utils; 2 | 3 | /** 4 | * Store constants for the inventory app. 5 | */ 6 | 7 | public class Constants { 8 | 9 | /** 10 | * Creates a private constructor because no one should ever create a {@link Constants} object. 11 | */ 12 | private Constants() { 13 | } 14 | 15 | /** Extract the key associated with the JSONObject and JSONArray */ 16 | static final String JSON_KEY_ITEMS = "items"; 17 | static final String JSON_KEY_VOLUME_INFO = "volumeInfo"; 18 | static final String JSON_KEY_TITLE = "title"; 19 | static final String JSON_KEY_AUTHORS = "authors"; 20 | static final String JSON_KEY_INDUSTRY_IDENTIFIERS = "industryIdentifiers"; 21 | static final String JSON_KEY_TYPE = "type"; 22 | static final String JSON_KEY_ISBN_13 = "ISBN_13"; 23 | static final String JSON_KEY_IDENTIFIER = "identifier"; 24 | static final String JSON_KEY_PUBLISHER = "publisher"; 25 | 26 | /** Read timeout for setting up the HTTP request */ 27 | static final int READ_TIMEOUT = 10000; /* milliseconds */ 28 | 29 | /** Connect timeout for setting up the HTTP request */ 30 | static final int CONNECT_TIMEOUT = 15000; /* milliseconds */ 31 | 32 | /** HTTP response code when the request is successful */ 33 | static final int SUCCESS_RESPONSE_CODE = 200; 34 | 35 | /** Request method type "GET" for reading information from the server */ 36 | static final String REQUEST_METHOD_GET = "GET"; 37 | 38 | /** URL for the book data from the Google books data set */ 39 | public static final String BOOK_REQUEST_URL = "https://www.googleapis.com/books/v1/volumes?"; 40 | 41 | /** Default number to set the image on the top of the textView */ 42 | public static final int DEFAULT_NUMBER = 0; 43 | } 44 | -------------------------------------------------------------------------------- /app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 30 | 31 | 35 | 36 | 37 | 38 | 42 | 43 | 44 | -------------------------------------------------------------------------------- /app/src/main/res/drawable-v24/ic_launcher_foreground.xml: -------------------------------------------------------------------------------- 1 | 7 | 12 | 13 | 19 | 22 | 25 | 26 | 27 | 28 | 34 | 35 | -------------------------------------------------------------------------------- /app/src/main/res/values/colors.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | #ab47bc 4 | #790e8b 5 | #ab47bc 6 | 7 | 8 | #66bb6a 9 | 10 | 11 | #338a3e 12 | 13 | #880d0d0f 14 | #885d5d5e 15 | #880f0f10 16 | 17 | 18 | #f3e5f5 19 | 20 | 21 | #ff9800 22 | 23 | 24 | #fafafa 25 | 26 | 27 | #004d40 28 | 29 | 30 | #338a3e 31 | 32 | 33 | #e8f5e9 34 | 35 | 36 | #7986cb 37 | #9e9e9e 38 | 39 | 40 | #494949 41 | #a4a4a4 42 | 43 | 44 | #000a12 45 | 46 | 47 | #b0bec5 48 | 49 | 50 | #2B3D4D 51 | 52 | 53 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Inventory App 2 | 3 | Project as a part of Android Basics Nanodegree at Udacity 4 | 5 | ### Project Overview 6 | 7 | The goal is to design and create the structure of an Inventory App which would allow a store to keep track of its inventory of products. 8 | 9 | ### Features 10 | 11 | * SQLite Database 12 | * SQLiteOpenHelper 13 | * Content Provider 14 | * URI Matcher 15 | * Content Resolver 16 | * Cursor Loader 17 | * CursorRecyclerViewAdapter 18 | * RecyclerView 19 | * CardView 20 | * Google Books API 21 | * JSON Parsing 22 | 23 | ### Screenshots 24 | 25 | ![screenshot_main](https://user-images.githubusercontent.com/33213229/35272952-379866ba-007a-11e8-95f3-9e357e85a223.png) 26 | ![screenshot_dialog](https://user-images.githubusercontent.com/33213229/35272965-3dbe2bb0-007a-11e8-8261-0a3ccd76aad2.png) 27 | ![screenshot_add_manually](https://user-images.githubusercontent.com/33213229/35272971-41f0c062-007a-11e8-9be3-b92a67f9785e.png) 28 | ![screenshot_add_by_isbn](https://user-images.githubusercontent.com/33213229/35272974-459f31a8-007a-11e8-9b5f-e9716d933db9.png) 29 | ![screenshot_detail](https://user-images.githubusercontent.com/33213229/35272982-4ae49478-007a-11e8-89c6-d5b893ddc94a.png) 30 | ![screenshot_edit](https://user-images.githubusercontent.com/33213229/35272987-4ea10c36-007a-11e8-8f9a-4469c6150b82.png) 31 | 32 | ``` 33 | MIT License 34 | 35 | Copyright (c) 2018 Soojeong Shin 36 | 37 | Permission is hereby granted, free of charge, to any person obtaining a copy 38 | of this software and associated documentation files (the "Software"), to deal 39 | in the Software without restriction, including without limitation the rights 40 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 41 | copies of the Software, and to permit persons to whom the Software is 42 | furnished to do so, subject to the following conditions: 43 | 44 | The above copyright notice and this permission notice shall be included in all 45 | copies or substantial portions of the Software. 46 | 47 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 48 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 49 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 50 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 51 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 52 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 53 | SOFTWARE. 54 | ``` 55 | -------------------------------------------------------------------------------- /gradlew.bat: -------------------------------------------------------------------------------- 1 | @if "%DEBUG%" == "" @echo off 2 | @rem ########################################################################## 3 | @rem 4 | @rem Gradle startup script for Windows 5 | @rem 6 | @rem ########################################################################## 7 | 8 | @rem Set local scope for the variables with windows NT shell 9 | if "%OS%"=="Windows_NT" setlocal 10 | 11 | set DIRNAME=%~dp0 12 | if "%DIRNAME%" == "" set DIRNAME=. 13 | set APP_BASE_NAME=%~n0 14 | set APP_HOME=%DIRNAME% 15 | 16 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 17 | set DEFAULT_JVM_OPTS= 18 | 19 | @rem Find java.exe 20 | if defined JAVA_HOME goto findJavaFromJavaHome 21 | 22 | set JAVA_EXE=java.exe 23 | %JAVA_EXE% -version >NUL 2>&1 24 | if "%ERRORLEVEL%" == "0" goto init 25 | 26 | echo. 27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 28 | echo. 29 | echo Please set the JAVA_HOME variable in your environment to match the 30 | echo location of your Java installation. 31 | 32 | goto fail 33 | 34 | :findJavaFromJavaHome 35 | set JAVA_HOME=%JAVA_HOME:"=% 36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe 37 | 38 | if exist "%JAVA_EXE%" goto init 39 | 40 | echo. 41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 42 | echo. 43 | echo Please set the JAVA_HOME variable in your environment to match the 44 | echo location of your Java installation. 45 | 46 | goto fail 47 | 48 | :init 49 | @rem Get command-line arguments, handling Windows variants 50 | 51 | if not "%OS%" == "Windows_NT" goto win9xME_args 52 | 53 | :win9xME_args 54 | @rem Slurp the command line arguments. 55 | set CMD_LINE_ARGS= 56 | set _SKIP=2 57 | 58 | :win9xME_args_slurp 59 | if "x%~1" == "x" goto execute 60 | 61 | set CMD_LINE_ARGS=%* 62 | 63 | :execute 64 | @rem Setup the command line 65 | 66 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar 67 | 68 | @rem Execute Gradle 69 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% 70 | 71 | :end 72 | @rem End local scope for the variables with windows NT shell 73 | if "%ERRORLEVEL%"=="0" goto mainEnd 74 | 75 | :fail 76 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of 77 | rem the _cmd.exe /c_ return code! 78 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 79 | exit /b 1 80 | 81 | :mainEnd 82 | if "%OS%"=="Windows_NT" endlocal 83 | 84 | :omega 85 | -------------------------------------------------------------------------------- /app/src/main/java/com/example/android/inventory/data/ProductDbHelper.java: -------------------------------------------------------------------------------- 1 | package com.example.android.inventory.data; 2 | 3 | import android.content.Context; 4 | import android.database.sqlite.SQLiteDatabase; 5 | import android.database.sqlite.SQLiteOpenHelper; 6 | 7 | import com.example.android.inventory.data.ProductContract.ProductEntry; 8 | 9 | /** 10 | * Database helper for Inventory app. Manages database creation and version management. 11 | */ 12 | public class ProductDbHelper extends SQLiteOpenHelper { 13 | 14 | /** Name of the database file */ 15 | private static final String DATABASE_NAME = "inventory.db"; 16 | 17 | /** Database version. If you change the database schema, you must increment the database version. */ 18 | private static final int DATABASE_VERSION = 1; 19 | 20 | /** 21 | * Constructs a new instance of {@link ProductDbHelper}. 22 | * @param context of the app 23 | */ 24 | ProductDbHelper(Context context) { 25 | super(context, DATABASE_NAME, null, DATABASE_VERSION); 26 | } 27 | 28 | /** 29 | * This is called when the database is created for the first time. 30 | */ 31 | @Override 32 | public void onCreate(SQLiteDatabase db) { 33 | // Create a String that contains the SQL statement to create the products table 34 | String SQL_CREATE_PRODUCTS_TABLE = "CREATE TABLE " + ProductEntry.TABLE_NAME + " (" 35 | + ProductEntry._ID + " INTEGER PRIMARY KEY AUTOINCREMENT, " 36 | + ProductEntry.COLUMN_PRODUCT_NAME + " TEXT NOT NULL, " 37 | + ProductEntry.COLUMN_PRODUCT_AUTHOR + " TEXT NOT NULL, " 38 | + ProductEntry.COLUMN_PRODUCT_PUBLISHER + " TEXT, " 39 | + ProductEntry.COLUMN_PRODUCT_ISBN + " TEXT NOT NULL, " 40 | + ProductEntry.COLUMN_PRODUCT_PRICE + " REAL NOT NULL DEFAULT 0.0, " 41 | + ProductEntry.COLUMN_PRODUCT_QUANTITY + " INTEGER NOT NULL DEFAULT 0, " 42 | + ProductEntry.COLUMN_PRODUCT_IMAGE + " TEXT, " 43 | + ProductEntry.COLUMN_SUPPLIER_NAME + " TEXT NOT NULL, " 44 | + ProductEntry.COLUMN_SUPPLIER_EMAIL + " TEXT, " 45 | + ProductEntry.COLUMN_SUPPLIER_PHONE + " TEXT NOT NULL);"; 46 | 47 | // Execute the SQL statement 48 | db.execSQL(SQL_CREATE_PRODUCTS_TABLE); 49 | } 50 | 51 | /** 52 | * This is called when the database needs to be upgraded. 53 | */ 54 | @Override 55 | public void onUpgrade(SQLiteDatabase db, int i, int i1) { 56 | // The database is still at version 1, so there's nothing to do be done here. 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_main.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | 9 | 17 | 18 | 19 | 24 | 25 | 34 | 35 | 48 | 49 | 50 | 51 | 60 | 61 | 62 | -------------------------------------------------------------------------------- /app/src/main/java/com/example/android/inventory/EmptyRecyclerView.java: -------------------------------------------------------------------------------- 1 | package com.example.android.inventory; 2 | 3 | import android.content.Context; 4 | import android.support.v7.widget.RecyclerView; 5 | import android.util.AttributeSet; 6 | import android.view.View; 7 | import android.widget.RelativeLayout; 8 | 9 | /** 10 | * EmptyRecyclerView is RecyclerView subclass that provides empty view support for RecyclerView 11 | * to show or hide an empty view based on whether the adapter provided to the RecyclerView has 12 | * data or not. 13 | */ 14 | 15 | public class EmptyRecyclerView extends RecyclerView { 16 | 17 | private View mEmptyView; 18 | 19 | /** 20 | * The AdapterDataObserver calls checkIfEmpty() method every time, and it observes 21 | * an event that changes the content of the adapter 22 | */ 23 | final private AdapterDataObserver observer = new AdapterDataObserver() { 24 | @Override 25 | public void onChanged() { 26 | checkIfEmpty(); 27 | } 28 | 29 | @Override 30 | public void onItemRangeInserted(int positionStart, int itemCount) { 31 | checkIfEmpty(); 32 | } 33 | 34 | @Override 35 | public void onItemRangeRemoved(int positionStart, int itemCount) { 36 | checkIfEmpty(); 37 | } 38 | }; 39 | 40 | public EmptyRecyclerView(Context context) { 41 | super(context); 42 | } 43 | 44 | public EmptyRecyclerView(Context context, AttributeSet attrs) { 45 | super(context, attrs); 46 | } 47 | 48 | public EmptyRecyclerView(Context context, AttributeSet attrs, 49 | int defStyle) { 50 | super(context, attrs, defStyle); 51 | } 52 | 53 | /** 54 | * Checks if both mEmptyView and adapter are not null. 55 | * Hide or show mEmptyView depending on the size of the data(item count) in the adapter. 56 | */ 57 | private void checkIfEmpty() { 58 | // If the item count provided by the adapter is equal to zero, make the empty View visible 59 | // and hide the EmptyRecyclerView. 60 | // Otherwise, hide the empty View and make the EmptyRecyclerView visible. 61 | if (mEmptyView != null && getAdapter() != null) { 62 | final boolean emptyViewVisible = 63 | getAdapter().getItemCount() == 0; 64 | mEmptyView.setVisibility(emptyViewVisible ? VISIBLE : GONE); 65 | setVisibility(emptyViewVisible ? GONE : VISIBLE); 66 | } 67 | } 68 | 69 | @Override 70 | public void setAdapter(Adapter adapter) { 71 | final Adapter oldAdapter = getAdapter(); 72 | if (oldAdapter != null) { 73 | oldAdapter.unregisterAdapterDataObserver(observer); 74 | } 75 | super.setAdapter(adapter); 76 | if (adapter != null) { 77 | adapter.registerAdapterDataObserver(observer); 78 | } 79 | 80 | checkIfEmpty(); 81 | } 82 | 83 | /** 84 | * Set an empty layout on the EmptyRecyclerView 85 | * @param relativeLayout refers to the empty state of the relative layout 86 | */ 87 | public void setEmptyLayout(RelativeLayout relativeLayout) { 88 | mEmptyView = relativeLayout; 89 | checkIfEmpty(); 90 | } 91 | } 92 | -------------------------------------------------------------------------------- /app/src/main/java/com/example/android/inventory/data/ProductContract.java: -------------------------------------------------------------------------------- 1 | package com.example.android.inventory.data; 2 | 3 | import android.content.ContentResolver; 4 | import android.net.Uri; 5 | import android.provider.BaseColumns; 6 | 7 | /** 8 | * API Contract for the Inventory app. 9 | */ 10 | 11 | public final class ProductContract { 12 | 13 | // To prevent someone from accidentally instantiating the contract class, 14 | // give it an empty constructor. 15 | private ProductContract() { 16 | } 17 | 18 | /** 19 | * The "Content authority" is a name for the entire content provider, similar to the 20 | * relationship between a domain name and its website. A convenient string to use for the 21 | * content authority is the package name for the app, which is guaranteed to be unique on the 22 | * device. 23 | */ 24 | static final String CONTENT_AUTHORITY = "com.example.android.inventory"; 25 | 26 | /** 27 | * Use CONTENT_AUTHORITY to create the base of all URI's which apps will use to contact 28 | * the content provider. 29 | */ 30 | private static final Uri BASE_CONTENT_URI = Uri.parse("content://" + CONTENT_AUTHORITY); 31 | 32 | /** 33 | * Possible path (appended to base content URI for possible URI's) 34 | * For instance, content://com.example.android.inventory/products/ is a valid path for 35 | * looking at product data. content://com.example.android.inventory/staff/ will fail, 36 | * as the ContentProvider hasn't been given any information on what to do with "staff". 37 | */ 38 | static final String PATH_PRODUCT = "products"; 39 | 40 | 41 | /** 42 | * Inner class that defines constant values for the products database table. 43 | * Each entry in the table represents a single product. 44 | */ 45 | public static final class ProductEntry implements BaseColumns { 46 | 47 | /** The content URI to access the product data in the provider */ 48 | public static final Uri CONTENT_URI = Uri.withAppendedPath(BASE_CONTENT_URI, PATH_PRODUCT); 49 | 50 | /** 51 | * The MIME type of the {@link #CONTENT_URI} for a list of products. 52 | */ 53 | static final String CONTENT_LIST_TYPE = 54 | ContentResolver.CURSOR_DIR_BASE_TYPE + "/" + CONTENT_AUTHORITY + "/" + PATH_PRODUCT; 55 | 56 | /** 57 | * The MIME type of the {@link #CONTENT_URI} for a single product. 58 | */ 59 | static final String CONTENT_ITEM_TYPE = 60 | ContentResolver.CURSOR_ITEM_BASE_TYPE + "/" + CONTENT_AUTHORITY + "/" + PATH_PRODUCT; 61 | 62 | /** Name of database table for products */ 63 | static final String TABLE_NAME = "products"; 64 | 65 | /** Name of the product. Type: TEXT */ 66 | public static final String COLUMN_PRODUCT_NAME = "product_name"; 67 | 68 | /** Price of the product. Type: INTEGER */ 69 | public static final String COLUMN_PRODUCT_PRICE = "price"; 70 | 71 | /** Quantity of the product. Type: INTEGER */ 72 | public static final String COLUMN_PRODUCT_QUANTITY = "quantity"; 73 | 74 | /** Image of the product. */ 75 | public static final String COLUMN_PRODUCT_IMAGE = "product_image"; 76 | 77 | /** Supplier name. Type: TEXT */ 78 | public static final String COLUMN_SUPPLIER_NAME = "supplier_name"; 79 | 80 | /** Supplier email. Type: TEXT */ 81 | public static final String COLUMN_SUPPLIER_EMAIL = "supplier_email"; 82 | 83 | /** Supplier phone number. Type: TEXT */ 84 | public static final String COLUMN_SUPPLIER_PHONE= "supplier_phone"; 85 | 86 | /** Author of the product. Type: TEXT */ 87 | public static final String COLUMN_PRODUCT_AUTHOR = "author"; 88 | 89 | /** Publisher of the product. Type: Text */ 90 | public static final String COLUMN_PRODUCT_PUBLISHER = "publisher"; 91 | 92 | /** ISBN of the product. Type: Text */ 93 | public static final String COLUMN_PRODUCT_ISBN = "isbn"; 94 | } 95 | } 96 | -------------------------------------------------------------------------------- /app/src/main/res/layout/card_item.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | 17 | 18 | 23 | 24 | 31 | 32 | 38 | 39 | 45 | 46 | 50 | 51 | 58 | 59 | 65 | 66 | 67 | 68 | 69 | 70 | 78 | 79 | 86 | 87 |