diff --git a/.gradle/buildOutputCleanup/buildOutputCleanup.lock b/.gradle/buildOutputCleanup/buildOutputCleanup.lock
index 342415f..46a8113 100644
Binary files a/.gradle/buildOutputCleanup/buildOutputCleanup.lock and b/.gradle/buildOutputCleanup/buildOutputCleanup.lock differ
diff --git a/.gradle/buildOutputCleanup/cache.properties b/.gradle/buildOutputCleanup/cache.properties
index 06566a7..c091584 100644
--- a/.gradle/buildOutputCleanup/cache.properties
+++ b/.gradle/buildOutputCleanup/cache.properties
@@ -1,2 +1,2 @@
-#Thu Apr 25 11:11:45 PKT 2024
-gradle.version=8.7
+#Tue Jul 16 05:40:40 PDT 2024
+gradle.version=8.9
diff --git a/.idea/kotlinc.xml b/.idea/kotlinc.xml
index ae3f30a..6d0ee1c 100644
--- a/.idea/kotlinc.xml
+++ b/.idea/kotlinc.xml
@@ -1,6 +1,6 @@
-
+
\ No newline at end of file
diff --git a/.idea/other.xml b/.idea/other.xml
index bbf1ed0..0d3a1fb 100644
--- a/.idea/other.xml
+++ b/.idea/other.xml
@@ -36,6 +36,17 @@
+
+
+
+
+
+
+
+
+
+
+
@@ -69,6 +80,17 @@
+
+
+
+
+
+
+
+
+
+
+
diff --git a/.idea/workspace.xml b/.idea/workspace.xml
index 59d02a0..4fdf646 100644
--- a/.idea/workspace.xml
+++ b/.idea/workspace.xml
@@ -4,20 +4,33 @@
+
+
+
+ @android:style/Theme.Material.Light
+
+
+
+
+
-
-
+
+
+
+
+
+
@@ -27,7 +40,7 @@
-
+
@@ -56,8 +69,9 @@
-
+
+
@@ -92,29 +106,30 @@
- {
- "keyToString": {
- "RunOnceActivity.OpenProjectViewOnStart": "true",
- "RunOnceActivity.ShowReadmeOnStart": "true",
- "RunOnceActivity.cidr.known.project.marker": "true",
- "RunOnceActivity.readMode.enableVisualFormatting": "true",
- "SHARE_PROJECT_CONFIGURATION_FILES": "true",
- "cf.first.check.clang-format": "false",
- "cidr.known.project.marker": "true",
- "git-widget-placeholder": "master",
- "kotlin-language-version-configured": "true",
- "last_opened_file_path": "/Volumes/Sohaib - Data/Work/Projects/Android/Github/PegasusUtils",
- "project.structure.last.edited": "Suggestions",
- "project.structure.proportion": "0.17",
- "project.structure.side.proportion": "0.2",
- "settings.editor.selected.configurable": "org.jetbrains.plugins.github.ui.GithubSettingsConfigurable"
+
+}]]>
diff --git a/app/build.gradle b/app/build.gradle
index aef6ff7..29cf9fb 100644
--- a/app/build.gradle
+++ b/app/build.gradle
@@ -2,6 +2,7 @@ plugins {
id 'com.android.application'
id 'org.jetbrains.kotlin.android'
id 'kotlin-kapt'
+ id 'com.google.firebase.crashlytics'
}
android {
@@ -38,9 +39,9 @@ android {
dependencies {
implementation project(path: ':pegutils')
- implementation 'androidx.core:core-ktx:1.13.0'
- implementation 'androidx.appcompat:appcompat:1.6.1'
- implementation 'com.google.android.material:material:1.11.0'
+ implementation 'androidx.core:core-ktx:1.13.1'
+ implementation 'androidx.appcompat:appcompat:1.7.0'
+ implementation 'com.google.android.material:material:1.12.0'
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
}
\ No newline at end of file
diff --git a/build.gradle b/build.gradle
index 55854de..4910c1a 100644
--- a/build.gradle
+++ b/build.gradle
@@ -1,8 +1,8 @@
// Top-level build file where you can add configuration options common to all sub-projects/modules.
plugins {
- id 'com.android.application' version '8.3.2' apply false
- id 'com.android.library' version '8.3.2' apply false
- id 'org.jetbrains.kotlin.android' version '1.9.21' apply false
+ id 'com.android.application' version '8.5.1' apply false
+ id 'com.android.library' version '8.5.1' apply false
+ id 'org.jetbrains.kotlin.android' version '2.0.0' apply false
id 'androidx.navigation.safeargs.kotlin' version '2.7.7' apply false
- id 'com.google.firebase.crashlytics' version '2.9.9' apply false
+ id 'com.google.firebase.crashlytics' version '3.0.2' apply false
}
\ No newline at end of file
diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties
index 524e689..9e7ff7b 100644
--- a/gradle/wrapper/gradle-wrapper.properties
+++ b/gradle/wrapper/gradle-wrapper.properties
@@ -1,6 +1,6 @@
-#Thu Apr 25 11:10:50 PKT 2024
+#Tue Jul 16 05:40:38 PDT 2024
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
-distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-bin.zip
+distributionUrl=https\://services.gradle.org/distributions/gradle-8.9-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
diff --git a/local.properties b/local.properties
index 24723ee..51c821d 100644
--- a/local.properties
+++ b/local.properties
@@ -4,5 +4,5 @@
# Location of the SDK. This is only used by Gradle.
# For customization when using a Version Control System, please read the
# header note.
-#Thu Apr 25 10:30:05 PKT 2024
-sdk.dir=C\:\\Users\\Desk11\\AppData\\Local\\Android\\Sdk
+#Tue Jul 16 05:10:05 PDT 2024
+sdk.dir=C\:\\Users\\HUAWEI\\AppData\\Local\\Android\\Sdk
diff --git a/pegutils/build.gradle b/pegutils/build.gradle
index c7735ce..75b9d8d 100644
--- a/pegutils/build.gradle
+++ b/pegutils/build.gradle
@@ -3,7 +3,6 @@ plugins {
id 'org.jetbrains.kotlin.android'
id 'kotlin-kapt'
id 'androidx.navigation.safeargs.kotlin'
- id 'com.google.firebase.crashlytics'
id 'maven-publish'
}
@@ -14,8 +13,6 @@ android {
defaultConfig {
minSdk 23
targetSdk 34
-
- consumerProguardFiles "consumer-rules.pro"
}
buildTypes {
@@ -40,9 +37,9 @@ android {
dependencies {
- implementation 'androidx.core:core-ktx:1.13.0'
- implementation 'androidx.appcompat:appcompat:1.6.1'
- implementation 'com.google.android.material:material:1.11.0'
+ implementation 'androidx.core:core-ktx:1.13.1'
+ implementation 'androidx.appcompat:appcompat:1.7.0'
+ implementation 'com.google.android.material:material:1.12.0'
// Exif interface (for image rotation)
implementation 'androidx.exifinterface:exifinterface:1.3.7'
@@ -52,15 +49,15 @@ dependencies {
implementation 'androidx.navigation:navigation-ui-ktx:2.7.7'
// Firebase
- implementation 'com.google.firebase:firebase-crashlytics-ktx:18.6.4'
- implementation 'com.google.firebase:firebase-analytics-ktx:21.6.2'
+ implementation 'com.google.firebase:firebase-crashlytics-ktx:19.0.3'
+ implementation 'com.google.firebase:firebase-analytics-ktx:22.0.2'
// Glide
implementation 'com.github.bumptech.glide:glide:4.16.0'
kapt 'com.github.bumptech.glide:compiler:4.16.0'
// GSON (JSON to Object & vice versa)
- implementation "com.google.code.gson:gson:2.10.1"
+ implementation 'com.google.code.gson:gson:2.11.0'
}
publishing {
@@ -68,7 +65,7 @@ publishing {
release(MavenPublication) {
groupId = 'dev.pegasus.utils'
artifactId = 'utils'
- version = '1.0.0-alpha-13'
+ version = '1.0.0-alpha-14'
afterEvaluate {
from components.release
diff --git a/pegutils/consumer-rules.pro b/pegutils/consumer-rules.pro
deleted file mode 100644
index e69de29..0000000
diff --git a/pegutils/src/main/java/dev/pegasus/utils/base/ParentActivity.kt b/pegutils/src/main/java/dev/pegasus/utils/base/ParentActivity.kt
new file mode 100644
index 0000000..cb6f3d3
--- /dev/null
+++ b/pegutils/src/main/java/dev/pegasus/utils/base/ParentActivity.kt
@@ -0,0 +1,34 @@
+package dev.pegasus.utils.base
+
+import android.os.Bundle
+import android.view.LayoutInflater
+import androidx.activity.enableEdgeToEdge
+import androidx.appcompat.app.AppCompatActivity
+import androidx.core.view.ViewCompat
+import androidx.core.view.WindowInsetsCompat
+import androidx.core.view.updatePadding
+import androidx.viewbinding.ViewBinding
+
+abstract class ParentActivity(val bindingFactory: (LayoutInflater) -> T) : AppCompatActivity() {
+
+ private val binding by lazy { bindingFactory(layoutInflater) }
+
+ override fun onCreate(savedInstanceState: Bundle?) {
+ super.onCreate(savedInstanceState)
+ enableEdgeToEdge()
+ setContentView(binding.root)
+ setPadding()
+
+ onCreated()
+ }
+
+ private fun setPadding() {
+ ViewCompat.setOnApplyWindowInsetsListener(binding.root) { v, insets ->
+ val bars = insets.getInsets(WindowInsetsCompat.Type.systemBars() or WindowInsetsCompat.Type.displayCutout())
+ v.updatePadding(left = bars.left, top = bars.top, right = bars.right, bottom = bars.bottom)
+ WindowInsetsCompat.CONSUMED
+ }
+ }
+
+ abstract fun onCreated()
+}
\ No newline at end of file
diff --git a/pegutils/src/main/java/dev/pegasus/utils/base/ParentFragment.kt b/pegutils/src/main/java/dev/pegasus/utils/base/ParentFragment.kt
new file mode 100644
index 0000000..260ff18
--- /dev/null
+++ b/pegutils/src/main/java/dev/pegasus/utils/base/ParentFragment.kt
@@ -0,0 +1,52 @@
+package dev.pegasus.utils.base
+
+import android.app.Activity
+import android.os.Bundle
+import android.view.LayoutInflater
+import android.view.View
+import android.view.ViewGroup
+import androidx.fragment.app.Fragment
+import androidx.viewbinding.ViewBinding
+
+abstract class ParentFragment(val bindingFactory: (LayoutInflater) -> T) : Fragment() {
+
+ /**
+ * These properties are only valid between onCreateView and onDestroyView
+ * @property binding
+ * -> after onCreateView
+ * -> before onDestroyView
+ */
+ private var _binding: T? = null
+ protected val binding get() = _binding!!
+
+ /**
+ * These properties are only valid between onCreateView and onDestroyView
+ * @property globalContext
+ * @property globalActivity
+ * -> after onCreateView
+ * -> before onDestroyView
+ */
+
+ protected val globalContext by lazy { binding.root.context }
+ protected val globalActivity by lazy { globalContext as Activity }
+
+ override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View {
+ _binding = bindingFactory(inflater)
+ return binding.root
+ }
+
+ override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
+ super.onViewCreated(view, savedInstanceState)
+ onViewCreated()
+ }
+
+ /**
+ * @since : Start code...
+ */
+ abstract fun onViewCreated()
+
+ override fun onDestroyView() {
+ super.onDestroyView()
+ _binding = null
+ }
+}
\ No newline at end of file
diff --git a/pegutils/src/main/java/dev/pegasus/utils/decorators/GridSpacingItemDecoration.kt b/pegutils/src/main/java/dev/pegasus/utils/decorators/GridSpacingItemDecoration.kt
index 80162e6..f7c520d 100644
--- a/pegutils/src/main/java/dev/pegasus/utils/decorators/GridSpacingItemDecoration.kt
+++ b/pegutils/src/main/java/dev/pegasus/utils/decorators/GridSpacingItemDecoration.kt
@@ -13,6 +13,10 @@ import dev.pegasus.utils.extensions.tools.px
* -> https://stackoverflow.com/users/20440272/sohaib-ahmed
*/
+/**
+ * Used in recyclerview
+ */
+
class GridSpacingItemDecoration(spacing: Int, private val spanCount: Int) : RecyclerView.ItemDecoration() {
private var spacingInPixels = 0
diff --git a/pegutils/src/main/java/dev/pegasus/utils/extensions/ui/FragmentExtensions.kt b/pegutils/src/main/java/dev/pegasus/utils/extensions/ui/FragmentExtensions.kt
index 2139726..f1fc8b6 100644
--- a/pegutils/src/main/java/dev/pegasus/utils/extensions/ui/FragmentExtensions.kt
+++ b/pegutils/src/main/java/dev/pegasus/utils/extensions/ui/FragmentExtensions.kt
@@ -168,24 +168,26 @@ fun Fragment.showToast(@StringRes stringResId: Int) {
showToast(getResString(stringResId))
}
-fun Fragment.showSnackbar(message: String, anchorView: View? = null, duration: Int = Snackbar.LENGTH_SHORT) {
+fun Fragment.showSnackBar(message: String, anchorView: View? = null, duration: Int = Snackbar.LENGTH_SHORT) {
val v: View? = anchorView ?: view
v?.let {
- val snackbar = Snackbar.make(it, message, duration)
- snackbar.anchorView = anchorView
- snackbar.show()
+ val snackBar = Snackbar.make(it, message, duration)
+ snackBar.anchorView = anchorView
+ snackBar.show()
}
}
-fun Fragment.showSnackbar(@StringRes stringResId: Int, anchorView: View? = null, duration: Int = Snackbar.LENGTH_SHORT) {
+fun Fragment.showSnackBar(@StringRes stringResId: Int, anchorView: View? = null, duration: Int = Snackbar.LENGTH_SHORT) {
val v: View? = anchorView ?: view
v?.let {
- val snackbar = Snackbar.make(it, getResString(stringResId), duration)
- snackbar.anchorView = anchorView
- snackbar.show()
+ val snackBar = Snackbar.make(it, getResString(stringResId), duration)
+ snackBar.anchorView = anchorView
+ snackBar.show()
}
}
+/* ----------------------------------------- Keyboard -----------------------------------------*/
+
/**
* @param view: View should be of edittext or something
*/
@@ -205,6 +207,8 @@ fun Fragment.hideKeyboard() {
}
}
+/* ----------------------------------------- Clipboard -----------------------------------------*/
+
fun Fragment.copyClipboardData(label: String, data: String) {
context?.let {
try {
diff --git a/pegutils/src/main/java/dev/pegasus/utils/fragments/BaseStableFragment.kt b/pegutils/src/main/java/dev/pegasus/utils/fragments/BaseStableFragment.kt
index 5259286..b910192 100644
--- a/pegutils/src/main/java/dev/pegasus/utils/fragments/BaseStableFragment.kt
+++ b/pegutils/src/main/java/dev/pegasus/utils/fragments/BaseStableFragment.kt
@@ -16,6 +16,7 @@ import androidx.databinding.ViewDataBinding
* -> https://github.com/epegasus
* -> https://linkedin.com/in/epegasus
*/
+
abstract class BaseStableFragment(@LayoutRes private val layoutId: Int) : BasePermissionFragment() {
/**