Skip to content

Commit

Permalink
PegUtils
Browse files Browse the repository at this point in the history
  • Loading branch information
goku143u committed Jul 16, 2024
1 parent d8f7146 commit 3af010b
Show file tree
Hide file tree
Showing 16 changed files with 186 additions and 56 deletions.
Binary file modified .gradle/buildOutputCleanup/buildOutputCleanup.lock
Binary file not shown.
4 changes: 2 additions & 2 deletions .gradle/buildOutputCleanup/cache.properties
Original file line number Diff line number Diff line change
@@ -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
2 changes: 1 addition & 1 deletion .idea/kotlinc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

22 changes: 22 additions & 0 deletions .idea/other.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

63 changes: 39 additions & 24 deletions .idea/workspace.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 4 additions & 3 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ plugins {
id 'com.android.application'
id 'org.jetbrains.kotlin.android'
id 'kotlin-kapt'
id 'com.google.firebase.crashlytics'
}

android {
Expand Down Expand Up @@ -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'

}
8 changes: 4 additions & 4 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -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
}
4 changes: 2 additions & 2 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -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
4 changes: 2 additions & 2 deletions local.properties
Original file line number Diff line number Diff line change
Expand Up @@ -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
17 changes: 7 additions & 10 deletions pegutils/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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'
}

Expand All @@ -14,8 +13,6 @@ android {
defaultConfig {
minSdk 23
targetSdk 34

consumerProguardFiles "consumer-rules.pro"
}

buildTypes {
Expand All @@ -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'
Expand All @@ -52,23 +49,23 @@ 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 {
publications {
release(MavenPublication) {
groupId = 'dev.pegasus.utils'
artifactId = 'utils'
version = '1.0.0-alpha-13'
version = '1.0.0-alpha-14'

afterEvaluate {
from components.release
Expand Down
Empty file removed pegutils/consumer-rules.pro
Empty file.
34 changes: 34 additions & 0 deletions pegutils/src/main/java/dev/pegasus/utils/base/ParentActivity.kt
Original file line number Diff line number Diff line change
@@ -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<T : ViewBinding>(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()
}
52 changes: 52 additions & 0 deletions pegutils/src/main/java/dev/pegasus/utils/base/ParentFragment.kt
Original file line number Diff line number Diff line change
@@ -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<T : ViewBinding>(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
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Loading

0 comments on commit 3af010b

Please sign in to comment.