-
-
Notifications
You must be signed in to change notification settings - Fork 36
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #187 from michaelbel/develop
1.5.2
- Loading branch information
Showing
264 changed files
with
2,654 additions
and
1,106 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,24 @@ | ||
package org.michaelbel.movies | ||
|
||
import android.app.Application | ||
import android.util.Log | ||
import androidx.hilt.work.HiltWorkerFactory | ||
import androidx.work.Configuration | ||
import com.google.firebase.FirebaseApp | ||
import dagger.hilt.android.HiltAndroidApp | ||
import org.michaelbel.moviemade.BuildConfig | ||
import javax.inject.Inject | ||
import org.michaelbel.movies.ui.appicon.installLauncherIcon | ||
|
||
@HiltAndroidApp | ||
internal class App: Application(), Configuration.Provider { | ||
|
||
@Inject lateinit var workerFactory: HiltWorkerFactory | ||
|
||
override fun getWorkManagerConfiguration(): Configuration { | ||
return Configuration.Builder() | ||
.setWorkerFactory(workerFactory) | ||
.setMinimumLoggingLevel(if (BuildConfig.DEBUG) Log.DEBUG else Log.ERROR) | ||
.build() | ||
} | ||
override val workManagerConfiguration: Configuration | ||
get() = Configuration.Builder().setWorkerFactory(workerFactory).build() | ||
|
||
override fun onCreate() { | ||
super.onCreate() | ||
installLauncherIcon() | ||
FirebaseApp.initializeApp(this) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
74 changes: 45 additions & 29 deletions
74
app/src/main/kotlin/org/michaelbel/movies/MainActivityContent.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,54 +1,70 @@ | ||
package org.michaelbel.movies | ||
|
||
import androidx.compose.runtime.Composable | ||
import androidx.compose.runtime.getValue | ||
import androidx.hilt.navigation.compose.hiltViewModel | ||
import androidx.lifecycle.compose.collectAsStateWithLifecycle | ||
import androidx.navigation.NavHostController | ||
import androidx.navigation.compose.NavHost | ||
import androidx.navigation.compose.rememberNavController | ||
import org.michaelbel.movies.auth.accountGraph | ||
import org.michaelbel.movies.auth.authGraph | ||
import org.michaelbel.movies.auth.navigateToAccount | ||
import org.michaelbel.movies.auth.navigateToAuth | ||
import org.michaelbel.movies.common.theme.AppTheme | ||
import org.michaelbel.movies.details.detailsGraph | ||
import org.michaelbel.movies.details.navigateToDetails | ||
import org.michaelbel.movies.feed.FeedDestination | ||
import org.michaelbel.movies.feed.feedGraph | ||
import org.michaelbel.movies.gallery.galleryGraph | ||
import org.michaelbel.movies.gallery.navigateToGallery | ||
import org.michaelbel.movies.navigation.ktx.addOnDestinationChangedListener | ||
import org.michaelbel.movies.settings.navigateToSettings | ||
import org.michaelbel.movies.settings.settingsGraph | ||
import org.michaelbel.movies.ui.theme.MoviesTheme | ||
|
||
@Composable | ||
internal fun MainActivityContent( | ||
navHostController: NavHostController = rememberNavController(), | ||
startDestination: String = FeedDestination.route, | ||
onStartUpdateFlow: () -> Unit | ||
onStartUpdateFlow: () -> Unit, | ||
viewModel: MainViewModel = hiltViewModel() | ||
) { | ||
NavHost( | ||
navController = navHostController, | ||
startDestination = startDestination | ||
val currentTheme: AppTheme by viewModel.currentTheme.collectAsStateWithLifecycle() | ||
val dynamicColors: Boolean by viewModel.dynamicColors.collectAsStateWithLifecycle() | ||
val navHostController: NavHostController = rememberNavController().apply { | ||
addOnDestinationChangedListener(viewModel::analyticsTrackDestination) | ||
} | ||
|
||
MoviesTheme( | ||
theme = currentTheme, | ||
dynamicColors = dynamicColors | ||
) { | ||
authGraph( | ||
navigateBack = navHostController::popBackStack | ||
) | ||
accountGraph( | ||
navigateBack = navHostController::popBackStack | ||
) | ||
feedGraph( | ||
navigateToAuth = navHostController::navigateToAuth, | ||
navigateToAccount = navHostController::navigateToAccount, | ||
navigateToSettings = navHostController::navigateToSettings, | ||
navigateToDetails = navHostController::navigateToDetails, | ||
onStartUpdateFlow = onStartUpdateFlow | ||
) | ||
detailsGraph( | ||
navigateBack = navHostController::popBackStack, | ||
navigateToGallery = navHostController::navigateToGallery | ||
) | ||
galleryGraph( | ||
navigateBack = navHostController::popBackStack | ||
) | ||
settingsGraph( | ||
navigateBack = navHostController::popBackStack | ||
) | ||
NavHost( | ||
navController = navHostController, | ||
startDestination = FeedDestination.route | ||
) { | ||
authGraph( | ||
navigateBack = navHostController::popBackStack | ||
) | ||
accountGraph( | ||
navigateBack = navHostController::popBackStack | ||
) | ||
feedGraph( | ||
navigateToAuth = navHostController::navigateToAuth, | ||
navigateToAccount = navHostController::navigateToAccount, | ||
navigateToSettings = navHostController::navigateToSettings, | ||
navigateToDetails = navHostController::navigateToDetails, | ||
onStartUpdateFlow = onStartUpdateFlow | ||
) | ||
detailsGraph( | ||
navigateBack = navHostController::popBackStack, | ||
navigateToGallery = navHostController::navigateToGallery | ||
) | ||
galleryGraph( | ||
navigateBack = navHostController::popBackStack | ||
) | ||
settingsGraph( | ||
navigateBack = navHostController::popBackStack | ||
) | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
<resources> | ||
<string name="app_name" translatable="false">Movies</string> | ||
<string name="app_name_dev" translatable="false">Movies Dev</string> | ||
</resources> |
Oops, something went wrong.