-
-
Notifications
You must be signed in to change notification settings - Fork 263
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rewrite connection screen in Jetpack Compose
- Loading branch information
Showing
22 changed files
with
656 additions
and
371 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<resources> | ||
<string name="app_name" translatable="false">Jellyfin Debug</string> | ||
<string name="app_name_short" translatable="false">Jellyfin</string> | ||
</resources> |
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
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
46 changes: 46 additions & 0 deletions
46
app/src/main/java/org/jellyfin/mobile/setup/ComposeFragment.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,46 @@ | ||
package org.jellyfin.mobile.setup | ||
|
||
import android.os.Bundle | ||
import android.view.LayoutInflater | ||
import android.view.View | ||
import android.view.ViewGroup | ||
import androidx.compose.ui.platform.ComposeView | ||
import androidx.core.view.ViewCompat | ||
import androidx.fragment.app.Fragment | ||
import org.jellyfin.mobile.MainViewModel | ||
import org.jellyfin.mobile.databinding.FragmentComposeBinding | ||
import org.jellyfin.mobile.ui.screens.connect.ConnectScreen | ||
import org.jellyfin.mobile.ui.utils.AppTheme | ||
import org.jellyfin.mobile.utils.Constants | ||
import org.jellyfin.mobile.utils.applyWindowInsetsAsMargins | ||
import org.koin.androidx.viewmodel.ext.android.sharedViewModel | ||
|
||
class ComposeFragment : Fragment() { | ||
private val mainViewModel: MainViewModel by sharedViewModel() | ||
private var _viewBinding: FragmentComposeBinding? = null | ||
private val viewBinding get() = _viewBinding!! | ||
private val composeView: ComposeView get() = viewBinding.composeView | ||
|
||
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View { | ||
_viewBinding = FragmentComposeBinding.inflate(inflater, container, false) | ||
return composeView.apply { applyWindowInsetsAsMargins() } | ||
} | ||
|
||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) { | ||
super.onViewCreated(view, savedInstanceState) | ||
|
||
// Apply window insets | ||
ViewCompat.requestApplyInsets(composeView) | ||
|
||
val encounteredConnectionError = arguments?.getBoolean(Constants.FRAGMENT_CONNECT_EXTRA_ERROR) == true | ||
|
||
composeView.setContent { | ||
AppTheme { | ||
ConnectScreen( | ||
mainViewModel = mainViewModel, | ||
showExternalConnectionError = encounteredConnectionError, | ||
) | ||
} | ||
} | ||
} | ||
} |
Oops, something went wrong.