[Marshmallow] Support crop image borders
This commit is contained in:
1 parent
4a12e71877
commit
c99d8e8275
4 files changed
+17
-18
No files matched your search
@@ -103,7 +103,7 @@ android {
|
||||
versionNameSuffix = "-M"
|
||||
externalNativeBuild {
|
||||
cmake {
|
||||
targets += "noop"
|
||||
arguments("-DMARSHMALLOW=1")
|
||||
}
|
||||
}
|
||||
compileOptions {
|
||||
|
||||
@@ -76,7 +76,10 @@ FetchContent_MakeAvailable(libarchive)
|
||||
include_directories(${libarchive_SOURCE_DIR}/libarchive)
|
||||
|
||||
# Build and link our app's native lib
|
||||
add_library(${PROJECT_NAME} SHARED archive.c border.c gifutils.c natsort/strnatcmp.c)
|
||||
target_link_libraries(${PROJECT_NAME} archive_static log jnigraphics)
|
||||
|
||||
add_custom_target("noop")
|
||||
if (MARSHMALLOW)
|
||||
add_library(${PROJECT_NAME} SHARED border.c)
|
||||
target_link_libraries(${PROJECT_NAME} jnigraphics)
|
||||
else ()
|
||||
add_library(${PROJECT_NAME} SHARED archive.c border.c gifutils.c natsort/strnatcmp.c)
|
||||
target_link_libraries(${PROJECT_NAME} archive_static log jnigraphics)
|
||||
endif ()
|
||||
@@ -101,9 +101,7 @@ class EhApplication : Application(), SingletonImageLoader.Factory {
|
||||
handler?.uncaughtException(t, e)
|
||||
}
|
||||
super.onCreate()
|
||||
if (isAtLeastP) {
|
||||
System.loadLibrary("ehviewer")
|
||||
}
|
||||
System.loadLibrary("ehviewer")
|
||||
System.loadLibrary("ehviewer_rust")
|
||||
ReadableTime.initialize(this)
|
||||
lifecycleScope.launchIO {
|
||||
|
||||
+8
-10
@@ -37,6 +37,12 @@ class ReaderColorFilterSettings @JvmOverloads constructor(context: Context, attr
|
||||
init {
|
||||
addView(binding.root)
|
||||
|
||||
context as ReaderActivity
|
||||
|
||||
readerPreferences.cropBorders().asHotFlow {
|
||||
context.restartGalleryProvider()
|
||||
}.launchIn(context.lifecycleScope)
|
||||
|
||||
if (isAtLeastO) {
|
||||
binding.wideColorGamut.isEnabled = Image.isWideColorGamut
|
||||
if (!Image.isWideColorGamut) {
|
||||
@@ -44,28 +50,20 @@ class ReaderColorFilterSettings @JvmOverloads constructor(context: Context, attr
|
||||
}
|
||||
binding.wideColorGamut.bindToPreference(readerPreferences.wideColorGamut())
|
||||
|
||||
val activity = context as ReaderActivity
|
||||
|
||||
readerPreferences.cropBorders().asHotFlow {
|
||||
activity.restartGalleryProvider()
|
||||
}.launchIn(activity.lifecycleScope)
|
||||
|
||||
readerPreferences.wideColorGamut().asHotFlow {
|
||||
Image.colorSpace = ColorSpace.get(if (Image.isWideColorGamut && it) ColorSpace.Named.DISPLAY_P3 else ColorSpace.Named.SRGB)
|
||||
val colorMode = if (Image.isWideColorGamut && it) ActivityInfo.COLOR_MODE_WIDE_COLOR_GAMUT else ActivityInfo.COLOR_MODE_DEFAULT
|
||||
with(activity) {
|
||||
with(context) {
|
||||
if (window.colorMode != colorMode) {
|
||||
window.colorMode = colorMode
|
||||
restartGalleryProvider()
|
||||
}
|
||||
}
|
||||
}.launchIn(activity.lifecycleScope)
|
||||
}.launchIn(context.lifecycleScope)
|
||||
} else {
|
||||
binding.wideColorGamut.isVisible = false
|
||||
}
|
||||
|
||||
context as ReaderActivity
|
||||
|
||||
readerPreferences.colorFilter().changes()
|
||||
.onEach { setColorFilter(it) }
|
||||
.launchIn(context.lifecycleScope)
|
||||
|
||||
Reference in new issue
Block a user