Skip to content

Commit

Permalink
Add delays to animation. Fixes #417
Browse files Browse the repository at this point in the history
Github Source: Add support for Amaze, MaterialFiles, AFWall+, Anki-Android, Simple-Flashlight
Start porting gradle scripts to kotlin
Lower minSDK to 21
Update Gradle
  • Loading branch information
rumboalla committed Aug 24, 2023
1 parent 81a575e commit 9c17950
Show file tree
Hide file tree
Showing 10 changed files with 34 additions and 24 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ The 3.x branch is a full rewrite using modern technologies like **Jetpack Compos
* **Update Sources**: Find updates from **APKMirror**, **Aptoide**, **F-Droid** and **GitHub**.
* **Search Sources**: Find new apps to install from **APKMirror**, **Aptoide**, **F-Droid** and **GitHub**.
* Schedule **background update checks** and receive a **notification** when updates are found.
* Supports **Android 7.0** (**24**) to **Android 14** (**34**).
* Supports **Android 5** (**21**) to **Android 14** (**34**).
* Supports **Android TV**.
* **Material Design 3** with **Dark**, **Light** and **System** theme support.
* Supports **Material You** on Android 12+.
Expand Down
2 changes: 1 addition & 1 deletion app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ android {

defaultConfig {
applicationId "com.apkupdater"
minSdk 24
minSdk 21
targetSdk 34
versionCode 48
versionName "3.0.0-beta-05"
Expand Down
8 changes: 7 additions & 1 deletion app/src/main/java/com/apkupdater/data/github/GitHubApp.kt
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,11 @@ val GitHubApps = listOf(
GitHubApp("com.fsck.k9", "thundernest", "k-9"),
GitHubApp("de.tutao.tutanota", "tutao", "tutanota"),
GitHubApp("com.shabinder.spotiflyer", "Shabinder", "SpotiFlyer"),
GitHubApp("org.koreader.launcher", "koreader", "koreader")
GitHubApp("org.koreader.launcher", "koreader", "koreader"),
GitHubApp("org.koreader.launcher", "koreader", "koreader"),
GitHubApp("com.amaze.filemanager", "TeamAmaze", "AmazeFileManager"),
GitHubApp("me.zhanghai.android.files", "zhanghai", "MaterialFiles"),
GitHubApp("dev.ukanth.ufirewall", "ukanth", "afwall"),
GitHubApp("com.ichi2.anki", "ankidroid", "Anki-Android"),
GitHubApp("com.simplemobiletools.flashlight", "SimpleMobileTools", "Simple-Flashlight")
)
20 changes: 11 additions & 9 deletions app/src/main/java/com/apkupdater/ui/component/Text.kt
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@ package com.apkupdater.ui.component

import androidx.compose.animation.animateContentSize
import androidx.compose.animation.core.LinearEasing
import androidx.compose.animation.core.RepeatMode
import androidx.compose.animation.core.infiniteRepeatable
import androidx.compose.animation.core.tween
import androidx.compose.foundation.ScrollState
import androidx.compose.foundation.background
Expand Down Expand Up @@ -119,16 +117,20 @@ fun ScrollableText(
val outer = remember { mutableStateOf(IntSize.Zero) }

val effect: suspend (ScrollState) -> Unit = {
it.scrollTo(0)
state.scrollTo(0)
val scroll = (inner.value.width - outer.value.width)
if (scroll > 0) {
it.animateScrollTo(
scroll,
infiniteRepeatable(
animation = tween(durationMillis = scroll * 10, easing = LinearEasing),
repeatMode = RepeatMode.Reverse
while(true) {
state.animateScrollTo(
scroll,
tween(delayMillis = 1000, durationMillis = scroll * 10, easing = LinearEasing)
)
)
state.animateScrollTo(
0,
tween(delayMillis = 1000, durationMillis = scroll * 10, easing = LinearEasing)
)
}

}
}
LaunchedEffect(outer.value) { effect(state) }
Expand Down
4 changes: 2 additions & 2 deletions app/src/main/java/com/apkupdater/ui/screen/MainScreen.kt
Original file line number Diff line number Diff line change
Expand Up @@ -56,14 +56,14 @@ import com.apkupdater.viewmodel.MainViewModel
import com.apkupdater.viewmodel.SearchViewModel
import com.apkupdater.viewmodel.SettingsViewModel
import com.apkupdater.viewmodel.UpdatesViewModel
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.flow.flowOn
import kotlinx.coroutines.flow.launchIn
import kotlinx.coroutines.flow.onEach
import org.koin.androidx.compose.koinViewModel
import org.koin.core.parameter.parametersOf
import kotlin.coroutines.CoroutineContext
import kotlin.coroutines.EmptyCoroutineContext


@Composable
Expand Down Expand Up @@ -148,7 +148,7 @@ suspend fun handleSnack(

@Composable
fun <T> Flow<T>.CollectAsEffect(
context: CoroutineContext = EmptyCoroutineContext,
context: CoroutineContext = Dispatchers.IO,
block: suspend (T) -> Unit
) {
LaunchedEffect(Unit) {
Expand Down
5 changes: 4 additions & 1 deletion app/src/main/java/com/apkupdater/util/SessionInstaller.kt
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,10 @@ class SessionInstaller(private val context: Context) {
val packageInstaller: PackageInstaller = context.packageManager.packageInstaller
val params = PackageInstaller.SessionParams(PackageInstaller.SessionParams.MODE_FULL_INSTALL)
params.setAppPackageName(packageName)
params.setOriginatingUid(android.os.Process.myUid())

if (Build.VERSION.SDK_INT > 24) {
params.setOriginatingUid(android.os.Process.myUid())
}

if (Build.VERSION.SDK_INT >= 31) {
params.setRequireUserAction(PackageInstaller.SessionParams.USER_ACTION_NOT_REQUIRED)
Expand Down
5 changes: 0 additions & 5 deletions build.gradle

This file was deleted.

4 changes: 4 additions & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
plugins {
id("com.android.application") version "8.1.1" apply false
id("org.jetbrains.kotlin.android") version "1.9.0" apply false
}
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionUrl=https\://services.gradle.org/distributions/gradle-8.2.1-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.3-bin.zip
distributionPath=wrapper/dists
zipStorePath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
6 changes: 3 additions & 3 deletions settings.gradle → settings.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ dependencyResolutionManagement {
repositories {
google()
mavenCentral()
maven { url 'https://jitpack.io' }
maven("https://jitpack.io")
}
}

rootProject.name = "ApkUpdater"
include ':app'
rootProject.name = "APKUpdater"
include(":app")

0 comments on commit 9c17950

Please sign in to comment.