diff --git a/.gradle/buildOutputCleanup/cache.properties b/.gradle/buildOutputCleanup/cache.properties
index 02c628d..30fd8b7 100644
--- a/.gradle/buildOutputCleanup/cache.properties
+++ b/.gradle/buildOutputCleanup/cache.properties
@@ -1,2 +1,2 @@
-#Sun Aug 27 00:13:51 PKT 2023
-gradle.version=8.3
+#Fri Feb 16 22:51:39 PKT 2024
+gradle.version=8.5
diff --git a/.idea/workspace.xml b/.idea/workspace.xml
index 86beed4..0febcac 100644
--- a/.idea/workspace.xml
+++ b/.idea/workspace.xml
@@ -10,22 +10,10 @@
-
-
-
-
-
-
-
-
+
-
-
-
-
-
-
+
@@ -89,22 +77,22 @@
- {
+ "keyToString": {
+ "RunOnceActivity.OpenProjectViewOnStart": "true",
+ "RunOnceActivity.ShowReadmeOnStart": "true",
+ "RunOnceActivity.cidr.known.project.marker": "true",
+ "SHARE_PROJECT_CONFIGURATION_FILES": "true",
+ "cf.first.check.clang-format": "false",
+ "cidr.known.project.marker": "true",
+ "git-widget-placeholder": "master",
+ "last_opened_file_path": "/Volumes/Sohaib - Data/Work/Projects/Android/Github/PegasusUtils",
+ "project.structure.last.edited": "Project",
+ "project.structure.proportion": "0.17",
+ "project.structure.side.proportion": "0.2",
+ "settings.editor.selected.configurable": "preferences.pluginManager"
}
-}]]>
+}
@@ -120,7 +108,7 @@
-
+
@@ -266,7 +254,15 @@
1693077556060
-
+
+
+ 1708107188546
+
+
+
+ 1708107188546
+
+
diff --git a/pegutils/build.gradle b/pegutils/build.gradle
index a09798c..ee8dd7b 100644
--- a/pegutils/build.gradle
+++ b/pegutils/build.gradle
@@ -45,15 +45,15 @@ dependencies {
implementation 'com.google.android.material:material:1.11.0'
// Exif interface (for image rotation)
- implementation 'androidx.exifinterface:exifinterface:1.3.6'
+ implementation 'androidx.exifinterface:exifinterface:1.3.7'
// Navigational Components
implementation 'androidx.navigation:navigation-fragment-ktx:2.7.7'
implementation 'androidx.navigation:navigation-ui-ktx:2.7.7'
// Firebase
- implementation 'com.google.firebase:firebase-crashlytics-ktx:18.6.1'
- implementation 'com.google.firebase:firebase-analytics-ktx:21.5.0'
+ implementation 'com.google.firebase:firebase-crashlytics-ktx:18.6.2'
+ implementation 'com.google.firebase:firebase-analytics-ktx:21.5.1'
// Glide
implementation 'com.github.bumptech.glide:glide:4.16.0'
@@ -68,7 +68,7 @@ publishing {
release(MavenPublication) {
groupId = 'dev.pegasus.utils'
artifactId = 'utils'
- version = '1.0.0-alpha-12'
+ version = '1.0.0-alpha-13'
afterEvaluate {
from components.release
diff --git a/pegutils/src/main/java/dev/pegasus/utils/extensions/uiComponents/ViewGroupExtensions.kt b/pegutils/src/main/java/dev/pegasus/utils/extensions/uiComponents/ViewGroupExtensions.kt
index ebf02c6..f924dec 100644
--- a/pegutils/src/main/java/dev/pegasus/utils/extensions/uiComponents/ViewGroupExtensions.kt
+++ b/pegutils/src/main/java/dev/pegasus/utils/extensions/uiComponents/ViewGroupExtensions.kt
@@ -1,6 +1,7 @@
package dev.pegasus.utils.extensions.uiComponents
import android.content.res.Resources
+import android.os.Handler
import android.view.View
import android.view.ViewGroup
import androidx.constraintlayout.widget.ConstraintLayout
@@ -62,4 +63,28 @@ fun ViewPager2.addCarouselEffect(enableZoom: Boolean = true) {
}
}
setPageTransformer(compositePageTransformer)
+}
+
+/**
+ * -> e.g. viewPager2.startAutoScroll(1000)
+ * @param intervalMillis: Time in milliseconds to change the slide
+ * @param autoScrollHandler: Pass your own handler to handle scroll
+ *
+ * Note: passing same handler will be able to remove scroll
+ */
+
+fun ViewPager2.startAutoScroll(autoScrollHandler: Handler, intervalMillis: Long = 3000) {
+ val autoScrollRunnable = object : Runnable {
+ override fun run() {
+ val currentItem = currentItem
+ val nextItem = if (currentItem == adapter?.itemCount?.minus(1)) 0 else currentItem + 1
+ this@startAutoScroll.currentItem = nextItem
+ autoScrollHandler.postDelayed(this, intervalMillis)
+ }
+ }
+ autoScrollHandler.postDelayed(autoScrollRunnable, intervalMillis)
+}
+
+fun ViewPager2.stopAutoScroll(handler: Handler) {
+ handler.removeCallbacksAndMessages(null)
}
\ No newline at end of file
diff --git a/settings.gradle b/settings.gradle
index ff93271..1672454 100644
--- a/settings.gradle
+++ b/settings.gradle
@@ -12,6 +12,6 @@ dependencyResolutionManagement {
mavenCentral()
}
}
-rootProject.name = "peg-utils"
+rootProject.name = "Pegasus Utils"
include ':app'
include ':pegutils'