Skip to content

Commit

Permalink
75
Browse files Browse the repository at this point in the history
75
  • Loading branch information
umerov1999 committed Dec 10, 2024
1 parent 1633bc0 commit b59e189
Show file tree
Hide file tree
Showing 181 changed files with 4,842 additions and 2,025 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@

<b>Инструкция по сборке:</b>
Требуется:
1) Android Studio Hedgehog (2023.1.1) или выше. Kotlin 1.9.*
2) Android SDK 34
3) Android NDK 26.0.10404224
1) Android Studio Ladybug Feature Drop 2024.2.2 или выше. Kotlin 2.1.*
2) Android SDK 35
3) Android NDK 28.0.12674087

Если не работает музыка в Fenrir Kate, обновите kate_receipt_gms_token в app.build_config.
Взять токен можно из Kate Mobile Extra Mod
Expand Down
4 changes: 3 additions & 1 deletion app_fenrir/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -618,7 +618,9 @@
<activity
android:name="dev.ragnarok.fenrir.activity.qr.CameraScanActivity"
android:label="@string/scan_qr"
android:theme="@style/App.DayNight.Swipes" />
android:screenOrientation="locked"
android:theme="@style/App.DayNight.Swipes"
tools:ignore="DiscouragedApi" />

<activity
android:name="dev.ragnarok.fenrir.activity.DualTabPhotoActivity"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ class CameraScanActivity : NoMainActivity() {
}
}
val op = RotatedImage(mYBuffer, widthImage, heightImage)
if (tmpRotationDegrees != 180) {
if (tmpRotationDegrees != 180 && tmpRotationDegrees != 0) {
op.height = widthImage
op.width = heightImage
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,7 @@ import com.google.android.material.materialswitch.MaterialSwitch
import com.google.android.material.snackbar.Snackbar
import com.google.android.material.textfield.TextInputEditText
import com.google.android.material.textview.MaterialTextView
import com.squareup.picasso3.BitmapSafeResize.isOverflowCanvas
import com.squareup.picasso3.BitmapSafeResize.setHardwareRendering
import com.squareup.picasso3.BitmapSafeResize.setMaxResolution
import com.squareup.picasso3.BitmapSafeResize
import de.maxr1998.modernpreferences.AbsPreferencesFragment
import de.maxr1998.modernpreferences.PreferenceScreen
import de.maxr1998.modernpreferences.PreferencesAdapter
Expand Down Expand Up @@ -86,6 +84,7 @@ import dev.ragnarok.fenrir.settings.Settings
import dev.ragnarok.fenrir.settings.backup.SettingsBackup
import dev.ragnarok.fenrir.util.AppPerms
import dev.ragnarok.fenrir.util.AppPerms.requestPermissionsAbs
import dev.ragnarok.fenrir.util.CoverSafeResize
import dev.ragnarok.fenrir.util.Utils
import dev.ragnarok.fenrir.util.coroutines.CancelableJob
import dev.ragnarok.fenrir.util.coroutines.CompositeJob
Expand Down Expand Up @@ -1639,10 +1638,10 @@ class PreferencesFragment : AbsPreferencesFragment(), PreferencesAdapter.OnScree
sz = its.toString().trim().toInt()
} catch (_: NumberFormatException) {
}
if (isOverflowCanvas(sz) || sz in 0..99) {
if (BitmapSafeResize.isOverflowCanvas(sz) || sz in 0..99) {
return@onTextBeforeChanged false
} else {
setMaxResolution(sz)
BitmapSafeResize.setMaxResolution(sz)
}
requireActivity().recreate()
true
Expand All @@ -1664,10 +1663,10 @@ class PreferencesFragment : AbsPreferencesFragment(), PreferencesAdapter.OnScree
sz = its.toString().trim().toInt()
} catch (_: NumberFormatException) {
}
if (isOverflowCanvas(sz) || sz in 0..99) {
if (CoverSafeResize.isOverflowCanvas(sz) || sz in 0..99) {
return@onTextBeforeChanged false
} else {
setMaxResolution(sz)
CoverSafeResize.setMaxResolution(sz)
}
true
}
Expand All @@ -1691,7 +1690,7 @@ class PreferencesFragment : AbsPreferencesFragment(), PreferencesAdapter.OnScree
sz = it.trim().toInt()
} catch (_: NumberFormatException) {
}
setHardwareRendering(sz)
BitmapSafeResize.setHardwareRendering(sz)
requireActivity().recreate()
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ class SettingsBackup {
var image_size: String? = null
var start_news: String? = null
var crypt_version: String? = null
var validate_tls: Boolean? = null
var photo_preview_size: String? = null
var viewpager_page_transform: String? = null
var player_cover_transform: String? = null
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ internal fun AbstractJsonLexer.invalidTrailingComma(entity: String = "object"):
fail(
"Trailing comma before the end of JSON $entity",
position = currentPosition - 1,
hint = "Trailing commas are non-complaint JSON and not allowed by default. Use 'allowTrailingCommas = true' in 'Json {}' builder to support them."
hint = "Trailing commas are non-complaint JSON and not allowed by default. Use 'allowTrailingComma = true' in 'Json {}' builder to support them."
)
}

