├── .github └── workflows │ └── build.yml ├── .gitignore ├── .idea ├── .gitignore ├── codeStyles │ ├── Project.xml │ └── codeStyleConfig.xml ├── compiler.xml ├── deploymentTargetDropDown.xml ├── deploymentTargetSelector.xml ├── git_toolbox_blame.xml ├── git_toolbox_prj.xml ├── gradle.xml ├── inspectionProfiles │ └── Project_Default.xml ├── kotlinc.xml ├── migrations.xml ├── misc.xml └── vcs.xml ├── README.md ├── app ├── .gitignore ├── build.gradle.kts ├── proguard-rules.pro ├── schemas │ └── com.kanyideveloper.muviz.favorites.data.data.local.FavoritesDatabase │ │ └── 4.json └── src │ └── main │ ├── AndroidManifest.xml │ ├── ic_launcher-playstore.png │ ├── java │ └── com │ │ └── kanyideveloper │ │ └── muviz │ │ ├── MainActivity.kt │ │ ├── MainViewModel.kt │ │ ├── MuvizApp.kt │ │ ├── about │ │ ├── domain │ │ │ └── model │ │ │ │ └── AccountItem.kt │ │ └── presentation │ │ │ ├── AboutScreen.kt │ │ │ └── AboutScreenUiEvents.kt │ │ ├── account │ │ └── presentation │ │ │ ├── AccountScreen.kt │ │ │ ├── AccountScreenUiEvents.kt │ │ │ └── AccountViewModel.kt │ │ ├── cast │ │ ├── data │ │ │ ├── network │ │ │ │ └── dto │ │ │ │ │ └── CastResponse.kt │ │ │ └── repository │ │ │ │ └── CastRepositoryImpl.kt │ │ ├── di │ │ │ └── CastModule.kt │ │ ├── domain │ │ │ ├── model │ │ │ │ ├── Cast.kt │ │ │ │ └── Credits.kt │ │ │ ├── repository │ │ │ │ └── CastRepository.kt │ │ │ └── usecase │ │ │ │ ├── GetCastDetailsUseCase.kt │ │ │ │ ├── GetMovieCastUseCase.kt │ │ │ │ └── GetTvCastUseCase.kt │ │ └── presentation │ │ │ ├── castdetails │ │ │ ├── CastDetailsEvents.kt │ │ │ ├── CastDetailsScreen.kt │ │ │ ├── CastDetailsUiState.kt │ │ │ └── CastDetailsViewModel.kt │ │ │ └── casts │ │ │ ├── CastsScreen.kt │ │ │ └── CastsUiEvents.kt │ │ ├── common │ │ ├── data │ │ │ ├── network │ │ │ │ └── TMDBApi.kt │ │ │ └── repository │ │ │ │ └── PreferenceRepositoryImpl.kt │ │ ├── di │ │ │ └── AppModule.kt │ │ ├── domain │ │ │ ├── model │ │ │ │ ├── BottomNavItem.kt │ │ │ │ └── Film.kt │ │ │ └── repository │ │ │ │ └── PreferenceRepository.kt │ │ ├── presentation │ │ │ ├── components │ │ │ │ ├── CircleButton.kt │ │ │ │ ├── StandardScaffold.kt │ │ │ │ └── StandardToolbar.kt │ │ │ └── theme │ │ │ │ ├── Color.kt │ │ │ │ ├── Dimensions.kt │ │ │ │ ├── Shape.kt │ │ │ │ ├── Theme.kt │ │ │ │ └── Type.kt │ │ └── util │ │ │ ├── Constants.kt │ │ │ ├── Resource.kt │ │ │ └── Utils.kt │ │ ├── favorites │ │ ├── data │ │ │ └── data │ │ │ │ ├── local │ │ │ │ ├── Favorite.kt │ │ │ │ ├── FavoritesDao.kt │ │ │ │ └── FavoritesDatabase.kt │ │ │ │ └── repository │ │ │ │ └── FavoritesRepositoryImpl.kt │ │ ├── di │ │ │ └── FavoritesModule.kt │ │ ├── domain │ │ │ └── repository │ │ │ │ └── FavoritesRepository.kt │ │ └── presentation │ │ │ ├── FavoritesScreen.kt │ │ │ └── FavoritesViewModel.kt │ │ ├── filmdetail │ │ ├── data │ │ │ ├── mappers │ │ │ │ └── FilmDetailsMappers.kt │ │ │ └── repository │ │ │ │ └── FilmsDetailsRepository.kt │ │ └── presentation │ │ │ ├── FilmDetailsScreen.kt │ │ │ ├── FilmDetailsUiEvents.kt │ │ │ ├── FilmDetailsUiState.kt │ │ │ ├── FilmDetailsViewModel.kt │ │ │ └── common │ │ │ ├── CastDetails.kt │ │ │ ├── FilmActions.kt │ │ │ ├── FilmImageBanner.kt │ │ │ ├── FilmInfo.kt │ │ │ ├── FilmNameAndRating.kt │ │ │ └── VoteAverageRatingIndicator.kt │ │ ├── genre │ │ ├── data │ │ │ ├── mappers │ │ │ │ └── GenreMappers.kt │ │ │ ├── network │ │ │ │ └── dto │ │ │ │ │ └── GenreResponse.kt │ │ │ └── repository │ │ │ │ └── GenreRepositoryImpl.kt │ │ ├── di │ │ │ └── GenreModule.kt │ │ └── domain │ │ │ ├── model │ │ │ └── Genre.kt │ │ │ ├── repository │ │ │ └── GenreRepository.kt │ │ │ └── usecase │ │ │ ├── GetMovieGenresUseCase.kt │ │ │ └── GetTvSeriesGenresUseCase.kt │ │ ├── home │ │ ├── data │ │ │ ├── network │ │ │ │ └── dto │ │ │ │ │ ├── CreditsResponse.kt │ │ │ │ │ ├── MovieDetails.kt │ │ │ │ │ ├── MoviesResponse.kt │ │ │ │ │ ├── TvSeriesDetails.kt │ │ │ │ │ └── TvSeriesResponse.kt │ │ │ ├── paging │ │ │ │ ├── AiringTodayTvSeriesSource.kt │ │ │ │ ├── NowPlayingMoviesSource.kt │ │ │ │ ├── OnTheAirSeriesSource.kt │ │ │ │ ├── PopularMoviesSource.kt │ │ │ │ ├── PopularSeriesSource.kt │ │ │ │ ├── TopRatedMoviesSource.kt │ │ │ │ ├── TopRatedSeriesSource.kt │ │ │ │ ├── TrendingMoviesSource.kt │ │ │ │ ├── TrendingSeriesSource.kt │ │ │ │ └── UpcomingMoviesSource.kt │ │ │ └── repository │ │ │ │ ├── MoviesRepository.kt │ │ │ │ └── TvSeriesRepository.kt │ │ ├── di │ │ │ └── HomeModule.kt │ │ ├── domain │ │ │ └── model │ │ │ │ ├── Movie.kt │ │ │ │ └── Series.kt │ │ └── presentation │ │ │ ├── HomeScreen.kt │ │ │ ├── HomeUiEvents.kt │ │ │ ├── HomeUiState.kt │ │ │ └── HomeViewModel.kt │ │ └── search │ │ ├── data │ │ ├── network │ │ │ └── dto │ │ │ │ └── MultiSearchResponse.kt │ │ ├── paging │ │ │ └── SearchPagingSource.kt │ │ └── repository │ │ │ └── SearchRepositoryImpl.kt │ │ ├── di │ │ └── SearchModule.kt │ │ ├── domain │ │ ├── model │ │ │ └── Search.kt │ │ ├── repository │ │ │ └── SearchRepository.kt │ │ └── usecase │ │ │ └── SearchFilmUseCase.kt │ │ └── presentation │ │ ├── SearchScreen.kt │ │ ├── SearchUiEvents.kt │ │ ├── SearchUiState.kt │ │ └── SearchViewModel.kt │ └── res │ ├── drawable │ ├── dark_mode.xml │ ├── ic__facebook.xml │ ├── ic__linkedin.xml │ ├── ic__search_biggy.xml │ ├── ic_chevron_left.xml │ ├── ic_chevron_right.xml │ ├── ic_danger_circle.xml │ ├── ic_empty_cuate.xml │ ├── ic_github.xml │ ├── ic_home.xml │ ├── ic_launcher_foreground.xml │ ├── ic_placeholder.xml │ ├── ic_profile.xml │ ├── ic_search.xml │ ├── ic_share.xml │ ├── ic_socials.xml │ ├── ic_star.xml │ ├── ic_theme.xml │ ├── ic_twitter.xml │ ├── light_mode.xml │ ├── muviz.png │ ├── settings_suggest.xml │ ├── wallpaper.xml │ └── window_background.xml │ ├── font │ ├── quicksand_bold.ttf │ ├── quicksand_light.ttf │ ├── quicksand_medium.ttf │ ├── quicksand_regular.ttf │ └── quicksand_semibold.ttf │ ├── mipmap-anydpi-v26 │ ├── ic_launcher.xml │ └── ic_launcher_round.xml │ ├── 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 │ └── values │ ├── colors.xml │ ├── ic_launcher_background.xml │ ├── strings.xml │ └── themes.xml ├── build.gradle.kts ├── gradle.properties ├── gradle ├── libs.versions.toml └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── gradlew ├── gradlew.bat ├── renovate.json ├── screenshots ├── account_dark.png ├── account_light.png ├── cast_dark.png ├── cast_light.png ├── details_dark.png ├── details_light.png ├── favorites_dark.png ├── favorites_light.png ├── home_dark.png ├── home_light.png ├── muviz.png ├── search_dark.png └── search_light.png ├── settings.gradle.kts └── spotless └── copyright.kt /.github/workflows/build.yml: -------------------------------------------------------------------------------- 1 | name: Build 2 | 3 | on: 4 | push: 5 | branches: [ main ] 6 | pull_request: 7 | branches: [ main ] 8 | 9 | concurrency: 10 | group: build-${{ github.ref }} 11 | cancel-in-progress: true 12 | 13 | jobs: 14 | build_android_app: 15 | name: Build Android App 16 | runs-on: ubuntu-latest 17 | steps: 18 | - name: Checkout code 19 | uses: actions/checkout@v4 20 | 21 | - name: Validate Gradle Wrapper 22 | uses: gradle/wrapper-validation-action@v3 23 | 24 | - name: Set up JDK 17 25 | uses: actions/setup-java@v4 26 | with: 27 | java-version: '17' 28 | distribution: 'adopt' 29 | cache: gradle 30 | 31 | - name: Make gradle executable 32 | run: chmod +x ./gradlew 33 | 34 | - name: Get local.properties from secrets 35 | run: echo "${{secrets.LOCAL_PROPERTIES }}" > $GITHUB_WORKSPACE/local.properties 36 | 37 | - name: Build app 38 | run: ./gradlew assembleDebug --stacktrace -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Gradle 2 | .gradle 3 | build/ 4 | 5 | captures 6 | 7 | /local.properties 8 | 9 | # IntelliJ .idea folder 10 | .idea/workspace.xml 11 | .idea/misc.xml 12 | .idea/libraries 13 | .idea/caches 14 | .idea/navEditor.xml 15 | .idea/tasks.xml 16 | .idea/modules.xml 17 | .idea/compiler.xml 18 | .idea/jarRepositories.xml 19 | .idea/deploymentTargetDropDown.xml 20 | .idea/androidTestResultsUserPreferences.xml 21 | .idea/appInsightsSettings.xml 22 | .idea/artifacts 23 | gradle.xml 24 | *.iml 25 | .fleet 26 | 27 | # General 28 | .DS_Store 29 | .externalNativeBuild 30 | 31 | # Do not commit plain-text release keys 32 | app-release.jks 33 | play-account.p12 34 | play-account.json 35 | 36 | # Do not commit firebase config 37 | google-services.json 38 | 39 | # VS Code config 40 | org.eclipse.buildship.core.prefs 41 | .classpath 42 | .project 43 | bin/ 44 | 45 | # Docs 46 | site/ 47 | .cache/ 48 | 49 | # Ignore baseline profile files in samples 50 | sample/**/generated 51 | 52 | ########################################################################################## 53 | # Imported from https://github.com/github/gitignore/blob/main/Swift.gitignore 54 | ########################################################################################## 55 | 56 | # Xcode 57 | # 58 | # gitignore contributors: remember to update Global/Xcode.gitignore, Objective-C.gitignore & Swift.gitignore 59 | 60 | ## User settings 61 | xcuserdata/ 62 | 63 | ## Obj-C/Swift specific 64 | *.hmap 65 | 66 | ## App packaging 67 | *.ipa 68 | *.dSYM.zip 69 | *.dSYM 70 | 71 | ## Playgrounds 72 | timeline.xctimeline 73 | playground.xcworkspace 74 | 75 | # Swift Package Manager 76 | # 77 | # Add this line if you want to avoid checking in source code from Swift Package Manager dependencies. 78 | # Packages/ 79 | # Package.pins 80 | # Package.resolved 81 | # *.xcodeproj 82 | # 83 | # Xcode automatically generates this directory with a .xcworkspacedata file and xcuserdata 84 | # hence it is not needed unless you have added a package configuration file to your project 85 | # .swiftpm 86 | 87 | .build/ 88 | 89 | # fastlane 90 | # 91 | # It is recommended to not store the screenshots in the git repo. 92 | # Instead, use fastlane to re-generate the screenshots whenever they are needed. 93 | # For more information about the recommended setup visit: 94 | # https://docs.fastlane.tools/best-practices/source-control/#source-control 95 | 96 | report.xml 97 | Preview.html 98 | screenshots/**/*.png 99 | test_output 100 | 101 | *.env* 102 | 103 | .kotlin 104 | 105 | keystore/ -------------------------------------------------------------------------------- /.idea/.gitignore: -------------------------------------------------------------------------------- 1 | # Default ignored files 2 | /shelf/ 3 | /workspace.xml 4 | # GitHub Copilot persisted chat sessions 5 | /copilot/chatSessions 6 | -------------------------------------------------------------------------------- /.idea/codeStyles/Project.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 6 | 7 | 119 | 120 | 122 | 123 | -------------------------------------------------------------------------------- /.idea/codeStyles/codeStyleConfig.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | -------------------------------------------------------------------------------- /.idea/compiler.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /.idea/deploymentTargetDropDown.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /.idea/deploymentTargetSelector.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /.idea/git_toolbox_blame.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 6 | -------------------------------------------------------------------------------- /.idea/git_toolbox_prj.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 9 | 14 | 15 | -------------------------------------------------------------------------------- /.idea/gradle.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 18 | 19 | -------------------------------------------------------------------------------- /.idea/inspectionProfiles/Project_Default.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 41 | -------------------------------------------------------------------------------- /.idea/kotlinc.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 6 | -------------------------------------------------------------------------------- /.idea/migrations.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 9 | 10 | -------------------------------------------------------------------------------- /.idea/misc.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 33 | 34 | 35 | 36 | 37 | 38 | 40 | -------------------------------------------------------------------------------- /.idea/vcs.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /app/.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 | 17 | /gradle.properties 18 | -------------------------------------------------------------------------------- /app/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | ## Retrofit 2 | ## https://github.com/square/retrofit/blob/master/retrofit/src/main/resources/META-INF/proguard/retrofit2.pro 3 | 4 | -keepattributes Signature, InnerClasses, EnclosingMethod 5 | -keepattributes RuntimeVisibleAnnotations, RuntimeVisibleParameterAnnotations 6 | 7 | -keepclassmembers,allowshrinking,allowobfuscation interface * { 8 | @retrofit2.http.* ; 9 | } 10 | 11 | -dontwarn org.codehaus.mojo.animal_sniffer.IgnoreJRERequirement 12 | -dontwarn javax.annotation.** 13 | -dontwarn kotlin.Unit 14 | -dontwarn retrofit2.KotlinExtensions 15 | -dontwarn retrofit2.KotlinExtensions$* 16 | 17 | -if interface * { @retrofit2.http.* ; } 18 | -keep,allowobfuscation interface <1> 19 | 20 | ## OkHttp 21 | ## https://github.com/square/okhttp/blob/master/okhttp/src/main/resources/META-INF/proguard/okhttp3.pro 22 | 23 | -dontwarn javax.annotation.** 24 | -keepnames class okhttp3.internal.publicsuffix.PublicSuffixDatabase 25 | -dontwarn org.codehaus.mojo.animal_sniffer.* 26 | -dontwarn okhttp3.internal.platform.ConscryptPlatform 27 | 28 | ## Gson 29 | ## https://github.com/google/gson/blob/master/examples/android-proguard-example/proguard.cfg 30 | 31 | -keepattributes Signature 32 | -keepattributes *Annotation* 33 | 34 | -dontwarn sun.misc.** 35 | 36 | -keep class * implements com.google.gson.TypeAdapter 37 | -keep class * implements com.google.gson.TypeAdapterFactory 38 | -keep class * implements com.google.gson.JsonSerializer 39 | -keep class * implements com.google.gson.JsonDeserializer 40 | 41 | -keepclassmembers,allowobfuscation class * { 42 | @com.google.gson.annotations.SerializedName ; 43 | } 44 | 45 | -keep,allowobfuscation,allowshrinking class com.google.gson.reflect.TypeToken 46 | -keep,allowobfuscation,allowshrinking class * extends com.google.gson.reflect.TypeToken 47 | 48 | ## Dagger 49 | ## https://github.com/google/dagger/blob/master/java/dagger/android/proguard.cfg 50 | 51 | -dontwarn com.google.errorprone.annotations.** 52 | 53 | ## Coroutines 54 | ## https://github.com/Kotlin/kotlinx.coroutines/blob/master/core/kotlinx-coroutines-core/resources/META-INF/proguard/coroutines.pro 55 | 56 | -keepnames class kotlinx.coroutines.internal.MainDispatcherFactory {} 57 | -keepnames class kotlinx.coroutines.CoroutineExceptionHandler {} 58 | -keepnames class kotlinx.coroutines.android.AndroidExceptionPreHandler {} 59 | -keepnames class kotlinx.coroutines.android.AndroidDispatcherFactory {} 60 | 61 | -keepclassmembernames class kotlinx.** { 62 | volatile ; 63 | } 64 | 65 | -keepattributes SourceFile,LineNumberTable 66 | -renamesourcefileattribute SourceFile 67 | 68 | -optimizations !code/allocation/variable 69 | 70 | -keepclassmembers enum * { *; } 71 | -------------------------------------------------------------------------------- /app/schemas/com.kanyideveloper.muviz.favorites.data.data.local.FavoritesDatabase/4.json: -------------------------------------------------------------------------------- 1 | { 2 | "formatVersion": 1, 3 | "database": { 4 | "version": 4, 5 | "identityHash": "14fb4481fb8e7c01fbac74fb64db1132", 6 | "entities": [ 7 | { 8 | "tableName": "favorites_table", 9 | "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`favorite` INTEGER NOT NULL, `mediaId` INTEGER NOT NULL, `mediaType` TEXT NOT NULL, `image` TEXT NOT NULL, `title` TEXT NOT NULL, `releaseDate` TEXT NOT NULL, `rating` REAL NOT NULL, `overview` TEXT NOT NULL, PRIMARY KEY(`mediaId`))", 10 | "fields": [ 11 | { 12 | "fieldPath": "favorite", 13 | "columnName": "favorite", 14 | "affinity": "INTEGER", 15 | "notNull": true 16 | }, 17 | { 18 | "fieldPath": "mediaId", 19 | "columnName": "mediaId", 20 | "affinity": "INTEGER", 21 | "notNull": true 22 | }, 23 | { 24 | "fieldPath": "mediaType", 25 | "columnName": "mediaType", 26 | "affinity": "TEXT", 27 | "notNull": true 28 | }, 29 | { 30 | "fieldPath": "image", 31 | "columnName": "image", 32 | "affinity": "TEXT", 33 | "notNull": true 34 | }, 35 | { 36 | "fieldPath": "title", 37 | "columnName": "title", 38 | "affinity": "TEXT", 39 | "notNull": true 40 | }, 41 | { 42 | "fieldPath": "releaseDate", 43 | "columnName": "releaseDate", 44 | "affinity": "TEXT", 45 | "notNull": true 46 | }, 47 | { 48 | "fieldPath": "rating", 49 | "columnName": "rating", 50 | "affinity": "REAL", 51 | "notNull": true 52 | }, 53 | { 54 | "fieldPath": "overview", 55 | "columnName": "overview", 56 | "affinity": "TEXT", 57 | "notNull": true 58 | } 59 | ], 60 | "primaryKey": { 61 | "autoGenerate": false, 62 | "columnNames": [ 63 | "mediaId" 64 | ] 65 | }, 66 | "indices": [], 67 | "foreignKeys": [] 68 | } 69 | ], 70 | "views": [], 71 | "setupQueries": [ 72 | "CREATE TABLE IF NOT EXISTS room_master_table (id INTEGER PRIMARY KEY,identity_hash TEXT)", 73 | "INSERT OR REPLACE INTO room_master_table (id,identity_hash) VALUES(42, '14fb4481fb8e7c01fbac74fb64db1132')" 74 | ] 75 | } 76 | } -------------------------------------------------------------------------------- /app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 14 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /app/src/main/ic_launcher-playstore.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/joelkanyi/Muviz/032640d9946cdb0eddde15b05ab928ddf4d0bfea/app/src/main/ic_launcher-playstore.png -------------------------------------------------------------------------------- /app/src/main/java/com/kanyideveloper/muviz/MainViewModel.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2024 Joel Kanyi. 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 | package com.kanyideveloper.muviz 17 | 18 | import androidx.lifecycle.ViewModel 19 | import androidx.lifecycle.viewModelScope 20 | import com.kanyideveloper.muviz.common.domain.repository.PreferenceRepository 21 | import dagger.hilt.android.lifecycle.HiltViewModel 22 | import kotlinx.coroutines.flow.SharingStarted 23 | import kotlinx.coroutines.flow.stateIn 24 | import javax.inject.Inject 25 | 26 | @HiltViewModel 27 | class MainViewModel @Inject constructor( 28 | preferenceRepository: PreferenceRepository, 29 | ) : ViewModel() { 30 | val theme = preferenceRepository.getTheme() 31 | .stateIn( 32 | scope = viewModelScope, 33 | started = SharingStarted.WhileSubscribed(5_000), 34 | initialValue = 0, 35 | ) 36 | } 37 | -------------------------------------------------------------------------------- /app/src/main/java/com/kanyideveloper/muviz/MuvizApp.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2024 Joel Kanyi. 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 | package com.kanyideveloper.muviz 17 | 18 | import android.app.Application 19 | import dagger.hilt.android.HiltAndroidApp 20 | import timber.log.Timber 21 | 22 | @HiltAndroidApp 23 | class MuvizApp : Application() { 24 | override fun onCreate() { 25 | super.onCreate() 26 | initTimber() 27 | } 28 | 29 | private fun initTimber() { 30 | Timber.plant(Timber.DebugTree()) 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /app/src/main/java/com/kanyideveloper/muviz/about/domain/model/AccountItem.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2024 Joel Kanyi. 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 | package com.kanyideveloper.muviz.about.domain.model 17 | 18 | data class AccountItem( 19 | val title: String, 20 | val icon: Int 21 | ) 22 | -------------------------------------------------------------------------------- /app/src/main/java/com/kanyideveloper/muviz/about/presentation/AboutScreenUiEvents.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2024 Joel Kanyi. 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 | package com.kanyideveloper.muviz.about.presentation 17 | 18 | sealed interface AboutScreenUiEvents { 19 | data object NavigateBack : AboutScreenUiEvents 20 | } 21 | -------------------------------------------------------------------------------- /app/src/main/java/com/kanyideveloper/muviz/account/presentation/AccountScreenUiEvents.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2024 Joel Kanyi. 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 | package com.kanyideveloper.muviz.account.presentation 17 | 18 | sealed interface AccountScreenUiEvents { 19 | data object NavigateToAbout : AccountScreenUiEvents 20 | data object OpenSocialsDialog : AccountScreenUiEvents 21 | data object OnRateUsClicked : AccountScreenUiEvents 22 | data object OnShareClicked : AccountScreenUiEvents 23 | data object ShowThemesDialog: AccountScreenUiEvents 24 | } 25 | -------------------------------------------------------------------------------- /app/src/main/java/com/kanyideveloper/muviz/account/presentation/AccountViewModel.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2024 Joel Kanyi. 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 | package com.kanyideveloper.muviz.account.presentation 17 | 18 | import androidx.lifecycle.ViewModel 19 | import androidx.lifecycle.viewModelScope 20 | import com.kanyideveloper.muviz.common.domain.repository.PreferenceRepository 21 | import dagger.hilt.android.lifecycle.HiltViewModel 22 | import kotlinx.coroutines.flow.SharingStarted 23 | import kotlinx.coroutines.flow.stateIn 24 | import kotlinx.coroutines.launch 25 | import javax.inject.Inject 26 | 27 | @HiltViewModel 28 | class AccountViewModel @Inject constructor( 29 | private val preferenceRepository: PreferenceRepository 30 | ) : ViewModel() { 31 | val theme = preferenceRepository.getTheme() 32 | .stateIn( 33 | scope = viewModelScope, 34 | started = SharingStarted.WhileSubscribed(5_000), 35 | initialValue = 0, 36 | ) 37 | fun updateTheme(themeValue: Int) { 38 | viewModelScope.launch { 39 | preferenceRepository.saveTheme(themeValue) 40 | } 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /app/src/main/java/com/kanyideveloper/muviz/cast/data/network/dto/CastResponse.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2024 Joel Kanyi. 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 | package com.kanyideveloper.muviz.cast.data.network.dto 17 | 18 | import com.google.gson.annotations.SerializedName 19 | 20 | data class CastResponse( 21 | @SerializedName("adult") 22 | val adult: Boolean, 23 | @SerializedName("cast_id") 24 | val castId: Int, 25 | @SerializedName("character") 26 | val character: String, 27 | @SerializedName("credit_id") 28 | val creditId: String, 29 | @SerializedName("gender") 30 | val gender: Int, 31 | @SerializedName("id") 32 | val id: Int, 33 | @SerializedName("known_for_department") 34 | val knownForDepartment: String, 35 | @SerializedName("name") 36 | val name: String, 37 | @SerializedName("order") 38 | val order: Int, 39 | @SerializedName("original_name") 40 | val originalName: String, 41 | @SerializedName("popularity") 42 | val popularity: Double, 43 | @SerializedName("profile_path") 44 | val profilePath: String? = "https://pixy.org/src/9/94083.png" 45 | ) 46 | -------------------------------------------------------------------------------- /app/src/main/java/com/kanyideveloper/muviz/cast/data/repository/CastRepositoryImpl.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2024 Joel Kanyi. 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 | package com.kanyideveloper.muviz.cast.data.repository 17 | 18 | import com.kanyideveloper.muviz.cast.domain.model.Credits 19 | import com.kanyideveloper.muviz.cast.domain.repository.CastRepository 20 | import com.kanyideveloper.muviz.common.data.network.TMDBApi 21 | import com.kanyideveloper.muviz.common.util.Resource 22 | import com.kanyideveloper.muviz.filmdetail.data.mappers.toDomain 23 | import timber.log.Timber 24 | import javax.inject.Inject 25 | 26 | class CastRepositoryImpl @Inject constructor( 27 | private val api: TMDBApi, 28 | ) : CastRepository { 29 | // Series Casts 30 | override suspend fun getTvSeriesCasts(id: Int): Resource { 31 | val response = try { 32 | api.getTvSeriesCredits(id) 33 | } catch (e: Exception) { 34 | Timber.d(e.message) 35 | return Resource.Error("Unknown error occurred") 36 | } 37 | 38 | Timber.d("Series cast $response") 39 | return Resource.Success(response.toDomain()) 40 | } 41 | 42 | // Movie Casts 43 | override suspend fun getMovieCasts(id: Int): Resource { 44 | val response = try { 45 | api.getMovieCredits(id) 46 | } catch (e: Exception) { 47 | Timber.d(e.message) 48 | return Resource.Error("Unknown error occurred") 49 | } 50 | 51 | Timber.d("Movie Casts $response") 52 | return Resource.Success(response.toDomain()) 53 | } 54 | 55 | override suspend fun getCastDetails(id: Int): Resource { 56 | val response = try { 57 | api.getCreditDetails(creditId = id) 58 | } catch (e: Exception) { 59 | Timber.d(e.message) 60 | return Resource.Error("Unknown error occurred") 61 | } 62 | Timber.d("Cast Details $response") 63 | return Resource.Success(Unit) 64 | } 65 | } 66 | -------------------------------------------------------------------------------- /app/src/main/java/com/kanyideveloper/muviz/cast/di/CastModule.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2024 Joel Kanyi. 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 | package com.kanyideveloper.muviz.cast.di 17 | 18 | import com.kanyideveloper.muviz.cast.data.repository.CastRepositoryImpl 19 | import com.kanyideveloper.muviz.cast.domain.repository.CastRepository 20 | import dagger.Binds 21 | import dagger.Module 22 | import dagger.hilt.InstallIn 23 | import dagger.hilt.components.SingletonComponent 24 | 25 | @Module 26 | @InstallIn(SingletonComponent::class) 27 | abstract class CastModule { 28 | @Binds 29 | abstract fun bindCastRepository( 30 | castRepositoryImpl: CastRepositoryImpl 31 | ): CastRepository 32 | } 33 | -------------------------------------------------------------------------------- /app/src/main/java/com/kanyideveloper/muviz/cast/domain/model/Cast.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2024 Joel Kanyi. 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 | package com.kanyideveloper.muviz.cast.domain.model 17 | 18 | import android.os.Parcelable 19 | import kotlinx.parcelize.Parcelize 20 | 21 | @Parcelize 22 | data class Cast( 23 | val adult: Boolean, 24 | val castId: Int, 25 | val character: String, 26 | val creditId: String, 27 | val gender: Int, 28 | val id: Int, 29 | val knownForDepartment: String, 30 | val name: String, 31 | val order: Int, 32 | val originalName: String, 33 | val popularity: Double, 34 | val profilePath: String?, 35 | ): Parcelable 36 | -------------------------------------------------------------------------------- /app/src/main/java/com/kanyideveloper/muviz/cast/domain/model/Credits.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2024 Joel Kanyi. 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 | package com.kanyideveloper.muviz.cast.domain.model 17 | 18 | import android.os.Parcelable 19 | import kotlinx.parcelize.Parcelize 20 | 21 | @Parcelize 22 | data class Credits( 23 | val cast: List, 24 | val id: Int 25 | ) : Parcelable 26 | -------------------------------------------------------------------------------- /app/src/main/java/com/kanyideveloper/muviz/cast/domain/repository/CastRepository.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2024 Joel Kanyi. 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 | package com.kanyideveloper.muviz.cast.domain.repository 17 | 18 | import com.kanyideveloper.muviz.cast.domain.model.Credits 19 | import com.kanyideveloper.muviz.common.util.Resource 20 | 21 | interface CastRepository { 22 | suspend fun getTvSeriesCasts(id: Int): Resource 23 | suspend fun getMovieCasts(id: Int): Resource 24 | suspend fun getCastDetails(id: Int): Resource 25 | } 26 | -------------------------------------------------------------------------------- /app/src/main/java/com/kanyideveloper/muviz/cast/domain/usecase/GetCastDetailsUseCase.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2024 Joel Kanyi. 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 | package com.kanyideveloper.muviz.cast.domain.usecase 17 | 18 | import com.kanyideveloper.muviz.cast.domain.repository.CastRepository 19 | import javax.inject.Inject 20 | 21 | class GetCastDetailsUseCase @Inject constructor( 22 | private val repository: CastRepository 23 | ) { 24 | suspend operator fun invoke(id: Int) = repository.getCastDetails(id) 25 | } 26 | -------------------------------------------------------------------------------- /app/src/main/java/com/kanyideveloper/muviz/cast/domain/usecase/GetMovieCastUseCase.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2024 Joel Kanyi. 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 | package com.kanyideveloper.muviz.cast.domain.usecase 17 | 18 | import com.kanyideveloper.muviz.cast.domain.repository.CastRepository 19 | import javax.inject.Inject 20 | 21 | class GetMovieCastUseCase @Inject constructor( 22 | private val repository: CastRepository 23 | ) { 24 | suspend operator fun invoke(id: Int) = repository.getMovieCasts(id) 25 | } 26 | -------------------------------------------------------------------------------- /app/src/main/java/com/kanyideveloper/muviz/cast/domain/usecase/GetTvCastUseCase.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2024 Joel Kanyi. 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 | package com.kanyideveloper.muviz.cast.domain.usecase 17 | 18 | import com.kanyideveloper.muviz.cast.domain.repository.CastRepository 19 | import javax.inject.Inject 20 | 21 | class GetTvCastUseCase @Inject constructor( 22 | private val repository: CastRepository, 23 | ) { 24 | suspend operator fun invoke(id: Int) = repository.getTvSeriesCasts(id) 25 | } 26 | -------------------------------------------------------------------------------- /app/src/main/java/com/kanyideveloper/muviz/cast/presentation/castdetails/CastDetailsEvents.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2024 Joel Kanyi. 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 | package com.kanyideveloper.muviz.cast.presentation.castdetails 17 | 18 | sealed interface CastDetailsEvents { 19 | data object NavigateBack : CastDetailsEvents 20 | } 21 | -------------------------------------------------------------------------------- /app/src/main/java/com/kanyideveloper/muviz/cast/presentation/castdetails/CastDetailsUiState.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2024 Joel Kanyi. 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 | package com.kanyideveloper.muviz.cast.presentation.castdetails 17 | 18 | data class CastDetailsUiState( 19 | val isLoading: Boolean = false, 20 | val castDetails: Any? = null, 21 | val error: String? = null 22 | ) 23 | -------------------------------------------------------------------------------- /app/src/main/java/com/kanyideveloper/muviz/cast/presentation/castdetails/CastDetailsViewModel.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2024 Joel Kanyi. 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 | package com.kanyideveloper.muviz.cast.presentation.castdetails 17 | 18 | import androidx.lifecycle.ViewModel 19 | import androidx.lifecycle.viewModelScope 20 | import com.kanyideveloper.muviz.cast.domain.usecase.GetCastDetailsUseCase 21 | import com.kanyideveloper.muviz.common.util.Resource 22 | import dagger.hilt.android.lifecycle.HiltViewModel 23 | import kotlinx.coroutines.flow.MutableStateFlow 24 | import kotlinx.coroutines.flow.asStateFlow 25 | import kotlinx.coroutines.flow.update 26 | import kotlinx.coroutines.launch 27 | import javax.inject.Inject 28 | 29 | @HiltViewModel 30 | class CastDetailsViewModel @Inject constructor( 31 | private val getCastDetailsUseCase: GetCastDetailsUseCase, 32 | ) : ViewModel() { 33 | private val _castDetailsUiState = MutableStateFlow(CastDetailsUiState()) 34 | val castDetailsUiState = _castDetailsUiState.asStateFlow() 35 | fun getCastDetails(id: Int) { 36 | viewModelScope.launch { 37 | _castDetailsUiState.update { 38 | it.copy( 39 | isLoading = true 40 | ) 41 | } 42 | when (val result = getCastDetailsUseCase(id)) { 43 | is Resource.Error -> { 44 | _castDetailsUiState.update { 45 | it.copy( 46 | isLoading = false, 47 | error = result.message 48 | ) 49 | } 50 | } 51 | is Resource.Success -> { 52 | _castDetailsUiState.update { 53 | it.copy( 54 | isLoading = false, 55 | castDetails = result.data 56 | ) 57 | } 58 | } 59 | else -> { 60 | castDetailsUiState 61 | } 62 | } 63 | } 64 | } 65 | } 66 | -------------------------------------------------------------------------------- /app/src/main/java/com/kanyideveloper/muviz/cast/presentation/casts/CastsUiEvents.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2024 Joel Kanyi. 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 | package com.kanyideveloper.muviz.cast.presentation.casts 17 | 18 | import com.kanyideveloper.muviz.cast.domain.model.Cast 19 | 20 | sealed interface CastsUiEvents { 21 | data class NavigateToCastDetails(val cast: Cast) : 22 | CastsUiEvents 23 | 24 | data object NavigateBack : CastsUiEvents 25 | } 26 | -------------------------------------------------------------------------------- /app/src/main/java/com/kanyideveloper/muviz/common/data/repository/PreferenceRepositoryImpl.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2024 Joel Kanyi. 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 | package com.kanyideveloper.muviz.common.data.repository 17 | 18 | import androidx.appcompat.app.AppCompatDelegate 19 | import androidx.datastore.core.DataStore 20 | import androidx.datastore.preferences.core.Preferences 21 | import androidx.datastore.preferences.core.edit 22 | import com.kanyideveloper.muviz.common.domain.repository.PreferenceRepository 23 | import com.kanyideveloper.muviz.common.util.Constants 24 | import kotlinx.coroutines.flow.Flow 25 | import kotlinx.coroutines.flow.map 26 | 27 | class PreferenceRepositoryImpl( 28 | private val dataStore: DataStore, 29 | ) : PreferenceRepository { 30 | override suspend fun saveTheme(themeValue: Int) { 31 | dataStore.edit { preferences -> 32 | preferences[Constants.THEME_OPTIONS] = themeValue 33 | } 34 | } 35 | 36 | override fun getTheme(): Flow { 37 | return dataStore.data.map { preferences -> 38 | preferences[Constants.THEME_OPTIONS] ?: AppCompatDelegate.MODE_NIGHT_FOLLOW_SYSTEM 39 | } 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /app/src/main/java/com/kanyideveloper/muviz/common/domain/model/BottomNavItem.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2024 Joel Kanyi. 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 | package com.kanyideveloper.muviz.common.domain.model 17 | 18 | import com.kanyideveloper.muviz.R 19 | import com.ramcosta.composedestinations.generated.destinations.AccountScreenDestination 20 | import com.ramcosta.composedestinations.generated.destinations.FavoritesScreenDestination 21 | import com.ramcosta.composedestinations.generated.destinations.HomeScreenDestination 22 | import com.ramcosta.composedestinations.generated.destinations.SearchScreenDestination 23 | 24 | sealed class BottomNavItem( 25 | val title: String, 26 | val icon: Int, 27 | val route: String, 28 | ) { 29 | data object Home : BottomNavItem( 30 | title = "Home", 31 | icon = R.drawable.ic_home, 32 | route = HomeScreenDestination.route 33 | ) 34 | data object Search: BottomNavItem( 35 | title = "Search", 36 | icon = R.drawable.ic_search, 37 | route = SearchScreenDestination.route, 38 | ) 39 | data object Favorites: BottomNavItem( 40 | title = "Favorites", 41 | icon = R.drawable.ic_star, 42 | route = FavoritesScreenDestination.route 43 | ) 44 | data object Account: BottomNavItem( 45 | title = "Account", 46 | icon = R.drawable.ic_profile, 47 | route = AccountScreenDestination.route 48 | ) 49 | } 50 | -------------------------------------------------------------------------------- /app/src/main/java/com/kanyideveloper/muviz/common/domain/model/Film.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2024 Joel Kanyi. 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 | package com.kanyideveloper.muviz.common.domain.model 17 | 18 | import android.os.Parcelable 19 | import kotlinx.parcelize.Parcelize 20 | 21 | @Parcelize 22 | data class Film( 23 | val id: Int, 24 | val type: String, 25 | val image: String, 26 | val category: String, 27 | val name: String, 28 | val rating: Float, 29 | val releaseDate: String, 30 | val overview: String 31 | ) : Parcelable 32 | -------------------------------------------------------------------------------- /app/src/main/java/com/kanyideveloper/muviz/common/domain/repository/PreferenceRepository.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2024 Joel Kanyi. 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 | package com.kanyideveloper.muviz.common.domain.repository 17 | 18 | import kotlinx.coroutines.flow.Flow 19 | 20 | interface PreferenceRepository { 21 | suspend fun saveTheme(themeValue: Int) 22 | fun getTheme(): Flow 23 | } 24 | -------------------------------------------------------------------------------- /app/src/main/java/com/kanyideveloper/muviz/common/presentation/components/CircleButton.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2024 Joel Kanyi. 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 | package com.kanyideveloper.muviz.common.presentation.components 17 | 18 | import androidx.compose.foundation.BorderStroke 19 | import androidx.compose.foundation.background 20 | import androidx.compose.foundation.border 21 | import androidx.compose.foundation.clickable 22 | import androidx.compose.foundation.layout.Box 23 | import androidx.compose.foundation.layout.size 24 | import androidx.compose.foundation.shape.CircleShape 25 | import androidx.compose.material3.MaterialTheme 26 | import androidx.compose.runtime.Composable 27 | import androidx.compose.ui.Alignment 28 | import androidx.compose.ui.Modifier 29 | import androidx.compose.ui.graphics.Color 30 | import androidx.compose.ui.unit.dp 31 | 32 | @Composable 33 | fun CircleButton( 34 | modifier: Modifier = Modifier, 35 | onClick: () -> Unit, 36 | containerColor: Color = MaterialTheme.colorScheme.primary, 37 | borderStroke: BorderStroke? = null, 38 | content: @Composable () -> Unit 39 | ) { 40 | Box( 41 | modifier = modifier 42 | .size(40.dp) 43 | .border(borderStroke ?: BorderStroke(0.dp, containerColor), CircleShape) 44 | .background( 45 | color = containerColor, 46 | shape = CircleShape 47 | ) 48 | .clickable { onClick() }, 49 | contentAlignment = Alignment.Center, 50 | ) { 51 | content() 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /app/src/main/java/com/kanyideveloper/muviz/common/presentation/components/StandardScaffold.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2024 Joel Kanyi. 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 | package com.kanyideveloper.muviz.common.presentation.components 17 | 18 | import androidx.compose.foundation.layout.PaddingValues 19 | import androidx.compose.foundation.layout.size 20 | import androidx.compose.material3.Icon 21 | import androidx.compose.material3.MaterialTheme 22 | import androidx.compose.material3.NavigationBar 23 | import androidx.compose.material3.NavigationBarItem 24 | import androidx.compose.material3.Scaffold 25 | import androidx.compose.material3.Text 26 | import androidx.compose.runtime.Composable 27 | import androidx.compose.runtime.getValue 28 | import androidx.compose.ui.Modifier 29 | import androidx.compose.ui.res.painterResource 30 | import androidx.compose.ui.unit.dp 31 | import androidx.navigation.NavController 32 | import androidx.navigation.compose.currentBackStackEntryAsState 33 | import com.kanyideveloper.muviz.common.domain.model.BottomNavItem 34 | 35 | 36 | @Composable 37 | fun StandardScaffold( 38 | navController: NavController, 39 | showBottomBar: Boolean = true, 40 | items: List = listOf( 41 | BottomNavItem.Home, 42 | BottomNavItem.Search, 43 | BottomNavItem.Favorites, 44 | BottomNavItem.Account 45 | ), 46 | content: @Composable (paddingValues: PaddingValues) -> Unit, 47 | ) { 48 | Scaffold( 49 | bottomBar = { 50 | if (showBottomBar) { 51 | NavigationBar( 52 | containerColor = MaterialTheme.colorScheme.background, 53 | contentColor = MaterialTheme.colorScheme.onBackground, 54 | ) { 55 | val navBackStackEntry by navController.currentBackStackEntryAsState() 56 | val currentDestination = navBackStackEntry?.destination 57 | items.forEach { item -> 58 | NavigationBarItem( 59 | icon = { 60 | Icon( 61 | modifier = Modifier.size(24.dp), 62 | painter = painterResource(id = item.icon), 63 | contentDescription = item.title, 64 | ) 65 | }, 66 | label = { 67 | Text( 68 | text = item.title, 69 | style = MaterialTheme.typography.bodySmall, 70 | ) 71 | }, 72 | alwaysShowLabel = true, 73 | selected = currentDestination?.route?.contains(item.route) == true, 74 | onClick = { 75 | navController.navigate(item.route) { 76 | navController.graph.startDestinationRoute?.let { screenRoute -> 77 | popUpTo(screenRoute) { 78 | saveState = true 79 | } 80 | } 81 | launchSingleTop = true 82 | restoreState = true 83 | } 84 | } 85 | ) 86 | } 87 | } 88 | } 89 | } 90 | ) { paddingValues -> 91 | content(paddingValues) 92 | } 93 | } 94 | -------------------------------------------------------------------------------- /app/src/main/java/com/kanyideveloper/muviz/common/presentation/components/StandardToolbar.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2024 Joel Kanyi. 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 | package com.kanyideveloper.muviz.common.presentation.components 17 | 18 | import androidx.compose.foundation.layout.RowScope 19 | import androidx.compose.material3.Icon 20 | import androidx.compose.material3.IconButton 21 | import androidx.compose.material3.Text 22 | import androidx.compose.material3.TopAppBar 23 | import androidx.compose.material.icons.Icons 24 | import androidx.compose.material.icons.automirrored.filled.ArrowBack 25 | import androidx.compose.material3.ExperimentalMaterial3Api 26 | import androidx.compose.material3.MaterialTheme 27 | import androidx.compose.material3.TopAppBarDefaults 28 | import androidx.compose.runtime.Composable 29 | import androidx.compose.ui.Modifier 30 | import androidx.compose.ui.tooling.preview.Preview 31 | import com.kanyideveloper.muviz.common.presentation.theme.MuvizTheme 32 | 33 | @OptIn(ExperimentalMaterial3Api::class) 34 | @Composable 35 | fun StandardToolbar( 36 | modifier: Modifier = Modifier, 37 | showBackArrow: Boolean = false, 38 | onBackArrowClicked: () -> Unit = {}, 39 | navActions: @Composable RowScope.() -> Unit = {}, 40 | title: @Composable () -> Unit = {} 41 | ) { 42 | TopAppBar( 43 | modifier = modifier, 44 | title = title, 45 | navigationIcon = { 46 | if (showBackArrow) { 47 | IconButton( 48 | onClick = 49 | onBackArrowClicked 50 | ) { 51 | Icon( 52 | imageVector = Icons.AutoMirrored.Default.ArrowBack, 53 | contentDescription = null, 54 | ) 55 | } 56 | } 57 | }, 58 | actions = navActions, 59 | colors = TopAppBarDefaults.topAppBarColors( 60 | containerColor = MaterialTheme.colorScheme.background 61 | ) 62 | ) 63 | } 64 | 65 | @Preview 66 | @Composable 67 | fun StandardToolbarPreview() { 68 | MuvizTheme { 69 | StandardToolbar( 70 | title = { 71 | Text( 72 | text = "About", 73 | ) 74 | } 75 | ) 76 | } 77 | } 78 | -------------------------------------------------------------------------------- /app/src/main/java/com/kanyideveloper/muviz/common/presentation/theme/Color.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2024 Joel Kanyi. 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 | package com.kanyideveloper.muviz.common.presentation.theme 17 | 18 | import androidx.compose.ui.graphics.Color 19 | 20 | val PrimaryColor = Color(0xFFFE0A58) 21 | val PrimaryLightColor = PrimaryColor.copy(.5f) 22 | 23 | val SecondaryColor = PrimaryColor.copy(.8f) 24 | val SecondaryLightColor = SecondaryColor.copy(.5f) 25 | 26 | val PrimaryTextColor = Color(0xffffffff) 27 | val SecondaryTextColor = Color(0xff000000) 28 | 29 | val SurfaceDark = Color(0xFF393939) 30 | val SurfaceLight = Color(0xFFFFFFFF) 31 | 32 | val BackgroundLightColor = Color(0xFFFFFFFF) 33 | val BackgroundDarkColor = Color(0xFF161616) 34 | 35 | val ErrorColor = Color(0xFFFF8989) 36 | val OnErrorColor = Color(0xFF000000) 37 | 38 | /* 39 | val primaryGray = Color(0xFF828588) 40 | val lightGray = Color(0xFFF7F7F7) 41 | val Transparent = Color(0x00FFFFFF)*/ 42 | -------------------------------------------------------------------------------- /app/src/main/java/com/kanyideveloper/muviz/common/presentation/theme/Dimensions.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2024 Joel Kanyi. 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 | package com.kanyideveloper.muviz.common.presentation.theme 17 | 18 | import androidx.compose.ui.unit.dp 19 | 20 | val AppBarCollapsedHeight = 50.dp 21 | val AppBarExpendedHeight = 420.dp 22 | -------------------------------------------------------------------------------- /app/src/main/java/com/kanyideveloper/muviz/common/presentation/theme/Shape.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2024 Joel Kanyi. 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 | package com.kanyideveloper.muviz.common.presentation.theme 17 | 18 | import androidx.compose.foundation.shape.RoundedCornerShape 19 | import androidx.compose.material3.Shapes 20 | import androidx.compose.ui.unit.dp 21 | 22 | val Shapes = Shapes( 23 | extraSmall = RoundedCornerShape(4.dp), 24 | small = RoundedCornerShape(4.dp), 25 | medium = RoundedCornerShape(4.dp), 26 | large = RoundedCornerShape(0.dp), 27 | extraLarge = RoundedCornerShape(0.dp) 28 | ) 29 | -------------------------------------------------------------------------------- /app/src/main/java/com/kanyideveloper/muviz/common/presentation/theme/Type.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2024 Joel Kanyi. 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 | package com.kanyideveloper.muviz.common.presentation.theme 17 | 18 | import androidx.compose.material3.Typography 19 | import androidx.compose.ui.text.font.Font 20 | import androidx.compose.ui.text.font.FontFamily 21 | import androidx.compose.ui.text.font.FontWeight 22 | import com.kanyideveloper.muviz.R 23 | 24 | 25 | val quicksand = FontFamily( 26 | Font(R.font.quicksand_light, FontWeight.Light), 27 | Font(R.font.quicksand_regular, FontWeight.Normal), 28 | Font(R.font.quicksand_medium, FontWeight.Medium), 29 | Font(R.font.quicksand_semibold, FontWeight.SemiBold), 30 | Font(R.font.quicksand_bold, FontWeight.Bold) 31 | ) 32 | 33 | 34 | val Typography = Typography().run { 35 | copy( 36 | displayLarge = displayLarge.copy( 37 | fontFamily = quicksand 38 | ), 39 | displayMedium = displayMedium.copy( 40 | fontFamily = quicksand 41 | ), 42 | displaySmall = displaySmall.copy( 43 | fontFamily = quicksand 44 | ), 45 | headlineLarge = headlineLarge.copy( 46 | fontFamily = quicksand 47 | ), 48 | headlineMedium = headlineMedium.copy( 49 | fontFamily = quicksand 50 | ), 51 | headlineSmall = headlineSmall.copy( 52 | fontFamily = quicksand 53 | ), 54 | titleLarge = titleLarge.copy( 55 | fontFamily = quicksand, 56 | fontWeight = FontWeight.Bold 57 | ), 58 | titleMedium = titleMedium.copy( 59 | fontFamily = quicksand, 60 | fontWeight = FontWeight.Bold 61 | ), 62 | titleSmall = titleSmall.copy( 63 | fontFamily = quicksand, 64 | fontWeight = FontWeight.Bold 65 | ), 66 | bodyLarge = bodyLarge.copy( 67 | fontFamily = quicksand 68 | ), 69 | bodyMedium = bodyMedium.copy( 70 | fontFamily = quicksand 71 | ), 72 | bodySmall = bodySmall.copy( 73 | fontFamily = quicksand 74 | ), 75 | labelLarge = labelLarge.copy( 76 | fontFamily = quicksand 77 | ), 78 | labelMedium = labelMedium.copy( 79 | fontFamily = quicksand 80 | ), 81 | labelSmall = labelSmall.copy( 82 | fontFamily = quicksand 83 | ), 84 | ) 85 | } 86 | -------------------------------------------------------------------------------- /app/src/main/java/com/kanyideveloper/muviz/common/util/Constants.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2024 Joel Kanyi. 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 | package com.kanyideveloper.muviz.common.util 17 | 18 | import androidx.datastore.preferences.core.intPreferencesKey 19 | 20 | object Constants { 21 | const val BASE_URL = "https://api.themoviedb.org/3/" 22 | const val STARTING_PAGE_INDEX = 0 23 | const val IMAGE_BASE_UR = "https://image.tmdb.org/t/p/w500/" 24 | const val DATABASE_NAME = "favorites_database" 25 | const val TABLE_NAME = "favorites_table" 26 | 27 | const val MUVIZ_PREFERENCES = "MEALTIME_PREFERENCES" 28 | val THEME_OPTIONS = intPreferencesKey(name = "theme_option") 29 | const val PAGING_SIZE = 20 30 | 31 | // Films 32 | const val TYPE_MOVIE = "movie" 33 | const val TYPE_TV_SERIES = "tv" 34 | } 35 | -------------------------------------------------------------------------------- /app/src/main/java/com/kanyideveloper/muviz/common/util/Resource.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2024 Joel Kanyi. 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 | package com.kanyideveloper.muviz.common.util 17 | 18 | sealed class Resource(val data: T? = null, val message: String? = null) { 19 | class Success(data: T) : Resource(data) 20 | class Loading(data: T? = null) : Resource(data) 21 | class Error(message: String, data: T? = null) : Resource(data, message) 22 | } 23 | -------------------------------------------------------------------------------- /app/src/main/java/com/kanyideveloper/muviz/common/util/Utils.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2024 Joel Kanyi. 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 | package com.kanyideveloper.muviz.common.util 17 | 18 | import android.content.Context 19 | 20 | /* 21 | actual val versionName: String 22 | get() = try { 23 | val pInfo: PackageInfo = 24 | context.packageManager.getPackageInfo(context.packageName, 0) 25 | val version = pInfo.versionName 26 | version 27 | } catch (e: PackageManager.NameNotFoundException) { 28 | e.printStackTrace() 29 | "---" 30 | } 31 | 32 | actual val versionCode: Int 33 | get() = try { 34 | val pInfo: PackageInfo = 35 | context.packageManager.getPackageInfo(context.packageName, 0) 36 | val version = pInfo.versionCode 37 | version 38 | } catch (e: PackageManager.NameNotFoundException) { 39 | e.printStackTrace() 40 | 0 41 | } 42 | */ 43 | 44 | fun Context.appVersionName(): String { 45 | return try { 46 | val pInfo = this.packageManager.getPackageInfo(this.packageName, 0) 47 | val version = pInfo.versionName 48 | version 49 | } catch (e: Exception) { 50 | e.printStackTrace() 51 | "---" 52 | } 53 | } 54 | 55 | fun Context.appVersionCode(): Int { 56 | return try { 57 | val pInfo = this.packageManager.getPackageInfo(this.packageName, 0) 58 | val version = pInfo.versionCode 59 | version 60 | } catch (e: Exception) { 61 | e.printStackTrace() 62 | 0 63 | } 64 | } 65 | 66 | fun String.createImageUrl(): String { 67 | return "${Constants.IMAGE_BASE_UR}/$this" 68 | } 69 | -------------------------------------------------------------------------------- /app/src/main/java/com/kanyideveloper/muviz/favorites/data/data/local/Favorite.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2024 Joel Kanyi. 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 | package com.kanyideveloper.muviz.favorites.data.data.local 17 | 18 | import androidx.room.Entity 19 | import androidx.room.PrimaryKey 20 | import com.kanyideveloper.muviz.common.util.Constants.TABLE_NAME 21 | 22 | @Entity(tableName = TABLE_NAME) 23 | data class Favorite( 24 | val favorite: Boolean, 25 | @PrimaryKey val mediaId: Int, 26 | val mediaType: String, 27 | val image: String, 28 | val title: String, 29 | val releaseDate: String, 30 | val rating: Float, 31 | val overview: String, 32 | ) 33 | -------------------------------------------------------------------------------- /app/src/main/java/com/kanyideveloper/muviz/favorites/data/data/local/FavoritesDao.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2024 Joel Kanyi. 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 | package com.kanyideveloper.muviz.favorites.data.data.local 17 | 18 | import androidx.room.Dao 19 | import androidx.room.Delete 20 | import androidx.room.Insert 21 | import androidx.room.Query 22 | import kotlinx.coroutines.flow.Flow 23 | 24 | @Dao 25 | interface FavoritesDao { 26 | 27 | @Insert 28 | suspend fun insertFavorite(favorite: Favorite) 29 | 30 | @Query("SELECT * FROM favorites_table ORDER BY mediaId DESC") 31 | fun getAllFavorites(): Flow> 32 | 33 | @Query("SELECT * FROM favorites_table WHERE mediaId == :mediaId") 34 | fun getAFavorites(mediaId: Int): Flow 35 | 36 | @Query("SELECT favorite FROM favorites_table WHERE mediaId = :mediaId") 37 | fun isFavorite(mediaId: Int): Flow 38 | 39 | @Delete 40 | suspend fun deleteAFavorite(favorite: Favorite) 41 | 42 | @Query("DELETE FROM favorites_table") 43 | suspend fun deleteAllFavorites() 44 | } 45 | -------------------------------------------------------------------------------- /app/src/main/java/com/kanyideveloper/muviz/favorites/data/data/local/FavoritesDatabase.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2024 Joel Kanyi. 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 | package com.kanyideveloper.muviz.favorites.data.data.local 17 | 18 | import androidx.room.Database 19 | import androidx.room.RoomDatabase 20 | 21 | @Database(entities = [Favorite::class], version = 5, exportSchema = true) 22 | abstract class FavoritesDatabase : RoomDatabase() { 23 | abstract val dao: FavoritesDao 24 | } 25 | -------------------------------------------------------------------------------- /app/src/main/java/com/kanyideveloper/muviz/favorites/data/data/repository/FavoritesRepositoryImpl.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2024 Joel Kanyi. 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 | package com.kanyideveloper.muviz.favorites.data.data.repository 17 | 18 | import com.kanyideveloper.muviz.favorites.data.data.local.Favorite 19 | import com.kanyideveloper.muviz.favorites.data.data.local.FavoritesDatabase 20 | import com.kanyideveloper.muviz.favorites.domain.repository.FavoritesRepository 21 | import kotlinx.coroutines.flow.Flow 22 | import javax.inject.Inject 23 | 24 | class FavoritesRepositoryImpl @Inject constructor(private val database: FavoritesDatabase): 25 | FavoritesRepository { 26 | override suspend fun insertFavorite(favorite: Favorite) { 27 | database.dao.insertFavorite(favorite) 28 | } 29 | 30 | override fun getFavorites(): Flow> { 31 | return database.dao.getAllFavorites() 32 | } 33 | 34 | override fun isFavorite(mediaId: Int): Flow{ 35 | return database.dao.isFavorite(mediaId) 36 | } 37 | 38 | override fun getAFavorites(mediaId: Int): Flow { 39 | return database.dao.getAFavorites(mediaId) 40 | } 41 | 42 | override suspend fun deleteOneFavorite(favorite: Favorite) { 43 | database.dao.deleteAFavorite(favorite) 44 | } 45 | 46 | override suspend fun deleteAllFavorites() { 47 | database.dao.deleteAllFavorites() 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /app/src/main/java/com/kanyideveloper/muviz/favorites/di/FavoritesModule.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2024 Joel Kanyi. 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 | package com.kanyideveloper.muviz.favorites.di 17 | 18 | import com.kanyideveloper.muviz.favorites.data.data.repository.FavoritesRepositoryImpl 19 | import com.kanyideveloper.muviz.favorites.domain.repository.FavoritesRepository 20 | import dagger.Binds 21 | import dagger.Module 22 | import dagger.hilt.InstallIn 23 | import dagger.hilt.components.SingletonComponent 24 | 25 | @Module 26 | @InstallIn(SingletonComponent::class) 27 | abstract class FavoritesModule { 28 | @Binds 29 | abstract fun bindFavoritesRepository( 30 | favoritesRepositoryImpl: FavoritesRepositoryImpl 31 | ): FavoritesRepository 32 | } 33 | -------------------------------------------------------------------------------- /app/src/main/java/com/kanyideveloper/muviz/favorites/domain/repository/FavoritesRepository.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2024 Joel Kanyi. 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 | package com.kanyideveloper.muviz.favorites.domain.repository 17 | 18 | import com.kanyideveloper.muviz.favorites.data.data.local.Favorite 19 | import kotlinx.coroutines.flow.Flow 20 | 21 | interface FavoritesRepository { 22 | suspend fun insertFavorite(favorite: Favorite) 23 | fun getFavorites(): Flow> 24 | fun isFavorite(mediaId: Int): Flow 25 | fun getAFavorites(mediaId: Int): Flow 26 | suspend fun deleteOneFavorite(favorite: Favorite) 27 | suspend fun deleteAllFavorites() 28 | } 29 | -------------------------------------------------------------------------------- /app/src/main/java/com/kanyideveloper/muviz/favorites/presentation/FavoritesViewModel.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2024 Joel Kanyi. 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 | package com.kanyideveloper.muviz.favorites.presentation 17 | 18 | import androidx.lifecycle.ViewModel 19 | import androidx.lifecycle.viewModelScope 20 | import com.kanyideveloper.muviz.favorites.data.data.local.Favorite 21 | import com.kanyideveloper.muviz.favorites.domain.repository.FavoritesRepository 22 | import dagger.hilt.android.lifecycle.HiltViewModel 23 | import kotlinx.coroutines.flow.SharingStarted 24 | import kotlinx.coroutines.flow.map 25 | import kotlinx.coroutines.flow.stateIn 26 | import kotlinx.coroutines.launch 27 | import javax.inject.Inject 28 | 29 | @HiltViewModel 30 | class FavoritesViewModel @Inject constructor( 31 | private val repository: FavoritesRepository 32 | ) : 33 | ViewModel() { 34 | 35 | val favorites = repository.getFavorites() 36 | .map { 37 | it 38 | } 39 | .stateIn( 40 | scope = viewModelScope, 41 | started = SharingStarted.WhileSubscribed(5_000), 42 | initialValue = emptyList() 43 | ) 44 | 45 | fun deleteOneFavorite(favorite: Favorite) { 46 | viewModelScope.launch { 47 | repository.deleteOneFavorite(favorite) 48 | } 49 | } 50 | 51 | fun deleteAllFavorites() { 52 | viewModelScope.launch { 53 | repository.deleteAllFavorites() 54 | } 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /app/src/main/java/com/kanyideveloper/muviz/filmdetail/data/mappers/FilmDetailsMappers.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2024 Joel Kanyi. 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 | package com.kanyideveloper.muviz.filmdetail.data.mappers 17 | 18 | import com.kanyideveloper.muviz.cast.data.network.dto.CastResponse 19 | import com.kanyideveloper.muviz.cast.domain.model.Cast 20 | import com.kanyideveloper.muviz.cast.domain.model.Credits 21 | import com.kanyideveloper.muviz.home.data.network.dto.CreditsResponse 22 | 23 | internal fun CreditsResponse.toDomain() = Credits( 24 | id = id, 25 | cast = cast.map { it.toDomain() } 26 | ) 27 | 28 | internal fun CastResponse.toDomain() = Cast( 29 | adult = adult, 30 | castId = castId, 31 | character = character, 32 | creditId = creditId, 33 | gender = gender, 34 | id = id, 35 | knownForDepartment = knownForDepartment, 36 | name = name, 37 | order = order, 38 | originalName = originalName, 39 | popularity = popularity, 40 | profilePath = profilePath, 41 | ) 42 | -------------------------------------------------------------------------------- /app/src/main/java/com/kanyideveloper/muviz/filmdetail/data/repository/FilmsDetailsRepository.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2024 Joel Kanyi. 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 | package com.kanyideveloper.muviz.filmdetail.data.repository 17 | 18 | import com.kanyideveloper.muviz.common.data.network.TMDBApi 19 | import com.kanyideveloper.muviz.home.data.network.dto.MovieDetails 20 | import com.kanyideveloper.muviz.home.data.network.dto.TvSeriesDetails 21 | import com.kanyideveloper.muviz.common.util.Resource 22 | import timber.log.Timber 23 | import javax.inject.Inject 24 | 25 | class FilmsDetailsRepository @Inject constructor(private val api: TMDBApi) { 26 | 27 | // Movie Details 28 | suspend fun getMoviesDetails(movieId: Int): Resource { 29 | val response = try { 30 | api.getMovieDetails(movieId) 31 | } catch (e: Exception) { 32 | return Resource.Error("Unknown error occurred") 33 | } 34 | Timber.d("Movie details: $response") 35 | return Resource.Success(response) 36 | } 37 | 38 | // Series Details 39 | suspend fun getTvSeriesDetails(tvId: Int): Resource { 40 | val response = try { 41 | api.getTvSeriesDetails(tvId) 42 | } catch (e: Exception) { 43 | return Resource.Error("Unknown error occurred") 44 | } 45 | Timber.d("Series details: $response") 46 | return Resource.Success(response) 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /app/src/main/java/com/kanyideveloper/muviz/filmdetail/presentation/FilmDetailsUiEvents.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2024 Joel Kanyi. 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 | package com.kanyideveloper.muviz.filmdetail.presentation 17 | 18 | import com.kanyideveloper.muviz.cast.domain.model.Cast 19 | import com.kanyideveloper.muviz.cast.domain.model.Credits 20 | import com.kanyideveloper.muviz.favorites.data.data.local.Favorite 21 | 22 | sealed interface FilmDetailsUiEvents { 23 | data object NavigateBack : FilmDetailsUiEvents 24 | data class NavigateToCastsScreen(val credits: Credits) : 25 | FilmDetailsUiEvents 26 | 27 | data class AddToFavorites(val favorite: Favorite) : 28 | FilmDetailsUiEvents 29 | 30 | data class RemoveFromFavorites(val favorite: Favorite) : 31 | FilmDetailsUiEvents 32 | data class NavigateToCastDetails(val cast: Cast) : FilmDetailsUiEvents 33 | } 34 | -------------------------------------------------------------------------------- /app/src/main/java/com/kanyideveloper/muviz/filmdetail/presentation/FilmDetailsUiState.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2024 Joel Kanyi. 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 | package com.kanyideveloper.muviz.filmdetail.presentation 17 | 18 | import com.kanyideveloper.muviz.cast.domain.model.Credits 19 | import com.kanyideveloper.muviz.home.data.network.dto.MovieDetails 20 | import com.kanyideveloper.muviz.home.data.network.dto.TvSeriesDetails 21 | 22 | data class FilmDetailsUiState( 23 | val credits: Credits? = null, 24 | val isLoading: Boolean = false, 25 | val isLoadingCasts: Boolean = false, 26 | val error: String? = null, 27 | val errorCasts: String? = null, 28 | val tvSeriesDetails: TvSeriesDetails? = null, 29 | val movieDetails: MovieDetails? = null 30 | ) 31 | -------------------------------------------------------------------------------- /app/src/main/java/com/kanyideveloper/muviz/filmdetail/presentation/common/FilmImageBanner.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2024 Joel Kanyi. 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 | package com.kanyideveloper.muviz.filmdetail.presentation.common 17 | 18 | import androidx.compose.foundation.layout.fillMaxSize 19 | import androidx.compose.runtime.Composable 20 | import androidx.compose.ui.Modifier 21 | import androidx.compose.ui.layout.ContentScale 22 | import androidx.compose.ui.platform.LocalContext 23 | import androidx.compose.ui.res.painterResource 24 | import coil.compose.AsyncImage 25 | import coil.request.ImageRequest 26 | import com.kanyideveloper.muviz.R 27 | 28 | @Composable 29 | fun FilmImageBanner( 30 | modifier: Modifier = Modifier, 31 | filmImage: String, 32 | ) { 33 | AsyncImage( 34 | model = ImageRequest.Builder(LocalContext.current) 35 | .data(filmImage) 36 | .crossfade(true) 37 | .build(), 38 | placeholder = painterResource(R.drawable.ic_placeholder), 39 | contentDescription = "Movie Banner", 40 | contentScale = ContentScale.Crop, 41 | modifier = modifier.fillMaxSize(), 42 | ) 43 | } 44 | -------------------------------------------------------------------------------- /app/src/main/java/com/kanyideveloper/muviz/filmdetail/presentation/common/FilmNameAndRating.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2024 Joel Kanyi. 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 | package com.kanyideveloper.muviz.filmdetail.presentation.common 17 | 18 | import androidx.compose.foundation.layout.Arrangement 19 | import androidx.compose.foundation.layout.Row 20 | import androidx.compose.foundation.layout.fillMaxWidth 21 | import androidx.compose.material3.MaterialTheme 22 | import androidx.compose.material3.Text 23 | import androidx.compose.runtime.Composable 24 | import androidx.compose.ui.Alignment 25 | import androidx.compose.ui.Modifier 26 | 27 | @Composable 28 | fun FilmNameAndRating( 29 | modifier: Modifier = Modifier, 30 | filmName: String, 31 | rating: Float 32 | ) { 33 | Row( 34 | modifier = modifier, 35 | verticalAlignment = Alignment.Bottom 36 | ) { 37 | Row( 38 | modifier = Modifier 39 | .fillMaxWidth(), 40 | verticalAlignment = Alignment.CenterVertically, 41 | horizontalArrangement = Arrangement.SpaceBetween 42 | ) { 43 | Text( 44 | modifier = Modifier 45 | .fillMaxWidth(0.83f), 46 | text = filmName, 47 | style = MaterialTheme.typography.titleMedium, 48 | ) 49 | VoteAverageRatingIndicator( 50 | percentage = rating 51 | ) 52 | } 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /app/src/main/java/com/kanyideveloper/muviz/filmdetail/presentation/common/VoteAverageRatingIndicator.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2024 Joel Kanyi. 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 | package com.kanyideveloper.muviz.filmdetail.presentation.common 17 | 18 | import androidx.compose.animation.core.animateFloatAsState 19 | import androidx.compose.animation.core.tween 20 | import androidx.compose.foundation.Canvas 21 | import androidx.compose.foundation.layout.Box 22 | import androidx.compose.foundation.layout.size 23 | import androidx.compose.material3.MaterialTheme 24 | import androidx.compose.material3.Text 25 | import androidx.compose.runtime.* 26 | import androidx.compose.ui.Alignment 27 | import androidx.compose.ui.Modifier 28 | import androidx.compose.ui.graphics.Color 29 | import androidx.compose.ui.graphics.StrokeCap 30 | import androidx.compose.ui.graphics.drawscope.Stroke 31 | import androidx.compose.ui.text.font.FontWeight 32 | import androidx.compose.ui.unit.Dp 33 | import androidx.compose.ui.unit.TextUnit 34 | import androidx.compose.ui.unit.dp 35 | import androidx.compose.ui.unit.sp 36 | 37 | @Composable 38 | fun VoteAverageRatingIndicator( 39 | percentage: Float, 40 | number: Int = 10, 41 | fontSize: TextUnit = 16.sp, 42 | radius: Dp = 20.dp, 43 | color: Color = MaterialTheme.colorScheme.primary, 44 | strokeWidth: Dp = 3.dp, 45 | animationDuration: Int = 1000, 46 | animDelay: Int = 0 47 | ) { 48 | var animationPlayed by remember { 49 | mutableStateOf(false) 50 | } 51 | 52 | val currentPercentage = animateFloatAsState( 53 | targetValue = if (animationPlayed) percentage else 0f, 54 | animationSpec = tween( 55 | durationMillis = animationDuration, 56 | delayMillis = animDelay 57 | ), label = "" 58 | ) 59 | 60 | LaunchedEffect(key1 = true) { 61 | animationPlayed = true 62 | } 63 | 64 | Box( 65 | contentAlignment = Alignment.Center, 66 | modifier = Modifier.size(radius * 2f) 67 | ) { 68 | Canvas( 69 | modifier = Modifier 70 | .size(radius * 2f) 71 | ) { 72 | drawArc( 73 | color = color, 74 | startAngle = -90f, 75 | sweepAngle = (360 * (currentPercentage.value * 0.1)).toFloat(), 76 | useCenter = false, 77 | style = Stroke(strokeWidth.toPx(), cap = StrokeCap.Round) 78 | ) 79 | } 80 | Text( 81 | text = "${(currentPercentage.value * number).toInt()}%", 82 | color = MaterialTheme.colorScheme.primary, 83 | fontSize = fontSize, 84 | fontWeight = FontWeight.Bold 85 | ) 86 | } 87 | } 88 | -------------------------------------------------------------------------------- /app/src/main/java/com/kanyideveloper/muviz/genre/data/mappers/GenreMappers.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2024 Joel Kanyi. 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 | package com.kanyideveloper.muviz.genre.data.mappers 17 | 18 | import com.kanyideveloper.muviz.genre.data.network.dto.GenresResponse 19 | import com.kanyideveloper.muviz.genre.domain.model.Genre 20 | 21 | 22 | internal fun GenresResponse.GenreDto.toDomain() = Genre( 23 | id = id, 24 | name = name 25 | ) 26 | -------------------------------------------------------------------------------- /app/src/main/java/com/kanyideveloper/muviz/genre/data/network/dto/GenreResponse.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2024 Joel Kanyi. 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 | package com.kanyideveloper.muviz.genre.data.network.dto 17 | 18 | import com.google.gson.annotations.SerializedName 19 | 20 | data class GenresResponse( 21 | @SerializedName("genres") 22 | val genres: List 23 | ) { 24 | data class GenreDto( 25 | @SerializedName("id") 26 | val id: Int, 27 | @SerializedName("name") 28 | val name: String 29 | ) 30 | } 31 | -------------------------------------------------------------------------------- /app/src/main/java/com/kanyideveloper/muviz/genre/data/repository/GenreRepositoryImpl.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2024 Joel Kanyi. 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 | package com.kanyideveloper.muviz.genre.data.repository 17 | 18 | import com.kanyideveloper.muviz.common.data.network.TMDBApi 19 | import com.kanyideveloper.muviz.common.util.Resource 20 | import com.kanyideveloper.muviz.genre.domain.model.Genre 21 | import com.kanyideveloper.muviz.genre.domain.repository.GenreRepository 22 | import com.kanyideveloper.muviz.genre.data.mappers.toDomain 23 | import timber.log.Timber 24 | import javax.inject.Inject 25 | 26 | class GenreRepositoryImpl @Inject constructor( 27 | private val api: TMDBApi, 28 | ) : GenreRepository { 29 | override suspend fun getMovieGenres(): Resource> { 30 | val response = try { 31 | api.getMovieGenres() 32 | } catch (e: Exception) { 33 | return Resource.Error("Unknown error occurred") 34 | } 35 | Timber.d("Movies genres: $response") 36 | return Resource.Success( 37 | response.genres.map { it.toDomain() } 38 | ) 39 | } 40 | 41 | override suspend fun getTvSeriesGenres(): Resource> { 42 | val response = try { 43 | api.getTvSeriesGenres() 44 | } catch (e: Exception) { 45 | return Resource.Error("Unknown error occurred") 46 | } 47 | Timber.d("Series genres: $response") 48 | return Resource.Success( 49 | response.genres.map { it.toDomain() } 50 | ) 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /app/src/main/java/com/kanyideveloper/muviz/genre/di/GenreModule.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2024 Joel Kanyi. 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 | package com.kanyideveloper.muviz.genre.di 17 | 18 | import com.kanyideveloper.muviz.genre.data.repository.GenreRepositoryImpl 19 | import com.kanyideveloper.muviz.genre.domain.repository.GenreRepository 20 | import dagger.Binds 21 | import dagger.Module 22 | import dagger.hilt.InstallIn 23 | import dagger.hilt.components.SingletonComponent 24 | 25 | @Module 26 | @InstallIn(SingletonComponent::class) 27 | abstract class GenreModule { 28 | @Binds 29 | abstract fun bindGenreRepository( 30 | genreRepositoryImpl: GenreRepositoryImpl 31 | ): GenreRepository 32 | } 33 | -------------------------------------------------------------------------------- /app/src/main/java/com/kanyideveloper/muviz/genre/domain/model/Genre.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2024 Joel Kanyi. 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 | package com.kanyideveloper.muviz.genre.domain.model 17 | 18 | data class Genre( 19 | val id: Int, 20 | val name: String 21 | ) 22 | -------------------------------------------------------------------------------- /app/src/main/java/com/kanyideveloper/muviz/genre/domain/repository/GenreRepository.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2024 Joel Kanyi. 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 | package com.kanyideveloper.muviz.genre.domain.repository 17 | 18 | import com.kanyideveloper.muviz.common.util.Resource 19 | import com.kanyideveloper.muviz.genre.domain.model.Genre 20 | 21 | interface GenreRepository { 22 | suspend fun getMovieGenres(): Resource> 23 | suspend fun getTvSeriesGenres(): Resource> 24 | } 25 | -------------------------------------------------------------------------------- /app/src/main/java/com/kanyideveloper/muviz/genre/domain/usecase/GetMovieGenresUseCase.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2024 Joel Kanyi. 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 | package com.kanyideveloper.muviz.genre.domain.usecase 17 | 18 | import com.kanyideveloper.muviz.genre.domain.repository.GenreRepository 19 | import javax.inject.Inject 20 | 21 | class GetMovieGenresUseCase @Inject constructor( 22 | private val repository: GenreRepository 23 | ) { 24 | suspend operator fun invoke() = repository.getMovieGenres() 25 | } 26 | -------------------------------------------------------------------------------- /app/src/main/java/com/kanyideveloper/muviz/genre/domain/usecase/GetTvSeriesGenresUseCase.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2024 Joel Kanyi. 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 | package com.kanyideveloper.muviz.genre.domain.usecase 17 | 18 | import com.kanyideveloper.muviz.genre.domain.repository.GenreRepository 19 | import javax.inject.Inject 20 | 21 | class GetTvSeriesGenresUseCase @Inject constructor( 22 | private val repository: GenreRepository 23 | ) { 24 | suspend operator fun invoke() = repository.getTvSeriesGenres() 25 | } 26 | -------------------------------------------------------------------------------- /app/src/main/java/com/kanyideveloper/muviz/home/data/network/dto/CreditsResponse.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2024 Joel Kanyi. 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 | package com.kanyideveloper.muviz.home.data.network.dto 17 | 18 | 19 | import com.google.gson.annotations.SerializedName 20 | import com.kanyideveloper.muviz.cast.data.network.dto.CastResponse 21 | 22 | data class CreditsResponse( 23 | @SerializedName("cast") 24 | val cast: List, 25 | @SerializedName("id") 26 | val id: Int 27 | ) 28 | -------------------------------------------------------------------------------- /app/src/main/java/com/kanyideveloper/muviz/home/data/network/dto/MovieDetails.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2024 Joel Kanyi. 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 | package com.kanyideveloper.muviz.home.data.network.dto 17 | 18 | 19 | import com.google.gson.annotations.SerializedName 20 | import com.kanyideveloper.muviz.genre.domain.model.Genre 21 | 22 | data class MovieDetails( 23 | @SerializedName("adult") 24 | val adult: Boolean? = null, 25 | @SerializedName("backdrop_path") 26 | val backdropPath: String? = null, 27 | @SerializedName("budget") 28 | val budget: Int? = null, 29 | @SerializedName("genres") 30 | val genres: List? = null, 31 | @SerializedName("homepage") 32 | val homepage: String? = null, 33 | @SerializedName("id") 34 | val id: Int? = null, 35 | @SerializedName("imdb_id") 36 | val imdbId: String? = null, 37 | @SerializedName("original_language") 38 | val originalLanguage: String? = null, 39 | @SerializedName("original_title") 40 | val originalTitle: String? = null, 41 | @SerializedName("overview") 42 | val overview: String? = null, 43 | @SerializedName("popularity") 44 | val popularity: Double? = null, 45 | @SerializedName("poster_path") 46 | val posterPath: String? = null, 47 | @SerializedName("release_date") 48 | val releaseDate: String? = null, 49 | @SerializedName("revenue") 50 | val revenue: Int? = null, 51 | @SerializedName("runtime") 52 | val runtime: Int? = null, 53 | @SerializedName("status") 54 | val status: String? = null, 55 | @SerializedName("tagline") 56 | val tagline: String? = null, 57 | @SerializedName("title") 58 | val title: String? = null, 59 | @SerializedName("video") 60 | val video: Boolean? = null, 61 | @SerializedName("vote_average") 62 | val voteAverage: Double? = null, 63 | @SerializedName("vote_count") 64 | val voteCount: Int? = null 65 | ) 66 | -------------------------------------------------------------------------------- /app/src/main/java/com/kanyideveloper/muviz/home/data/network/dto/MoviesResponse.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2024 Joel Kanyi. 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 | package com.kanyideveloper.muviz.home.data.network.dto 17 | 18 | import com.google.gson.annotations.SerializedName 19 | import com.kanyideveloper.muviz.home.domain.model.Movie 20 | 21 | data class MoviesResponse( 22 | @SerializedName("page") 23 | val page: Int, 24 | @SerializedName("results") 25 | val searches: List, 26 | @SerializedName("total_pages") 27 | val totalPages: Int, 28 | @SerializedName("total_results") 29 | val totalResults: Int 30 | ) 31 | -------------------------------------------------------------------------------- /app/src/main/java/com/kanyideveloper/muviz/home/data/network/dto/TvSeriesDetails.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2024 Joel Kanyi. 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 | package com.kanyideveloper.muviz.home.data.network.dto 17 | 18 | 19 | import com.google.gson.annotations.SerializedName 20 | import com.kanyideveloper.muviz.genre.domain.model.Genre 21 | 22 | data class TvSeriesDetails( 23 | @SerializedName("adult") 24 | val adult: Boolean, 25 | @SerializedName("backdrop_path") 26 | val backdropPath: String, 27 | @SerializedName("episode_run_time") 28 | val episodeRunTime: List, 29 | @SerializedName("first_air_date") 30 | val firstAirDate: String, 31 | @SerializedName("genres") 32 | val genres: List, 33 | @SerializedName("homepage") 34 | val homepage: String, 35 | @SerializedName("id") 36 | val id: Int, 37 | @SerializedName("in_production") 38 | val inProduction: Boolean, 39 | @SerializedName("languages") 40 | val languages: List, 41 | @SerializedName("last_air_date") 42 | val lastAirDate: String, 43 | @SerializedName("name") 44 | val name: String, 45 | @SerializedName("next_episode_to_air") 46 | val nextEpisodeToAir: Any, 47 | @SerializedName("number_of_episodes") 48 | val numberOfEpisodes: Int, 49 | @SerializedName("number_of_seasons") 50 | val numberOfSeasons: Int, 51 | @SerializedName("origin_country") 52 | val originCountry: List, 53 | @SerializedName("original_language") 54 | val originalLanguage: String, 55 | @SerializedName("original_name") 56 | val originalName: String, 57 | @SerializedName("overview") 58 | val overview: String, 59 | @SerializedName("popularity") 60 | val popularity: Double, 61 | @SerializedName("poster_path") 62 | val posterPath: String, 63 | @SerializedName("status") 64 | val status: String, 65 | @SerializedName("tagline") 66 | val tagline: String, 67 | @SerializedName("type") 68 | val type: String, 69 | @SerializedName("vote_average") 70 | val voteAverage: Double, 71 | @SerializedName("vote_count") 72 | val voteCount: Int 73 | ) 74 | -------------------------------------------------------------------------------- /app/src/main/java/com/kanyideveloper/muviz/home/data/network/dto/TvSeriesResponse.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2024 Joel Kanyi. 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 | package com.kanyideveloper.muviz.home.data.network.dto 17 | 18 | import com.google.gson.annotations.SerializedName 19 | import com.kanyideveloper.muviz.home.domain.model.Series 20 | 21 | data class TvSeriesResponse( 22 | @SerializedName("page") 23 | val page: Int, 24 | @SerializedName("results") 25 | val results: List, 26 | @SerializedName("total_pages") 27 | val total_pages: Int, 28 | @SerializedName("total_results") 29 | val total_results: Int 30 | ) 31 | -------------------------------------------------------------------------------- /app/src/main/java/com/kanyideveloper/muviz/home/data/paging/AiringTodayTvSeriesSource.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2024 Joel Kanyi. 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 | package com.kanyideveloper.muviz.home.data.paging 17 | 18 | import androidx.paging.PagingSource 19 | import androidx.paging.PagingState 20 | import com.kanyideveloper.muviz.common.data.network.TMDBApi 21 | import com.kanyideveloper.muviz.home.domain.model.Series 22 | import retrofit2.HttpException 23 | import java.io.IOException 24 | 25 | class AiringTodayTvSeriesSource(private val api: TMDBApi) : 26 | PagingSource() { 27 | override fun getRefreshKey(state: PagingState): Int? { 28 | return state.anchorPosition 29 | } 30 | 31 | override suspend fun load(params: LoadParams): LoadResult { 32 | return try { 33 | val nextPage = params.key ?: 1 34 | val airingMoviesToday = api.getAiringTodayTvSeries(nextPage) 35 | LoadResult.Page( 36 | data = airingMoviesToday.results, 37 | prevKey = if (nextPage == 1) null else nextPage - 1, 38 | nextKey = if (airingMoviesToday.results.isEmpty()) null else airingMoviesToday.page + 1 39 | ) 40 | } catch (exception: IOException) { 41 | return LoadResult.Error(exception) 42 | } catch (exception: HttpException) { 43 | return LoadResult.Error(exception) 44 | } 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /app/src/main/java/com/kanyideveloper/muviz/home/data/paging/NowPlayingMoviesSource.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2024 Joel Kanyi. 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 | package com.kanyideveloper.muviz.home.data.paging 17 | 18 | import androidx.paging.PagingSource 19 | import androidx.paging.PagingState 20 | import com.kanyideveloper.muviz.common.data.network.TMDBApi 21 | import com.kanyideveloper.muviz.home.domain.model.Movie 22 | import retrofit2.HttpException 23 | import java.io.IOException 24 | 25 | class NowPlayingMoviesSource(private val api: TMDBApi) : 26 | PagingSource() { 27 | override fun getRefreshKey(state: PagingState): Int? { 28 | return state.anchorPosition 29 | } 30 | 31 | override suspend fun load(params: LoadParams): LoadResult { 32 | return try { 33 | val nextPage = params.key ?: 1 34 | val nowPlayingMovies = api.getNowPlayingMovies(nextPage) 35 | LoadResult.Page( 36 | data = nowPlayingMovies.searches, 37 | prevKey = if (nextPage == 1) null else nextPage - 1, 38 | nextKey = if (nowPlayingMovies.searches.isEmpty()) null else nowPlayingMovies.page + 1 39 | ) 40 | } catch (exception: IOException) { 41 | return LoadResult.Error(exception) 42 | } catch (exception: HttpException) { 43 | return LoadResult.Error(exception) 44 | } 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /app/src/main/java/com/kanyideveloper/muviz/home/data/paging/OnTheAirSeriesSource.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2024 Joel Kanyi. 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 | package com.kanyideveloper.muviz.home.data.paging 17 | 18 | import androidx.paging.PagingSource 19 | import androidx.paging.PagingState 20 | import com.kanyideveloper.muviz.common.data.network.TMDBApi 21 | import com.kanyideveloper.muviz.home.domain.model.Series 22 | import retrofit2.HttpException 23 | import java.io.IOException 24 | 25 | class OnTheAirSeriesSource(private val api: TMDBApi) : 26 | PagingSource() { 27 | override fun getRefreshKey(state: PagingState): Int? { 28 | return state.anchorPosition 29 | } 30 | 31 | override suspend fun load(params: LoadParams): LoadResult { 32 | return try { 33 | val nextPage = params.key ?: 1 34 | val onAirSeries = api.getOnTheAirTvSeries(nextPage) 35 | LoadResult.Page( 36 | data = onAirSeries.results, 37 | prevKey = if (nextPage == 1) null else nextPage - 1, 38 | nextKey = if (onAirSeries.results.isEmpty()) null else onAirSeries.page + 1 39 | ) 40 | } catch (exception: IOException) { 41 | return LoadResult.Error(exception) 42 | } catch (exception: HttpException) { 43 | return LoadResult.Error(exception) 44 | } 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /app/src/main/java/com/kanyideveloper/muviz/home/data/paging/PopularMoviesSource.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2024 Joel Kanyi. 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 | package com.kanyideveloper.muviz.home.data.paging 17 | 18 | import androidx.paging.PagingSource 19 | import androidx.paging.PagingState 20 | import com.kanyideveloper.muviz.common.data.network.TMDBApi 21 | import com.kanyideveloper.muviz.home.domain.model.Movie 22 | import retrofit2.HttpException 23 | import java.io.IOException 24 | 25 | class PopularMoviesSource(private val api: TMDBApi) : 26 | PagingSource() { 27 | override fun getRefreshKey(state: PagingState): Int? { 28 | return state.anchorPosition 29 | } 30 | 31 | override suspend fun load(params: LoadParams): LoadResult { 32 | return try { 33 | val nextPage = params.key ?: 1 34 | val popularMovies = api.getPopularMovies(nextPage) 35 | LoadResult.Page( 36 | data = popularMovies.searches, 37 | prevKey = if (nextPage == 1) null else nextPage - 1, 38 | nextKey = if (popularMovies.searches.isEmpty()) null else popularMovies.page + 1 39 | ) 40 | } catch (exception: IOException) { 41 | return LoadResult.Error(exception) 42 | } catch (exception: HttpException) { 43 | return LoadResult.Error(exception) 44 | } 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /app/src/main/java/com/kanyideveloper/muviz/home/data/paging/PopularSeriesSource.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2024 Joel Kanyi. 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 | package com.kanyideveloper.muviz.home.data.paging 17 | 18 | import androidx.paging.PagingSource 19 | import androidx.paging.PagingState 20 | import com.kanyideveloper.muviz.common.data.network.TMDBApi 21 | import com.kanyideveloper.muviz.home.domain.model.Series 22 | import retrofit2.HttpException 23 | import java.io.IOException 24 | 25 | class PopularSeriesSource(private val api: TMDBApi) : 26 | PagingSource() { 27 | override fun getRefreshKey(state: PagingState): Int? { 28 | return state.anchorPosition 29 | } 30 | 31 | override suspend fun load(params: LoadParams): LoadResult { 32 | return try { 33 | val nextPage = params.key ?: 1 34 | val popularSeries = api.getPopularTvSeries(nextPage) 35 | LoadResult.Page( 36 | data = popularSeries.results, 37 | prevKey = if (nextPage == 1) null else nextPage - 1, 38 | nextKey = if (popularSeries.results.isEmpty()) null else popularSeries.page + 1 39 | ) 40 | } catch (exception: IOException) { 41 | return LoadResult.Error(exception) 42 | } catch (exception: HttpException) { 43 | return LoadResult.Error(exception) 44 | } 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /app/src/main/java/com/kanyideveloper/muviz/home/data/paging/TopRatedMoviesSource.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2024 Joel Kanyi. 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 | package com.kanyideveloper.muviz.home.data.paging 17 | 18 | import androidx.paging.PagingSource 19 | import androidx.paging.PagingState 20 | import com.kanyideveloper.muviz.common.data.network.TMDBApi 21 | import com.kanyideveloper.muviz.home.domain.model.Movie 22 | import retrofit2.HttpException 23 | import java.io.IOException 24 | 25 | class TopRatedMoviesSource(private val api: TMDBApi) : 26 | PagingSource() { 27 | override fun getRefreshKey(state: PagingState): Int? { 28 | return state.anchorPosition 29 | } 30 | 31 | override suspend fun load(params: LoadParams): LoadResult { 32 | return try { 33 | val nextPage = params.key ?: 1 34 | val topRatedMovies = api.getTopRatedMovies(nextPage) 35 | LoadResult.Page( 36 | data = topRatedMovies.searches, 37 | prevKey = if (nextPage == 1) null else nextPage - 1, 38 | nextKey = if (topRatedMovies.searches.isEmpty()) null else topRatedMovies.page + 1 39 | ) 40 | } catch (exception: IOException) { 41 | return LoadResult.Error(exception) 42 | } catch (exception: HttpException) { 43 | return LoadResult.Error(exception) 44 | } 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /app/src/main/java/com/kanyideveloper/muviz/home/data/paging/TopRatedSeriesSource.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2024 Joel Kanyi. 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 | package com.kanyideveloper.muviz.home.data.paging 17 | 18 | import androidx.paging.PagingSource 19 | import androidx.paging.PagingState 20 | import com.kanyideveloper.muviz.common.data.network.TMDBApi 21 | import com.kanyideveloper.muviz.home.domain.model.Series 22 | import retrofit2.HttpException 23 | import java.io.IOException 24 | 25 | class TopRatedSeriesSource(private val api: TMDBApi) : 26 | PagingSource() { 27 | override fun getRefreshKey(state: PagingState): Int? { 28 | return state.anchorPosition 29 | } 30 | 31 | override suspend fun load(params: LoadParams): LoadResult { 32 | return try { 33 | val nextPage = params.key ?: 1 34 | val topRatedSeries = api.getTopRatedTvSeries(nextPage) 35 | LoadResult.Page( 36 | data = topRatedSeries.results, 37 | prevKey = if (nextPage == 1) null else nextPage - 1, 38 | nextKey = if (topRatedSeries.results.isEmpty()) null else topRatedSeries.page + 1 39 | ) 40 | } catch (exception: IOException) { 41 | return LoadResult.Error(exception) 42 | } catch (exception: HttpException) { 43 | return LoadResult.Error(exception) 44 | } 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /app/src/main/java/com/kanyideveloper/muviz/home/data/paging/TrendingMoviesSource.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2024 Joel Kanyi. 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 | package com.kanyideveloper.muviz.home.data.paging 17 | 18 | import androidx.paging.PagingSource 19 | import androidx.paging.PagingState 20 | import com.kanyideveloper.muviz.common.data.network.TMDBApi 21 | import com.kanyideveloper.muviz.home.domain.model.Movie 22 | import retrofit2.HttpException 23 | import timber.log.Timber 24 | import java.io.IOException 25 | 26 | class TrendingMoviesSource(private val api: TMDBApi) : 27 | PagingSource() { 28 | override fun getRefreshKey(state: PagingState): Int? { 29 | return state.anchorPosition 30 | } 31 | 32 | override suspend fun load(params: LoadParams): LoadResult { 33 | return try { 34 | val nextPage = params.key ?: 1 35 | val trendingMoviesList = api.getTrendingTodayMovies(nextPage) 36 | Timber.d("trending movies list : ${trendingMoviesList.searches}") 37 | LoadResult.Page( 38 | data = trendingMoviesList.searches, 39 | prevKey = if (nextPage == 1) null else nextPage - 1, 40 | nextKey = if (trendingMoviesList.searches.isEmpty()) null else trendingMoviesList.page + 1 41 | ) 42 | } catch (exception: IOException) { 43 | return LoadResult.Error(exception) 44 | } catch (exception: HttpException) { 45 | return LoadResult.Error(exception) 46 | } 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /app/src/main/java/com/kanyideveloper/muviz/home/data/paging/TrendingSeriesSource.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2024 Joel Kanyi. 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 | package com.kanyideveloper.muviz.home.data.paging 17 | 18 | import androidx.paging.PagingSource 19 | import androidx.paging.PagingState 20 | import com.kanyideveloper.muviz.common.data.network.TMDBApi 21 | import com.kanyideveloper.muviz.home.domain.model.Series 22 | import retrofit2.HttpException 23 | import java.io.IOException 24 | 25 | class TrendingSeriesSource(private val api: TMDBApi) : 26 | PagingSource() { 27 | override fun getRefreshKey(state: PagingState): Int? { 28 | return state.anchorPosition 29 | } 30 | 31 | override suspend fun load(params: LoadParams): LoadResult { 32 | return try { 33 | val nextPage = params.key ?: 1 34 | val trendingSeriesList = api.getTrendingTvSeries(nextPage) 35 | LoadResult.Page( 36 | data = trendingSeriesList.results, 37 | prevKey = if (nextPage == 1) null else nextPage - 1, 38 | nextKey = if (trendingSeriesList.results.isEmpty()) null else trendingSeriesList.page + 1 39 | ) 40 | } catch (exception: IOException) { 41 | return LoadResult.Error(exception) 42 | } catch (exception: HttpException) { 43 | return LoadResult.Error(exception) 44 | } 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /app/src/main/java/com/kanyideveloper/muviz/home/data/paging/UpcomingMoviesSource.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2024 Joel Kanyi. 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 | package com.kanyideveloper.muviz.home.data.paging 17 | 18 | import androidx.paging.PagingSource 19 | import androidx.paging.PagingState 20 | import com.kanyideveloper.muviz.common.data.network.TMDBApi 21 | import com.kanyideveloper.muviz.home.domain.model.Movie 22 | import retrofit2.HttpException 23 | import java.io.IOException 24 | 25 | class UpcomingMoviesSource(private val api: TMDBApi) : 26 | PagingSource() { 27 | override fun getRefreshKey(state: PagingState): Int? { 28 | return state.anchorPosition 29 | } 30 | 31 | override suspend fun load(params: LoadParams): LoadResult { 32 | return try { 33 | val nextPage = params.key ?: 1 34 | val upcomingComingMoviesList = api.getUpcomingMovies(nextPage) 35 | LoadResult.Page( 36 | data = upcomingComingMoviesList.searches, 37 | prevKey = if (nextPage == 1) null else nextPage - 1, 38 | nextKey = if (upcomingComingMoviesList.searches.isEmpty()) null else upcomingComingMoviesList.page + 1 39 | ) 40 | } catch (exception: IOException) { 41 | return LoadResult.Error(exception) 42 | } catch (exception: HttpException) { 43 | return LoadResult.Error(exception) 44 | } 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /app/src/main/java/com/kanyideveloper/muviz/home/data/repository/MoviesRepository.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2024 Joel Kanyi. 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 | package com.kanyideveloper.muviz.home.data.repository 17 | 18 | import androidx.paging.Pager 19 | import androidx.paging.PagingConfig 20 | import androidx.paging.PagingData 21 | import com.kanyideveloper.muviz.common.data.network.TMDBApi 22 | import com.kanyideveloper.muviz.common.util.Constants.PAGING_SIZE 23 | import com.kanyideveloper.muviz.home.domain.model.Movie 24 | import com.kanyideveloper.muviz.home.data.paging.NowPlayingMoviesSource 25 | import com.kanyideveloper.muviz.home.data.paging.PopularMoviesSource 26 | import com.kanyideveloper.muviz.home.data.paging.TopRatedMoviesSource 27 | import com.kanyideveloper.muviz.home.data.paging.TrendingMoviesSource 28 | import com.kanyideveloper.muviz.home.data.paging.UpcomingMoviesSource 29 | import kotlinx.coroutines.flow.Flow 30 | import javax.inject.Inject 31 | 32 | class MoviesRepository @Inject constructor(private val api: TMDBApi) { 33 | 34 | fun getTrendingMoviesThisWeek(): Flow> { 35 | return Pager( 36 | config = PagingConfig(enablePlaceholders = false, pageSize = PAGING_SIZE), 37 | pagingSourceFactory = { 38 | TrendingMoviesSource(api) 39 | } 40 | ).flow 41 | } 42 | 43 | fun getUpcomingMovies(): Flow> { 44 | return Pager( 45 | config = PagingConfig(enablePlaceholders = false, pageSize = PAGING_SIZE), 46 | pagingSourceFactory = { 47 | UpcomingMoviesSource(api) 48 | } 49 | ).flow 50 | } 51 | 52 | fun getTopRatedMovies(): Flow> { 53 | return Pager( 54 | config = PagingConfig(enablePlaceholders = false, pageSize = PAGING_SIZE), 55 | pagingSourceFactory = { 56 | TopRatedMoviesSource(api) 57 | } 58 | ).flow 59 | } 60 | 61 | fun getNowPlayingMovies(): Flow> { 62 | return Pager( 63 | config = PagingConfig(enablePlaceholders = false, pageSize = PAGING_SIZE), 64 | pagingSourceFactory = { 65 | NowPlayingMoviesSource(api) 66 | } 67 | ).flow 68 | } 69 | 70 | fun getPopularMovies(): Flow> { 71 | return Pager( 72 | config = PagingConfig(enablePlaceholders = false, pageSize = PAGING_SIZE), 73 | pagingSourceFactory = { 74 | PopularMoviesSource(api) 75 | } 76 | ).flow 77 | } 78 | } 79 | -------------------------------------------------------------------------------- /app/src/main/java/com/kanyideveloper/muviz/home/data/repository/TvSeriesRepository.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2024 Joel Kanyi. 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 | package com.kanyideveloper.muviz.home.data.repository 17 | 18 | import androidx.paging.Pager 19 | import androidx.paging.PagingConfig 20 | import androidx.paging.PagingData 21 | import com.kanyideveloper.muviz.common.data.network.TMDBApi 22 | import com.kanyideveloper.muviz.common.util.Constants.PAGING_SIZE 23 | import com.kanyideveloper.muviz.home.domain.model.Series 24 | import com.kanyideveloper.muviz.home.data.paging.AiringTodayTvSeriesSource 25 | import com.kanyideveloper.muviz.home.data.paging.OnTheAirSeriesSource 26 | import com.kanyideveloper.muviz.home.data.paging.PopularSeriesSource 27 | import com.kanyideveloper.muviz.home.data.paging.TopRatedSeriesSource 28 | import com.kanyideveloper.muviz.home.data.paging.TrendingSeriesSource 29 | import kotlinx.coroutines.flow.Flow 30 | import javax.inject.Inject 31 | 32 | class TvSeriesRepository @Inject constructor(private val api: TMDBApi) { 33 | fun getTrendingThisWeekTvSeries(): Flow> { 34 | return Pager( 35 | config = PagingConfig(enablePlaceholders = false, pageSize = PAGING_SIZE), 36 | pagingSourceFactory = { 37 | TrendingSeriesSource(api) 38 | } 39 | ).flow 40 | } 41 | 42 | fun getOnTheAirTvSeries(): Flow> { 43 | return Pager( 44 | config = PagingConfig(enablePlaceholders = false, pageSize = PAGING_SIZE), 45 | pagingSourceFactory = { 46 | OnTheAirSeriesSource(api) 47 | } 48 | ).flow 49 | } 50 | 51 | fun getTopRatedTvSeries(): Flow> { 52 | return Pager( 53 | config = PagingConfig(enablePlaceholders = false, pageSize = PAGING_SIZE), 54 | pagingSourceFactory = { 55 | TopRatedSeriesSource(api) 56 | } 57 | ).flow 58 | } 59 | 60 | fun getAiringTodayTvSeries(): Flow> { 61 | return Pager( 62 | config = PagingConfig(enablePlaceholders = false, pageSize = PAGING_SIZE), 63 | pagingSourceFactory = { 64 | AiringTodayTvSeriesSource(api) 65 | } 66 | ).flow 67 | } 68 | 69 | fun getPopularTvSeries(): Flow> { 70 | return Pager( 71 | config = PagingConfig(enablePlaceholders = false, pageSize = PAGING_SIZE), 72 | pagingSourceFactory = { 73 | PopularSeriesSource(api) 74 | } 75 | ).flow 76 | } 77 | } 78 | -------------------------------------------------------------------------------- /app/src/main/java/com/kanyideveloper/muviz/home/di/HomeModule.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2024 Joel Kanyi. 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 | package com.kanyideveloper.muviz.home.di 17 | 18 | import dagger.Module 19 | import dagger.hilt.InstallIn 20 | import dagger.hilt.components.SingletonComponent 21 | 22 | /* 23 | @Module 24 | @InstallIn(SingletonComponent::class) 25 | abstract class HomeModule { 26 | 27 | }*/ 28 | -------------------------------------------------------------------------------- /app/src/main/java/com/kanyideveloper/muviz/home/domain/model/Movie.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2024 Joel Kanyi. 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 | package com.kanyideveloper.muviz.home.domain.model 17 | 18 | import com.google.gson.annotations.SerializedName 19 | 20 | data class Movie( 21 | @SerializedName("adult") 22 | val adult: Boolean, 23 | @SerializedName("backdrop_path") 24 | val backdropPath: String, 25 | @SerializedName("genre_ids") 26 | val genreIds: List, 27 | @SerializedName("id") 28 | val id: Int, 29 | @SerializedName("original_language") 30 | val originalLanguage: String, 31 | @SerializedName("original_title") 32 | val originalTitle: String, 33 | @SerializedName("overview") 34 | val overview: String, 35 | @SerializedName("popularity") 36 | val popularity: Double, 37 | @SerializedName("poster_path") 38 | val posterPath: String, 39 | @SerializedName("release_date") 40 | val releaseDate: String, 41 | @SerializedName("title") 42 | val title: String, 43 | @SerializedName("video") 44 | val video: Boolean, 45 | @SerializedName("vote_average") 46 | val voteAverage: Double, 47 | @SerializedName("vote_count") 48 | val voteCount: Int 49 | ) 50 | -------------------------------------------------------------------------------- /app/src/main/java/com/kanyideveloper/muviz/home/domain/model/Series.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2024 Joel Kanyi. 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 | package com.kanyideveloper.muviz.home.domain.model 17 | 18 | import com.google.gson.annotations.SerializedName 19 | 20 | data class Series( 21 | @SerializedName("backdrop_path") 22 | val backdropPath: String, 23 | @SerializedName("first_air_date") 24 | val firstAirDate: String, 25 | @SerializedName("genre_ids") 26 | val genreIds: List, 27 | @SerializedName("id") 28 | val id: Int, 29 | @SerializedName("name") 30 | val name: String, 31 | @SerializedName("origin_country") 32 | val originCountry: List, 33 | @SerializedName("original_language") 34 | val originalLanguage: String, 35 | @SerializedName("original_name") 36 | val originalName: String, 37 | @SerializedName("overview") 38 | val overview: String, 39 | @SerializedName("popularity") 40 | val popularity: Double, 41 | @SerializedName("poster_path") 42 | val posterPath: String, 43 | @SerializedName("vote_average") 44 | val voteAverage: Double, 45 | @SerializedName("vote_count") 46 | val voteCount: Int 47 | ) 48 | -------------------------------------------------------------------------------- /app/src/main/java/com/kanyideveloper/muviz/home/presentation/HomeUiEvents.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2024 Joel Kanyi. 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 | package com.kanyideveloper.muviz.home.presentation 17 | 18 | import com.kanyideveloper.muviz.common.domain.model.Film 19 | import com.kanyideveloper.muviz.genre.domain.model.Genre 20 | 21 | sealed interface HomeUiEvents { 22 | data object NavigateBack : HomeUiEvents 23 | data object OnPullToRefresh : HomeUiEvents 24 | 25 | data class NavigateToFilmDetails( 26 | val film: Film, 27 | ) : HomeUiEvents 28 | 29 | data class OnFilmGenreSelected( 30 | val genre: Genre, 31 | val filmType: String, 32 | val selectedFilmOption: String 33 | ) : 34 | HomeUiEvents 35 | 36 | data class OnFilmOptionSelected(val item: String) : 37 | HomeUiEvents 38 | } 39 | -------------------------------------------------------------------------------- /app/src/main/java/com/kanyideveloper/muviz/home/presentation/HomeUiState.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2024 Joel Kanyi. 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 | package com.kanyideveloper.muviz.home.presentation 17 | 18 | import androidx.paging.PagingData 19 | import com.kanyideveloper.muviz.genre.domain.model.Genre 20 | import com.kanyideveloper.muviz.home.domain.model.Movie 21 | import com.kanyideveloper.muviz.home.domain.model.Series 22 | import kotlinx.coroutines.flow.Flow 23 | import kotlinx.coroutines.flow.emptyFlow 24 | 25 | data class HomeUiState( 26 | // Movies 27 | val trendingMovies: Flow> = emptyFlow(), 28 | val upcomingMovies: Flow> = emptyFlow(), 29 | val topRatedMovies: Flow> = emptyFlow(), 30 | val nowPlayingMovies: Flow> = emptyFlow(), 31 | val popularMovies: Flow> = emptyFlow(), 32 | 33 | // Tv Series 34 | val trendingTvSeries: Flow> = emptyFlow(), 35 | val onAirTvSeries: Flow> = emptyFlow(), 36 | val topRatedTvSeries: Flow> = emptyFlow(), 37 | val airingTodayTvSeries: Flow> = emptyFlow(), 38 | val popularTvSeries: Flow> = emptyFlow(), 39 | 40 | val selectedFilmOption: String = "Movies", 41 | val tvSeriesGenres: List = emptyList(), 42 | val moviesGenres: List = emptyList(), 43 | val selectedGenre: Genre? = null, 44 | ) 45 | -------------------------------------------------------------------------------- /app/src/main/java/com/kanyideveloper/muviz/search/data/network/dto/MultiSearchResponse.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2024 Joel Kanyi. 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 | package com.kanyideveloper.muviz.search.data.network.dto 17 | 18 | 19 | import com.google.gson.annotations.SerializedName 20 | import com.kanyideveloper.muviz.search.domain.model.Search 21 | 22 | data class MultiSearchResponse( 23 | @SerializedName("page") 24 | val page: Int, 25 | @SerializedName("results") 26 | val searches: List, 27 | @SerializedName("total_pages") 28 | val totalPages: Int, 29 | @SerializedName("total_results") 30 | val totalResults: Int 31 | ) 32 | -------------------------------------------------------------------------------- /app/src/main/java/com/kanyideveloper/muviz/search/data/paging/SearchPagingSource.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2024 Joel Kanyi. 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 | package com.kanyideveloper.muviz.search.data.paging 17 | 18 | import androidx.paging.PagingSource 19 | import androidx.paging.PagingState 20 | import com.kanyideveloper.muviz.common.data.network.TMDBApi 21 | import com.kanyideveloper.muviz.search.domain.model.Search 22 | import retrofit2.HttpException 23 | import java.io.IOException 24 | 25 | class SearchPagingSource(private val api: TMDBApi, private val query: String) : 26 | PagingSource() { 27 | override fun getRefreshKey(state: PagingState): Int? { 28 | return state.anchorPosition 29 | } 30 | 31 | override suspend fun load(params: LoadParams): LoadResult { 32 | return try { 33 | val nextPage = params.key ?: 1 34 | val searchResultList = api.multiSearch(nextPage, query) 35 | LoadResult.Page( 36 | data = searchResultList.searches, 37 | prevKey = if (nextPage == 1) null else nextPage - 1, 38 | nextKey = if (searchResultList.searches.isEmpty()) null else searchResultList.page + 1 39 | ) 40 | } catch (exception: IOException) { 41 | return LoadResult.Error(exception) 42 | } catch (exception: HttpException) { 43 | return LoadResult.Error(exception) 44 | } 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /app/src/main/java/com/kanyideveloper/muviz/search/data/repository/SearchRepositoryImpl.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2024 Joel Kanyi. 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 | package com.kanyideveloper.muviz.search.data.repository 17 | 18 | import androidx.paging.Pager 19 | import androidx.paging.PagingConfig 20 | import androidx.paging.PagingData 21 | import com.kanyideveloper.muviz.search.data.paging.SearchPagingSource 22 | import com.kanyideveloper.muviz.common.data.network.TMDBApi 23 | import com.kanyideveloper.muviz.common.util.Constants.PAGING_SIZE 24 | import com.kanyideveloper.muviz.search.domain.model.Search 25 | import com.kanyideveloper.muviz.search.domain.repository.SearchRepository 26 | import kotlinx.coroutines.flow.Flow 27 | import javax.inject.Inject 28 | 29 | class SearchRepositoryImpl @Inject constructor(private val api: TMDBApi): SearchRepository { 30 | override fun multiSearch(queryParam: String): Flow> { 31 | return Pager( 32 | config = PagingConfig(enablePlaceholders = false, pageSize = PAGING_SIZE), 33 | pagingSourceFactory = { 34 | SearchPagingSource(api, queryParam) 35 | } 36 | ).flow 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /app/src/main/java/com/kanyideveloper/muviz/search/di/SearchModule.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2024 Joel Kanyi. 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 | package com.kanyideveloper.muviz.search.di 17 | 18 | import com.kanyideveloper.muviz.search.data.repository.SearchRepositoryImpl 19 | import com.kanyideveloper.muviz.search.domain.repository.SearchRepository 20 | import dagger.Binds 21 | import dagger.Module 22 | import dagger.hilt.InstallIn 23 | import dagger.hilt.components.SingletonComponent 24 | 25 | @Module 26 | @InstallIn(SingletonComponent::class) 27 | abstract class SearchModule { 28 | @Binds 29 | abstract fun bindSearchRepository( 30 | searchRepositoryImpl: SearchRepositoryImpl 31 | ): SearchRepository 32 | } 33 | -------------------------------------------------------------------------------- /app/src/main/java/com/kanyideveloper/muviz/search/domain/model/Search.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2024 Joel Kanyi. 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 | package com.kanyideveloper.muviz.search.domain.model 17 | 18 | 19 | import com.google.gson.annotations.SerializedName 20 | 21 | data class Search( 22 | @SerializedName("adult") 23 | val adult: Boolean?, 24 | @SerializedName("backdrop_path") 25 | val backdropPath: String?, 26 | @SerializedName("first_air_date") 27 | val firstAirDate: String?, 28 | @SerializedName("genre_ids") 29 | val genreIds: List?, 30 | @SerializedName("id") 31 | val id: Int, 32 | @SerializedName("media_type") 33 | val mediaType: String, 34 | @SerializedName("name") 35 | val name: String?, 36 | @SerializedName("origin_country") 37 | val originCountry: List?, 38 | @SerializedName("original_language") 39 | val originalLanguage: String?, 40 | @SerializedName("original_name") 41 | val originalName: String?, 42 | @SerializedName("original_title") 43 | val originalTitle: String?, 44 | @SerializedName("overview") 45 | val overview: String?, 46 | @SerializedName("popularity") 47 | val popularity: Double?, 48 | @SerializedName("poster_path") 49 | val posterPath: String?, 50 | @SerializedName("release_date") 51 | val releaseDate: String?, 52 | @SerializedName("title") 53 | val title: String?, 54 | @SerializedName("video") 55 | val video: Boolean?, 56 | @SerializedName("vote_average") 57 | val voteAverage: Double?, 58 | @SerializedName("vote_count") 59 | val voteCount: Int? 60 | ) 61 | -------------------------------------------------------------------------------- /app/src/main/java/com/kanyideveloper/muviz/search/domain/repository/SearchRepository.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2024 Joel Kanyi. 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 | package com.kanyideveloper.muviz.search.domain.repository 17 | 18 | import androidx.paging.PagingData 19 | import com.kanyideveloper.muviz.search.domain.model.Search 20 | import kotlinx.coroutines.flow.Flow 21 | 22 | interface SearchRepository { 23 | fun multiSearch(queryParam: String): Flow> 24 | } 25 | -------------------------------------------------------------------------------- /app/src/main/java/com/kanyideveloper/muviz/search/domain/usecase/SearchFilmUseCase.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2024 Joel Kanyi. 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 | package com.kanyideveloper.muviz.search.domain.usecase 17 | 18 | import androidx.paging.PagingData 19 | import androidx.paging.filter 20 | import com.kanyideveloper.muviz.search.domain.model.Search 21 | import com.kanyideveloper.muviz.search.domain.repository.SearchRepository 22 | import kotlinx.coroutines.flow.Flow 23 | import kotlinx.coroutines.flow.map 24 | import javax.inject.Inject 25 | 26 | class SearchFilmUseCase @Inject constructor( 27 | private val repository: SearchRepository 28 | ) { 29 | operator fun invoke(searchParam: String): Flow> { 30 | return repository.multiSearch(searchParam).map { pagingData -> 31 | pagingData.filter { search -> 32 | ((search.title != null || search.originalName != null || search.originalTitle != null) && 33 | (search.mediaType == "tv" || search.mediaType == "movie")) 34 | } 35 | } 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /app/src/main/java/com/kanyideveloper/muviz/search/presentation/SearchUiEvents.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2024 Joel Kanyi. 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 | package com.kanyideveloper.muviz.search.presentation 17 | 18 | import com.kanyideveloper.muviz.search.domain.model.Search 19 | 20 | sealed interface SearchUiEvents { 21 | data class SearchTermChanged(val value: String) : SearchUiEvents 22 | data class SearchFilm(val searchTerm: String) : 23 | SearchUiEvents 24 | 25 | data class OpenFilmDetails(val search: Search?) : 26 | SearchUiEvents 27 | data object ClearSearchTerm: SearchUiEvents 28 | } 29 | -------------------------------------------------------------------------------- /app/src/main/java/com/kanyideveloper/muviz/search/presentation/SearchUiState.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2024 Joel Kanyi. 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 | package com.kanyideveloper.muviz.search.presentation 17 | 18 | import androidx.paging.PagingData 19 | import com.kanyideveloper.muviz.genre.domain.model.Genre 20 | import com.kanyideveloper.muviz.search.domain.model.Search 21 | import kotlinx.coroutines.flow.Flow 22 | import kotlinx.coroutines.flow.emptyFlow 23 | 24 | data class SearchUiState( 25 | val isLoadingGenres: Boolean = false, 26 | val searchTerm: String = "", 27 | val searchResult: Flow> = emptyFlow(), 28 | val moviesGenres: List = emptyList(), 29 | val tvSeriesGenres: List = emptyList() 30 | ) 31 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/dark_mode.xml: -------------------------------------------------------------------------------- 1 | 7 | 10 | 11 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic__facebook.xml: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic__linkedin.xml: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic__search_biggy.xml: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_chevron_left.xml: -------------------------------------------------------------------------------- 1 | 6 | 9 | 10 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_chevron_right.xml: -------------------------------------------------------------------------------- 1 | 6 | 9 | 10 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_danger_circle.xml: -------------------------------------------------------------------------------- 1 | 6 | 10 | 14 | 18 | 19 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_github.xml: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_home.xml: -------------------------------------------------------------------------------- 1 | 6 | 7 | 10 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_profile.xml: -------------------------------------------------------------------------------- 1 | 6 | 7 | 10 | 14 | 15 | 16 | 19 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_search.xml: -------------------------------------------------------------------------------- 1 | 6 | 13 | 20 | 21 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_share.xml: -------------------------------------------------------------------------------- 1 | 6 | 9 | 10 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_socials.xml: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_star.xml: -------------------------------------------------------------------------------- 1 | 6 | 10 | 11 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_theme.xml: -------------------------------------------------------------------------------- 1 | 6 | 9 | 10 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_twitter.xml: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/light_mode.xml: -------------------------------------------------------------------------------- 1 | 7 | 10 | 11 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/muviz.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/joelkanyi/Muviz/032640d9946cdb0eddde15b05ab928ddf4d0bfea/app/src/main/res/drawable/muviz.png -------------------------------------------------------------------------------- /app/src/main/res/drawable/settings_suggest.xml: -------------------------------------------------------------------------------- 1 | 7 | 10 | 11 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/wallpaper.xml: -------------------------------------------------------------------------------- 1 | 7 | 10 | 11 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/window_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /app/src/main/res/font/quicksand_bold.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/joelkanyi/Muviz/032640d9946cdb0eddde15b05ab928ddf4d0bfea/app/src/main/res/font/quicksand_bold.ttf -------------------------------------------------------------------------------- /app/src/main/res/font/quicksand_light.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/joelkanyi/Muviz/032640d9946cdb0eddde15b05ab928ddf4d0bfea/app/src/main/res/font/quicksand_light.ttf -------------------------------------------------------------------------------- /app/src/main/res/font/quicksand_medium.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/joelkanyi/Muviz/032640d9946cdb0eddde15b05ab928ddf4d0bfea/app/src/main/res/font/quicksand_medium.ttf -------------------------------------------------------------------------------- /app/src/main/res/font/quicksand_regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/joelkanyi/Muviz/032640d9946cdb0eddde15b05ab928ddf4d0bfea/app/src/main/res/font/quicksand_regular.ttf -------------------------------------------------------------------------------- /app/src/main/res/font/quicksand_semibold.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/joelkanyi/Muviz/032640d9946cdb0eddde15b05ab928ddf4d0bfea/app/src/main/res/font/quicksand_semibold.ttf -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /app/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/joelkanyi/Muviz/032640d9946cdb0eddde15b05ab928ddf4d0bfea/app/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-hdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/joelkanyi/Muviz/032640d9946cdb0eddde15b05ab928ddf4d0bfea/app/src/main/res/mipmap-hdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/joelkanyi/Muviz/032640d9946cdb0eddde15b05ab928ddf4d0bfea/app/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-mdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/joelkanyi/Muviz/032640d9946cdb0eddde15b05ab928ddf4d0bfea/app/src/main/res/mipmap-mdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/joelkanyi/Muviz/032640d9946cdb0eddde15b05ab928ddf4d0bfea/app/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/joelkanyi/Muviz/032640d9946cdb0eddde15b05ab928ddf4d0bfea/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/joelkanyi/Muviz/032640d9946cdb0eddde15b05ab928ddf4d0bfea/app/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/joelkanyi/Muviz/032640d9946cdb0eddde15b05ab928ddf4d0bfea/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/joelkanyi/Muviz/032640d9946cdb0eddde15b05ab928ddf4d0bfea/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/joelkanyi/Muviz/032640d9946cdb0eddde15b05ab928ddf4d0bfea/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /app/src/main/res/values/colors.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | #FFBB86FC 4 | #FF6200EE 5 | #FF3700B3 6 | #FF03DAC5 7 | #FF018786 8 | #FF161616 9 | #FFFFFFFF 10 | #FF161616 11 | #00FFFFFF 12 | -------------------------------------------------------------------------------- /app/src/main/res/values/ic_launcher_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | #161616 4 | -------------------------------------------------------------------------------- /app/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | Muviz 3 | Unlike 4 | Like 5 | About 6 | Muviz is an Android app that help movies, Tv shows and series fanatics to have current information of the trending, popular, upcoming, on air and many other films. It also helps user know the details of their favorite films and the casts, this helps users add their favorites films to favorite for easy remembrance. It also helps users search for that show that they have heard about it and they are not sure about it. 7 | v%1$s-(%2$s) 8 | Get in touch 9 | Share 10 | Rate us 11 | Casts 12 | View all 13 | Cast 14 | Release date 15 | Search... 16 | Search 17 | Change Theme 18 | Trending today 19 | Tv Shows 20 | Popular 21 | On Air 22 | Upcoming 23 | Airing today 24 | Now playing 25 | Top rated 26 | Movies 27 | Genres 28 | Delete all favorites 29 | Are you want to delete all? 30 | Yes 31 | No 32 | Favorites 33 | -------------------------------------------------------------------------------- /app/src/main/res/values/themes.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 8 | 9 | -------------------------------------------------------------------------------- /build.gradle.kts: -------------------------------------------------------------------------------- 1 | plugins { 2 | alias(libs.plugins.android.application) apply false 3 | alias(libs.plugins.android.library) apply false 4 | alias(libs.plugins.android.kotlin) apply false 5 | alias(libs.plugins.jvm) apply false 6 | alias(libs.plugins.hilt.android) apply false 7 | alias(libs.plugins.google.services) apply false 8 | alias(libs.plugins.spotless) 9 | alias(libs.plugins.kapt) apply false 10 | alias(libs.plugins.parcelize) apply false 11 | alias(libs.plugins.ksp) apply false 12 | alias(libs.plugins.compose.compiler) apply false 13 | } 14 | 15 | subprojects { 16 | apply(plugin = "com.diffplug.spotless") 17 | spotless { 18 | kotlin { 19 | target("**/*.kt") 20 | licenseHeaderFile( 21 | rootProject.file("${project.rootDir}/spotless/copyright.kt"), 22 | "^(package|object|import|interface)", 23 | ) 24 | trimTrailingWhitespace() 25 | endWithNewline() 26 | } 27 | format("kts") { 28 | target("**/*.kts") 29 | targetExclude("$buildDir/**/*.kts") 30 | licenseHeaderFile(rootProject.file("spotless/copyright.kt"), "(^(?![\\/ ]\\*).*$)") 31 | } 32 | format("misc") { 33 | target("**/*.md", "**/.gitignore") 34 | trimTrailingWhitespace() 35 | indentWithTabs() 36 | endWithNewline() 37 | } 38 | } 39 | } -------------------------------------------------------------------------------- /gradle.properties: -------------------------------------------------------------------------------- 1 | # Project-wide Gradle settings. 2 | # IDE (e.g. Android Studio) users: 3 | # Gradle settings configured through the IDE *will override* 4 | # any settings specified in this file. 5 | # For more details on how to configure your build environment visit 6 | # http://www.gradle.org/docs/current/userguide/build_environment.html 7 | # Specifies the JVM arguments used for the daemon process. 8 | # The setting is particularly useful for tweaking memory settings. 9 | org.gradle.jvmargs=-Xmx2048m -Dfile.encoding=UTF-8 10 | # When configured, Gradle will run in incubating parallel mode. 11 | # This option should only be used with decoupled projects. More details, visit 12 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects 13 | # org.gradle.parallel=true 14 | # AndroidX package structure to make it clearer which packages are bundled with the 15 | # Android operating system, and which are packaged with your app"s APK 16 | # https://developer.android.com/topic/libraries/support-library/androidx-rn 17 | android.useAndroidX=true 18 | # Kotlin code style for this project: "official" or "obsolete": 19 | kotlin.code.style=official 20 | # Enables namespacing of each library's R class so that its R class includes only the 21 | # resources declared in the library itself and none from the library's dependencies, 22 | # thereby reducing the size of the R class for that library 23 | android.nonTransitiveRClass=true 24 | 25 | # Enable R8 full mode: 26 | # https://developer.android.com/studio/build/shrink-code#full-mode 27 | android.enableR8.fullMode=false -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/joelkanyi/Muviz/032640d9946cdb0eddde15b05ab928ddf4d0bfea/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionBase=GRADLE_USER_HOME 2 | distributionPath=wrapper/dists 3 | distributionUrl=https\://services.gradle.org/distributions/gradle-8.8-bin.zip 4 | networkTimeout=10000 5 | validateDistributionUrl=true 6 | zipStoreBase=GRADLE_USER_HOME 7 | zipStorePath=wrapper/dists 8 | -------------------------------------------------------------------------------- /gradlew.bat: -------------------------------------------------------------------------------- 1 | @rem 2 | @rem Copyright 2015 the original author or authors. 3 | @rem 4 | @rem Licensed under the Apache License, Version 2.0 (the "License"); 5 | @rem you may not use this file except in compliance with the License. 6 | @rem You may obtain a copy of the License at 7 | @rem 8 | @rem https://www.apache.org/licenses/LICENSE-2.0 9 | @rem 10 | @rem Unless required by applicable law or agreed to in writing, software 11 | @rem distributed under the License is distributed on an "AS IS" BASIS, 12 | @rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | @rem See the License for the specific language governing permissions and 14 | @rem limitations under the License. 15 | @rem 16 | 17 | @if "%DEBUG%"=="" @echo off 18 | @rem ########################################################################## 19 | @rem 20 | @rem Gradle startup script for Windows 21 | @rem 22 | @rem ########################################################################## 23 | 24 | @rem Set local scope for the variables with windows NT shell 25 | if "%OS%"=="Windows_NT" setlocal 26 | 27 | set DIRNAME=%~dp0 28 | if "%DIRNAME%"=="" set DIRNAME=. 29 | @rem This is normally unused 30 | set APP_BASE_NAME=%~n0 31 | set APP_HOME=%DIRNAME% 32 | 33 | @rem Resolve any "." and ".." in APP_HOME to make it shorter. 34 | for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi 35 | 36 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 37 | set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" 38 | 39 | @rem Find java.exe 40 | if defined JAVA_HOME goto findJavaFromJavaHome 41 | 42 | set JAVA_EXE=java.exe 43 | %JAVA_EXE% -version >NUL 2>&1 44 | if %ERRORLEVEL% equ 0 goto execute 45 | 46 | echo. 1>&2 47 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2 48 | echo. 1>&2 49 | echo Please set the JAVA_HOME variable in your environment to match the 1>&2 50 | echo location of your Java installation. 1>&2 51 | 52 | goto fail 53 | 54 | :findJavaFromJavaHome 55 | set JAVA_HOME=%JAVA_HOME:"=% 56 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe 57 | 58 | if exist "%JAVA_EXE%" goto execute 59 | 60 | echo. 1>&2 61 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2 62 | echo. 1>&2 63 | echo Please set the JAVA_HOME variable in your environment to match the 1>&2 64 | echo location of your Java installation. 1>&2 65 | 66 | goto fail 67 | 68 | :execute 69 | @rem Setup the command line 70 | 71 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar 72 | 73 | 74 | @rem Execute Gradle 75 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* 76 | 77 | :end 78 | @rem End local scope for the variables with windows NT shell 79 | if %ERRORLEVEL% equ 0 goto mainEnd 80 | 81 | :fail 82 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of 83 | rem the _cmd.exe /c_ return code! 84 | set EXIT_CODE=%ERRORLEVEL% 85 | if %EXIT_CODE% equ 0 set EXIT_CODE=1 86 | if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE% 87 | exit /b %EXIT_CODE% 88 | 89 | :mainEnd 90 | if "%OS%"=="Windows_NT" endlocal 91 | 92 | :omega 93 | -------------------------------------------------------------------------------- /renovate.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://docs.renovatebot.com/renovate-schema.json", 3 | "extends": [ 4 | "config:base" 5 | ], 6 | "schedule": [ 7 | "on friday" 8 | ], 9 | "timezone": "Africa/Nairobi", 10 | "labels": [ 11 | "dependency-update" 12 | ], 13 | "prHourlyLimit": 0, 14 | "baseBranches": [ 15 | "main" 16 | ], 17 | "separateMultipleMajor": true, 18 | "dependencyDashboardTitle": "automated dependency updates dashboard", 19 | "dependencyDashboard": true, 20 | "branchPrefix": "chore/", 21 | "additionalBranchPrefix": "update-libs/", 22 | "commitMessageAction": "update", 23 | "commitMessageExtra": "from {{{currentValue}}} to {{#if isPinDigest}}{{{newDigestShort}}}{{else}}{{#if isMajor}}{{prettyNewMajor}}{{else}}{{#if isSingleVersion}}{{prettyNewVersion}}{{else}}{{#if newValue}}{{{newValue}}}{{else}}{{{newDigestShort}}}{{/if}}{{/if}}{{/if}}{{/if}}", 24 | "packageRules": [ 25 | { 26 | "groupName": "all non-major dependencies", 27 | "groupSlug": "all-minor-patch", 28 | "matchPackagePatterns": [ 29 | "*" 30 | ], 31 | "matchUpdateTypes": [ 32 | "minor", 33 | "patch" 34 | ] 35 | }, 36 | { 37 | "groupName": "kotlin dependencies", 38 | "matchPackagePatterns": [ 39 | "org.jetbrains.kotlin:*", 40 | "com.google.devtools.ksp", 41 | "composeOptions" 42 | ] 43 | }, 44 | { 45 | "groupName": "coroutine dependencies", 46 | "matchPackagePatterns": [ 47 | "io.coil-kt:*", 48 | "org.jetbrains.kotlinx:*" 49 | ] 50 | }, 51 | { 52 | "groupName": "plugin dependencies", 53 | "matchPackagePatterns": [ 54 | "com.android.library", 55 | "com.android.application", 56 | "app.cash.paparazzi" 57 | ] 58 | }, 59 | { 60 | "groupName": "sonar", 61 | "matchPackagePatterns": [ 62 | "org.sonarqube" 63 | ] 64 | }, 65 | { 66 | "groupName": "target sdk 34", 67 | "matchPackagePatterns": [ 68 | "androidx.navigation:navigation-compose" 69 | ] 70 | }, 71 | { 72 | "groupName": "ktlint", 73 | "matchPackagePatterns": [ 74 | "org.jlleitschuh.gradle.ktlint" 75 | ] 76 | }, 77 | { 78 | "groupName": "test dependencies", 79 | "matchPackagePatterns": [ 80 | "com.google.truth:truth", 81 | "androidx.compose.ui:ui-test-junit4", 82 | "androidx.compose.ui:ui-test-manifest", 83 | "org.robolectric:robolectric", 84 | "junit:junit", 85 | "androidx.test:core-ktx" 86 | ] 87 | } 88 | ], 89 | "ignoreDeps": [ 90 | "androidx.emoji2:emoji2" 91 | ] 92 | } -------------------------------------------------------------------------------- /screenshots/account_dark.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/joelkanyi/Muviz/032640d9946cdb0eddde15b05ab928ddf4d0bfea/screenshots/account_dark.png -------------------------------------------------------------------------------- /screenshots/account_light.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/joelkanyi/Muviz/032640d9946cdb0eddde15b05ab928ddf4d0bfea/screenshots/account_light.png -------------------------------------------------------------------------------- /screenshots/cast_dark.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/joelkanyi/Muviz/032640d9946cdb0eddde15b05ab928ddf4d0bfea/screenshots/cast_dark.png -------------------------------------------------------------------------------- /screenshots/cast_light.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/joelkanyi/Muviz/032640d9946cdb0eddde15b05ab928ddf4d0bfea/screenshots/cast_light.png -------------------------------------------------------------------------------- /screenshots/details_dark.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/joelkanyi/Muviz/032640d9946cdb0eddde15b05ab928ddf4d0bfea/screenshots/details_dark.png -------------------------------------------------------------------------------- /screenshots/details_light.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/joelkanyi/Muviz/032640d9946cdb0eddde15b05ab928ddf4d0bfea/screenshots/details_light.png -------------------------------------------------------------------------------- /screenshots/favorites_dark.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/joelkanyi/Muviz/032640d9946cdb0eddde15b05ab928ddf4d0bfea/screenshots/favorites_dark.png -------------------------------------------------------------------------------- /screenshots/favorites_light.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/joelkanyi/Muviz/032640d9946cdb0eddde15b05ab928ddf4d0bfea/screenshots/favorites_light.png -------------------------------------------------------------------------------- /screenshots/home_dark.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/joelkanyi/Muviz/032640d9946cdb0eddde15b05ab928ddf4d0bfea/screenshots/home_dark.png -------------------------------------------------------------------------------- /screenshots/home_light.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/joelkanyi/Muviz/032640d9946cdb0eddde15b05ab928ddf4d0bfea/screenshots/home_light.png -------------------------------------------------------------------------------- /screenshots/muviz.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/joelkanyi/Muviz/032640d9946cdb0eddde15b05ab928ddf4d0bfea/screenshots/muviz.png -------------------------------------------------------------------------------- /screenshots/search_dark.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/joelkanyi/Muviz/032640d9946cdb0eddde15b05ab928ddf4d0bfea/screenshots/search_dark.png -------------------------------------------------------------------------------- /screenshots/search_light.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/joelkanyi/Muviz/032640d9946cdb0eddde15b05ab928ddf4d0bfea/screenshots/search_light.png -------------------------------------------------------------------------------- /settings.gradle.kts: -------------------------------------------------------------------------------- 1 | pluginManagement { 2 | repositories { 3 | gradlePluginPortal() 4 | google() 5 | mavenCentral() 6 | } 7 | } 8 | dependencyResolutionManagement { 9 | repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS) 10 | repositories { 11 | google() 12 | mavenCentral() 13 | } 14 | } 15 | rootProject.name = "Muviz" 16 | include(":app") 17 | -------------------------------------------------------------------------------- /spotless/copyright.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright $YEAR Joel Kanyi. 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 | */ --------------------------------------------------------------------------------