-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Migrate related items fragment to Jetpack Compose (#11383)
* Rename .java to .kt * Migrate related items fragment to Jetpack Compose * Specify mode parameter explicitly * Rm unused class * Fix list item size * Added stream progress bar, separate stream and playlist thumbnails * Display message if no related streams are available * Dispose of related items when closing the video player * Add modifiers for no items message function * Implement remaining stream menu items * Improved stream composables * Use view model lifecycle scope * Make live color solid red * Use nested scroll modifier * Simplify determineItemViewMode()
- Loading branch information
1 parent
9d04a73
commit 2836191
Showing
30 changed files
with
940 additions
and
395 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 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
176 changes: 0 additions & 176 deletions
176
app/src/main/java/org/schabi/newpipe/fragments/list/videos/RelatedItemsFragment.java
This file was deleted.
Oops, something went wrong.
43 changes: 43 additions & 0 deletions
43
app/src/main/java/org/schabi/newpipe/fragments/list/videos/RelatedItemsFragment.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 |
---|---|---|
@@ -0,0 +1,43 @@ | ||
package org.schabi.newpipe.fragments.list.videos | ||
|
||
import android.os.Bundle | ||
import android.view.LayoutInflater | ||
import android.view.View | ||
import android.view.ViewGroup | ||
import androidx.compose.material3.MaterialTheme | ||
import androidx.compose.material3.Surface | ||
import androidx.compose.ui.platform.ComposeView | ||
import androidx.compose.ui.platform.ViewCompositionStrategy | ||
import androidx.core.os.bundleOf | ||
import androidx.fragment.app.Fragment | ||
import org.schabi.newpipe.extractor.stream.StreamInfo | ||
import org.schabi.newpipe.ktx.serializable | ||
import org.schabi.newpipe.ui.components.video.RelatedItems | ||
import org.schabi.newpipe.ui.theme.AppTheme | ||
import org.schabi.newpipe.util.KEY_INFO | ||
|
||
class RelatedItemsFragment : Fragment() { | ||
override fun onCreateView( | ||
inflater: LayoutInflater, | ||
container: ViewGroup?, | ||
savedInstanceState: Bundle? | ||
): View { | ||
return ComposeView(requireContext()).apply { | ||
setViewCompositionStrategy(ViewCompositionStrategy.DisposeOnViewTreeLifecycleDestroyed) | ||
setContent { | ||
AppTheme { | ||
Surface(color = MaterialTheme.colorScheme.background) { | ||
RelatedItems(requireArguments().serializable<StreamInfo>(KEY_INFO)!!) | ||
} | ||
} | ||
} | ||
} | ||
} | ||
|
||
companion object { | ||
@JvmStatic | ||
fun getInstance(info: StreamInfo) = RelatedItemsFragment().apply { | ||
arguments = bundleOf(KEY_INFO to info) | ||
} | ||
} | ||
} |
22 changes: 0 additions & 22 deletions
22
app/src/main/java/org/schabi/newpipe/fragments/list/videos/RelatedItemsInfo.java
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
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
Oops, something went wrong.