-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
16 changed files
with
186 additions
and
56 deletions.
There are no files selected for viewing
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
34 changes: 34 additions & 0 deletions
34
pegutils/src/main/java/dev/pegasus/utils/base/ParentActivity.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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
52
pegutils/src/main/java/dev/pegasus/utils/base/ParentFragment.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.