-
-
Notifications
You must be signed in to change notification settings - Fork 54
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Split ZmqSpMsPlayerService, add FormFactor, add sidebar
- Loading branch information
1 parent
601fb82
commit b65cb85
Showing
41 changed files
with
760 additions
and
439 deletions.
There are no files selected for viewing
Submodule ComposeKit
updated
from d49cff to 266319
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
29 changes: 29 additions & 0 deletions
29
shared/src/commonMain/kotlin/com/toasterofbread/spmp/platform/FormFactor.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,29 @@ | ||
package com.toasterofbread.spmp.platform | ||
|
||
import com.toasterofbread.composekit.platform.Platform | ||
import com.toasterofbread.spmp.ui.layout.apppage.mainpage.PlayerState | ||
|
||
private const val MIN_PORTRAIT_RATIO: Float = 1f / 2f | ||
|
||
enum class FormFactor { | ||
PORTRAIT, | ||
LANDSCAPE, | ||
DESKTOP; | ||
|
||
val is_large: Boolean get() = this != PORTRAIT | ||
} | ||
|
||
val PlayerState.form_factor: FormFactor | ||
get() { | ||
if (isPortrait()) { | ||
return FormFactor.PORTRAIT | ||
} | ||
|
||
return when (Platform.current) { | ||
Platform.ANDROID -> FormFactor.LANDSCAPE | ||
Platform.DESKTOP -> FormFactor.DESKTOP | ||
} | ||
} | ||
|
||
private fun PlayerState.isPortrait(): Boolean = | ||
(screen_size.width / screen_size.height) <= MIN_PORTRAIT_RATIO |
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
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.