From 1f50a9cbe737d40cf12bdd76341d27a2fb4b0188 Mon Sep 17 00:00:00 2001 From: Nik Clayton Date: Tue, 30 Apr 2024 16:08:08 +0200 Subject: [PATCH] change: Remove unnecessary types --- app/src/main/java/app/pachli/TabViewData.kt | 2 +- .../main/java/app/pachli/fragment/ViewMediaFragment.kt | 2 +- app/src/main/java/app/pachli/view/MediaPreviewLayout.kt | 4 ++-- .../pachli/core/testing/rules/LazyActivityScenarioRule.kt | 8 ++++---- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/app/src/main/java/app/pachli/TabViewData.kt b/app/src/main/java/app/pachli/TabViewData.kt index ca7cd6fb0..614ee5362 100644 --- a/app/src/main/java/app/pachli/TabViewData.kt +++ b/app/src/main/java/app/pachli/TabViewData.kt @@ -132,7 +132,7 @@ data class TabViewData( } }, ) { context -> - val tag = (timeline as Timeline.Hashtags).tags.first() + val tag = timeline.tags.first() ComposeActivityIntent( context, ComposeActivityIntent.ComposeOptions( diff --git a/app/src/main/java/app/pachli/fragment/ViewMediaFragment.kt b/app/src/main/java/app/pachli/fragment/ViewMediaFragment.kt index c5eb8a628..32f4d5564 100644 --- a/app/src/main/java/app/pachli/fragment/ViewMediaFragment.kt +++ b/app/src/main/java/app/pachli/fragment/ViewMediaFragment.kt @@ -136,7 +136,7 @@ abstract class ViewMediaFragment : Fragment() { override fun onViewCreated(view: View, savedInstanceState: Bundle?) { super.onViewCreated(view, savedInstanceState) - attachment = arguments?.getParcelable(ARG_ATTACHMENT) + attachment = arguments?.getParcelable(ARG_ATTACHMENT) ?: throw IllegalArgumentException("ARG_ATTACHMENT has to be set") shouldCallMediaReady = arguments?.getBoolean(ARG_SHOULD_CALL_MEDIA_READY) diff --git a/app/src/main/java/app/pachli/view/MediaPreviewLayout.kt b/app/src/main/java/app/pachli/view/MediaPreviewLayout.kt index 76b110059..ebf90afc2 100644 --- a/app/src/main/java/app/pachli/view/MediaPreviewLayout.kt +++ b/app/src/main/java/app/pachli/view/MediaPreviewLayout.kt @@ -190,8 +190,8 @@ class MediaPreviewLayout(context: Context, attrs: AttributeSet? = null) : val wrapper = getChildAt(index) action( index, - wrapper.findViewById(R.id.preview_image_view) as MediaPreviewImageView, - wrapper.findViewById(R.id.preview_media_description_indicator) as TextView, + wrapper.findViewById(R.id.preview_image_view)!!, + wrapper.findViewById(R.id.preview_media_description_indicator)!!, ) } } diff --git a/core/testing/src/main/kotlin/app/pachli/core/testing/rules/LazyActivityScenarioRule.kt b/core/testing/src/main/kotlin/app/pachli/core/testing/rules/LazyActivityScenarioRule.kt index e9ca772f5..f2f9d771e 100644 --- a/core/testing/src/main/kotlin/app/pachli/core/testing/rules/LazyActivityScenarioRule.kt +++ b/core/testing/src/main/kotlin/app/pachli/core/testing/rules/LazyActivityScenarioRule.kt @@ -34,17 +34,17 @@ import org.junit.rules.ExternalResource class LazyActivityScenarioRule : ExternalResource { constructor(launchActivity: Boolean, startActivityIntentSupplier: () -> Intent) { this.launchActivity = launchActivity - scenarioSupplier = { ActivityScenario.launch(startActivityIntentSupplier()) } + scenarioSupplier = { ActivityScenario.launch(startActivityIntentSupplier()) } } constructor(launchActivity: Boolean, startActivityIntent: Intent) { this.launchActivity = launchActivity - scenarioSupplier = { ActivityScenario.launch(startActivityIntent) } + scenarioSupplier = { ActivityScenario.launch(startActivityIntent) } } constructor(launchActivity: Boolean, startActivityClass: Class) { this.launchActivity = launchActivity - scenarioSupplier = { ActivityScenario.launch(startActivityClass) } + scenarioSupplier = { ActivityScenario.launch(startActivityClass) } } private var launchActivity: Boolean @@ -68,7 +68,7 @@ class LazyActivityScenarioRule : ExternalResource { fun launch(newIntent: Intent? = null) { if (scenarioLaunched) throw IllegalStateException("Scenario has already been launched!") - newIntent?.let { scenarioSupplier = { ActivityScenario.launch(it) } } + newIntent?.let { scenarioSupplier = { ActivityScenario.launch(it) } } scenario = scenarioSupplier() scenarioLaunched = true }