mirror of
https://github.com/signalapp/Signal-Android.git
synced 2026-04-21 17:29:32 +01:00
Support different width ranges for different brushes.
This commit is contained in:
committed by
Greyson Parrelli
parent
38f6efbcae
commit
f86c1fe508
@@ -0,0 +1,42 @@
|
||||
package org.thoughtcrime.securesms.keyvalue
|
||||
|
||||
internal class ImageEditorValues internal constructor(store: KeyValueStore) : SignalStoreValues(store) {
|
||||
|
||||
companion object {
|
||||
private const val KEY_IMAGE_EDITOR_MARKER_WIDTH = "image.editor.marker.width"
|
||||
private const val KEY_IMAGE_EDITOR_HIGHLIGHTER_WIDTH = "image.editor.highlighter.width"
|
||||
private const val KEY_IMAGE_EDITOR_BLUR_WIDTH = "image.editor.blur.width"
|
||||
}
|
||||
|
||||
public override fun onFirstEverAppLaunch() = Unit
|
||||
|
||||
public override fun getKeysToIncludeInBackup(): List<String> = listOf(
|
||||
KEY_IMAGE_EDITOR_MARKER_WIDTH,
|
||||
KEY_IMAGE_EDITOR_HIGHLIGHTER_WIDTH,
|
||||
KEY_IMAGE_EDITOR_BLUR_WIDTH
|
||||
)
|
||||
|
||||
fun setMarkerPercentage(markerPercentage: Int) {
|
||||
putInteger(KEY_IMAGE_EDITOR_MARKER_WIDTH, markerPercentage)
|
||||
}
|
||||
|
||||
fun setHighlighterPercentage(highlighterPercentage: Int) {
|
||||
putInteger(KEY_IMAGE_EDITOR_HIGHLIGHTER_WIDTH, highlighterPercentage)
|
||||
}
|
||||
|
||||
fun setBlurPercentage(blurPercentage: Int) {
|
||||
putInteger(KEY_IMAGE_EDITOR_BLUR_WIDTH, blurPercentage)
|
||||
}
|
||||
|
||||
fun getMarkerPercentage(): Int = getInteger(KEY_IMAGE_EDITOR_MARKER_WIDTH, 0)
|
||||
|
||||
fun getHighlighterPercentage(): Int = getInteger(KEY_IMAGE_EDITOR_HIGHLIGHTER_WIDTH, 0)
|
||||
|
||||
fun getBlurPercentage(): Int = getInteger(KEY_IMAGE_EDITOR_BLUR_WIDTH, 0)
|
||||
|
||||
fun getMarkerWidthRange(): Pair<Float, Float> = Pair(0.01f, 0.05f)
|
||||
|
||||
fun getHighlighterWidthRange(): Pair<Float, Float> = Pair(0.03f, 0.08f)
|
||||
|
||||
fun getBlurWidthRange(): Pair<Float, Float> = Pair(0.052f, 0.092f)
|
||||
}
|
||||
@@ -37,6 +37,7 @@ public final class SignalStore {
|
||||
private final ProxyValues proxyValues;
|
||||
private final RateLimitValues rateLimitValues;
|
||||
private final ChatColorsValues chatColorsValues;
|
||||
private final ImageEditorValues imageEditorValues;
|
||||
|
||||
private SignalStore() {
|
||||
this.store = new KeyValueStore(ApplicationDependencies.getApplication());
|
||||
@@ -59,6 +60,7 @@ public final class SignalStore {
|
||||
this.proxyValues = new ProxyValues(store);
|
||||
this.rateLimitValues = new RateLimitValues(store);
|
||||
this.chatColorsValues = new ChatColorsValues(store);
|
||||
this.imageEditorValues = new ImageEditorValues(store);
|
||||
}
|
||||
|
||||
public static void onFirstEverAppLaunch() {
|
||||
@@ -81,6 +83,7 @@ public final class SignalStore {
|
||||
proxy().onFirstEverAppLaunch();
|
||||
rateLimit().onFirstEverAppLaunch();
|
||||
chatColorsValues().onFirstEverAppLaunch();
|
||||
imageEditorValues().onFirstEverAppLaunch();
|
||||
}
|
||||
|
||||
public static List<String> getKeysToIncludeInBackup() {
|
||||
@@ -104,6 +107,7 @@ public final class SignalStore {
|
||||
keys.addAll(proxy().getKeysToIncludeInBackup());
|
||||
keys.addAll(rateLimit().getKeysToIncludeInBackup());
|
||||
keys.addAll(chatColorsValues().getKeysToIncludeInBackup());
|
||||
keys.addAll(imageEditorValues().getKeysToIncludeInBackup());
|
||||
return keys;
|
||||
}
|
||||
|
||||
@@ -192,6 +196,10 @@ public final class SignalStore {
|
||||
return INSTANCE.chatColorsValues;
|
||||
}
|
||||
|
||||
public static @NonNull ImageEditorValues imageEditorValues() {
|
||||
return INSTANCE.imageEditorValues;
|
||||
}
|
||||
|
||||
public static @NonNull GroupsV2AuthorizationSignalStoreCache groupsV2AuthorizationCache() {
|
||||
return new GroupsV2AuthorizationSignalStoreCache(getStore());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user