├── .idea ├── .name ├── .gitignore ├── compiler.xml ├── vcs.xml ├── copyright │ ├── profiles_settings.xml │ └── Google_Developer_Student_Clubs_BBSBEC.xml ├── gradle.xml └── misc.xml ├── app ├── .gitignore ├── src │ ├── main │ │ ├── ic_launcher-playstore.png │ │ ├── res │ │ │ ├── drawable │ │ │ │ ├── server_error.png │ │ │ │ ├── ic_delete.xml │ │ │ │ ├── ic_filled_star.xml │ │ │ │ ├── ic_empty_star.xml │ │ │ │ ├── ic_search.xml │ │ │ │ ├── ic_schedule.xml │ │ │ │ ├── ic_default_book.xml │ │ │ │ └── ic_gdsc_splash.xml │ │ │ ├── font │ │ │ │ ├── product_sans_bold.ttf │ │ │ │ ├── product_sans_italic.ttf │ │ │ │ └── product_sans_medium.ttf │ │ │ ├── mipmap-hdpi │ │ │ │ ├── ic_launcher.png │ │ │ │ ├── ic_launcher_round.png │ │ │ │ └── ic_launcher_foreground.png │ │ │ ├── mipmap-mdpi │ │ │ │ ├── ic_launcher.png │ │ │ │ ├── ic_launcher_round.png │ │ │ │ └── ic_launcher_foreground.png │ │ │ ├── mipmap-xhdpi │ │ │ │ ├── ic_launcher.png │ │ │ │ ├── ic_launcher_round.png │ │ │ │ └── ic_launcher_foreground.png │ │ │ ├── mipmap-xxhdpi │ │ │ │ ├── ic_launcher.png │ │ │ │ ├── ic_launcher_round.png │ │ │ │ └── ic_launcher_foreground.png │ │ │ ├── mipmap-xxxhdpi │ │ │ │ ├── ic_launcher.png │ │ │ │ ├── ic_launcher_round.png │ │ │ │ └── ic_launcher_foreground.png │ │ │ ├── values │ │ │ │ ├── ic_launcher_background.xml │ │ │ │ ├── dimens.xml │ │ │ │ ├── colors.xml │ │ │ │ ├── strings.xml │ │ │ │ └── themes.xml │ │ │ ├── mipmap-anydpi-v26 │ │ │ │ ├── ic_launcher.xml │ │ │ │ └── ic_launcher_round.xml │ │ │ ├── values-night │ │ │ │ ├── strings.xml │ │ │ │ └── themes.xml │ │ │ ├── layout │ │ │ │ ├── activity_book_search_result_recycler_view.xml │ │ │ │ ├── book_wishlist_row.xml │ │ │ │ ├── activity_book_wishlist_recycler_view.xml │ │ │ │ ├── activity_splash.xml │ │ │ │ ├── activity_server_error.xml │ │ │ │ ├── activity_book_search_result.xml │ │ │ │ ├── activity_main.xml │ │ │ │ └── activity_book_details.xml │ │ │ └── drawable-v24 │ │ │ │ └── ic_launcher_foreground.xml │ │ ├── java │ │ │ └── com │ │ │ │ └── gdsc │ │ │ │ └── bbsbec │ │ │ │ └── gbooks │ │ │ │ ├── utils │ │ │ │ └── Constants.kt │ │ │ │ ├── model │ │ │ │ ├── Books.kt │ │ │ │ ├── Items.kt │ │ │ │ ├── ImageLinks.kt │ │ │ │ ├── BookSearchResultData.kt │ │ │ │ ├── BookDatabase.kt │ │ │ │ └── VolumeInfo.kt │ │ │ │ ├── repository │ │ │ │ ├── Repository.kt │ │ │ │ └── BookRepository.kt │ │ │ │ ├── api │ │ │ │ ├── BooksApiInterface.kt │ │ │ │ └── RetrofitInstance.kt │ │ │ │ ├── viewmodel │ │ │ │ ├── MainViewModelFactory.kt │ │ │ │ ├── MainViewModel.kt │ │ │ │ └── BookDataViewModel.kt │ │ │ │ ├── activity │ │ │ │ ├── BookDao.kt │ │ │ │ ├── ServerErrorActivity.kt │ │ │ │ ├── SplashActivity.kt │ │ │ │ ├── BookWishlistRecyclerView.kt │ │ │ │ ├── BookDetailsActivity.kt │ │ │ │ ├── BookSearchResultRecyclerView.kt │ │ │ │ ├── MainActivity.kt │ │ │ │ └── ListOfQuotes.kt │ │ │ │ └── adapter │ │ │ │ ├── WishlistAdapter.kt │ │ │ │ └── BookSearchResultAdapter.kt │ │ └── AndroidManifest.xml │ ├── test │ │ └── java │ │ │ └── com │ │ │ └── gdsc │ │ │ └── bbsbec │ │ │ └── gbooks │ │ │ └── ExampleUnitTest.kt │ └── androidTest │ │ └── java │ │ └── com │ │ └── gdsc │ │ └── bbsbec │ │ └── gbooks │ │ └── ExampleInstrumentedTest.kt ├── proguard-rules.pro └── build.gradle ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── assets └── images │ └── screenshots │ ├── dark │ ├── MainActivity.png │ ├── SplashActivity.png │ ├── WishlistActivity.png │ ├── BookDetailsActivity.png │ ├── BookSearchResultsActivity.png │ ├── MainActivity-EmptyTitleCheck.png │ ├── BookDetailsActivity-AddedToWishlist.png │ ├── ServerErrorActivity-NoResponseFound.png │ ├── BookDetailsActivity-RemovedFromWishlist.png │ └── MainActivity-InternetConnectivityCheck.png │ └── light │ ├── MainActivity.png │ ├── SplashActivity.png │ ├── WishlistActivity.png │ ├── BookDetailsActivity.png │ ├── BookSearchResultsActivity.png │ ├── MainActivity-EmptyTitleCheck.png │ ├── BookDetailsActivity-AddedToWishlist.png │ ├── ServerErrorActivity-NoResponseFound.png │ ├── MainActivity-InternetConnectivityCheck.png │ └── BookDetailsActivity-RemovedFromWishlist.png ├── .gitignore ├── profiles_settings.xml ├── settings.gradle ├── .github └── workflows │ └── android.yml ├── gradlew.bat ├── README.md ├── CODE_OF_CONDUCT.md ├── gradlew ├── CONTRIBUTING.md └── LICENSE.md /.idea/.name: -------------------------------------------------------------------------------- 1 | G-Books -------------------------------------------------------------------------------- /app/.gitignore: -------------------------------------------------------------------------------- 1 | /build -------------------------------------------------------------------------------- /.idea/.gitignore: -------------------------------------------------------------------------------- 1 | # Default ignored files 2 | /shelf/ 3 | /workspace.xml 4 | -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gdsc-bbsbec/GBooks/HEAD/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /app/src/main/ic_launcher-playstore.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gdsc-bbsbec/GBooks/HEAD/app/src/main/ic_launcher-playstore.png -------------------------------------------------------------------------------- /app/src/main/res/drawable/server_error.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gdsc-bbsbec/GBooks/HEAD/app/src/main/res/drawable/server_error.png -------------------------------------------------------------------------------- /app/src/main/res/font/product_sans_bold.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gdsc-bbsbec/GBooks/HEAD/app/src/main/res/font/product_sans_bold.ttf -------------------------------------------------------------------------------- /app/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gdsc-bbsbec/GBooks/HEAD/app/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gdsc-bbsbec/GBooks/HEAD/app/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/font/product_sans_italic.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gdsc-bbsbec/GBooks/HEAD/app/src/main/res/font/product_sans_italic.ttf -------------------------------------------------------------------------------- /app/src/main/res/font/product_sans_medium.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gdsc-bbsbec/GBooks/HEAD/app/src/main/res/font/product_sans_medium.ttf -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gdsc-bbsbec/GBooks/HEAD/app/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gdsc-bbsbec/GBooks/HEAD/app/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gdsc-bbsbec/GBooks/HEAD/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /assets/images/screenshots/dark/MainActivity.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gdsc-bbsbec/GBooks/HEAD/assets/images/screenshots/dark/MainActivity.png -------------------------------------------------------------------------------- /assets/images/screenshots/dark/SplashActivity.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gdsc-bbsbec/GBooks/HEAD/assets/images/screenshots/dark/SplashActivity.png -------------------------------------------------------------------------------- /assets/images/screenshots/light/MainActivity.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gdsc-bbsbec/GBooks/HEAD/assets/images/screenshots/light/MainActivity.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-hdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gdsc-bbsbec/GBooks/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/gdsc-bbsbec/GBooks/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/gdsc-bbsbec/GBooks/HEAD/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gdsc-bbsbec/GBooks/HEAD/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /assets/images/screenshots/dark/WishlistActivity.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gdsc-bbsbec/GBooks/HEAD/assets/images/screenshots/dark/WishlistActivity.png -------------------------------------------------------------------------------- /assets/images/screenshots/light/SplashActivity.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gdsc-bbsbec/GBooks/HEAD/assets/images/screenshots/light/SplashActivity.png -------------------------------------------------------------------------------- /assets/images/screenshots/light/WishlistActivity.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gdsc-bbsbec/GBooks/HEAD/assets/images/screenshots/light/WishlistActivity.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gdsc-bbsbec/GBooks/HEAD/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /assets/images/screenshots/dark/BookDetailsActivity.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gdsc-bbsbec/GBooks/HEAD/assets/images/screenshots/dark/BookDetailsActivity.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-hdpi/ic_launcher_foreground.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gdsc-bbsbec/GBooks/HEAD/app/src/main/res/mipmap-hdpi/ic_launcher_foreground.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-mdpi/ic_launcher_foreground.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gdsc-bbsbec/GBooks/HEAD/app/src/main/res/mipmap-mdpi/ic_launcher_foreground.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xhdpi/ic_launcher_foreground.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gdsc-bbsbec/GBooks/HEAD/app/src/main/res/mipmap-xhdpi/ic_launcher_foreground.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/ic_launcher_foreground.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gdsc-bbsbec/GBooks/HEAD/app/src/main/res/mipmap-xxhdpi/ic_launcher_foreground.png -------------------------------------------------------------------------------- /assets/images/screenshots/light/BookDetailsActivity.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gdsc-bbsbec/GBooks/HEAD/assets/images/screenshots/light/BookDetailsActivity.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxxhdpi/ic_launcher_foreground.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gdsc-bbsbec/GBooks/HEAD/app/src/main/res/mipmap-xxxhdpi/ic_launcher_foreground.png -------------------------------------------------------------------------------- /assets/images/screenshots/dark/BookSearchResultsActivity.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gdsc-bbsbec/GBooks/HEAD/assets/images/screenshots/dark/BookSearchResultsActivity.png -------------------------------------------------------------------------------- /assets/images/screenshots/light/BookSearchResultsActivity.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gdsc-bbsbec/GBooks/HEAD/assets/images/screenshots/light/BookSearchResultsActivity.png -------------------------------------------------------------------------------- /app/src/main/res/values/ic_launcher_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | #FFFFFF 4 | -------------------------------------------------------------------------------- /assets/images/screenshots/dark/MainActivity-EmptyTitleCheck.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gdsc-bbsbec/GBooks/HEAD/assets/images/screenshots/dark/MainActivity-EmptyTitleCheck.png -------------------------------------------------------------------------------- /assets/images/screenshots/light/MainActivity-EmptyTitleCheck.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gdsc-bbsbec/GBooks/HEAD/assets/images/screenshots/light/MainActivity-EmptyTitleCheck.png -------------------------------------------------------------------------------- /assets/images/screenshots/dark/BookDetailsActivity-AddedToWishlist.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gdsc-bbsbec/GBooks/HEAD/assets/images/screenshots/dark/BookDetailsActivity-AddedToWishlist.png -------------------------------------------------------------------------------- /assets/images/screenshots/dark/ServerErrorActivity-NoResponseFound.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gdsc-bbsbec/GBooks/HEAD/assets/images/screenshots/dark/ServerErrorActivity-NoResponseFound.png -------------------------------------------------------------------------------- /assets/images/screenshots/light/BookDetailsActivity-AddedToWishlist.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gdsc-bbsbec/GBooks/HEAD/assets/images/screenshots/light/BookDetailsActivity-AddedToWishlist.png -------------------------------------------------------------------------------- /assets/images/screenshots/light/ServerErrorActivity-NoResponseFound.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gdsc-bbsbec/GBooks/HEAD/assets/images/screenshots/light/ServerErrorActivity-NoResponseFound.png -------------------------------------------------------------------------------- /assets/images/screenshots/dark/BookDetailsActivity-RemovedFromWishlist.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gdsc-bbsbec/GBooks/HEAD/assets/images/screenshots/dark/BookDetailsActivity-RemovedFromWishlist.png -------------------------------------------------------------------------------- /assets/images/screenshots/dark/MainActivity-InternetConnectivityCheck.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gdsc-bbsbec/GBooks/HEAD/assets/images/screenshots/dark/MainActivity-InternetConnectivityCheck.png -------------------------------------------------------------------------------- /assets/images/screenshots/light/MainActivity-InternetConnectivityCheck.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gdsc-bbsbec/GBooks/HEAD/assets/images/screenshots/light/MainActivity-InternetConnectivityCheck.png -------------------------------------------------------------------------------- /.idea/compiler.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /assets/images/screenshots/light/BookDetailsActivity-RemovedFromWishlist.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gdsc-bbsbec/GBooks/HEAD/assets/images/screenshots/light/BookDetailsActivity-RemovedFromWishlist.png -------------------------------------------------------------------------------- /.idea/vcs.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /.idea/copyright/profiles_settings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 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 15 | local.properties 16 | gradle.properties 17 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_delete.xml: -------------------------------------------------------------------------------- 1 | 7 | 10 | 11 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_filled_star.xml: -------------------------------------------------------------------------------- 1 | 7 | 10 | 11 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_empty_star.xml: -------------------------------------------------------------------------------- 1 | 7 | 10 | 11 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_search.xml: -------------------------------------------------------------------------------- 1 | 7 | 10 | 11 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_schedule.xml: -------------------------------------------------------------------------------- 1 | 7 | 10 | 13 | 14 | -------------------------------------------------------------------------------- /.idea/gradle.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 19 | 20 | -------------------------------------------------------------------------------- /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 -------------------------------------------------------------------------------- /app/src/main/res/values/dimens.xml: -------------------------------------------------------------------------------- 1 | 16 | 17 | 18 | 250dp 19 | -------------------------------------------------------------------------------- /.idea/copyright/Google_Developer_Student_Clubs_BBSBEC.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 6 | -------------------------------------------------------------------------------- /app/src/main/java/com/gdsc/bbsbec/gbooks/utils/Constants.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2021 Google Developer Student Clubs BBSBEC 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.gdsc.bbsbec.gbooks.utils 18 | 19 | class Constants { 20 | companion object { 21 | const val BASE_URL = "https://www.googleapis.com/books/v1/volumes/" 22 | } 23 | } -------------------------------------------------------------------------------- /app/src/main/java/com/gdsc/bbsbec/gbooks/model/Books.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2021 Google Developer Student Clubs BBSBEC 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.gdsc.bbsbec.gbooks.model 18 | 19 | import com.google.gson.annotations.SerializedName 20 | 21 | 22 | data class Books( 23 | 24 | @SerializedName("items") var items: ArrayList = arrayListOf() 25 | 26 | ) 27 | -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (C) 2021 Google Developer Student Clubs BBSBEC 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); 5 | # you may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | # 16 | 17 | #Sat Dec 25 20:16:55 IST 2021 18 | distributionBase=GRADLE_USER_HOME 19 | distributionUrl=https\://services.gradle.org/distributions/gradle-7.0.2-bin.zip 20 | distributionPath=wrapper/dists 21 | zipStorePath=wrapper/dists 22 | zipStoreBase=GRADLE_USER_HOME 23 | -------------------------------------------------------------------------------- /profiles_settings.xml: -------------------------------------------------------------------------------- 1 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /app/src/main/java/com/gdsc/bbsbec/gbooks/model/Items.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2021 Google Developer Student Clubs BBSBEC 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.gdsc.bbsbec.gbooks.model 18 | 19 | import com.google.gson.annotations.SerializedName 20 | 21 | 22 | data class Items( 23 | 24 | @SerializedName("id") var id: String? = null, 25 | @SerializedName("volumeInfo") var volumeInfo: VolumeInfo? = VolumeInfo(), 26 | ) 27 | -------------------------------------------------------------------------------- /settings.gradle: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2021 Google Developer Student Clubs BBSBEC 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | dependencyResolutionManagement { 18 | repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS) 19 | repositories { 20 | google() 21 | mavenCentral() 22 | jcenter() // Warning: this repository is going to shut down soon 23 | } 24 | } 25 | rootProject.name = "G-Books" 26 | include ':app' 27 | -------------------------------------------------------------------------------- /app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml: -------------------------------------------------------------------------------- 1 | 2 | 17 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml: -------------------------------------------------------------------------------- 1 | 2 | 17 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /app/src/main/java/com/gdsc/bbsbec/gbooks/model/ImageLinks.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2021 Google Developer Student Clubs BBSBEC 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.gdsc.bbsbec.gbooks.model 18 | 19 | import com.google.gson.annotations.SerializedName 20 | 21 | 22 | data class ImageLinks( 23 | 24 | @SerializedName("smallThumbnail") var smallThumbnail: String? = "https://i.imgur.com/YjoNXCX.png", 25 | @SerializedName("thumbnail") var thumbnail: String? = "https://i.imgur.com/YjoNXCX.png" 26 | 27 | ) -------------------------------------------------------------------------------- /app/src/main/java/com/gdsc/bbsbec/gbooks/repository/Repository.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2021 Google Developer Student Clubs BBSBEC 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.gdsc.bbsbec.gbooks.repository 18 | 19 | import com.gdsc.bbsbec.gbooks.api.RetrofitInstance 20 | import com.gdsc.bbsbec.gbooks.model.Books 21 | import retrofit2.Response 22 | 23 | class Repository { 24 | suspend fun getBooks(title: String, apiKey: String): Response { 25 | return RetrofitInstance.api.getBooks(title, apiKey) 26 | } 27 | } -------------------------------------------------------------------------------- /app/src/main/java/com/gdsc/bbsbec/gbooks/api/BooksApiInterface.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2021 Google Developer Student Clubs BBSBEC 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.gdsc.bbsbec.gbooks.api 18 | 19 | import com.gdsc.bbsbec.gbooks.model.Books 20 | import retrofit2.Response 21 | import retrofit2.http.GET 22 | import retrofit2.http.Query 23 | 24 | interface BooksApiInterface { 25 | 26 | @GET(" ") 27 | suspend fun getBooks( 28 | @Query("q") inTitle: String, 29 | @Query("key") apiKey: String 30 | ): Response 31 | } 32 | -------------------------------------------------------------------------------- /app/src/main/res/values/colors.xml: -------------------------------------------------------------------------------- 1 | 2 | 17 | 18 | 19 | #FFBB86FC 20 | #FF6200EE 21 | #FF3700B3 22 | #FF03DAC5 23 | #FF018786 24 | #FF000000 25 | #FFFFFFFF 26 | -------------------------------------------------------------------------------- /app/src/test/java/com/gdsc/bbsbec/gbooks/ExampleUnitTest.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2021 Google Developer Student Clubs BBSBEC 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.gdsc.bbsbec.gbooks 18 | 19 | import org.junit.Test 20 | 21 | import org.junit.Assert.* 22 | 23 | /** 24 | * Example local unit test, which will execute on the development machine (host). 25 | * 26 | * See [testing documentation](http://d.android.com/tools/testing). 27 | */ 28 | class ExampleUnitTest { 29 | @Test 30 | fun addition_isCorrect() { 31 | assertEquals(4, 2 + 2) 32 | } 33 | } -------------------------------------------------------------------------------- /app/src/main/java/com/gdsc/bbsbec/gbooks/viewmodel/MainViewModelFactory.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2021 Google Developer Student Clubs BBSBEC 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.gdsc.bbsbec.gbooks.viewmodel 18 | 19 | import androidx.lifecycle.ViewModel 20 | import androidx.lifecycle.ViewModelProvider 21 | import com.gdsc.bbsbec.gbooks.repository.Repository 22 | 23 | class MainViewModelFactory( 24 | private val repository: Repository 25 | ) : ViewModelProvider.Factory { 26 | override fun create(modelClass: Class): T { 27 | return MainViewModel(repository) as T 28 | } 29 | } -------------------------------------------------------------------------------- /app/src/main/java/com/gdsc/bbsbec/gbooks/model/BookSearchResultData.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2021 Google Developer Student Clubs BBSBEC 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.gdsc.bbsbec.gbooks.model 18 | 19 | import androidx.room.Entity 20 | import androidx.room.PrimaryKey 21 | 22 | @Entity(tableName = "book_data") 23 | data class BookSearchResultData( 24 | @PrimaryKey(autoGenerate = false) 25 | val id: String, 26 | val bookSmallThumbnail: String?, 27 | val title: String, 28 | val publisher: String?, 29 | val bookDescription: String?, 30 | val previewLink: String?, 31 | val bookThumbnail: String?, 32 | var isFavourite: Boolean? = false 33 | ) -------------------------------------------------------------------------------- /.github/workflows/android.yml: -------------------------------------------------------------------------------- 1 | name: Gradle Build 2 | 3 | on: 4 | push: 5 | branches: [ master ] 6 | pull_request: 7 | branches: [ master ] 8 | 9 | # Allows you to run this workflow manually from the Actions tab 10 | workflow_dispatch: 11 | 12 | jobs: 13 | build: 14 | 15 | runs-on: ubuntu-latest 16 | 17 | steps: 18 | - uses: actions/checkout@v2 19 | 20 | - name: Set up JDK 11 21 | uses: actions/setup-java@v2 22 | with: 23 | java-version: '11' 24 | distribution: 'adopt' 25 | cache: gradle 26 | 27 | - name: Validate Gradle wrapper 28 | uses: gradle/wrapper-validation-action@e6e38bacfdf1a337459f332974bb2327a31aaf4b 29 | 30 | - name: Gradle Build 31 | env: 32 | CI: true 33 | run: | 34 | echo "${{ secrets.PROPERTIES }}" > gradle.properties 35 | ./gradlew build --warning-mode=all 36 | 37 | - name: Cleanup Gradle Cache 38 | # Remove some files from the Gradle cache, so they aren't cached by GitHub Actions. 39 | # Restoring these files from a GitHub Actions cache might cause problems for future builds. 40 | run: | 41 | rm -f ~/.gradle/caches/modules-2/modules-2.lock 42 | rm -f ~/.gradle/caches/modules-2/gc.properties 43 | -------------------------------------------------------------------------------- /app/src/main/java/com/gdsc/bbsbec/gbooks/activity/BookDao.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2022 Google Developer Student Clubs BBSBEC 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.gdsc.bbsbec.gbooks.activity 18 | 19 | import androidx.lifecycle.LiveData 20 | import androidx.room.* 21 | import com.gdsc.bbsbec.gbooks.model.BookSearchResultData 22 | 23 | @Dao 24 | interface BookDao { 25 | 26 | @Insert(onConflict = OnConflictStrategy.IGNORE) 27 | suspend fun addBook(books: BookSearchResultData) 28 | 29 | @Query("SELECT * FROM book_data ORDER BY id ASC") 30 | fun readAllData(): LiveData> 31 | 32 | @Delete 33 | suspend fun deleteBook(book: BookSearchResultData) 34 | } -------------------------------------------------------------------------------- /app/src/main/java/com/gdsc/bbsbec/gbooks/api/RetrofitInstance.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2021 Google Developer Student Clubs BBSBEC 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.gdsc.bbsbec.gbooks.api 18 | 19 | import com.gdsc.bbsbec.gbooks.utils.Constants.Companion.BASE_URL 20 | import retrofit2.Retrofit 21 | import retrofit2.converter.gson.GsonConverterFactory 22 | 23 | object RetrofitInstance { 24 | 25 | private val retrofit by lazy { 26 | Retrofit.Builder() 27 | .baseUrl(BASE_URL) 28 | .addConverterFactory(GsonConverterFactory.create()) 29 | .build() 30 | } 31 | 32 | val api: BooksApiInterface by lazy { 33 | retrofit.create(BooksApiInterface::class.java) 34 | } 35 | 36 | } -------------------------------------------------------------------------------- /app/src/main/java/com/gdsc/bbsbec/gbooks/repository/BookRepository.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2022 Google Developer Student Clubs BBSBEC 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.gdsc.bbsbec.gbooks.repository 18 | 19 | import androidx.lifecycle.LiveData 20 | import com.gdsc.bbsbec.gbooks.activity.BookDao 21 | import com.gdsc.bbsbec.gbooks.model.BookSearchResultData 22 | 23 | class BookRepository(private val bookDao: BookDao) { 24 | 25 | val readAllData: LiveData> = bookDao.readAllData() 26 | 27 | suspend fun addBook(book: BookSearchResultData) { 28 | bookDao.addBook(book) 29 | } 30 | 31 | suspend fun deleteBook(book: BookSearchResultData) { 32 | bookDao.deleteBook(book) 33 | } 34 | } -------------------------------------------------------------------------------- /app/src/main/java/com/gdsc/bbsbec/gbooks/viewmodel/MainViewModel.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2021 Google Developer Student Clubs BBSBEC 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.gdsc.bbsbec.gbooks.viewmodel 18 | 19 | import androidx.lifecycle.MutableLiveData 20 | import androidx.lifecycle.ViewModel 21 | import androidx.lifecycle.viewModelScope 22 | import com.gdsc.bbsbec.gbooks.model.Books 23 | import com.gdsc.bbsbec.gbooks.repository.Repository 24 | import kotlinx.coroutines.launch 25 | import retrofit2.Response 26 | 27 | class MainViewModel(private val repository: Repository) : ViewModel() { 28 | 29 | val myResponse: MutableLiveData> = MutableLiveData() 30 | 31 | fun getBooks(title: String, apiKey: String) { 32 | viewModelScope.launch { 33 | val response: Response = repository.getBooks(title, apiKey) 34 | myResponse.value = response 35 | } 36 | } 37 | } -------------------------------------------------------------------------------- /app/src/main/res/values-night/strings.xml: -------------------------------------------------------------------------------- 1 | 16 | 17 | 18 | G-Books 19 | GDSC Logo for splash screen 20 | Google Developer Student Clubs 21 | Baba Banda Singh Bahadur Engineering College 22 | Enter book title 23 | Search 24 | Preview Book 25 | Something went wrong, please go back and search again 26 | Go Back 27 | Book Name 28 | Publisher 29 | -------------------------------------------------------------------------------- /app/src/androidTest/java/com/gdsc/bbsbec/gbooks/ExampleInstrumentedTest.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2021 Google Developer Student Clubs BBSBEC 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.gdsc.bbsbec.gbooks 18 | 19 | import androidx.test.ext.junit.runners.AndroidJUnit4 20 | import androidx.test.platform.app.InstrumentationRegistry 21 | import org.junit.Assert.assertEquals 22 | import org.junit.Test 23 | import org.junit.runner.RunWith 24 | 25 | /** 26 | * Instrumented test, which will execute on an Android device. 27 | * 28 | * See [testing documentation](http://d.android.com/tools/testing). 29 | */ 30 | @RunWith(AndroidJUnit4::class) 31 | class ExampleInstrumentedTest { 32 | @Test 33 | fun useAppContext() { 34 | // Context of the app under test. 35 | val appContext = InstrumentationRegistry.getInstrumentation().targetContext 36 | assertEquals("com.gdsc.bbsbec.gbooks", appContext.packageName) 37 | } 38 | } -------------------------------------------------------------------------------- /app/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 16 | 17 | 18 | G-Books 19 | GDSC Logo for splash screen 20 | Google Developer Student Clubs 21 | Baba Banda Singh Bahadur Engineering College 22 | Enter book title 23 | Search 24 | Preview Book 25 | Something went wrong, please go back and search again 26 | Go Back 27 | Book Name 28 | Publisher 29 | Open Book Wishlist 30 | -------------------------------------------------------------------------------- /app/src/main/java/com/gdsc/bbsbec/gbooks/activity/ServerErrorActivity.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2022 Google Developer Student Clubs BBSBEC 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.gdsc.bbsbec.gbooks.activity 18 | 19 | import android.content.Intent 20 | import android.os.Bundle 21 | import androidx.appcompat.app.AppCompatActivity 22 | import com.gdsc.bbsbec.gbooks.databinding.ActivityServerErrorBinding 23 | 24 | class ServerErrorActivity : AppCompatActivity() { 25 | 26 | private lateinit var binding: ActivityServerErrorBinding 27 | 28 | override fun onCreate(savedInstanceState: Bundle?) { 29 | super.onCreate(savedInstanceState) 30 | binding = ActivityServerErrorBinding.inflate(layoutInflater) 31 | setContentView(binding.root) 32 | 33 | binding.backButton.setOnClickListener { 34 | val intent = Intent(this, MainActivity::class.java) 35 | startActivity(intent) 36 | finish() 37 | } 38 | } 39 | } -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_default_book.xml: -------------------------------------------------------------------------------- 1 | 7 | 10 | 13 | 16 | 19 | 20 | -------------------------------------------------------------------------------- /app/src/main/java/com/gdsc/bbsbec/gbooks/activity/SplashActivity.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2022 Google Developer Student Clubs BBSBEC 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.gdsc.bbsbec.gbooks.activity 18 | 19 | import android.content.Intent 20 | import android.os.Bundle 21 | import android.os.Handler 22 | import androidx.appcompat.app.AppCompatActivity 23 | import com.gdsc.bbsbec.gbooks.R 24 | 25 | class SplashActivity : AppCompatActivity() { 26 | override fun onCreate(savedInstanceState: Bundle?) { 27 | super.onCreate(savedInstanceState) 28 | setContentView(R.layout.activity_splash) 29 | 30 | supportActionBar?.hide() 31 | Handler().postDelayed({ 32 | val intent = Intent(this@SplashActivity, MainActivity::class.java) 33 | startActivity(intent) 34 | finish() // end the splash activity otherwise it will open up again onBackPressed in MainActivity 35 | }, 1000) // stay on splash for 1 second 36 | } 37 | } -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_book_search_result_recycler_view.xml: -------------------------------------------------------------------------------- 1 | 2 | 17 | 18 | 24 | 25 | 33 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_gdsc_splash.xml: -------------------------------------------------------------------------------- 1 | 16 | 17 | 22 | 25 | 28 | 31 | 34 | 35 | -------------------------------------------------------------------------------- /app/src/main/res/values/themes.xml: -------------------------------------------------------------------------------- 1 | 16 | 17 | 18 | 19 | 33 | -------------------------------------------------------------------------------- /app/src/main/res/values-night/themes.xml: -------------------------------------------------------------------------------- 1 | 16 | 17 | 18 | 19 | 33 | -------------------------------------------------------------------------------- /app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | 8 | 16 | 19 | 22 | 25 | 28 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 40 | 41 | 42 | -------------------------------------------------------------------------------- /app/src/main/java/com/gdsc/bbsbec/gbooks/model/BookDatabase.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2022 Google Developer Student Clubs BBSBEC 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.gdsc.bbsbec.gbooks.model 18 | 19 | import android.content.Context 20 | import androidx.room.Database 21 | import androidx.room.Room 22 | import androidx.room.RoomDatabase 23 | import com.gdsc.bbsbec.gbooks.activity.BookDao 24 | 25 | @Database(entities = [BookSearchResultData::class], version = 1, exportSchema = false) 26 | abstract class BookDatabase : RoomDatabase() { 27 | 28 | abstract fun bookDao(): BookDao 29 | 30 | companion object { 31 | @Volatile 32 | var INSTANCE: BookDatabase? = null 33 | 34 | fun getDatabase(context: Context): BookDatabase { 35 | val tempInstance = INSTANCE 36 | if (tempInstance != null) { 37 | return tempInstance 38 | } 39 | synchronized(this) { 40 | val instance = Room.databaseBuilder( 41 | context.applicationContext, 42 | BookDatabase::class.java, 43 | "book_database" 44 | ).build() 45 | INSTANCE = instance 46 | return instance 47 | } 48 | } 49 | } 50 | } -------------------------------------------------------------------------------- /.idea/misc.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 23 | 24 | 25 | 26 | 27 | 28 | 30 | -------------------------------------------------------------------------------- /app/src/main/java/com/gdsc/bbsbec/gbooks/viewmodel/BookDataViewModel.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2022 Google Developer Student Clubs BBSBEC 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.gdsc.bbsbec.gbooks.viewmodel 18 | 19 | import android.app.Application 20 | import androidx.lifecycle.AndroidViewModel 21 | import androidx.lifecycle.LiveData 22 | import androidx.lifecycle.viewModelScope 23 | import com.gdsc.bbsbec.gbooks.model.BookDatabase 24 | import com.gdsc.bbsbec.gbooks.model.BookSearchResultData 25 | import com.gdsc.bbsbec.gbooks.repository.BookRepository 26 | import kotlinx.coroutines.Dispatchers 27 | import kotlinx.coroutines.launch 28 | 29 | class BookDataViewModel(application: Application) : 30 | AndroidViewModel(application) { 31 | 32 | val readAllData: LiveData> 33 | private val repository: BookRepository 34 | 35 | init { 36 | val bookDao = BookDatabase.getDatabase(application).bookDao() 37 | repository = BookRepository(bookDao) 38 | readAllData = repository.readAllData 39 | } 40 | 41 | fun addBook(book: BookSearchResultData) { 42 | viewModelScope.launch(Dispatchers.IO) { 43 | repository.addBook(book) 44 | } 45 | } 46 | 47 | fun deleteBook(book: BookSearchResultData) { 48 | viewModelScope.launch(Dispatchers.IO) { 49 | repository.deleteBook(book) 50 | } 51 | } 52 | } -------------------------------------------------------------------------------- /app/src/main/java/com/gdsc/bbsbec/gbooks/model/VolumeInfo.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2021 Google Developer Student Clubs BBSBEC 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.gdsc.bbsbec.gbooks.model 18 | 19 | import com.google.gson.annotations.SerializedName 20 | 21 | 22 | data class VolumeInfo( 23 | 24 | @SerializedName("title") var title: String? = null, 25 | @SerializedName("subtitle") var subtitle: String? = null, 26 | @SerializedName("authors") var authors: ArrayList = arrayListOf(), 27 | @SerializedName("publisher") var publisher: String? = "Publisher details not available", 28 | @SerializedName("publishedDate") var publishedDate: String? = null, 29 | @SerializedName("description") var description: String? = "No description found", 30 | @SerializedName("pageCount") var pageCount: Int? = null, 31 | @SerializedName("printType") var printType: String? = null, 32 | @SerializedName("categories") var categories: ArrayList = arrayListOf(), 33 | @SerializedName("averageRating") var averageRating: Double? = null, 34 | @SerializedName("ratingsCount") var ratingsCount: Int? = null, 35 | @SerializedName("maturityRating") var maturityRating: String? = null, 36 | @SerializedName("allowAnonLogging") var allowAnonLogging: Boolean? = null, 37 | @SerializedName("contentVersion") var contentVersion: String? = null, 38 | @SerializedName("imageLinks") var imageLinks: ImageLinks? = ImageLinks(), 39 | @SerializedName("language") var language: String? = null, 40 | @SerializedName("previewLink") var previewLink: String? = null, 41 | @SerializedName("infoLink") var infoLink: String? = null, 42 | @SerializedName("canonicalVolumeLink") var canonicalVolumeLink: String? = null 43 | 44 | ) -------------------------------------------------------------------------------- /app/src/main/java/com/gdsc/bbsbec/gbooks/adapter/WishlistAdapter.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2022 Google Developer Student Clubs BBSBEC 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.gdsc.bbsbec.gbooks.adapter 18 | 19 | import android.view.LayoutInflater 20 | import android.view.View 21 | import android.view.ViewGroup 22 | import androidx.recyclerview.widget.RecyclerView 23 | import com.gdsc.bbsbec.gbooks.R 24 | import com.gdsc.bbsbec.gbooks.model.BookSearchResultData 25 | import kotlinx.android.synthetic.main.book_wishlist_row.view.* 26 | 27 | class WishlistAdapter(private val listener: DeleteBookInterface) : 28 | RecyclerView.Adapter() { 29 | 30 | private var bookList = emptyList() 31 | 32 | class MyViewHolder(itemView: View) : RecyclerView.ViewHolder(itemView) {} 33 | 34 | override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): MyViewHolder { 35 | return MyViewHolder( 36 | LayoutInflater.from(parent.context) 37 | .inflate(R.layout.book_wishlist_row, parent, false) 38 | ) 39 | } 40 | 41 | override fun onBindViewHolder(holder: MyViewHolder, position: Int) { 42 | val currentItem = bookList[position] 43 | holder.itemView.book_name.text = currentItem.title 44 | holder.itemView.book_publisher.text = currentItem.publisher 45 | holder.itemView.delete_image_view.setOnClickListener { 46 | listener.onClick(bookList[holder.adapterPosition]) 47 | } 48 | } 49 | 50 | override fun getItemCount(): Int { 51 | return bookList.size 52 | } 53 | 54 | fun setData(book: List) { 55 | this.bookList = book 56 | notifyDataSetChanged() 57 | } 58 | 59 | interface DeleteBookInterface { 60 | fun onClick(book: BookSearchResultData) 61 | } 62 | } -------------------------------------------------------------------------------- /app/src/main/res/layout/book_wishlist_row.xml: -------------------------------------------------------------------------------- 1 | 16 | 17 | 23 | 24 | 33 | 34 | 43 | 44 | 54 | 55 | -------------------------------------------------------------------------------- /app/src/main/res/drawable-v24/ic_launcher_foreground.xml: -------------------------------------------------------------------------------- 1 | 16 | 17 | 23 | 24 | 25 | 31 | 34 | 37 | 38 | 39 | 40 | 46 | -------------------------------------------------------------------------------- /app/src/main/java/com/gdsc/bbsbec/gbooks/activity/BookWishlistRecyclerView.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2022 Google Developer Student Clubs BBSBEC 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.gdsc.bbsbec.gbooks.activity 18 | 19 | 20 | import android.os.Bundle 21 | import android.widget.Toast 22 | import androidx.appcompat.app.AppCompatActivity 23 | import androidx.lifecycle.Observer 24 | import androidx.lifecycle.ViewModelProvider 25 | import androidx.recyclerview.widget.LinearLayoutManager 26 | import com.gdsc.bbsbec.gbooks.adapter.WishlistAdapter 27 | import com.gdsc.bbsbec.gbooks.databinding.ActivityBookWishlistRecyclerViewBinding 28 | import com.gdsc.bbsbec.gbooks.model.BookSearchResultData 29 | import com.gdsc.bbsbec.gbooks.viewmodel.BookDataViewModel 30 | 31 | class BookWishlistRecyclerView : AppCompatActivity(), WishlistAdapter.DeleteBookInterface { 32 | 33 | private lateinit var binding: ActivityBookWishlistRecyclerViewBinding 34 | private lateinit var mBookDataViewModel: BookDataViewModel 35 | 36 | override fun onCreate(savedInstanceState: Bundle?) { 37 | super.onCreate(savedInstanceState) 38 | binding = ActivityBookWishlistRecyclerViewBinding.inflate(layoutInflater) 39 | setContentView(binding.root) 40 | 41 | supportActionBar?.title = "Wishlist" 42 | 43 | // Recyclerview 44 | val wishlistAdapter = WishlistAdapter(this) 45 | binding.bookWishListRecyclerView.adapter = wishlistAdapter 46 | binding.bookWishListRecyclerView.layoutManager = LinearLayoutManager(this) 47 | 48 | // BookDataViewModel 49 | mBookDataViewModel = ViewModelProvider(this).get(BookDataViewModel::class.java) 50 | mBookDataViewModel.readAllData.observe(this, Observer { book -> 51 | wishlistAdapter.setData(book) 52 | }) 53 | } 54 | 55 | override fun onClick(book: BookSearchResultData) { 56 | mBookDataViewModel.deleteBook(book) 57 | Toast.makeText(applicationContext, "Book removed from wishlist", Toast.LENGTH_LONG) 58 | .show() 59 | } 60 | } -------------------------------------------------------------------------------- /app/src/main/java/com/gdsc/bbsbec/gbooks/adapter/BookSearchResultAdapter.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2021 Google Developer Student Clubs BBSBEC 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.gdsc.bbsbec.gbooks.adapter 18 | 19 | import android.view.LayoutInflater 20 | import android.view.ViewGroup 21 | import androidx.recyclerview.widget.RecyclerView 22 | import coil.load 23 | import com.gdsc.bbsbec.gbooks.databinding.ActivityBookSearchResultBinding 24 | import com.gdsc.bbsbec.gbooks.model.BookSearchResultData 25 | 26 | class BookSearchResultAdapter( 27 | private val data: ArrayList, 28 | private val onClick: (BookSearchResultData) -> Unit 29 | ) : 30 | RecyclerView.Adapter() { 31 | 32 | inner class BookSearchResultViewHolder(private val item: ActivityBookSearchResultBinding) : 33 | RecyclerView.ViewHolder(item.root) { 34 | fun bindData(bookSearchResultData: BookSearchResultData) { 35 | // Attach data to item 36 | item.bookNameTextView.text = bookSearchResultData.title 37 | item.publisherNameTextView.text = bookSearchResultData.publisher 38 | item.bookSmallThumbnail.load(bookSearchResultData.bookSmallThumbnail) 39 | item.searchResult.apply { 40 | setOnClickListener { 41 | onClick(bookSearchResultData) 42 | } 43 | } 44 | } 45 | } 46 | 47 | override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): BookSearchResultViewHolder { 48 | return BookSearchResultViewHolder( 49 | ActivityBookSearchResultBinding.inflate( 50 | LayoutInflater.from( 51 | parent.context 52 | ), parent, false 53 | ) 54 | ) 55 | } 56 | 57 | override fun onBindViewHolder(holder: BookSearchResultViewHolder, position: Int) { 58 | holder.bindData(data[position]) 59 | } 60 | 61 | override fun getItemCount(): Int { 62 | return data.size 63 | } 64 | } -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_book_wishlist_recycler_view.xml: -------------------------------------------------------------------------------- 1 | 2 | 17 | 18 | 24 | 25 | 37 | 38 | 51 | 52 | 60 | -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_splash.xml: -------------------------------------------------------------------------------- 1 | 16 | 17 | 23 | 24 | 36 | 37 | 48 | 49 | 59 | -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_server_error.xml: -------------------------------------------------------------------------------- 1 | 2 | 17 | 18 | 24 | 25 | 35 | 36 | 48 | 49 |