Skip to content

Commit

Permalink
build:
Browse files Browse the repository at this point in the history
1. remove silent mode.
2. remove post.
3. rename some classes and file names.
feat:
1. benchmark.
2. dropbox for backup subscriptions.
3. lifecycle-aware helper.
style:
1. deeply disabled content colors.
behaviour:
1. disable "about project" and "dropbox" until it is completed.
fix:
1. recomposition mistake.
2. Side-Effect mistake.
  • Loading branch information
oxyroid committed Oct 4, 2023
1 parent c4b8897 commit 33725cb
Show file tree
Hide file tree
Showing 119 changed files with 11,401 additions and 1,792 deletions.
22 changes: 22 additions & 0 deletions .idea/androidTestResultsUserPreferences.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions .idea/gradle.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ View this [file](CONTRIBUTING.md) to learn about how to contribute this reposito

### Literatures
1. http://upnp.org/specs/av/UPnP-av-ContentDirectory-v4-Service.pdf
2. https://developer.apple.com/documentation/http-live-streaming/example-playlists-for-http-live-streaming

### About me

Expand Down
9 changes: 8 additions & 1 deletion androidApp/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ plugins {
alias(libs.plugins.org.jetbrains.kotlin.android)
alias(libs.plugins.com.google.dagger.hilt.android)
alias(libs.plugins.com.google.devtools.ksp)
alias(libs.plugins.androidx.baselineprofile)
}