Expand Down
4 changes: 3 additions & 1 deletion app_filegallery/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,9 @@
<activity
android:name="dev.ragnarok.filegallery.activity.qr.CameraScanActivity"
android:label="@string/scan_qr"
android:theme="@style/App.DayNight.Swipes" />
android:screenOrientation="locked"
android:theme="@style/App.DayNight.Swipes"
tools:ignore="DiscouragedApi" />

<activity
android:name="dev.ragnarok.filegallery.activity.FileManagerSelectActivity"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ class CameraScanActivity : NoMainActivity() {
}
}
val op = RotatedImage(mYBuffer, widthImage, heightImage)
if (tmpRotationDegrees != 180) {
if (tmpRotationDegrees != 180 && tmpRotationDegrees != 0) {
op.height = widthImage
op.width = heightImage
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,7 @@ import com.google.android.material.materialswitch.MaterialSwitch
import com.google.android.material.snackbar.Snackbar
import com.google.android.material.textfield.TextInputEditText
import com.google.android.material.textview.MaterialTextView
import com.squareup.picasso3.BitmapSafeResize.isOverflowCanvas
import com.squareup.picasso3.BitmapSafeResize.setHardwareRendering
import com.squareup.picasso3.BitmapSafeResize.setMaxResolution
import com.squareup.picasso3.BitmapSafeResize
import de.maxr1998.modernpreferences.AbsPreferencesFragment
import de.maxr1998.modernpreferences.PreferenceScreen
import de.maxr1998.modernpreferences.PreferencesAdapter
Expand Down Expand Up @@ -63,6 +61,7 @@ import dev.ragnarok.filegallery.settings.CurrentTheme.getColorPrimary
import dev.ragnarok.filegallery.settings.CurrentTheme.getColorSecondary
import dev.ragnarok.filegallery.settings.Settings
import dev.ragnarok.filegallery.settings.backup.SettingsBackup
import dev.ragnarok.filegallery.util.CoverSafeResize
import dev.ragnarok.filegallery.util.Utils
import dev.ragnarok.filegallery.util.Utils.getAppVersionName
import dev.ragnarok.filegallery.util.Utils.safelyClose
Expand Down Expand Up @@ -653,10 +652,10 @@ class PreferencesFragment : AbsPreferencesFragment(), PreferencesAdapter.OnScree
sz = its.toString().trim().toInt()
} catch (_: NumberFormatException) {
}
if (isOverflowCanvas(sz) || sz in 0..99) {
if (BitmapSafeResize.isOverflowCanvas(sz) || sz in 0..99) {
return@onTextBeforeChanged false
} else {
setMaxResolution(sz)
BitmapSafeResize.setMaxResolution(sz)
}
requireActivity().recreate()
true
Expand All @@ -675,10 +674,10 @@ class PreferencesFragment : AbsPreferencesFragment(), PreferencesAdapter.OnScree
sz = its.toString().trim().toInt()
} catch (_: NumberFormatException) {
}
if (isOverflowCanvas(sz) || sz in 0..99) {
if (CoverSafeResize.isOverflowCanvas(sz) || sz in 0..99) {
return@onTextBeforeChanged false
} else {
setMaxResolution(sz)
CoverSafeResize.setMaxResolution(sz)
}
true
}
Expand Down Expand Up @@ -722,7 +721,7 @@ class PreferencesFragment : AbsPreferencesFragment(), PreferencesAdapter.OnScree
sz = it.trim().toInt()
} catch (_: NumberFormatException) {
}
setHardwareRendering(sz)
BitmapSafeResize.setHardwareRendering(sz)
requireActivity().recreate()
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,9 @@ abstract class BaseMvpBottomSheetDialogFragment<P : AbsPresenter<V>, V : IMvpVie
AbsMvpBottomSheetDialogFragment<P, V>(), IMvpView, IErrorView, IToastView, IToolbarView {

override fun showError(errorText: String?) {
customToast?.showToastError(errorText)
if (isAdded) {
customToast?.showToastError(errorText)
}
}

override val customToast: AbsCustomToast?
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ class SettingsBackup {
var download_photo_tap: Boolean? = null
var show_photos_line: Boolean? = null
var instant_photo_display: Boolean? = null
var validate_tls: Boolean? = null
var picasso_dispatcher: String? = null
var audio_round_icon: Boolean? = null
var use_long_click_download: Boolean? = null
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ internal fun AbstractJsonLexer.invalidTrailingComma(entity: String = "object"):
fail(
"Trailing comma before the end of JSON $entity",
position = currentPosition - 1,
hint = "Trailing commas are non-complaint JSON and not allowed by default. Use 'allowTrailingCommas = true' in 'Json {}' builder to support them."
hint = "Trailing commas are non-complaint JSON and not allowed by default. Use 'allowTrailingComma = true' in 'Json {}' builder to support them."
)
}

Expand Down
6 changes: 3 additions & 3 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ buildscript {
ext.graphicsShapesVersion = "1.0.1"
ext.lifecycleVersion = "2.8.7"
ext.mediaVersion = "1.7.0"
ext.media3Version = "1.5.0-rc02"
ext.media3Version = "1.5.0"
ext.resourceInspectionAnnotation = "1.0.1"
ext.savedStateVersion = "1.3.0-alpha05"
ext.swiperefreshlayoutVersion = "1.2.0-alpha01"
Expand All @@ -58,7 +58,7 @@ buildscript {
ext.autoValueVersion = "1.11.0"

//common libraries
ext.kotlin_version = "2.1.0-RC2"
ext.kotlin_version = "2.1.0"
ext.kotlin_coroutines = "1.9.0"
ext.kotlin_serializer = "1.7.3"
ext.okhttpLibraryVersion = "5.0.0-SNAPSHOT"
Expand Down Expand Up @@ -92,7 +92,7 @@ buildscript {
//maven { url 'https://s01.oss.sonatype.org/content/repositories/snapshots/' }
}
dependencies {
classpath "com.android.tools.build:gradle:8.7.2"
classpath "com.android.tools.build:gradle:8.8.0-rc01"
classpath "com.google.gms:google-services:4.4.2"
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath "org.jetbrains.kotlin:kotlin-serialization:$kotlin_version"
Expand Down
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#Wed Mar 20 16:00:00 MSK 2024
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.11-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.11.1-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
2 changes: 1 addition & 1 deletion libfenrir/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ android {

externalNativeBuild {
cmake {
version = "3.31.0"
version = "3.31.1"
path = file("src/main/jni/CMakeLists.txt")
}
}
Expand Down
2 changes: 1 addition & 1 deletion libfenrir/src/main/java/com/github/luben/zstd/Zstd.java
Original file line number Diff line number Diff line change
Expand Up @@ -531,7 +531,7 @@ public static long decompressDirectByteBufferFastDict(ByteBuffer dst, int dstOff
public static native int loadDictCompress(long stream, byte[] dict, int dict_size);
public static native int loadFastDictCompress(long stream, ZstdDictCompress dict);
// TODO: Fix native compilation
//public static native void registerSequenceProducer(long stream, long seqProdState, long seqProdFunction);
public static native void registerSequenceProducer(long stream, long seqProdState, long seqProdFunction);
// static native long getBuiltinSequenceProducer(); // Used in tests
static native long getStubSequenceProducer(); // Used in tests
public static native int setCompressionChecksums(long stream, boolean useChecksums);
Expand Down
54 changes: 36 additions & 18 deletions libfenrir/src/main/java/com/github/luben/zstd/ZstdCompressCtx.java
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,6 @@ public ZstdCompressCtx setLong(int windowLog) {
* Register an external sequence producer
* @param producer the user-defined {@link SequenceProducer} to register.
*/
/* TODO: fix compilation
public ZstdCompressCtx registerSequenceProducer(SequenceProducer producer) {
ensureOpen();
acquireSharedLock();
Expand All @@ -300,7 +299,6 @@ public ZstdCompressCtx registerSequenceProducer(SequenceProducer producer) {
}
return this;
}
*/

/**
* Enable or disable sequence producer fallback
Expand Down Expand Up @@ -361,7 +359,7 @@ public ZstdCompressCtx setValidateSequences(Zstd.ParamSwitch validateSequences)

/**
* Enable or disable long-distance matching.
* @param enableLDM whether to enable long-distance matching.
* @param ldm whether to enable long-distance matching.
*/
public ZstdCompressCtx setEnableLongDistanceMatching(Zstd.ParamSwitch enableLDM) {
ensureOpen();
Expand Down Expand Up @@ -433,7 +431,12 @@ public ZstdCompressCtx loadDict(byte[] dict) {
*/
public ZstdFrameProgression getFrameProgression() {
ensureOpen();
return getFrameProgression0(nativePtr);
acquireSharedLock();
try {
return getFrameProgression0(nativePtr);
} finally {
releaseSharedLock();
}
}
private static native ZstdFrameProgression getFrameProgression0(long ptr);

Expand All @@ -443,10 +446,16 @@ public ZstdFrameProgression getFrameProgression() {
*/
public void reset() {
ensureOpen();
long result = reset0(nativePtr);
if (Zstd.isError(result)) {
throw new ZstdException(result);
acquireSharedLock();
try {
long result = reset0(nativePtr);
if (Zstd.isError(result)) {
throw new ZstdException(result);
}
} finally {
releaseSharedLock();
}

}
private static native long reset0(long ptr);

Expand All @@ -460,9 +469,14 @@ public void reset() {
*/
public void setPledgedSrcSize(long srcSize) {
ensureOpen();
long result = setPledgedSrcSize0(nativePtr, srcSize);
if (Zstd.isError(result)) {
throw new ZstdException(result);
acquireSharedLock();
try {
long result = setPledgedSrcSize0(nativePtr, srcSize);
if (Zstd.isError(result)) {
throw new ZstdException(result);
}
} finally {
releaseSharedLock();
}
}
private static native long setPledgedSrcSize0(long ptr, long srcSize);
Expand All @@ -478,14 +492,19 @@ public void setPledgedSrcSize(long srcSize) {
*/
public boolean compressDirectByteBufferStream(ByteBuffer dst, ByteBuffer src, EndDirective endOp) {
ensureOpen();
long result = compressDirectByteBufferStream0(nativePtr, dst, dst.position(), dst.limit(), src, src.position(), src.limit(), endOp.value());
if ((result & 0x80000000L) != 0) {
long code = result & 0xFF;
throw new ZstdException(code, Zstd.getErrorName(code));
acquireSharedLock();
try {
long result = compressDirectByteBufferStream0(nativePtr, dst, dst.position(), dst.limit(), src, src.position(), src.limit(), endOp.value());
if ((result & 0x80000000L) != 0) {
long code = result & 0xFF;
throw new ZstdException(code, Zstd.getErrorName(code));
}
src.position((int)(result & 0x7FFFFFFF));
dst.position((int)(result >>> 32) & 0x7FFFFFFF);
return (result >>> 63) == 1;
} finally {
releaseSharedLock();
}
src.position((int)(result & 0x7FFFFFFF));
dst.position((int)(result >>> 32) & 0x7FFFFFFF);
return (result >>> 63) == 1;
}

/**
Expand Down Expand Up @@ -600,7 +619,6 @@ public int compressByteArray(byte[] dstBuff, int dstOffset, int dstSize, byte[]
* @return the size of the compressed data
*/
public int compress(ByteBuffer dstBuf, ByteBuffer srcBuf) {

int size = compressDirectByteBuffer(dstBuf, // compress into dstBuf
dstBuf.position(), // write compressed data starting at offset position()
dstBuf.limit() - dstBuf.position(), // write no more than limit() - position() bytes
Expand Down
Loading

0 comments on commit b59e189

Please sign in to comment.