Skip to content

Commit

Permalink
Cleanup and renames
Browse files Browse the repository at this point in the history
  • Loading branch information
Ali committed Oct 12, 2023
1 parent ea6090a commit fba1247
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,12 @@ abstract class BaseNavTypeActivity : BaseActivity() {
searchMenuView, getString(R.string.transition_search_back)
)

val activity = when (navType) {
val activityClass = when (navType) {
NavType.MOVIES -> SearchMovieActivity::class.java
NavType.TV_SERIES -> SearchTVShowActivity::class.java
else -> throw RuntimeException("Unknown search navigation type")
}
val intent = Intent(this, activity)
val intent = Intent(this, activityClass)
// Bundle introduce an unexpected result in destination Activity.
// See https://issuetracker.google.com/issues/251812970
startActivity(intent, options.toBundle())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@ abstract class BaseNavTypeFragment : DaggerFragment() {
protected abstract val navType: NavType

protected fun startDetailActivity(tmdbItem: TmdbItem) {
val activity = when (navType) {
val activityClass = when (navType) {
NavType.MOVIES -> DetailMovieActivity::class.java
NavType.TV_SERIES -> DetailTVShowActivity::class.java
else -> throw RuntimeException("Unknown item to start detail Activity")
}
val intent = Intent(requireActivity(), activity).apply {
val intent = Intent(requireActivity(), activityClass).apply {
putExtras(Bundle().apply {
putParcelable(Constants.EXTRA_TMDB_ITEM, tmdbItem)
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ private fun <T : TmdbItem> FeedCollection(
modifier = Modifier
.align(Alignment.CenterVertically)
.clickable {
val activity = when (navType) {
val activityClass = when (navType) {
NavType.MOVIES -> {
when (feedCollection.sortType) {
SortType.TRENDING -> {
Expand Down Expand Up @@ -142,7 +142,7 @@ private fun <T : TmdbItem> FeedCollection(

else -> throw RuntimeException("Unknown item to start paging Activity")
}
val intent = Intent(context, activity)
val intent = Intent(context, activityClass)
context.startActivity(intent)
}
.padding(Dimens.PaddingNormal)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import androidx.annotation.StringRes
import androidx.compose.foundation.BorderStroke
import androidx.compose.foundation.background
import androidx.compose.foundation.clickable
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Row
Expand Down

0 comments on commit fba1247

Please sign in to comment.