android {
Expand All @@ -16,6 +17,7 @@ android {
versionName = "1.12.0-beta06"

testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
testInstrumentationRunnerArguments["androidx.benchmark.profiling.mode"] = "MethodTracing"
}
buildTypes {
release {
Expand All @@ -26,14 +28,19 @@ android {
"proguard-rules.pro"
)
}
create("benchmark") {
initWith(buildTypes.getByName("release"))
signingConfig = signingConfigs.getByName("debug")
matchingFallbacks += listOf("release")
isDebuggable = false
}
}
compileOptions {
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
}
kotlinOptions {
jvmTarget = "17"
freeCompilerArgs = listOf("-opt-in=kotlin.RequiresOptIn")
}
buildFeatures {
compose = true
Expand Down
5 changes: 4 additions & 1 deletion androidApp/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,12 @@
android:theme="@style/Theme.M3U.Starting"
android:usesCleartextTraffic="true"
tools:targetApi="32">
<profileable
android:shell="true"
tools:targetApi="29" />
<activity
android:name=".MainActivity"
android:configChanges="screenSize|smallestScreenSize|screenLayout|orientation"
android:configChanges="screenSize|smallestScreenSize|screenLayout|orientation|locale|layoutDirection"
android:exported="true"
android:launchMode="singleInstance"
android:supportsPictureInPicture="true">
Expand Down

Large diffs are not rendered by default.

62 changes: 31 additions & 31 deletions androidApp/src/main/java/com/m3u/androidApp/MainActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,11 @@ import androidx.core.util.Consumer
import androidx.core.view.WindowInsetsCompat
import androidx.core.view.WindowInsetsControllerCompat
import com.m3u.androidApp.ui.App
import com.m3u.ui.model.Action
import com.m3u.ui.model.Fob
import com.m3u.ui.model.Helper
import com.m3u.ui.model.ScaffoldAction
import com.m3u.ui.model.ScaffoldFob
import dagger.hilt.android.AndroidEntryPoint
import kotlin.reflect.KMutableProperty0

@AndroidEntryPoint
class MainActivity : ComponentActivity() {
Expand All @@ -34,14 +35,16 @@ class MainActivity : ComponentActivity() {
}

private var onUserLeaveHintCallback: (() -> Unit)? = null

private fun createHelper(
setTitle: (String) -> Unit,
getTitle: () -> String,
setActions: (List<ScaffoldAction>) -> Unit,
getActions: () -> List<ScaffoldAction>,
setFab: (ScaffoldFob?) -> Unit,
getFab: () -> ScaffoldFob?
): Helper = object : Helper() {
title: Method<String>,
actions: Method<List<Action>>,
fob: Method<Fob?>
): Helper = object : Helper {
private val controller = WindowInsetsControllerCompat(window, window.decorView).apply {
systemBarsBehavior =
WindowInsetsControllerCompat.BEHAVIOR_SHOW_TRANSIENT_BARS_BY_SWIPE
}

override fun enterPipMode(size: Rect) {
val params = PictureInPictureParams.Builder()
Expand All @@ -50,29 +53,24 @@ class MainActivity : ComponentActivity() {
enterPictureInPictureMode(params)
}

override var title: String
get() = getTitle()
set(value) = setTitle(value)

override var actions: List<ScaffoldAction>
get() = getActions()
set(value) = setActions(value)

override var fab: ScaffoldFob?
get() = getFab()
set(value) = setFab(value)

override fun hideSystemUI() {
WindowInsetsControllerCompat(window, window.decorView).let { controller ->
controller.hide(WindowInsetsCompat.Type.systemBars())
controller.systemBarsBehavior =
WindowInsetsControllerCompat.BEHAVIOR_SHOW_TRANSIENT_BARS_BY_SWIPE
override var title: String by title
override var actions: List<Action> by actions
override var fob: Fob? by fob

override var systemUiVisibility: Boolean = true
set(value) {
field = value
controller.apply {
if (value) {
show(WindowInsetsCompat.Type.systemBars())
} else {
hide(WindowInsetsCompat.Type.systemBars())
}
}
}
}

override fun showSystemUI() {
WindowInsetsControllerCompat(window, window.decorView)
.show(WindowInsetsCompat.Type.systemBars())
override fun detectWindowInsetController(handler: WindowInsetsControllerCompat.() -> Unit) {
handler(controller)
}

override fun detectDarkMode(handler: () -> Boolean) {
Expand Down Expand Up @@ -109,4 +107,6 @@ class MainActivity : ComponentActivity() {
super.onUserLeaveHint()
onUserLeaveHintCallback?.invoke()
}
}
}

internal typealias Method<E> = KMutableProperty0<E>
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,14 @@ import com.m3u.ui.components.NavigationSheet
import com.m3u.ui.ktx.animateColor
import com.m3u.ui.ktx.animated
import com.m3u.ui.model.LocalTheme
import com.m3u.ui.model.ScaffoldFob
import com.m3u.ui.model.Fob

@Composable
fun BottomNavigationSheet(
fun AppBottomSheet(
destinations: List<TopLevelDestination>,
navigateToTopLevelDestination: NavigateToTopLevelDestination,
destination: TopLevelDestination?,
fob: ScaffoldFob?,
fob: Fob?,
modifier: Modifier = Modifier,
backgroundColor: Color = BottomSheetDefaults.backgroundColor(),
selectedColor: Color = BottomSheetDefaults.selectedColor(),
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
package com.m3u.androidApp.components

import androidx.compose.animation.AnimatedVisibility
import androidx.compose.animation.fadeIn
import androidx.compose.animation.fadeOut
import androidx.compose.animation.slideInVertically
import androidx.compose.animation.slideOutVertically
import androidx.compose.foundation.layout.padding
import androidx.compose.material.MaterialTheme
import androidx.compose.material3.Card
import androidx.compose.material3.CardDefaults
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.text.style.TextOverflow
import com.m3u.ui.model.LocalSpacing
import com.m3u.ui.model.LocalTheme

@Composable
fun AppSnackHost(
message: String,
modifier: Modifier = Modifier
) {
val theme = LocalTheme.current
val spacing = LocalSpacing.current
val containerColor = theme.tint
val contentColor = theme.onTint
AnimatedVisibility(
visible = message.isNotEmpty(),
enter = slideInVertically { it } + fadeIn(),
exit = slideOutVertically { it } + fadeOut(),
modifier = modifier
) {
Card(
colors = CardDefaults.cardColors(
containerColor = containerColor,
contentColor = contentColor
)
) {
Text(
text = message,
maxLines = 1,
overflow = TextOverflow.Ellipsis,
style = MaterialTheme.typography.subtitle1,
modifier = Modifier
.padding(
horizontal = spacing.medium,
vertical = spacing.small
)
)
}
}
}

This file was deleted.

Loading

0 comments on commit 33725cb

Please sign in to comment.