-
-
Notifications
You must be signed in to change notification settings - Fork 37
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #178 from SuhasDissa/redesign
feat: new wallpaper viewer design
- Loading branch information
Showing
30 changed files
with
1,354 additions
and
592 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 |
---|---|---|
@@ -0,0 +1,5 @@ | ||
package com.bnyro.wallpaper.enums | ||
|
||
enum class MultiState { | ||
RUNNING, SUCCESS, ERROR, IDLE | ||
} |
41 changes: 7 additions & 34 deletions
41
app/src/main/java/com/bnyro/wallpaper/ui/components/ImageFilterSlider.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 |
---|---|---|
@@ -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
39
app/src/main/java/com/bnyro/wallpaper/ui/components/PaletteItem.kt
This file was deleted.
Oops, something went wrong.
31 changes: 0 additions & 31 deletions
31
app/src/main/java/com/bnyro/wallpaper/ui/components/PaletteRow.kt
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
Oops, something went wrong.