Improved app loader framework to optimize overall performance of the app.
- The app is facing a weird data corruption issue in the backend and I cannot seem to
- find the source of the issue at the moment. It could be my device issue or in general
- I messed up somewhere either way I'm sure what has happened.
+ (This is a major improvement in the app's performance)
Removed
@@ -68,6 +66,13 @@
Music
Added Shuffle button.
+
Development
+
+
+
Updated many underlying APIs.
+
Updated how the codebase uses deprecated and old APIs.
+
+
@@ -117,6 +122,11 @@
Removed
+
+
The app is released on GitHub and FDroid from here.
+
+
+
@@ -125,7 +135,8 @@
Removed
User Interface
-
Added blur effect on the background when a popup window is showing.
+
Added blur effect on the background when a popup window is showing.
+ Will work on supported devices only.
Added option to enable disable blur effect on popup windows Behaviour
Preferences
panel.
diff --git a/app/src/main/java/app/simple/inure/adapters/home/AdapterHomeFrequentlyUsed.kt b/app/src/main/java/app/simple/inure/adapters/home/AdapterHomeFrequentlyUsed.kt
deleted file mode 100644
index b3bd0a4a8..000000000
--- a/app/src/main/java/app/simple/inure/adapters/home/AdapterHomeFrequentlyUsed.kt
+++ /dev/null
@@ -1,60 +0,0 @@
-package app.simple.inure.adapters.home
-
-import android.content.pm.PackageInfo
-import android.view.LayoutInflater
-import android.view.View
-import android.view.ViewGroup
-import android.widget.ImageView
-import androidx.recyclerview.widget.RecyclerView
-import app.simple.inure.R
-import app.simple.inure.decorations.overscroll.HorizontalListViewHolder
-import app.simple.inure.decorations.ripple.DynamicRippleLinearLayout
-import app.simple.inure.decorations.typeface.TypeFaceTextView
-import app.simple.inure.glide.util.ImageLoader.loadAppIcon
-import app.simple.inure.models.PackageStats
-
-@Deprecated("Not used anymore")
-class AdapterHomeFrequentlyUsed(private val list: ArrayList) : RecyclerView.Adapter() {
-
- private var recentlyUpdatedAppsCallbacks: RecentlyUpdatedAppsCallbacks? = null
-
- override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): Holder {
- return Holder(LayoutInflater.from(parent.context).inflate(R.layout.adapter_home_recently_updated, parent, false))
- }
-
- override fun onBindViewHolder(holder: Holder, position: Int) {
- holder.icon.transitionName = "frequently_$position"
- holder.icon.loadAppIcon(list[position].packageInfo!!.packageName)
- holder.name.text = list[position].packageInfo!!.applicationInfo.name
-
- holder.container.setOnClickListener {
- recentlyUpdatedAppsCallbacks?.onRecentAppClicked(list[position].packageInfo!!, holder.icon)
- }
-
- holder.container.setOnLongClickListener {
- recentlyUpdatedAppsCallbacks?.onRecentAppLongPressed(list[position].packageInfo!!, holder.icon, holder.container)
- true
- }
- }
-
- override fun getItemCount(): Int {
- return list.size / 5
- }
-
- inner class Holder(itemView: View) : HorizontalListViewHolder(itemView) {
- val icon: ImageView = itemView.findViewById(R.id.recently_app_icon)
- val name: TypeFaceTextView = itemView.findViewById(R.id.recently_app_name)
- val container: DynamicRippleLinearLayout = itemView.findViewById(R.id.recently_container)
- }
-
- fun setOnRecentAppsClickedListener(recentlyUpdatedAppsCallbacks: RecentlyUpdatedAppsCallbacks) {
- this.recentlyUpdatedAppsCallbacks = recentlyUpdatedAppsCallbacks
- }
-
- companion object {
- interface RecentlyUpdatedAppsCallbacks {
- fun onRecentAppClicked(packageInfo: PackageInfo, icon: ImageView)
- fun onRecentAppLongPressed(packageInfo: PackageInfo, icon: ImageView, anchor: ViewGroup)
- }
- }
-}
\ No newline at end of file
diff --git a/app/src/main/java/app/simple/inure/adapters/home/AdapterHomeRecentlyInstalled.kt b/app/src/main/java/app/simple/inure/adapters/home/AdapterHomeRecentlyInstalled.kt
deleted file mode 100644
index 395e2d30c..000000000
--- a/app/src/main/java/app/simple/inure/adapters/home/AdapterHomeRecentlyInstalled.kt
+++ /dev/null
@@ -1,59 +0,0 @@
-package app.simple.inure.adapters.home
-
-import android.content.pm.PackageInfo
-import android.view.LayoutInflater
-import android.view.View
-import android.view.ViewGroup
-import android.widget.ImageView
-import androidx.recyclerview.widget.RecyclerView
-import app.simple.inure.R
-import app.simple.inure.decorations.overscroll.HorizontalListViewHolder
-import app.simple.inure.decorations.ripple.DynamicRippleLinearLayout
-import app.simple.inure.decorations.typeface.TypeFaceTextView
-import app.simple.inure.glide.util.ImageLoader.loadAppIcon
-
-@Deprecated("Not in use anymore")
-class AdapterHomeRecentlyInstalled(private val list: ArrayList) : RecyclerView.Adapter() {
-
- private var recentlyAppsCallbacks: RecentlyAppsCallbacks? = null
-
- override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): Holder {
- return Holder(LayoutInflater.from(parent.context).inflate(R.layout.adapter_home_recently_installed, parent, false))
- }
-
- override fun onBindViewHolder(holder: Holder, position: Int) {
- holder.icon.transitionName = "recently_installed_$position"
- holder.icon.loadAppIcon(list[position].packageName)
- holder.name.text = list[position].applicationInfo.name
-
- holder.container.setOnClickListener {
- recentlyAppsCallbacks?.onRecentAppClicked(list[position], holder.icon)
- }
-
- holder.container.setOnLongClickListener {
- recentlyAppsCallbacks?.onRecentAppLongPressed(list[position], holder.icon, holder.container)
- true
- }
- }
-
- override fun getItemCount(): Int {
- return list.size / 5
- }
-
- inner class Holder(itemView: View) : HorizontalListViewHolder(itemView) {
- val icon: ImageView = itemView.findViewById(R.id.recently_app_icon)
- val name: TypeFaceTextView = itemView.findViewById(R.id.recently_app_name)
- val container: DynamicRippleLinearLayout = itemView.findViewById(R.id.recently_container)
- }
-
- fun setOnRecentAppsClickedListener(recentlyAppsCallbacks: RecentlyAppsCallbacks) {
- this.recentlyAppsCallbacks = recentlyAppsCallbacks
- }
-
- companion object {
- interface RecentlyAppsCallbacks {
- fun onRecentAppClicked(packageInfo: PackageInfo, icon: ImageView)
- fun onRecentAppLongPressed(packageInfo: PackageInfo, icon: ImageView, anchor: ViewGroup)
- }
- }
-}
\ No newline at end of file
diff --git a/app/src/main/java/app/simple/inure/adapters/home/AdapterHomeRecentlyUpdated.kt b/app/src/main/java/app/simple/inure/adapters/home/AdapterHomeRecentlyUpdated.kt
deleted file mode 100644
index 92dda253a..000000000
--- a/app/src/main/java/app/simple/inure/adapters/home/AdapterHomeRecentlyUpdated.kt
+++ /dev/null
@@ -1,59 +0,0 @@
-package app.simple.inure.adapters.home
-
-import android.content.pm.PackageInfo
-import android.view.LayoutInflater
-import android.view.View
-import android.view.ViewGroup
-import android.widget.ImageView
-import androidx.recyclerview.widget.RecyclerView
-import app.simple.inure.R
-import app.simple.inure.decorations.overscroll.HorizontalListViewHolder
-import app.simple.inure.decorations.ripple.DynamicRippleLinearLayout
-import app.simple.inure.decorations.typeface.TypeFaceTextView
-import app.simple.inure.glide.util.ImageLoader.loadAppIcon
-
-@Deprecated("Not in use anymore")
-class AdapterHomeRecentlyUpdated(private val list: ArrayList) : RecyclerView.Adapter() {
-
- private var recentlyUpdatedAppsCallbacks: RecentlyUpdatedAppsCallbacks? = null
-
- override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): Holder {
- return Holder(LayoutInflater.from(parent.context).inflate(R.layout.adapter_home_recently_updated, parent, false))
- }
-
- override fun onBindViewHolder(holder: Holder, position: Int) {
- holder.icon.transitionName = "app_updated_$position"
- holder.icon.loadAppIcon(list[position].packageName)
- holder.name.text = list[position].applicationInfo.name
-
- holder.container.setOnClickListener {
- recentlyUpdatedAppsCallbacks?.onRecentAppClicked(list[position], holder.icon)
- }
-
- holder.container.setOnLongClickListener {
- recentlyUpdatedAppsCallbacks?.onRecentAppLongPressed(list[position], holder.icon, holder.container)
- true
- }
- }
-
- override fun getItemCount(): Int {
- return list.size / 5
- }
-
- inner class Holder(itemView: View) : HorizontalListViewHolder(itemView) {
- val icon: ImageView = itemView.findViewById(R.id.recently_app_icon)
- val name: TypeFaceTextView = itemView.findViewById(R.id.recently_app_name)
- val container: DynamicRippleLinearLayout = itemView.findViewById(R.id.recently_container)
- }
-
- fun setOnRecentAppsClickedListener(recentlyUpdatedAppsCallbacks: RecentlyUpdatedAppsCallbacks) {
- this.recentlyUpdatedAppsCallbacks = recentlyUpdatedAppsCallbacks
- }
-
- companion object {
- interface RecentlyUpdatedAppsCallbacks {
- fun onRecentAppClicked(packageInfo: PackageInfo, icon: ImageView)
- fun onRecentAppLongPressed(packageInfo: PackageInfo, icon: ImageView, anchor: ViewGroup)
- }
- }
-}
\ No newline at end of file
diff --git a/app/src/main/java/app/simple/inure/adapters/ui/AdapterApps.kt b/app/src/main/java/app/simple/inure/adapters/ui/AdapterApps.kt
deleted file mode 100644
index 7b82638e0..000000000
--- a/app/src/main/java/app/simple/inure/adapters/ui/AdapterApps.kt
+++ /dev/null
@@ -1,77 +0,0 @@
-package app.simple.inure.adapters.ui
-
-import android.annotation.SuppressLint
-import android.content.pm.PackageInfo
-import android.view.LayoutInflater
-import android.view.View
-import android.view.ViewGroup
-import android.widget.ImageView
-import android.widget.TextView
-import androidx.constraintlayout.widget.ConstraintLayout
-import androidx.recyclerview.widget.RecyclerView
-import app.simple.inure.R
-import app.simple.inure.decorations.fastscroll.PopupTextProvider
-import app.simple.inure.decorations.overscroll.VerticalListViewHolder
-import app.simple.inure.glide.modules.GlideApp
-import app.simple.inure.glide.util.ImageLoader.loadAppIcon
-import app.simple.inure.interfaces.adapters.AdapterCallbacks
-import app.simple.inure.util.AdapterUtils.searchHighlighter
-
-@Deprecated("not in use anymore")
-class AdapterApps : RecyclerView.Adapter(), PopupTextProvider {
-
- private lateinit var adapterCallbacks: AdapterCallbacks
- var apps = arrayListOf()
- var searchKeyword: String = ""
-
- override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): Holder {
- return Holder(LayoutInflater.from(parent.context)
- .inflate(R.layout.adapter_all_apps, parent, false))
- }
-
- @SuppressLint("ClickableViewAccessibility")
- override fun onBindViewHolder(holder: Holder, position: Int) {
- holder.icon.transitionName = "app_$position"
- holder.icon.loadAppIcon(apps[position].packageName)
- holder.name.text = apps[position].applicationInfo.name
- holder.packageId.text = apps[position].packageName
-
- if (searchKeyword.isNotEmpty()) {
- searchHighlighter(holder.name, searchKeyword)
- searchHighlighter(holder.packageId, searchKeyword)
- }
-
- holder.container.setOnClickListener {
- adapterCallbacks.onAppClicked(apps[position], holder.icon)
- }
-
- holder.container.setOnLongClickListener {
- adapterCallbacks.onAppLongPressed(apps[position], holder.icon)
- true
- }
- }
-
- override fun onViewRecycled(holder: Holder) {
- super.onViewRecycled(holder)
- GlideApp.with(holder.icon).clear(holder.icon)
- }
-
- override fun getItemCount(): Int {
- return apps.size
- }
-
- fun setOnItemClickListener(adapterCallbacks: AdapterCallbacks) {
- this.adapterCallbacks = adapterCallbacks
- }
-
- inner class Holder(itemView: View) : VerticalListViewHolder(itemView) {
- val icon: ImageView = itemView.findViewById(R.id.adapter_all_app_icon)
- val name: TextView = itemView.findViewById(R.id.adapter_all_app_name)
- val packageId: TextView = itemView.findViewById(R.id.adapter_recently_app_package_id)
- val container: ConstraintLayout = itemView.findViewById(R.id.adapter_all_app_container)
- }
-
- override fun getPopupText(position: Int): String {
- return apps[position].applicationInfo.name.substring(0, 1)
- }
-}
diff --git a/app/src/main/java/app/simple/inure/apk/utils/ProvidersUtils.kt b/app/src/main/java/app/simple/inure/apk/utils/ProvidersUtils.kt
index e0d76e22b..951e103d4 100644
--- a/app/src/main/java/app/simple/inure/apk/utils/ProvidersUtils.kt
+++ b/app/src/main/java/app/simple/inure/apk/utils/ProvidersUtils.kt
@@ -8,7 +8,6 @@ import android.os.Build
import app.simple.inure.util.NullSafety.isNotNull
object ProvidersUtils {
-
fun isEnabled(context: Context, packageName: String, clsName: String): Boolean {
val componentName = ComponentName(packageName, clsName)
@@ -19,8 +18,17 @@ object ProvidersUtils {
// We need to get the application info to get the component's default state
try {
val packageInfo = if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
- context.packageManager.getPackageInfo(packageName, PackageManager.GET_PROVIDERS
- or PackageManager.MATCH_DISABLED_COMPONENTS)
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) {
+ context.packageManager
+ .getPackageInfo(packageName,
+ PackageManager.PackageInfoFlags.of(
+ (PackageManager.GET_PROVIDERS or PackageManager.MATCH_DISABLED_COMPONENTS).toLong()))
+ } else {
+ @Suppress("DEPRECATION")
+ context.packageManager
+ .getPackageInfo(packageName,
+ PackageManager.GET_PROVIDERS or PackageManager.MATCH_DISABLED_COMPONENTS)
+ }
} else {
@Suppress("deprecation")
context.packageManager.getPackageInfo(packageName, PackageManager.GET_PROVIDERS
@@ -49,8 +57,17 @@ object ProvidersUtils {
else -> {
try {
val packageInfo = if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
- context.packageManager.getPackageInfo(packageName, PackageManager.GET_PROVIDERS
- or PackageManager.MATCH_DISABLED_COMPONENTS)
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) {
+ context.packageManager
+ .getPackageInfo(packageName,
+ PackageManager.PackageInfoFlags.of(
+ (PackageManager.GET_PROVIDERS or PackageManager.MATCH_DISABLED_COMPONENTS).toLong()))
+ } else {
+ @Suppress("DEPRECATION")
+ context.packageManager
+ .getPackageInfo(packageName,
+ PackageManager.GET_PROVIDERS or PackageManager.MATCH_DISABLED_COMPONENTS)
+ }
} else {
@Suppress("deprecation")
context.packageManager.getPackageInfo(packageName, PackageManager.GET_PROVIDERS
diff --git a/app/src/main/java/app/simple/inure/apk/utils/ReceiversUtils.kt b/app/src/main/java/app/simple/inure/apk/utils/ReceiversUtils.kt
index 96df3063a..4fae16b6a 100644
--- a/app/src/main/java/app/simple/inure/apk/utils/ReceiversUtils.kt
+++ b/app/src/main/java/app/simple/inure/apk/utils/ReceiversUtils.kt
@@ -17,8 +17,17 @@ object ReceiversUtils {
PackageManager.COMPONENT_ENABLED_STATE_DEFAULT -> // We need to get the application info to get the component's default state
try {
val packageInfo = if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
- context.packageManager.getPackageInfo(packageName, PackageManager.GET_RECEIVERS
- or PackageManager.MATCH_DISABLED_COMPONENTS)
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) {
+ context.packageManager
+ .getPackageInfo(packageName,
+ PackageManager.PackageInfoFlags.of(
+ (PackageManager.GET_RECEIVERS or PackageManager.MATCH_DISABLED_COMPONENTS).toLong()))
+ } else {
+ @Suppress("DEPRECATION")
+ context.packageManager
+ .getPackageInfo(packageName,
+ PackageManager.GET_RECEIVERS or PackageManager.MATCH_DISABLED_COMPONENTS)
+ }
} else {
@Suppress("deprecation")
context.packageManager.getPackageInfo(packageName, PackageManager.GET_RECEIVERS
@@ -49,8 +58,17 @@ object ReceiversUtils {
else -> {
try {
val packageInfo = if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
- context.packageManager.getPackageInfo(packageName, PackageManager.GET_RECEIVERS
- or PackageManager.MATCH_DISABLED_COMPONENTS)
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) {
+ context.packageManager
+ .getPackageInfo(packageName,
+ PackageManager.PackageInfoFlags.of(
+ (PackageManager.GET_RECEIVERS or PackageManager.MATCH_DISABLED_COMPONENTS).toLong()))
+ } else {
+ @Suppress("DEPRECATION")
+ context.packageManager
+ .getPackageInfo(packageName,
+ PackageManager.GET_RECEIVERS or PackageManager.MATCH_DISABLED_COMPONENTS)
+ }
} else {
@Suppress("deprecation")
context.packageManager.getPackageInfo(packageName, PackageManager.GET_RECEIVERS
diff --git a/app/src/main/java/app/simple/inure/apk/utils/ServicesUtils.kt b/app/src/main/java/app/simple/inure/apk/utils/ServicesUtils.kt
index 6ae327060..5243aee06 100644
--- a/app/src/main/java/app/simple/inure/apk/utils/ServicesUtils.kt
+++ b/app/src/main/java/app/simple/inure/apk/utils/ServicesUtils.kt
@@ -17,8 +17,17 @@ object ServicesUtils {
PackageManager.COMPONENT_ENABLED_STATE_DEFAULT -> // We need to get the application info to get the component's default state
try {
val packageInfo = if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
- context.packageManager.getPackageInfo(packageName, PackageManager.GET_SERVICES
- or PackageManager.MATCH_DISABLED_COMPONENTS)
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) {
+ context.packageManager
+ .getPackageInfo(packageName,
+ PackageManager.PackageInfoFlags.of(
+ (PackageManager.GET_SERVICES or PackageManager.MATCH_DISABLED_COMPONENTS).toLong()))
+ } else {
+ @Suppress("DEPRECATION")
+ context.packageManager
+ .getPackageInfo(packageName,
+ PackageManager.GET_SERVICES or PackageManager.MATCH_DISABLED_COMPONENTS)
+ }
} else {
@Suppress("deprecation")
context.packageManager.getPackageInfo(packageName, PackageManager.GET_SERVICES
@@ -49,8 +58,17 @@ object ServicesUtils {
else -> {
try {
val packageInfo = if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
- context.packageManager.getPackageInfo(packageName, PackageManager.GET_SERVICES
- or PackageManager.MATCH_DISABLED_COMPONENTS)
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) {
+ context.packageManager
+ .getPackageInfo(packageName,
+ PackageManager.PackageInfoFlags.of(
+ (PackageManager.GET_SERVICES or PackageManager.MATCH_DISABLED_COMPONENTS).toLong()))
+ } else {
+ @Suppress("DEPRECATION")
+ context.packageManager
+ .getPackageInfo(packageName,
+ PackageManager.GET_SERVICES or PackageManager.MATCH_DISABLED_COMPONENTS)
+ }
} else {
@Suppress("deprecation")
context.packageManager.getPackageInfo(packageName, PackageManager.GET_SERVICES
diff --git a/app/src/main/java/app/simple/inure/apk/utils/SignatureUtils.kt b/app/src/main/java/app/simple/inure/apk/utils/SignatureUtils.kt
index daa4a568a..7e5b38f35 100644
--- a/app/src/main/java/app/simple/inure/apk/utils/SignatureUtils.kt
+++ b/app/src/main/java/app/simple/inure/apk/utils/SignatureUtils.kt
@@ -20,7 +20,15 @@ object SignatureUtils {
fun PackageInfo.getApplicationSignature(context: Context): Pair {
val arrayOfSignatures: Array = if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) {
- context.packageManager.getPackageInfo(packageName, PackageManager.GET_SIGNING_CERTIFICATES).signingInfo.apkContentsSigners
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) {
+ context.packageManager
+ .getPackageInfo(packageName,
+ PackageManager.PackageInfoFlags.of(
+ PackageManager.GET_SIGNING_CERTIFICATES.toLong())).signingInfo.apkContentsSigners
+ } else {
+ @Suppress("DEPRECATION")
+ context.packageManager.getPackageInfo(packageName, PackageManager.GET_SIGNING_CERTIFICATES).signingInfo.apkContentsSigners
+ }
} else {
@Suppress("deprecation", "PackageManagerGetSignatures")
context.packageManager.getPackageInfo(packageName, PackageManager.GET_SIGNATURES).signatures
@@ -53,14 +61,14 @@ object SignatureUtils {
try {
for (sg in z) {
x509Certificate = CertificateFactory.getInstance("X.509")
- .generateCertificate(ByteArrayInputStream(sg.toByteArray())) as X509Certificate
+ .generateCertificate(ByteArrayInputStream(sg.toByteArray())) as X509Certificate
string = x509Certificate.issuerX500Principal.name
if (string != "") tuple.first = string
string = x509Certificate.sigAlgName
if (string != "") tuple.second = string + "| " + convertToHex(MessageDigest.getInstance("sha256").digest(sg.toByteArray()))
}
- } catch (e: NoSuchAlgorithmException) {
- } catch (e: CertificateException) {
+ } catch (_: NoSuchAlgorithmException) {
+ } catch (_: CertificateException) {
}
return tuple
}
@@ -90,7 +98,7 @@ object SignatureUtils {
var s = ""
s = try {
val cert = CertificateFactory.getInstance("X.509")
- .generateCertificate(ByteArrayInputStream(sign.toByteArray())) as X509Certificate
+ .generateCertificate(ByteArrayInputStream(sign.toByteArray())) as X509Certificate
"""
${cert.issuerX500Principal.name}
diff --git a/app/src/main/java/app/simple/inure/decorations/overscroll/CustomVerticalRecyclerView.kt b/app/src/main/java/app/simple/inure/decorations/overscroll/CustomVerticalRecyclerView.kt
index 114adea7c..d9e52bc7a 100644
--- a/app/src/main/java/app/simple/inure/decorations/overscroll/CustomVerticalRecyclerView.kt
+++ b/app/src/main/java/app/simple/inure/decorations/overscroll/CustomVerticalRecyclerView.kt
@@ -25,7 +25,6 @@ import app.simple.inure.themes.manager.ThemeManager
import app.simple.inure.util.ConditionUtils.invert
import app.simple.inure.util.NullSafety.isNotNull
import app.simple.inure.util.RecyclerViewUtils.flingTranslationMagnitude
-import app.simple.inure.util.RecyclerViewUtils.overScrollRotationMagnitude
import app.simple.inure.util.RecyclerViewUtils.overScrollTranslationMagnitude
import app.simple.inure.util.StatusBarHeight
@@ -104,7 +103,6 @@ class CustomVerticalRecyclerView(context: Context, attrs: AttributeSet?) : Theme
* simply update the view properties without animation.
*/
val sign = if (direction == DIRECTION_BOTTOM) -1 else 1
- val rotationDelta = sign * deltaDistance * overScrollRotationMagnitude
/**
* This value decides how fast the recycler view views should move when
diff --git a/app/src/main/java/app/simple/inure/decorations/views/ZoomImageView.kt b/app/src/main/java/app/simple/inure/decorations/views/ZoomImageView.kt
index 5fcdf7a18..2accd41db 100644
--- a/app/src/main/java/app/simple/inure/decorations/views/ZoomImageView.kt
+++ b/app/src/main/java/app/simple/inure/decorations/views/ZoomImageView.kt
@@ -23,6 +23,7 @@ import kotlin.math.absoluteValue
* @since 03/09/20
*/
+@Suppress("MemberVisibilityCanBePrivate")
class ZoomImageView : androidx.appcompat.widget.AppCompatImageView {
private val textPaint = Paint()
@@ -132,8 +133,8 @@ class ZoomImageView : androidx.appcompat.widget.AppCompatImageView {
flingRunnable.lastX = -preEventImgRect.left
flingRunnable.lastY = -preEventImgRect.top
scroller.fling(
- flingRunnable.lastX.toInt(), flingRunnable.lastY.toInt(), -velocityX.toInt(),
- -velocityY.toInt(), 0, maxX, 0, maxY
+ flingRunnable.lastX.toInt(), flingRunnable.lastY.toInt(), -velocityX.toInt(),
+ -velocityY.toInt(), 0, maxX, 0, maxY
)
ViewCompat.postOnAnimation(this@ZoomImageView, flingRunnable)
return true
@@ -142,7 +143,7 @@ class ZoomImageView : androidx.appcompat.widget.AppCompatImageView {
override fun onDown(e: MotionEvent): Boolean {
removeCallbacks(flingRunnable)
scroller.forceFinished(true)
- displayRect?.let {
+ displayRect.let {
preEventImgRect.set(it)
}
panAnimator?.removeAllUpdateListeners()
@@ -167,11 +168,12 @@ class ZoomImageView : androidx.appcompat.widget.AppCompatImageView {
}
}
+ @Suppress("KotlinConstantConditions")
@SuppressLint("ClickableViewAccessibility")
override fun onTouchEvent(event: MotionEvent): Boolean {
val disallowIntercept =
currentScale > MIN_SCALE || scaleDetector.isInProgress || handlingDismiss
- if (event?.action == MotionEvent.ACTION_UP) {
+ if (event.action == MotionEvent.ACTION_UP) {
if (handlingDismiss) {
if (currentTransY.absoluteValue > dismissThreshold) {
onDismiss.invoke()
@@ -181,7 +183,7 @@ class ZoomImageView : androidx.appcompat.widget.AppCompatImageView {
}
}
parent?.requestDisallowInterceptTouchEvent(disallowIntercept)
- return tapDetector.onTouchEvent(event) || return scaleDetector.onTouchEvent(event) || return true
+ return tapDetector.onTouchEvent(event) || return scaleDetector.onTouchEvent(event)
}
private fun setZoom(scale: Float, x: Float, y: Float) {
@@ -269,9 +271,9 @@ class ZoomImageView : androidx.appcompat.widget.AppCompatImageView {
super.onDraw(canvas)
if (debugInfoVisible) {
canvas.drawText(logText, 10F, height - 10F, textPaint)
- val drawableBound = displayRect?.let {
+ val drawableBound = displayRect.let {
"Drawable: $it"
- } ?: ""
+ }
canvas.drawText(drawableBound, 10F, 40F, textPaint)
}
}
@@ -294,6 +296,7 @@ class ZoomImageView : androidx.appcompat.widget.AppCompatImageView {
}
}
+ @Suppress("SameParameterValue", "SameParameterValue")
private fun animatePan(startX: Float, startY: Float, endX: Float, endY: Float, dismissProgress: Float? = null) {
panAnimator = ValueAnimator.ofFloat(startX, startY, endX, endY).apply {
duration = VALUE_ANIMATOR_DURATION
@@ -334,7 +337,7 @@ class ZoomImageView : androidx.appcompat.widget.AppCompatImageView {
}
private fun setBounds() {
- val rect = displayRect ?: return
+ val rect = displayRect
val height = rect.height()
val width = rect.width()
val viewHeight: Int = this.viewHeight
@@ -391,16 +394,14 @@ class ZoomImageView : androidx.appcompat.widget.AppCompatImageView {
private inline val dismissProgress: Float
get() = currentTransY.absoluteValue / dismissThreshold
- private val displayRect: RectF? = RectF()
+ private val displayRect: RectF = RectF()
get() {
drawable?.let { d ->
- field?.set(
- 0f, 0f, d.intrinsicWidth.toFloat(), d.intrinsicHeight.toFloat()
- )
+ field.set(0f, 0f, d.intrinsicWidth.toFloat(), d.intrinsicHeight.toFloat())
drawMatrix.mapRect(field)
return field
}
- return null
+ return RectF()
}
private val drawMatrix: Matrix = Matrix()
diff --git a/app/src/main/java/app/simple/inure/dialogs/action/ActivityLauncher.kt b/app/src/main/java/app/simple/inure/dialogs/action/ActivityLauncher.kt
index 4a16c44cf..a984538d7 100644
--- a/app/src/main/java/app/simple/inure/dialogs/action/ActivityLauncher.kt
+++ b/app/src/main/java/app/simple/inure/dialogs/action/ActivityLauncher.kt
@@ -30,7 +30,6 @@ class ActivityLauncher : ScopedBottomSheetFragment() {
loader = view.findViewById(R.id.loader)
status = view.findViewById(R.id.activity_launcher_result)
- packageInfo = requireArguments().getParcelable(BundleConstants.packageInfo)!!
packageId = requireArguments().getString(BundleConstants.packageId)!!
activityLaunchFactory = ActivityLaunchFactory(packageInfo, packageId!!)
diff --git a/app/src/main/java/app/simple/inure/dialogs/action/ClearCache.kt b/app/src/main/java/app/simple/inure/dialogs/action/ClearCache.kt
index ece36fef2..04979ebca 100644
--- a/app/src/main/java/app/simple/inure/dialogs/action/ClearCache.kt
+++ b/app/src/main/java/app/simple/inure/dialogs/action/ClearCache.kt
@@ -25,8 +25,6 @@ class ClearCache : ScopedBottomSheetFragment() {
loader = view.findViewById(R.id.loader)
status = view.findViewById(R.id.clear_cache_result)
- packageInfo = requireArguments().getParcelable(BundleConstants.packageInfo)!!
-
return view
}
diff --git a/app/src/main/java/app/simple/inure/dialogs/action/ClearData.kt b/app/src/main/java/app/simple/inure/dialogs/action/ClearData.kt
index 8da57e4c8..a3e09495f 100644
--- a/app/src/main/java/app/simple/inure/dialogs/action/ClearData.kt
+++ b/app/src/main/java/app/simple/inure/dialogs/action/ClearData.kt
@@ -25,8 +25,6 @@ class ClearData : ScopedBottomSheetFragment() {
loader = view.findViewById(R.id.loader)
status = view.findViewById(R.id.clear_data_result)
- packageInfo = requireArguments().getParcelable(BundleConstants.packageInfo)!!
-
return view
}
diff --git a/app/src/main/java/app/simple/inure/dialogs/action/ComponentState.kt b/app/src/main/java/app/simple/inure/dialogs/action/ComponentState.kt
index cad949b84..dd9c93ef7 100644
--- a/app/src/main/java/app/simple/inure/dialogs/action/ComponentState.kt
+++ b/app/src/main/java/app/simple/inure/dialogs/action/ComponentState.kt
@@ -32,7 +32,6 @@ class ComponentState : ScopedBottomSheetFragment() {
loader = view.findViewById(R.id.loader)
status = view.findViewById(R.id.component_state_result)
- packageInfo = requireArguments().getParcelable(BundleConstants.packageInfo)!!
packageId = requireArguments().getString(BundleConstants.packageId)!!
mode = requireArguments().getBoolean(BundleConstants.componentMode)
diff --git a/app/src/main/java/app/simple/inure/dialogs/action/Extract.kt b/app/src/main/java/app/simple/inure/dialogs/action/Extract.kt
index cdddee530..e5a6086f5 100644
--- a/app/src/main/java/app/simple/inure/dialogs/action/Extract.kt
+++ b/app/src/main/java/app/simple/inure/dialogs/action/Extract.kt
@@ -38,8 +38,6 @@ class Extract : ScopedBottomSheetFragment() {
status = view.findViewById(R.id.extracting_updates)
share = view.findViewById(R.id.share)
- packageInfo = requireArguments().getParcelable(BundleConstants.packageInfo)!!
-
val extractViewModelFactory = ExtractViewModelFactory(packageInfo)
extractViewModel = ViewModelProvider(this, extractViewModelFactory)[ExtractViewModel::class.java]
diff --git a/app/src/main/java/app/simple/inure/dialogs/action/ForceStop.kt b/app/src/main/java/app/simple/inure/dialogs/action/ForceStop.kt
index 8067d4a11..4f6cd5fa3 100644
--- a/app/src/main/java/app/simple/inure/dialogs/action/ForceStop.kt
+++ b/app/src/main/java/app/simple/inure/dialogs/action/ForceStop.kt
@@ -25,8 +25,6 @@ class ForceStop : ScopedBottomSheetFragment() {
loader = view.findViewById(R.id.loader)
status = view.findViewById(R.id.force_stop_result)
- packageInfo = requireArguments().getParcelable(BundleConstants.packageInfo)!!
-
return view
}
@@ -34,9 +32,9 @@ class ForceStop : ScopedBottomSheetFragment() {
super.onViewCreated(view, savedInstanceState)
with(ViewModelProvider(this, ForceCloseViewModelFactory(packageInfo))[ForceCloseViewModel::class.java]) {
- getResults().observe(viewLifecycleOwner, {
+ getResults().observe(viewLifecycleOwner) {
- })
+ }
getSuccessStatus().observe(viewLifecycleOwner) {
when (it) {
diff --git a/app/src/main/java/app/simple/inure/dialogs/action/PermissionStatus.kt b/app/src/main/java/app/simple/inure/dialogs/action/PermissionStatus.kt
index 290d0b357..1f77ceedb 100644
--- a/app/src/main/java/app/simple/inure/dialogs/action/PermissionStatus.kt
+++ b/app/src/main/java/app/simple/inure/dialogs/action/PermissionStatus.kt
@@ -13,6 +13,7 @@ import app.simple.inure.decorations.views.LoaderImageView
import app.simple.inure.extensions.fragments.ScopedBottomSheetFragment
import app.simple.inure.factories.actions.PermissionStatusFactory
import app.simple.inure.models.PermissionInfo
+import app.simple.inure.util.ParcelUtils.parcelable
import app.simple.inure.viewmodels.dialogs.PermissionStatusViewModel
class PermissionStatus : ScopedBottomSheetFragment() {
@@ -33,8 +34,8 @@ class PermissionStatus : ScopedBottomSheetFragment() {
loader = view.findViewById(R.id.loader)
status = view.findViewById(R.id.permission_status_result)
- permissionInfo = requireArguments().getParcelable(BundleConstants.permissionInfo)!!
- packageInfo = requireArguments().getParcelable(BundleConstants.packageInfo)!!
+ permissionInfo = requireArguments().parcelable(BundleConstants.permissionInfo)!!
+ packageInfo = requireArguments().parcelable(BundleConstants.packageInfo)!!
mode = requireArguments().getString(BundleConstants.permissionMode)
permissionStatusFactory = PermissionStatusFactory(packageInfo,
@@ -43,7 +44,7 @@ class PermissionStatus : ScopedBottomSheetFragment() {
println(mode)
- permissionStatusViewModel = ViewModelProvider(this, permissionStatusFactory).get(PermissionStatusViewModel::class.java)
+ permissionStatusViewModel = ViewModelProvider(this, permissionStatusFactory)[PermissionStatusViewModel::class.java]
return view
}
diff --git a/app/src/main/java/app/simple/inure/dialogs/action/Preparing.kt b/app/src/main/java/app/simple/inure/dialogs/action/Preparing.kt
index 0e8291ac6..8882a923b 100644
--- a/app/src/main/java/app/simple/inure/dialogs/action/Preparing.kt
+++ b/app/src/main/java/app/simple/inure/dialogs/action/Preparing.kt
@@ -32,7 +32,6 @@ class Preparing : ScopedBottomSheetFragment() {
loader = view.findViewById(R.id.preparing_loader_indicator)
updates = view.findViewById(R.id.preparing_updates)
progress = view.findViewById(R.id.preparing_progress)
- packageInfo = requireArguments().getParcelable(BundleConstants.packageInfo)!!
packageInfoFactory = PackageInfoFactory(packageInfo)
extractViewModel = ViewModelProvider(this, packageInfoFactory)[ExtractViewModel::class.java]
diff --git a/app/src/main/java/app/simple/inure/dialogs/action/State.kt b/app/src/main/java/app/simple/inure/dialogs/action/State.kt
index 2cc172925..154fcef8b 100644
--- a/app/src/main/java/app/simple/inure/dialogs/action/State.kt
+++ b/app/src/main/java/app/simple/inure/dialogs/action/State.kt
@@ -8,6 +8,7 @@ import android.view.View
import android.view.ViewGroup
import androidx.lifecycle.ViewModelProvider
import app.simple.inure.R
+import app.simple.inure.apk.utils.PackageUtils.getApplicationInfo
import app.simple.inure.constants.BundleConstants
import app.simple.inure.decorations.typeface.TypeFaceTextView
import app.simple.inure.decorations.views.LoaderImageView
@@ -28,8 +29,6 @@ class State : ScopedBottomSheetFragment() {
loader = view.findViewById(R.id.loader)
status = view.findViewById(R.id.state_result)
- packageInfo = requireArguments().getParcelable(BundleConstants.packageInfo)!!
-
return view
}
@@ -45,7 +44,7 @@ class State : ScopedBottomSheetFragment() {
when (it) {
"Done" -> {
loader.loaded()
- if (getApplication().packageManager.getApplicationInfo(packageInfo.packageName, 0).enabled) {
+ if (getApplication().packageManager.getApplicationInfo(packageInfo.packageName)!!.enabled) {
status.setText(R.string.enabled)
} else {
status.setText(R.string.disabled)
diff --git a/app/src/main/java/app/simple/inure/dialogs/action/Uninstaller.kt b/app/src/main/java/app/simple/inure/dialogs/action/Uninstaller.kt
index 059326383..8b5721814 100644
--- a/app/src/main/java/app/simple/inure/dialogs/action/Uninstaller.kt
+++ b/app/src/main/java/app/simple/inure/dialogs/action/Uninstaller.kt
@@ -35,8 +35,6 @@ class Uninstaller : ScopedBottomSheetFragment() {
loader = view.findViewById(R.id.loader)
status = view.findViewById(R.id.uninstall_result)
- packageInfo = requireArguments().getParcelable(BundleConstants.packageInfo)!!
-
return view
}
diff --git a/app/src/main/java/app/simple/inure/dialogs/app/HtmlViewer.kt b/app/src/main/java/app/simple/inure/dialogs/app/HtmlViewer.kt
index a7fd26c42..feb62d233 100644
--- a/app/src/main/java/app/simple/inure/dialogs/app/HtmlViewer.kt
+++ b/app/src/main/java/app/simple/inure/dialogs/app/HtmlViewer.kt
@@ -22,7 +22,7 @@ class HtmlViewer : ScopedBottomSheetFragment() {
webView = view.findViewById(R.id.web_view)
if (this.arguments != null) {
- when (this.requireArguments().get("source")) {
+ when (this.requireArguments().getString("source")) {
getString(R.string.permissions) -> {
webView.loadUrl("file:///android_asset/html/required_permissions.html")
}
diff --git a/app/src/main/java/app/simple/inure/dialogs/association/InstallerServiceMode.kt b/app/src/main/java/app/simple/inure/dialogs/association/InstallerServiceMode.kt
index d3087f853..7eab8454b 100644
--- a/app/src/main/java/app/simple/inure/dialogs/association/InstallerServiceMode.kt
+++ b/app/src/main/java/app/simple/inure/dialogs/association/InstallerServiceMode.kt
@@ -18,6 +18,7 @@ import app.simple.inure.decorations.views.AppIconImageView
import app.simple.inure.extensions.fragments.ScopedBottomSheetFragment
import app.simple.inure.services.BatchExtractService
import app.simple.inure.services.InstallerService
+import app.simple.inure.util.ParcelUtils.parcelable
class InstallerServiceMode : ScopedBottomSheetFragment() {
@@ -56,7 +57,7 @@ class InstallerServiceMode : ScopedBottomSheetFragment() {
override fun onReceive(context: Context?, intent: Intent?) {
when (intent?.action) {
ServiceConstants.actionPackageInfo -> {
- packageInfo = intent.extras?.getParcelable(BundleConstants.packageInfo)!!
+ packageInfo = intent.extras?.parcelable(BundleConstants.packageInfo)!!
icon.setImageDrawable(packageInfo.applicationInfo.loadIcon(requireContext().packageManager))
name.text = packageInfo.applicationInfo.loadLabel(requireContext().packageManager)
packageName.text = buildString {
@@ -71,7 +72,7 @@ class InstallerServiceMode : ScopedBottomSheetFragment() {
serviceConnection = object : ServiceConnection {
override fun onServiceConnected(name: ComponentName?, service: IBinder?) {
installerService = (service as InstallerService.InstallerServiceBinder).getService()
- installerService?.uri = requireArguments().getParcelable(BundleConstants.uri)
+ installerService?.uri = requireArguments().parcelable(BundleConstants.uri)
}
override fun onServiceDisconnected(name: ComponentName?) {
diff --git a/app/src/main/java/app/simple/inure/dialogs/miscellaneous/IntentAction.kt b/app/src/main/java/app/simple/inure/dialogs/miscellaneous/IntentAction.kt
index 4af7bb8da..a288c9c30 100644
--- a/app/src/main/java/app/simple/inure/dialogs/miscellaneous/IntentAction.kt
+++ b/app/src/main/java/app/simple/inure/dialogs/miscellaneous/IntentAction.kt
@@ -41,11 +41,10 @@ class IntentAction : ScopedDialogFragment() {
launch = view.findViewById(R.id.launch_intent_action)
loader = view.findViewById(R.id.loader)
- packageInfo = requireArguments().getParcelable(BundleConstants.packageInfo)!!
packageId = requireArguments().getString(BundleConstants.packageId)!!
activityLaunchFactory = ActivityLaunchFactory(packageInfo, packageId!!)
- activityLauncherViewModel = ViewModelProvider(this, activityLaunchFactory).get(ActivityLauncherViewModel::class.java)
+ activityLauncherViewModel = ViewModelProvider(this, activityLaunchFactory)[ActivityLauncherViewModel::class.java]
return view
}
@@ -82,13 +81,13 @@ class IntentAction : ScopedDialogFragment() {
activityLauncherViewModel.runActionCommand(action.text.toString())
}
- activityLauncherViewModel.getActionStatus().observe(viewLifecycleOwner, {
+ activityLauncherViewModel.getActionStatus().observe(viewLifecycleOwner) {
when (it) {
"Done", "Failed" -> {
loader.invisible(true)
}
}
- })
+ }
}
companion object {
diff --git a/app/src/main/java/app/simple/inure/dialogs/miscellaneous/UsageStatsPermission.kt b/app/src/main/java/app/simple/inure/dialogs/miscellaneous/UsageStatsPermission.kt
index fc234a41c..3c085fc9d 100644
--- a/app/src/main/java/app/simple/inure/dialogs/miscellaneous/UsageStatsPermission.kt
+++ b/app/src/main/java/app/simple/inure/dialogs/miscellaneous/UsageStatsPermission.kt
@@ -60,7 +60,7 @@ class UsageStatsPermission : ScopedBottomSheetFragment() {
dismiss()
} else {
dismiss()
- requireActivity().onBackPressed()
+ requireActivity().onBackPressedDispatcher.onBackPressed()
}
}
}
diff --git a/app/src/main/java/app/simple/inure/dialogs/trackers/TrackersMessage.kt b/app/src/main/java/app/simple/inure/dialogs/trackers/TrackersMessage.kt
index db13f796f..2f9e4ad21 100644
--- a/app/src/main/java/app/simple/inure/dialogs/trackers/TrackersMessage.kt
+++ b/app/src/main/java/app/simple/inure/dialogs/trackers/TrackersMessage.kt
@@ -8,6 +8,7 @@ import app.simple.inure.R
import app.simple.inure.constants.BundleConstants
import app.simple.inure.decorations.typeface.TypeFaceTextView
import app.simple.inure.extensions.fragments.ScopedBottomSheetFragment
+import app.simple.inure.util.ParcelUtils.serializable
class TrackersMessage : ScopedBottomSheetFragment() {
@@ -28,7 +29,7 @@ class TrackersMessage : ScopedBottomSheetFragment() {
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
- data = requireArguments().getSerializable(BundleConstants.trackersMessage) as Pair?
+ data = requireArguments().serializable(BundleConstants.trackersMessage) as Pair?
title.text = data!!.first
message.text = data!!.second
diff --git a/app/src/main/java/app/simple/inure/extensions/fragments/ScopedBottomSheetFragment.kt b/app/src/main/java/app/simple/inure/extensions/fragments/ScopedBottomSheetFragment.kt
index 8cb0aef5b..ad51c052d 100644
--- a/app/src/main/java/app/simple/inure/extensions/fragments/ScopedBottomSheetFragment.kt
+++ b/app/src/main/java/app/simple/inure/extensions/fragments/ScopedBottomSheetFragment.kt
@@ -10,6 +10,7 @@ import android.widget.FrameLayout
import androidx.annotation.StringRes
import androidx.fragment.app.Fragment
import app.simple.inure.R
+import app.simple.inure.constants.BundleConstants
import app.simple.inure.constants.Misc
import app.simple.inure.dialogs.miscellaneous.Error.Companion.showError
import app.simple.inure.dialogs.miscellaneous.Warning
@@ -18,6 +19,7 @@ import app.simple.inure.preferences.SharedPreferences.getSharedPreferences
import app.simple.inure.preferences.SharedPreferences.registerSharedPreferenceChangeListener
import app.simple.inure.preferences.SharedPreferences.unregisterSharedPreferenceChangeListener
import app.simple.inure.ui.panels.Preferences
+import app.simple.inure.util.ParcelUtils.parcelable
import app.simple.inure.util.ViewUtils
import com.google.android.material.R.id.design_bottom_sheet
import com.google.android.material.bottomsheet.BottomSheetBehavior
@@ -40,6 +42,9 @@ abstract class ScopedBottomSheetFragment : BottomSheetDialogFragment(),
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setStyle(STYLE_NO_FRAME, R.style.CustomBottomSheetDialogTheme)
+ kotlin.runCatching {
+ packageInfo = requireArguments().parcelable(BundleConstants.packageInfo)!!
+ }
}
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
diff --git a/app/src/main/java/app/simple/inure/extensions/viewmodels/UsageStatsViewModel.kt b/app/src/main/java/app/simple/inure/extensions/viewmodels/UsageStatsViewModel.kt
index d5c44155c..01540b844 100644
--- a/app/src/main/java/app/simple/inure/extensions/viewmodels/UsageStatsViewModel.kt
+++ b/app/src/main/java/app/simple/inure/extensions/viewmodels/UsageStatsViewModel.kt
@@ -29,7 +29,7 @@ open class UsageStatsViewModel(application: Application) : WrappedViewModel(appl
protected var usageStatsManager: UsageStatsManager = getApplication()
.getSystemService(Context.USAGE_STATS_SERVICE) as UsageStatsManager
- protected var networkStatsManager = getApplication()
+ private var networkStatsManager = getApplication()
.getSystemService(Context.NETWORK_STATS_SERVICE) as NetworkStatsManager
protected fun getMobileData(@UsageInterval.IntervalType intervalType: Int): SparseArrayCompat {
@@ -40,7 +40,7 @@ open class UsageStatsViewModel(application: Application) : WrappedViewModel(appl
return getDataUsageForNetwork(NetworkCapabilities.TRANSPORT_WIFI, intervalType)
}
- protected fun getDataUsageForNetwork(@Transport networkType: Int, @UsageInterval.IntervalType intervalType: Int): SparseArrayCompat {
+ private fun getDataUsageForNetwork(@Transport networkType: Int, @UsageInterval.IntervalType intervalType: Int): SparseArrayCompat {
val dataUsageSparseArray = SparseArrayCompat()
val range: UsageInterval.UsageInterval = UsageInterval.getTimeInterval(intervalType)
// val subscriberIds: List = getSubscriberIds(context, networkType)
@@ -72,7 +72,7 @@ open class UsageStatsViewModel(application: Application) : WrappedViewModel(appl
*/
@SuppressLint("HardwareIds", "MissingPermission")
@Deprecated("Requires {@code android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE} from Android 10 (API 29)")
- protected fun getSubscriberIds(context: Context, @Transport networkType: Int): List {
+ protected fun getSubscriberIds(@Transport networkType: Int): List {
return if (networkType != NetworkCapabilities.TRANSPORT_CELLULAR || !PermissionUtils.hasPermission(applicationContext(), Manifest.permission.READ_PHONE_STATE)) {
Collections.singletonList(null)
} else try {
diff --git a/app/src/main/java/app/simple/inure/factories/subpanels/TrackerSourceViewModelFactory.kt b/app/src/main/java/app/simple/inure/factories/subpanels/TrackerSourceViewModelFactory.kt
index baffe7709..90f216c85 100644
--- a/app/src/main/java/app/simple/inure/factories/subpanels/TrackerSourceViewModelFactory.kt
+++ b/app/src/main/java/app/simple/inure/factories/subpanels/TrackerSourceViewModelFactory.kt
@@ -6,7 +6,7 @@ import androidx.lifecycle.ViewModelProvider
import androidx.lifecycle.viewmodel.CreationExtras
import app.simple.inure.viewmodels.subviewers.TrackerSourceViewModel
-class TrackerSourceViewModelFactory(private val className: String, val packageInfo: PackageInfo, val accentColor: Int)
+class TrackerSourceViewModelFactory(private val className: String, val packageInfo: PackageInfo)
: ViewModelProvider.Factory {
@Suppress("UNCHECKED_CAST")
@@ -15,7 +15,7 @@ class TrackerSourceViewModelFactory(private val className: String, val packageIn
when {
modelClass.isAssignableFrom(TrackerSourceViewModel::class.java) -> {
- return TrackerSourceViewModel(application, className, packageInfo, accentColor) as T
+ return TrackerSourceViewModel(application, className, packageInfo) as T
}
else -> {
throw IllegalArgumentException("Nope, Wrong Viewmodel!!")
diff --git a/app/src/main/java/app/simple/inure/glide/apkIcon/ApkIconFetcher.kt b/app/src/main/java/app/simple/inure/glide/apkIcon/ApkIconFetcher.kt
index 1eb475eb1..cfb6e261b 100644
--- a/app/src/main/java/app/simple/inure/glide/apkIcon/ApkIconFetcher.kt
+++ b/app/src/main/java/app/simple/inure/glide/apkIcon/ApkIconFetcher.kt
@@ -3,6 +3,7 @@ package app.simple.inure.glide.apkIcon
import android.content.pm.PackageManager
import android.graphics.Bitmap
import android.graphics.BitmapFactory
+import android.os.Build
import app.simple.inure.R
import app.simple.inure.preferences.AppearancePreferences
import app.simple.inure.util.BitmapHelper.toBitmap
@@ -16,7 +17,16 @@ class ApkIconFetcher internal constructor(private val apkIcon: ApkIcon) : DataFe
override fun loadData(priority: Priority, callback: DataFetcher.DataCallback) {
kotlin.runCatching {
kotlin.runCatching {
- val p0 = apkIcon.context.packageManager.getPackageArchiveInfo(apkIcon.file.path, PackageManager.GET_META_DATA)
+ val p0 = if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) {
+ apkIcon.context.packageManager
+ .getPackageArchiveInfo(apkIcon.file.path,
+ PackageManager.PackageInfoFlags.of(PackageManager.GET_META_DATA.toLong()))
+ } else {
+ @Suppress("DEPRECATION")
+ apkIcon.context.packageManager
+ .getPackageArchiveInfo(apkIcon.file.path,
+ PackageManager.GET_META_DATA)
+ }
p0!!.applicationInfo.sourceDir = apkIcon.file.path
p0.applicationInfo.publicSourceDir = apkIcon.file.path
val b = apkIcon.context.packageManager.getApplicationIcon(p0.applicationInfo)
diff --git a/app/src/main/java/app/simple/inure/glide/transformation/BlurShadow.kt b/app/src/main/java/app/simple/inure/glide/transformation/BlurShadow.kt
index 94d634630..807e72511 100644
--- a/app/src/main/java/app/simple/inure/glide/transformation/BlurShadow.kt
+++ b/app/src/main/java/app/simple/inure/glide/transformation/BlurShadow.kt
@@ -171,8 +171,8 @@ class BlurShadow(private val context: Context) : BitmapTransformation() {
} else {
//Scale
val scaleFactor = MAX_BLUR_RADIUS / blurRadius
- val scaledWidth = 1.coerceAtLeast((source.width.toFloat() * scaleFactor).roundToInt())
- val scaledHeight = 1.coerceAtLeast((source.height.toFloat() * scaleFactor).roundToInt())
+ @Suppress("UNUSED_VARIABLE") val scaledWidth = 1.coerceAtLeast((source.width.toFloat() * scaleFactor).roundToInt())
+ @Suppress("UNUSED_VARIABLE") val scaledHeight = 1.coerceAtLeast((source.height.toFloat() * scaleFactor).roundToInt())
val scaled = Bitmap.createScaledBitmap(source, source.width, source.height, true)
//Apply Blur
diff --git a/app/src/main/java/app/simple/inure/glide/uricover/UriCoverLoader.kt b/app/src/main/java/app/simple/inure/glide/uricover/UriCoverLoader.kt
index 182a9f01c..777933ec2 100644
--- a/app/src/main/java/app/simple/inure/glide/uricover/UriCoverLoader.kt
+++ b/app/src/main/java/app/simple/inure/glide/uricover/UriCoverLoader.kt
@@ -13,7 +13,7 @@ class UriCoverLoader : ModelLoader {
return ModelLoader.LoadData(ObjectKey(uriCoverModel), UriCoverFetcher(uriCoverModel))
}
- fun getResourceFetcher(model: UriCoverModel, width: Int, height: Int): DataFetcher {
+ fun getResourceFetcher(model: UriCoverModel): DataFetcher {
return UriCoverFetcher(model)
}
diff --git a/app/src/main/java/app/simple/inure/receivers/MediaButtonIntentReceiver.kt b/app/src/main/java/app/simple/inure/receivers/MediaButtonIntentReceiver.kt
index dad2ceb64..dee21fa0b 100644
--- a/app/src/main/java/app/simple/inure/receivers/MediaButtonIntentReceiver.kt
+++ b/app/src/main/java/app/simple/inure/receivers/MediaButtonIntentReceiver.kt
@@ -14,6 +14,7 @@ import androidx.core.content.ContextCompat
import app.simple.inure.BuildConfig
import app.simple.inure.constants.ServiceConstants
import app.simple.inure.services.AudioService
+import app.simple.inure.util.ParcelUtils.parcelable
/**
* Used to control headset playback.
@@ -63,7 +64,7 @@ class MediaButtonIntentReceiver : BroadcastReceiver() {
fun handleIntent(context: Context, intent: Intent): Boolean {
val intentAction = intent.action
if (Intent.ACTION_MEDIA_BUTTON == intentAction) {
- val event: KeyEvent = intent.getParcelableExtra(Intent.EXTRA_KEY_EVENT)
+ val event: KeyEvent = intent.parcelable(Intent.EXTRA_KEY_EVENT)
?: return false
val keycode: Int = event.keyCode
val action: Int = event.action
diff --git a/app/src/main/java/app/simple/inure/services/AudioService.kt b/app/src/main/java/app/simple/inure/services/AudioService.kt
index 9e6b1bcbc..2186c5bb1 100644
--- a/app/src/main/java/app/simple/inure/services/AudioService.kt
+++ b/app/src/main/java/app/simple/inure/services/AudioService.kt
@@ -108,7 +108,12 @@ class AudioService : Service(),
changePlayerState()
}
ServiceConstants.actionQuitMusicService -> {
- stopForeground(true)
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
+ stopForeground(STOP_FOREGROUND_REMOVE)
+ } else {
+ @Suppress("DEPRECATION")
+ stopForeground(true)
+ }
stopSelf()
IntentHelper.sendLocalBroadcastIntent(ServiceConstants.actionQuitMusicService, applicationContext)
}
@@ -174,7 +179,12 @@ class AudioService : Service(),
override fun onCompletion(mp: MediaPlayer?) {
IntentHelper.sendLocalBroadcastIntent(ServiceConstants.actionQuitMusicService, applicationContext)
- stopForeground(true)
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
+ stopForeground(STOP_FOREGROUND_REMOVE)
+ } else {
+ @Suppress("DEPRECATION")
+ stopForeground(true)
+ }
}
override fun onPrepared(mp: MediaPlayer?) {
@@ -246,7 +256,12 @@ class AudioService : Service(),
}
override fun onStop() {
- stopForeground(true)
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
+ stopForeground(STOP_FOREGROUND_DETACH)
+ } else {
+ @Suppress("DEPRECATION")
+ stopForeground(true)
+ }
stopSelf()
}
@@ -389,7 +404,12 @@ class AudioService : Service(),
setPlaybackState(PlaybackStateCompat.STATE_PAUSED)
kotlin.runCatching {
showNotification(generateAction(R.drawable.ic_play, "play", ServiceConstants.actionPlay))
- stopForeground(false)
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
+ stopForeground(STOP_FOREGROUND_REMOVE)
+ } else {
+ @Suppress("DEPRECATION")
+ stopForeground(true)
+ }
}
}
timer!!.cancel()
diff --git a/app/src/main/java/app/simple/inure/services/BatchExtractService.kt b/app/src/main/java/app/simple/inure/services/BatchExtractService.kt
index 62e24808c..79601cab0 100644
--- a/app/src/main/java/app/simple/inure/services/BatchExtractService.kt
+++ b/app/src/main/java/app/simple/inure/services/BatchExtractService.kt
@@ -60,7 +60,12 @@ class BatchExtractService : Service() {
when (intent?.action) {
ServiceConstants.actionBatchCancel -> {
copyThread.interrupt()
- stopForeground(true)
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
+ stopForeground(STOP_FOREGROUND_REMOVE)
+ } else {
+ @Suppress("DEPRECATION")
+ stopForeground(true)
+ }
stopSelf()
}
}
@@ -152,7 +157,12 @@ class BatchExtractService : Service() {
launchOnUiThread {
notificationManager.cancel(notificationId)
- stopForeground(true)
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
+ stopForeground(STOP_FOREGROUND_REMOVE)
+ } else {
+ @Suppress("DEPRECATION")
+ stopForeground(true)
+ }
stopSelf()
}
}
@@ -162,7 +172,16 @@ class BatchExtractService : Service() {
LocalBroadcastManager.getInstance(applicationContext).sendBroadcast(intent)
}
- stopForeground(true)
+ launchOnUiThread {
+ notificationManager.cancel(notificationId)
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
+ stopForeground(STOP_FOREGROUND_REMOVE)
+ } else {
+ @Suppress("DEPRECATION")
+ stopForeground(true)
+ }
+ stopSelf()
+ }
stopSelf()
}
}
diff --git a/app/src/main/java/app/simple/inure/services/InstallerService.kt b/app/src/main/java/app/simple/inure/services/InstallerService.kt
index ec9469be5..c3e3da4f1 100644
--- a/app/src/main/java/app/simple/inure/services/InstallerService.kt
+++ b/app/src/main/java/app/simple/inure/services/InstallerService.kt
@@ -55,11 +55,6 @@ class InstallerService : Service() {
return InstallerServiceBinder()
}
- override fun onCreate() {
- super.onCreate()
-
- }
-
override fun onStartCommand(intent: Intent?, flags: Int, startId: Int): Int {
return super.onStartCommand(intent, flags, startId)
}
@@ -87,7 +82,12 @@ class InstallerService : Service() {
FileUtils.copyStreamToFile(it!!, file)
}
- packageInfo = packageManager.getPackageArchiveInfo(file.path, flags)!!
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) {
+ packageInfo = packageManager.getPackageArchiveInfo(file.path, PackageManager.PackageInfoFlags.of(flags.toLong()))!!
+ } else {
+ @Suppress("DEPRECATION")
+ packageInfo = packageManager.getPackageArchiveInfo(file.path, flags)
+ }
Intent().let {
it.action = ServiceConstants.actionPackageInfo
diff --git a/app/src/main/java/app/simple/inure/ui/panels/Unpack.kt b/app/src/main/java/app/simple/inure/ui/panels/Unpack.kt
index ae9cc762c..cc1c310d2 100644
--- a/app/src/main/java/app/simple/inure/ui/panels/Unpack.kt
+++ b/app/src/main/java/app/simple/inure/ui/panels/Unpack.kt
@@ -15,6 +15,7 @@ import app.simple.inure.decorations.typeface.TypeFaceTextView
import app.simple.inure.decorations.views.CustomProgressBar
import app.simple.inure.extensions.fragments.ScopedFragment
import app.simple.inure.factories.panels.UnpackViewModelFactory
+import app.simple.inure.util.ParcelUtils.parcelable
import app.simple.inure.util.ViewUtils.gone
import app.simple.inure.viewmodels.panels.UnpackViewModel
@@ -35,7 +36,7 @@ class Unpack : ScopedFragment() {
progress = view.findViewById(R.id.data_progress)
recyclerView = view.findViewById(R.id.unpack_recycler_view)
- packageInfo = requireArguments().getParcelable(BundleConstants.packageInfo)!!
+ packageInfo = requireArguments().parcelable(BundleConstants.packageInfo)!!
val unpackViewModelFactory = UnpackViewModelFactory(packageInfo)
unpackViewModel = ViewModelProvider(this, unpackViewModelFactory)[UnpackViewModel::class.java]
diff --git a/app/src/main/java/app/simple/inure/ui/panels/WebPage.kt b/app/src/main/java/app/simple/inure/ui/panels/WebPage.kt
index 80ee0d261..929ebad4d 100644
--- a/app/src/main/java/app/simple/inure/ui/panels/WebPage.kt
+++ b/app/src/main/java/app/simple/inure/ui/panels/WebPage.kt
@@ -30,7 +30,7 @@ class WebPage : ScopedFragment() {
super.onViewCreated(view, savedInstanceState)
if (this.arguments != null && savedInstanceState.isNull()) {
- when (this.requireArguments().get(BundleConstants.webPage)) {
+ when (this.requireArguments().getString(BundleConstants.webPage)) {
getString(R.string.permissions) -> {
webView.loadUrl("file:///android_asset/html/required_permissions.html")
}
diff --git a/app/src/main/java/app/simple/inure/ui/subviewers/ActivityInfo.kt b/app/src/main/java/app/simple/inure/ui/subviewers/ActivityInfo.kt
index 82efa2965..85abd7345 100644
--- a/app/src/main/java/app/simple/inure/ui/subviewers/ActivityInfo.kt
+++ b/app/src/main/java/app/simple/inure/ui/subviewers/ActivityInfo.kt
@@ -15,6 +15,7 @@ import app.simple.inure.decorations.typeface.TypeFaceTextView
import app.simple.inure.extensions.fragments.ScopedFragment
import app.simple.inure.factories.subpanels.ActivityInfoFactory
import app.simple.inure.models.ActivityInfoModel
+import app.simple.inure.util.ParcelUtils.parcelable
import app.simple.inure.viewmodels.subviewers.ActivityInfoViewModel
class ActivityInfo : ScopedFragment() {
@@ -32,13 +33,13 @@ class ActivityInfo : ScopedFragment() {
recyclerView = view.findViewById(R.id.activity_info_recycler_view)
backButton = view.findViewById(R.id.activity_info_back_button)
- with(requireArguments().getParcelable(BundleConstants.activityInfo)!!) {
- packageInfo = requireArguments().getParcelable(BundleConstants.packageInfo)!!
+ with(requireArguments().parcelable(BundleConstants.activityInfo)!!) {
+ packageInfo = requireArguments().parcelable(BundleConstants.packageInfo)!!
this@ActivityInfo.name.text = name
activityInfoFactory = ActivityInfoFactory(this, packageInfo)
}
- activityInfoViewModel = ViewModelProvider(this, activityInfoFactory).get(ActivityInfoViewModel::class.java)
+ activityInfoViewModel = ViewModelProvider(this, activityInfoFactory)[ActivityInfoViewModel::class.java]
startPostponedEnterTransition()
@@ -53,7 +54,7 @@ class ActivityInfo : ScopedFragment() {
}
backButton.setOnClickListener {
- requireActivity().onBackPressed()
+ requireActivity().onBackPressedDispatcher.onBackPressed()
}
}
diff --git a/app/src/main/java/app/simple/inure/ui/subviewers/ProviderInfo.kt b/app/src/main/java/app/simple/inure/ui/subviewers/ProviderInfo.kt
index 86f35dcf8..45b87fb9c 100644
--- a/app/src/main/java/app/simple/inure/ui/subviewers/ProviderInfo.kt
+++ b/app/src/main/java/app/simple/inure/ui/subviewers/ProviderInfo.kt
@@ -15,6 +15,7 @@ import app.simple.inure.decorations.typeface.TypeFaceTextView
import app.simple.inure.extensions.fragments.ScopedFragment
import app.simple.inure.factories.subpanels.ProviderInfoFactory
import app.simple.inure.models.ProviderInfoModel
+import app.simple.inure.util.ParcelUtils.parcelable
import app.simple.inure.viewmodels.subviewers.ProviderInfoViewModel
class ProviderInfo : ScopedFragment() {
@@ -32,8 +33,8 @@ class ProviderInfo : ScopedFragment() {
recyclerView = view.findViewById(R.id.activity_info_recycler_view)
backButton = view.findViewById(R.id.activity_info_back_button)
- with(requireArguments().getParcelable(BundleConstants.providerInfo)!!) {
- packageInfo = requireArguments().getParcelable(BundleConstants.packageInfo)!!
+ with(requireArguments().parcelable(BundleConstants.providerInfo)!!) {
+ packageInfo = requireArguments().parcelable(BundleConstants.packageInfo)!!
this@ProviderInfo.name.text = name
providerInfoFactory = ProviderInfoFactory(this, packageInfo)
}
@@ -53,7 +54,7 @@ class ProviderInfo : ScopedFragment() {
}
backButton.setOnClickListener {
- requireActivity().onBackPressed()
+ requireActivity().onBackPressedDispatcher.onBackPressed()
}
}
diff --git a/app/src/main/java/app/simple/inure/ui/subviewers/ServiceInfo.kt b/app/src/main/java/app/simple/inure/ui/subviewers/ServiceInfo.kt
index 4aaf5ebb3..6b4c28254 100644
--- a/app/src/main/java/app/simple/inure/ui/subviewers/ServiceInfo.kt
+++ b/app/src/main/java/app/simple/inure/ui/subviewers/ServiceInfo.kt
@@ -15,6 +15,7 @@ import app.simple.inure.decorations.typeface.TypeFaceTextView
import app.simple.inure.extensions.fragments.ScopedFragment
import app.simple.inure.factories.subpanels.ServiceInfoFactory
import app.simple.inure.models.ServiceInfoModel
+import app.simple.inure.util.ParcelUtils.parcelable
import app.simple.inure.viewmodels.subviewers.ServiceInfoViewModel
class ServiceInfo : ScopedFragment() {
@@ -32,8 +33,8 @@ class ServiceInfo : ScopedFragment() {
recyclerView = view.findViewById(R.id.activity_info_recycler_view)
backButton = view.findViewById(R.id.activity_info_back_button)
- with(requireArguments().getParcelable(BundleConstants.serviceInfo)!!) {
- packageInfo = requireArguments().getParcelable(BundleConstants.packageInfo)!!
+ with(requireArguments().parcelable(BundleConstants.serviceInfo)!!) {
+ packageInfo = requireArguments().parcelable(BundleConstants.packageInfo)!!
this@ServiceInfo.name.text = name
serviceInfoFactory = ServiceInfoFactory(this, packageInfo)
}
@@ -53,7 +54,7 @@ class ServiceInfo : ScopedFragment() {
}
backButton.setOnClickListener {
- requireActivity().onBackPressed()
+ requireActivity().onBackPressedDispatcher.onBackPressed()
}
}
diff --git a/app/src/main/java/app/simple/inure/ui/subviewers/TrackerSourceViewer.kt b/app/src/main/java/app/simple/inure/ui/subviewers/TrackerSourceViewer.kt
index f773964fa..6f7956205 100644
--- a/app/src/main/java/app/simple/inure/ui/subviewers/TrackerSourceViewer.kt
+++ b/app/src/main/java/app/simple/inure/ui/subviewers/TrackerSourceViewer.kt
@@ -14,13 +14,13 @@ import androidx.activity.result.contract.ActivityResultContracts
import androidx.lifecycle.ViewModelProvider
import app.simple.inure.R
import app.simple.inure.constants.BundleConstants
+import app.simple.inure.constants.MimeConstants
import app.simple.inure.decorations.ripple.DynamicRippleImageButton
import app.simple.inure.decorations.typeface.TypeFaceEditText
import app.simple.inure.decorations.typeface.TypeFaceTextView
import app.simple.inure.extensions.fragments.ScopedFragment
import app.simple.inure.factories.subpanels.TrackerSourceViewModelFactory
import app.simple.inure.popups.app.PopupXmlViewer
-import app.simple.inure.util.ColorUtils.resolveAttrColor
import app.simple.inure.viewmodels.subviewers.TrackerSourceViewModel
import java.io.IOException
@@ -33,7 +33,7 @@ class TrackerSourceViewer : ScopedFragment() {
private lateinit var trackerSourceViewModelFactory: TrackerSourceViewModelFactory
private lateinit var trackerSourceViewModel: TrackerSourceViewModel
- private val exportText = registerForActivityResult(ActivityResultContracts.CreateDocument()) { uri: Uri? ->
+ private val exportText = registerForActivityResult(ActivityResultContracts.CreateDocument(MimeConstants.javaType)) { uri: Uri? ->
if (uri == null) {
// Back button pressed.
return@registerForActivityResult
@@ -58,10 +58,7 @@ class TrackerSourceViewer : ScopedFragment() {
options = view.findViewById(R.id.tracker_viewer_options)
text = view.findViewById(R.id.tracker_viewer)
- packageInfo = requireArguments().getParcelable(BundleConstants.packageInfo)!!
- trackerSourceViewModelFactory = TrackerSourceViewModelFactory(requireArguments().getString(BundleConstants.className)!!,
- packageInfo,
- requireContext().resolveAttrColor(R.attr.colorAppAccent))
+ trackerSourceViewModelFactory = TrackerSourceViewModelFactory(requireArguments().getString(BundleConstants.className)!!, packageInfo)
trackerSourceViewModel = ViewModelProvider(this, trackerSourceViewModelFactory)[TrackerSourceViewModel::class.java]
return view
diff --git a/app/src/main/java/app/simple/inure/util/ActivityUtils.kt b/app/src/main/java/app/simple/inure/util/ActivityUtils.kt
index 7534d00c1..5d2d1ab77 100644
--- a/app/src/main/java/app/simple/inure/util/ActivityUtils.kt
+++ b/app/src/main/java/app/simple/inure/util/ActivityUtils.kt
@@ -42,8 +42,17 @@ object ActivityUtils {
PackageManager.COMPONENT_ENABLED_STATE_DEFAULT -> // We need to get the application info to get the component's default state
try {
val packageInfo = if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
- context.packageManager.getPackageInfo(packageName, PackageManager.GET_ACTIVITIES
- or PackageManager.MATCH_DISABLED_COMPONENTS)
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) {
+ context.packageManager
+ .getPackageInfo(packageName,
+ PackageManager.PackageInfoFlags.of(
+ (PackageManager.GET_ACTIVITIES or PackageManager.MATCH_DISABLED_COMPONENTS).toLong()))
+ } else {
+ @Suppress("DEPRECATION")
+ context.packageManager
+ .getPackageInfo(packageName,
+ PackageManager.GET_ACTIVITIES or PackageManager.MATCH_DISABLED_COMPONENTS)
+ }
} else {
@Suppress("deprecation")
context.packageManager.getPackageInfo(packageName, PackageManager.GET_ACTIVITIES
@@ -74,8 +83,17 @@ object ActivityUtils {
else -> {
try {
val packageInfo = if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
- context.packageManager.getPackageInfo(packageName, PackageManager.GET_ACTIVITIES
- or PackageManager.MATCH_DISABLED_COMPONENTS)
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) {
+ context.packageManager
+ .getPackageInfo(packageName,
+ PackageManager.PackageInfoFlags.of(
+ (PackageManager.GET_ACTIVITIES or PackageManager.MATCH_DISABLED_COMPONENTS).toLong()))
+ } else {
+ @Suppress("DEPRECATION")
+ context.packageManager
+ .getPackageInfo(packageName,
+ PackageManager.GET_ACTIVITIES or PackageManager.MATCH_DISABLED_COMPONENTS)
+ }
} else {
@Suppress("deprecation")
context.packageManager.getPackageInfo(packageName, PackageManager.GET_ACTIVITIES
diff --git a/app/src/main/java/app/simple/inure/util/JavaSyntaxUtils.kt b/app/src/main/java/app/simple/inure/util/JavaSyntaxUtils.kt
index 37671fd48..a028e10f9 100644
--- a/app/src/main/java/app/simple/inure/util/JavaSyntaxUtils.kt
+++ b/app/src/main/java/app/simple/inure/util/JavaSyntaxUtils.kt
@@ -4,13 +4,12 @@ import android.graphics.Color
import android.text.Spannable
import android.text.SpannableString
import android.text.style.ForegroundColorSpan
+import app.simple.inure.preferences.AppearancePreferences
import java.util.regex.Matcher
import java.util.regex.Pattern
object JavaSyntaxUtils {
- var accentColor = Color.parseColor("#e74c3c")
-
private val quotations: Pattern = Pattern.compile("\"([^\"]*)\"",
Pattern.MULTILINE or Pattern.CASE_INSENSITIVE)
@@ -37,7 +36,7 @@ object JavaSyntaxUtils {
val matcher: Matcher = javaKeywords.matcher(this)
while (matcher.find()) {
- formatted.setSpan(ForegroundColorSpan(accentColor), matcher.start(),
+ formatted.setSpan(ForegroundColorSpan(AppearancePreferences.getAccentColor()), matcher.start(),
matcher.end(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE)
}
diff --git a/app/src/main/java/app/simple/inure/util/MarketUtils.kt b/app/src/main/java/app/simple/inure/util/MarketUtils.kt
index c21554432..7d26d71d8 100644
--- a/app/src/main/java/app/simple/inure/util/MarketUtils.kt
+++ b/app/src/main/java/app/simple/inure/util/MarketUtils.kt
@@ -3,8 +3,10 @@ package app.simple.inure.util
import android.content.ComponentName
import android.content.Context
import android.content.Intent
+import android.content.pm.PackageManager
import android.content.pm.ResolveInfo
import android.net.Uri
+import android.os.Build
object MarketUtils {
@@ -22,7 +24,12 @@ object MarketUtils {
/**
* find all applications able to handle our rateIntent
*/
- val otherApps: List = context.packageManager.queryIntentActivities(rateIntent, 0)
+ val otherApps: List = if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) {
+ context.packageManager.queryIntentActivities(rateIntent, PackageManager.ResolveInfoFlags.of(0))
+ } else {
+ @Suppress("DEPRECATION")
+ context.packageManager.queryIntentActivities(rateIntent, 0)
+ }
for (otherApp in otherApps) {
/**
@@ -83,7 +90,12 @@ object MarketUtils {
/**
* find all applications able to handle our rateIntent
*/
- val otherApps: List = context.packageManager.queryIntentActivities(rateIntent, 0)
+ val otherApps: List = if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) {
+ context.packageManager.queryIntentActivities(rateIntent, PackageManager.ResolveInfoFlags.of(0))
+ } else {
+ @Suppress("DEPRECATION")
+ context.packageManager.queryIntentActivities(rateIntent, 0)
+ }
for (otherApp in otherApps) {
/**
diff --git a/app/src/main/java/app/simple/inure/util/ParcelUtils.kt b/app/src/main/java/app/simple/inure/util/ParcelUtils.kt
index ed1da751e..2f556cf5c 100644
--- a/app/src/main/java/app/simple/inure/util/ParcelUtils.kt
+++ b/app/src/main/java/app/simple/inure/util/ParcelUtils.kt
@@ -17,6 +17,11 @@ object ParcelUtils {
else -> @Suppress("DEPRECATION") getParcelable(key) as? T
}
+ inline fun Bundle.serializable(key: String): T? = when {
+ SDK_INT >= 33 -> getSerializable(key, T::class.java)
+ else -> @Suppress("DEPRECATION") getSerializable(key) as? T
+ }
+
inline fun Bundle.parcelable(key: String, default: T): T = when {
SDK_INT >= 33 -> getParcelable(key, T::class.java) ?: default
else -> @Suppress("DEPRECATION") getParcelable(key) as? T ?: default
diff --git a/app/src/main/java/app/simple/inure/util/ScreenMetrics.kt b/app/src/main/java/app/simple/inure/util/ScreenMetrics.kt
index 511a090f6..dbfd5ed00 100644
--- a/app/src/main/java/app/simple/inure/util/ScreenMetrics.kt
+++ b/app/src/main/java/app/simple/inure/util/ScreenMetrics.kt
@@ -6,7 +6,6 @@ import android.content.res.Resources
import android.os.Build
import android.util.DisplayMetrics
import android.util.Size
-import android.view.Surface
import android.view.WindowManager
import android.view.WindowMetrics
import app.simple.inure.R
@@ -108,12 +107,10 @@ object ScreenMetrics {
}
fun getOrientation(context: Context): String {
- return when (context.getSystemService(WindowManager::class.java).defaultDisplay.rotation) {
- Surface.ROTATION_0 -> context.getString(R.string.portrait)
- Surface.ROTATION_90 -> context.getString(R.string.landscape)
- Surface.ROTATION_180 -> context.getString(R.string.reverse_portrait)
- Surface.ROTATION_270 -> context.getString(R.string.reverse_landscape)
- else -> context.getString(R.string.unknown)
+ return when (context.resources.configuration.orientation) {
+ Configuration.ORIENTATION_LANDSCAPE -> context.resources.getString(R.string.landscape)
+ Configuration.ORIENTATION_PORTRAIT -> context.resources.getString(R.string.portrait)
+ else -> context.resources.getString(R.string.unknown)
}
}
}
\ No newline at end of file
diff --git a/app/src/main/java/app/simple/inure/util/UsageInterval.kt b/app/src/main/java/app/simple/inure/util/UsageInterval.kt
index da020d568..5f258d5e4 100644
--- a/app/src/main/java/app/simple/inure/util/UsageInterval.kt
+++ b/app/src/main/java/app/simple/inure/util/UsageInterval.kt
@@ -20,6 +20,7 @@ object UsageInterval {
const val YEARLY = UsageStatsManager.INTERVAL_YEARLY
fun getTimeInterval(): UsageInterval {
+ @Suppress("DEPRECATION")
return when (StatisticsPreferences.getInterval()) {
TODAY -> getTodayInterval()
DAILY -> getDailyInterval()
@@ -31,6 +32,7 @@ object UsageInterval {
}
fun getTimeInterval(interval: Int): UsageInterval {
+ @Suppress("DEPRECATION")
return when (interval) {
TODAY -> getTodayInterval()
DAILY -> getDailyInterval()
diff --git a/app/src/main/java/app/simple/inure/util/ViewUtils.kt b/app/src/main/java/app/simple/inure/util/ViewUtils.kt
index 9f0f3fa62..9ea036d7b 100644
--- a/app/src/main/java/app/simple/inure/util/ViewUtils.kt
+++ b/app/src/main/java/app/simple/inure/util/ViewUtils.kt
@@ -245,7 +245,7 @@ object ViewUtils {
} else {
if (height == 0 || width == 0) {
var onLayoutChangeListener: View.OnLayoutChangeListener? = null
- var onGlobalLayoutListener: ViewTreeObserver.OnGlobalLayoutListener? = null
+ val onGlobalLayoutListener: ViewTreeObserver.OnGlobalLayoutListener?
onGlobalLayoutListener = object : ViewTreeObserver.OnGlobalLayoutListener {
override fun onGlobalLayout() {
diff --git a/app/src/main/java/app/simple/inure/viewmodels/panels/HomeViewModel.kt b/app/src/main/java/app/simple/inure/viewmodels/panels/HomeViewModel.kt
index bb72689f8..5f98aca6c 100644
--- a/app/src/main/java/app/simple/inure/viewmodels/panels/HomeViewModel.kt
+++ b/app/src/main/java/app/simple/inure/viewmodels/panels/HomeViewModel.kt
@@ -18,6 +18,7 @@ import app.simple.inure.apk.utils.PackageUtils
import app.simple.inure.extensions.viewmodels.WrappedViewModel
import app.simple.inure.models.PackageStats
import app.simple.inure.preferences.DevelopmentPreferences
+import app.simple.inure.util.ConditionUtils.invert
import app.simple.inure.util.UsageInterval
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.launch
@@ -25,7 +26,7 @@ import java.util.stream.Collectors
class HomeViewModel(application: Application) : WrappedViewModel(application) {
- private val oneMonth = 2592000000
+ private val oneMonth = 2592000000 // 30 days
private var usageStatsManager: UsageStatsManager = getApplication()
.getSystemService(Context.USAGE_STATS_SERVICE) as UsageStatsManager
@@ -44,7 +45,7 @@ class HomeViewModel(application: Application) : WrappedViewModel(application) {
private val mostUsedAppData: MutableLiveData> by lazy {
MutableLiveData>().also {
- loadFrequentlyUsed()
+ loadMostUsed()
}
}
@@ -147,7 +148,7 @@ class HomeViewModel(application: Application) : WrappedViewModel(application) {
}
}
- private fun loadFrequentlyUsed() {
+ private fun loadMostUsed() {
viewModelScope.launch(Dispatchers.Default) {
val stats = with(UsageInterval.getTimeInterval()) {
usageStatsManager.queryAndAggregateUsageStats(startTime, endTime)
@@ -222,21 +223,17 @@ class HomeViewModel(application: Application) : WrappedViewModel(application) {
private fun loadDisabledApps() {
viewModelScope.launch(Dispatchers.Default) {
- var apps = if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) {
- packageManager.getInstalledPackages(PackageInfoFlags.of(PackageManager.GET_META_DATA.toLong()))
+ val apps = if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) {
+ packageManager.getInstalledPackages(PackageInfoFlags.of((PackageManager.GET_META_DATA).toLong()))
.stream()
- .filter { it.applicationInfo.enabled }
+ .filter { it.applicationInfo.enabled.invert() }
.collect(Collectors.toList()) as ArrayList
} else {
@Suppress("DEPRECATION")
packageManager.getInstalledPackages(PackageManager.GET_META_DATA)
- .filter { it.applicationInfo.enabled } as ArrayList
+ .filter { it.applicationInfo.enabled.invert() } as ArrayList
}
- apps = apps.stream().filter { p ->
- !p.applicationInfo.enabled
- }.collect(Collectors.toList()) as ArrayList
-
for (i in apps.indices) {
apps[i].applicationInfo.name =
PackageUtils.getApplicationName(getApplication().applicationContext, apps[i].applicationInfo)
@@ -284,7 +281,7 @@ class HomeViewModel(application: Application) : WrappedViewModel(application) {
fun refresh() {
loadRecentlyInstalledAppData()
- loadFrequentlyUsed()
+ loadMostUsed()
loadRecentlyUpdatedAppData()
}
}
\ No newline at end of file
diff --git a/app/src/main/java/app/simple/inure/viewmodels/subviewers/TrackerSourceViewModel.kt b/app/src/main/java/app/simple/inure/viewmodels/subviewers/TrackerSourceViewModel.kt
index 317e58687..b32a372c2 100644
--- a/app/src/main/java/app/simple/inure/viewmodels/subviewers/TrackerSourceViewModel.kt
+++ b/app/src/main/java/app/simple/inure/viewmodels/subviewers/TrackerSourceViewModel.kt
@@ -12,7 +12,6 @@ import app.simple.inure.trackers.dex.DexLoaderBuilder
import app.simple.inure.trackers.reflector.Reflector
import app.simple.inure.trackers.utils.UriUtils
import app.simple.inure.util.IOUtils
-import app.simple.inure.util.JavaSyntaxUtils
import app.simple.inure.util.JavaSyntaxUtils.highlightJava
import dalvik.system.DexClassLoader
import kotlinx.coroutines.Dispatchers
@@ -20,7 +19,7 @@ import kotlinx.coroutines.launch
import java.io.File
import java.io.InputStream
-class TrackerSourceViewModel(application: Application, val className: String, val packageInfo: PackageInfo, val accentColor: Int) : WrappedViewModel(application) {
+class TrackerSourceViewModel(application: Application, val className: String, val packageInfo: PackageInfo) : WrappedViewModel(application) {
private val sourceData: MutableLiveData by lazy {
MutableLiveData().also {
@@ -51,7 +50,6 @@ class TrackerSourceViewModel(application: Application, val className: String, va
reflector.generateClassData()
- JavaSyntaxUtils.accentColor = accentColor
sourceData.postValue(reflector.toString().highlightJava())
} catch (e: Exception) {
e.printStackTrace()
diff --git a/app/src/main/java/app/simple/inure/viewmodels/viewers/JavaViewModel.kt b/app/src/main/java/app/simple/inure/viewmodels/viewers/JavaViewModel.kt
index 24e010e66..b029be648 100644
--- a/app/src/main/java/app/simple/inure/viewmodels/viewers/JavaViewModel.kt
+++ b/app/src/main/java/app/simple/inure/viewmodels/viewers/JavaViewModel.kt
@@ -9,7 +9,6 @@ import androidx.lifecycle.viewModelScope
import app.simple.inure.exceptions.LargeStringException
import app.simple.inure.extensions.viewmodels.WrappedViewModel
import app.simple.inure.preferences.FormattingPreferences
-import app.simple.inure.util.JavaSyntaxUtils
import app.simple.inure.util.JavaSyntaxUtils.highlightJava
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.delay
@@ -44,7 +43,6 @@ class JavaViewModel(application: Application, val accentColor: Int, val packageI
throw LargeStringException("String size ${code.length} is too big to render without freezing the app")
}
- JavaSyntaxUtils.accentColor = accentColor
val formattedContent = code.highlightJava()
spanned.postValue(formattedContent)
diff --git a/app/src/main/java/app/simple/inure/viewmodels/viewers/ReceiversViewModel.kt b/app/src/main/java/app/simple/inure/viewmodels/viewers/ReceiversViewModel.kt
index f00a8a15a..66b3e5653 100644
--- a/app/src/main/java/app/simple/inure/viewmodels/viewers/ReceiversViewModel.kt
+++ b/app/src/main/java/app/simple/inure/viewmodels/viewers/ReceiversViewModel.kt
@@ -2,13 +2,12 @@ package app.simple.inure.viewmodels.viewers
import android.app.Application
import android.content.pm.PackageInfo
-import android.content.pm.PackageManager
-import android.os.Build
import androidx.lifecycle.LiveData
import androidx.lifecycle.MutableLiveData
import androidx.lifecycle.viewModelScope
import app.simple.inure.R
import app.simple.inure.apk.utils.MetaUtils
+import app.simple.inure.apk.utils.PackageUtils.getPackageInfo
import app.simple.inure.extensions.viewmodels.WrappedViewModel
import app.simple.inure.models.ActivityInfoModel
import kotlinx.coroutines.Dispatchers
@@ -31,14 +30,7 @@ class ReceiversViewModel(application: Application, val packageInfo: PackageInfo)
kotlin.runCatching {
val list = arrayListOf()
- val flags = if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
- PackageManager.GET_RECEIVERS or PackageManager.MATCH_DISABLED_COMPONENTS
- } else {
- @Suppress("deprecation")
- PackageManager.GET_RECEIVERS or PackageManager.GET_DISABLED_COMPONENTS
- }
-
- for (ai in getApplication().packageManager.getPackageInfo(packageInfo.packageName, flags).receivers) {
+ for (ai in getApplication().packageManager.getPackageInfo(packageInfo.packageName)!!.receivers) {
val activityInfoModel = ActivityInfoModel()
activityInfoModel.activityInfo = ai
diff --git a/app/src/main/java/app/simple/inure/viewmodels/viewers/ServicesViewModel.kt b/app/src/main/java/app/simple/inure/viewmodels/viewers/ServicesViewModel.kt
index e6e17f50c..132dd94f8 100644
--- a/app/src/main/java/app/simple/inure/viewmodels/viewers/ServicesViewModel.kt
+++ b/app/src/main/java/app/simple/inure/viewmodels/viewers/ServicesViewModel.kt
@@ -2,13 +2,13 @@ package app.simple.inure.viewmodels.viewers
import android.app.Application
import android.content.pm.PackageInfo
-import android.content.pm.PackageManager
import android.os.Build
import androidx.lifecycle.LiveData
import androidx.lifecycle.MutableLiveData
import androidx.lifecycle.viewModelScope
import app.simple.inure.R
import app.simple.inure.apk.utils.MetaUtils
+import app.simple.inure.apk.utils.PackageUtils.getPackageInfo
import app.simple.inure.extensions.viewmodels.WrappedViewModel
import app.simple.inure.models.ServiceInfoModel
import kotlinx.coroutines.Dispatchers
@@ -31,14 +31,7 @@ class ServicesViewModel(application: Application, private val packageInfo: Packa
kotlin.runCatching {
val list = arrayListOf()
- val flags = if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
- PackageManager.GET_SERVICES or PackageManager.MATCH_DISABLED_COMPONENTS
- } else {
- @Suppress("deprecation")
- PackageManager.GET_SERVICES or PackageManager.GET_DISABLED_COMPONENTS
- }
-
- for (info in getApplication().packageManager.getPackageInfo(packageInfo.packageName, flags).services) {
+ for (info in getApplication().packageManager.getPackageInfo(packageInfo.packageName)!!.services) {
val serviceInfoModel = ServiceInfoModel()
serviceInfoModel.serviceInfo = info
diff --git a/app/src/main/java/app/simple/inure/viewmodels/viewers/TrackersViewModel.kt b/app/src/main/java/app/simple/inure/viewmodels/viewers/TrackersViewModel.kt
index d381532d0..745afca43 100644
--- a/app/src/main/java/app/simple/inure/viewmodels/viewers/TrackersViewModel.kt
+++ b/app/src/main/java/app/simple/inure/viewmodels/viewers/TrackersViewModel.kt
@@ -10,6 +10,7 @@ import androidx.lifecycle.LiveData
import androidx.lifecycle.MutableLiveData
import androidx.lifecycle.viewModelScope
import app.simple.inure.R
+import app.simple.inure.apk.utils.PackageUtils.getPackageInfo
import app.simple.inure.extensions.viewmodels.WrappedViewModel
import app.simple.inure.preferences.TrackersPreferences
import app.simple.inure.trackers.utils.PackageUtils.*
@@ -19,6 +20,7 @@ import dalvik.system.DexFile
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.launch
import kotlinx.coroutines.runBlocking
+import kotlinx.coroutines.withContext
import java.io.File
import java.io.IOException
import java.security.MessageDigest
@@ -35,17 +37,17 @@ class TrackersViewModel(application: Application, val packageInfo: PackageInfo)
}
private var isLoaded = false
- private var Signz = 0
- private var Totalz = 0
- private var ClassTotalz = 0
+ private var signs = 0
+ private var totals = 0
+ private var classTotals = 0
private var totalTT = 0
private val classesList = ArrayList()
private val classesListAll = ArrayList()
- private var Sign: Array? = null
- private var Names: Array? = null
- private var SignStat: IntArray? = null
- private var SignB: BooleanArray? = null
+ private var sign: Array? = null
+ private var names: Array? = null
+ private var signStat: IntArray? = null
+ private var signB: BooleanArray? = null
private val classesListData: MutableLiveData> by lazy {
MutableLiveData>().also {
@@ -92,11 +94,17 @@ class TrackersViewModel(application: Application, val packageInfo: PackageInfo)
}
}
+ @Suppress("BlockingMethodInNonBlockingContext")
@SuppressLint("PackageManagerGetSignatures")
private fun loadClasses() {
runBlocking {
val packageInfo = if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) {
- packageManager.getPackageInfo(packageInfo.packageName, PackageManager.GET_META_DATA or PackageManager.GET_SIGNING_CERTIFICATES)
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) {
+ packageManager.getPackageInfo(packageInfo.packageName, PackageManager.PackageInfoFlags.of((PackageManager.GET_META_DATA or PackageManager.GET_SIGNING_CERTIFICATES).toLong()))
+ } else {
+ @Suppress("DEPRECATION")
+ packageManager.getPackageInfo(packageInfo.packageName, PackageManager.GET_META_DATA or PackageManager.GET_SIGNING_CERTIFICATES)
+ }
} else {
@Suppress("DEPRECATION")
packageManager.getPackageInfo(packageInfo.packageName, PackageManager.GET_META_DATA or PackageManager.GET_SIGNATURES)
@@ -113,35 +121,35 @@ class TrackersViewModel(application: Application, val packageInfo: PackageInfo)
val dexFile = DexFile.loadDex(incomeFile.path, optimizedFile.path, 0)
msg = ""
- Sign = context.resources.getStringArray(R.array.trackers)
- SignStat = IntArray(Sign!!.size)
- SignB = BooleanArray(Sign!!.size) //Arrays.fill(SignB,false);
- Names = context.resources.getStringArray(R.array.tname)
+ sign = context.resources.getStringArray(R.array.trackers)
+ signStat = IntArray(sign!!.size)
+ signB = BooleanArray(sign!!.size) //Arrays.fill(SignB,false);
+ names = context.resources.getStringArray(R.array.tname)
val classNames = dexFile.entries()
while (classNames.hasMoreElements()) {
val className = classNames.nextElement()
classesListAll.add(className)
- ClassTotalz++
+ classTotals++
if (className.length > 8) {
if (className.contains(".")) {
- Signz = 0
- while (Signz < Sign!!.size) {
+ signs = 0
+ while (signs < sign!!.size) {
totalTT++ //TESTING only
- if (className.contains(Sign!![Signz])) {
+ if (className.contains(sign!![signs])) {
classesList.add(className)
- SignStat!![Signz]++
- SignB!![Signz] = true
- if (msg.contains(Names!![Signz])) {
+ signStat!![signs]++
+ signB!![signs] = true
+ if (msg.contains(names!![signs])) {
break
} else {
- msg += Names!![Signz] + "\n"
+ msg += names!![signs] + "\n"
}
- Totalz++
+ totals++
break
}
- Signz++
+ signs++
}
}
}
@@ -155,7 +163,9 @@ class TrackersViewModel(application: Application, val packageInfo: PackageInfo)
// ODEX, need to see how to handle
e.printStackTrace()
} finally {
- uriStream.close()
+ withContext(Dispatchers.IO) {
+ uriStream.close()
+ }
}
}
@@ -192,7 +202,7 @@ class TrackersViewModel(application: Application, val packageInfo: PackageInfo)
.toString() + "\nSHA1sum: " + convertS(MessageDigest.getInstance("sha1").digest(bytes))
.toString() + "\nSHA256sum: " + convertS(MessageDigest.getInstance("sha256").digest(bytes))
- val pInfo = packageManager.getPackageInfo(packageInfo.packageName, PackageManager.GET_META_DATA or PackageManager.GET_SERVICES or PackageManager.GET_SERVICES)
+ val pInfo = packageManager.getPackageInfo(packageInfo.packageName)
if (Build.VERSION.SDK_INT >= 29) sha256 += apkIsolatedZygote(packageInfo, getString(R.string.app_zygote).trimIndent())
sha256 += apkCert(pInfo)
}
@@ -203,21 +213,21 @@ class TrackersViewModel(application: Application, val packageInfo: PackageInfo)
val message = StringBuilder()
val title: String?
- if (Signz >= 0) {
+ if (signs >= 0) {
i = 0
- while (i < Sign!!.size) {
- if (SignB!![i]) {
- if (!statsMsg.contains(Names!![i])) {
- statsMsg += "*${Names!![i]}".trimIndent()
+ while (i < sign!!.size) {
+ if (signB!![i]) {
+ if (!statsMsg.contains(names!![i])) {
+ statsMsg += "*${names!![i]}".trimIndent()
}
- statsMsg += "${SignStat!![i]}${Sign!![i]}".trimIndent()
+ statsMsg += "${signStat!![i]}${sign!![i]}".trimIndent()
}
i++
}
}
- message.append("$i tested signatures on $ClassTotalz classes ($totalTT)")
+ message.append("$i tested signatures on $classTotals classes ($totalTT)")
message.append("\n\n")
message.append(msg)
message.append("\n")
@@ -225,7 +235,7 @@ class TrackersViewModel(application: Application, val packageInfo: PackageInfo)
message.append("\n")
message.append(sha256)
- title = Totalz.toString() + " Trackers = " + classesList.size + " Classes"
+ title = totals.toString() + " Trackers = " + classesList.size + " Classes"
this.message.postValue(Pair(title, message.toString()))
}