Skip to content

Commit

Permalink
Merge pull request #178 from SuhasDissa/redesign
Browse files Browse the repository at this point in the history
feat: new wallpaper viewer design
  • Loading branch information
SuhasDissa authored Feb 13, 2024
2 parents 36cc309 + 2ee1c53 commit ce9db60
Show file tree
Hide file tree
Showing 30 changed files with 1,354 additions and 592 deletions.
10 changes: 10 additions & 0 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,16 @@
</intent-filter>
</service>

<provider
android:name="androidx.core.content.FileProvider"
android:authorities="${applicationId}.provider"
android:exported="false"
android:grantUriPermissions="true">
<meta-data
android:name="android.support.FILE_PROVIDER_PATHS"
android:resource="@xml/provider_paths" />
</provider>

</application>

</manifest>
5 changes: 5 additions & 0 deletions app/src/main/java/com/bnyro/wallpaper/enums/TriState.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
package com.bnyro.wallpaper.enums

enum class MultiState {
RUNNING, SUCCESS, ERROR, IDLE
}
Original file line number Diff line number Diff line change
@@ -1,57 +1,30 @@
package com.bnyro.wallpaper.ui.components

import android.os.Handler
import android.os.Looper
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.padding
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableFloatStateOf
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
import androidx.compose.runtime.setValue
import androidx.compose.ui.Modifier
import androidx.compose.ui.unit.dp
import com.bnyro.wallpaper.util.Preferences

@Composable
fun ImageFilterSlider(
prefKey: String,
title: String,
defValue: Float,
value: Float,
valueRange: ClosedFloatingPointRange<Float>,
changeDelay: Long = 300L,
onValueChange: (Float) -> Unit = {}
onValueChange: (Float) -> Unit,
onValueChangeFinished: () -> Unit
) {
val handler = Handler(Looper.getMainLooper())

var value by remember {
mutableFloatStateOf(
Preferences.getFloat(prefKey, defValue)
)
}

var lastChanged = System.currentTimeMillis()

val delayedRunnable = Runnable {
if (System.currentTimeMillis() - lastChanged < changeDelay) return@Runnable
lastChanged = System.currentTimeMillis()
onValueChange.invoke(value)
}

Column {
Column(Modifier.padding(horizontal = 8.dp)) {
Text(title)
Spacer(Modifier.height(3.dp))
SliderWithLabel(
value = value,
valueRange = valueRange,
onValueChange = {
value = it
Preferences.edit { putFloat(prefKey, it) }
handler.postDelayed(delayedRunnable, changeDelay)
}
onValueChange = onValueChange,
onValueChangeFinished = onValueChangeFinished
)
}
}
39 changes: 0 additions & 39 deletions app/src/main/java/com/bnyro/wallpaper/ui/components/PaletteItem.kt

This file was deleted.

31 changes: 0 additions & 31 deletions app/src/main/java/com/bnyro/wallpaper/ui/components/PaletteRow.kt

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ fun SliderWithLabel(
valueRange: ClosedFloatingPointRange<Float>,
steps: Int = 0,
labelMinWidth: Dp = 42.dp,
onValueChangeFinished: () -> Unit = {},
onValueChange: (Float) -> Unit
) {
var showLabel by remember {
Expand Down Expand Up @@ -69,6 +70,7 @@ fun SliderWithLabel(
modifier = Modifier.fillMaxWidth(),
onValueChangeFinished = {
showLabel = false
onValueChangeFinished.invoke()
}
)
}
Expand Down
Loading

0 comments on commit ce9db60

Please sign in to comment.