Skip to content

Commit

Permalink
Routine update to newest Android libraries
Browse files Browse the repository at this point in the history
  • Loading branch information
AbandonedCart committed Dec 6, 2024
1 parent 07e3afb commit 25c8b7c
Show file tree
Hide file tree
Showing 22 changed files with 63 additions and 57 deletions.
2 changes: 1 addition & 1 deletion .github/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
github: AbandonedCart
buy_me_a_coffee: abandonedcart
custom: ['https://paypal.me/twistedumbrella']
custom: ['https://samsprung.gitlab.io/donate.html']
8 changes: 4 additions & 4 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -115,15 +115,15 @@ android {
}

dependencies {
implementation 'androidx.activity:activity-ktx:1.9.2'
implementation 'androidx.activity:activity-ktx:1.9.3'
implementation 'androidx.appcompat:appcompat:1.7.0'
implementation 'androidx.cardview:cardview:1.0.0'
implementation 'androidx.core:core-ktx:1.13.1'
implementation 'androidx.fragment:fragment-ktx:1.8.3'
implementation 'androidx.fragment:fragment-ktx:1.8.5'
implementation 'androidx.recyclerview:recyclerview:1.3.2'
implementation 'androidx.window:window-java:1.3.0'

implementation 'com.android.billingclient:billing:7.1.0'
implementation 'com.android.billingclient:billing:7.1.1'

implementation 'com.github.8bitdream:AndroidFastScroll:3453c46352'

Expand All @@ -132,5 +132,5 @@ dependencies {

implementation 'org.lsposed.hiddenapibypass:hiddenapibypass:4.3'

implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.8.0'
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.9.0'
}
14 changes: 6 additions & 8 deletions app/src/main/java/com/eightbit/app/CoverOptions.kt
Original file line number Diff line number Diff line change
Expand Up @@ -26,16 +26,14 @@ class CoverOptions(private var bounds: Rect?) {
}

fun getAnimatedOptions(display: Int, anchor: View?, intent: Intent?): ActivityOptions {
return if (null != intent?.sourceBounds) {
return intent?.sourceBounds?.let { bounds ->
ActivityOptions.makeScaleUpAnimation(
anchor,
intent.sourceBounds!!.left,
intent.sourceBounds!!.top,
intent.sourceBounds!!.width(),
intent.sourceBounds!!.height()
bounds.left,
bounds.top,
bounds.width(),
bounds.height()
).setLaunchDisplayId(display).setLaunchBounds(bounds)
} else {
getActivityOptions(display)
}
} ?: getActivityOptions(display)
}
}
14 changes: 7 additions & 7 deletions app/src/main/java/com/eightbit/io/Debug.kt
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ class Debug(private var context: Context) {
"new?labels=logcat&template=bug_report.yml&title=[Bug]%3A+"

private fun getDeviceProfile(isSecureDevice: Boolean): StringBuilder {
val separator = System.getProperty("line.separator") ?: "\n"
val separator = System.lineSeparator() ?: "\n"
val log = StringBuilder(separator)
log.append(SamSprung.versionLabel)
log.append(separator)
Expand Down Expand Up @@ -84,22 +84,22 @@ class Debug(private var context: Context) {
context.startActivity(Intent.createChooser(
emailIntent, context.getString(R.string.logcat_crash)
).addFlags(Intent.FLAG_ACTIVITY_NEW_TASK))
} catch (anf: ActivityNotFoundException) {
} catch (_: ActivityNotFoundException) {
try {
val emailIntent = setEmailParams(Intent.ACTION_SEND, subject, logText)
context.startActivity(Intent.createChooser(
emailIntent, context.getString(R.string.logcat_crash)
).addFlags(Intent.FLAG_ACTIVITY_NEW_TASK))
} catch (ex: ActivityNotFoundException) {
} catch (_: ActivityNotFoundException) {
try {
context.startActivity(Intent(Intent.ACTION_VIEW, Uri.parse(issueUrl)))
} catch (ignored: Exception) { }
} catch (_: Exception) { }
}
}
}

fun processException(isSecureDevice: Boolean, exception: String) {
val separator = System.getProperty("line.separator") ?: "\n"
val separator = System.lineSeparator() ?: "\n"
val log = getDeviceProfile(isSecureDevice)
log.append(separator).append(separator).append(exception)
submitLogcat(context, log.toString())
Expand All @@ -109,7 +109,7 @@ class Debug(private var context: Context) {
@Throws(IOException::class)
fun captureLogcat(isSecureDevice: Boolean) {
CoroutineScope(Dispatchers.IO).launch(Dispatchers.IO) {
val separator = System.getProperty("line.separator") ?: "\n"
val separator = System.lineSeparator() ?: "\n"
val log = getDeviceProfile(isSecureDevice)
var line: String?
val mLogcatProc = Runtime.getRuntime().exec(arrayOf(
Expand Down Expand Up @@ -142,7 +142,7 @@ class Debug(private var context: Context) {
val get = c.getMethod("get", String::class.java)
val name = get.invoke(c, "ro.product.manufacturer") as String
name.ifEmpty { "Unknown" }
} catch (e: Exception) {
} catch (_: Exception) {
Build.MANUFACTURER
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ class IconifiedSnackbar @JvmOverloads constructor(activity: Activity, layout: Vi
return try {
mActivity.resources.getResourceTypeName(value)
buildTickerBar(msg, value, Snackbar.LENGTH_LONG)
} catch (exception: Exception) {
} catch (_: Exception) {
buildTickerBar(msg, R.drawable.ic_samsprung_24dp, value)
}
}
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/java/com/eightbit/net/JSONExecutor.kt
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ class JSONExecutor(url: String) {
return@launch
} catch (fnf: FileNotFoundException) {
return@launch
} catch (ignored: UnknownHostException) { }
} catch (_: UnknownHostException) { }
try {
var conn = URL(url).asConnection.withToken
var statusCode = conn.responseCode
Expand Down
8 changes: 8 additions & 0 deletions app/src/main/java/com/eightbit/os/Version.kt
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,12 @@ object Version {
val isTiramisu: Boolean get() {
return Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU
}

/**
* Android 14, API 34
*/
@JvmStatic
val isUpsideDownCake: Boolean get() {
return Build.VERSION.SDK_INT >= Build.VERSION_CODES.UPSIDE_DOWN_CAKE
}
}
2 changes: 1 addition & 1 deletion app/src/main/java/com/eightbit/pm/PackageRetriever.kt
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ class PackageRetriever(val context: Context) {
"android:get_usage_stats", Process.myUid(), context.packageName
).run { if (this == AppOpsManager.MODE_ALLOWED) return true }
}
} catch (ignored: SecurityException) { }
} catch (_: SecurityException) { }
return false
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ class NotificationReceiver : NotificationListenerService() {
isConnected = false
try {
requestRebind(ComponentName(applicationContext, NotificationReceiver::class.java))
} catch (ignored: Exception) { }
} catch (_: Exception) { }
}

override fun onNotificationPosted(sbn: StatusBarNotification) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ class OnBroadcastService : Service() {
CoverOptions(null).getActivityOptions(1).toBundle()
)
}
try { applicationContext.unregisterReceiver(onReceiver) } catch (ignored: Exception) { }
try { applicationContext.unregisterReceiver(onReceiver) } catch (_: Exception) { }
IntentFilter().apply {
addAction(Intent.ACTION_USER_PRESENT)
addAction(Intent.ACTION_SCREEN_ON)
Expand Down Expand Up @@ -127,7 +127,7 @@ class OnBroadcastService : Service() {
}

private fun stopOverlayService(): Int {
try { unregisterReceiver(onReceiver) } catch (ignored: Exception) { }
try { unregisterReceiver(onReceiver) } catch (_: Exception) { }
stopForeground(STOP_FOREGROUND_REMOVE)
stopSelf()
return START_NOT_STICKY
Expand Down
4 changes: 2 additions & 2 deletions app/src/main/java/com/eightbit/samsprung/SamSprung.kt
Original file line number Diff line number Diff line change
Expand Up @@ -66,13 +66,13 @@ class SamSprung : Application() {
error.printStackTrace(PrintWriter(exception))
try {
OrientationManager(this).removeOrientationLayout()
} catch (ignored: Exception) { }
} catch (_: Exception) { }
try {
Debug(this).processException(
with (getSystemService(KEYGUARD_SERVICE) as KeyguardManager) { isDeviceSecure },
exception.toString()
)
} catch (ignored: Exception) { }
} catch (_: Exception) { }
// Unrecoverable error encountered
android.os.Process.killProcess(android.os.Process.myPid())
exitProcess(-1)
Expand Down
16 changes: 8 additions & 8 deletions app/src/main/java/com/eightbit/samsprung/SamSprungOverlay.kt
Original file line number Diff line number Diff line change
Expand Up @@ -234,13 +234,13 @@ class SamSprungOverlay : AppCompatActivity() {
animation.start()
}
}
} catch (ignored: Exception) { }
} catch (_: Exception) { }
} else {
val wallpaper = File(filesDir, "wallpaper.png")
if (wallpaper.exists()) {
try {
background = Drawable.createFromPath(wallpaper.absolutePath)
} catch (ignored: Exception) { }
} catch (_: Exception) { }
}
val permissions: Array<String> =
if (Version.isTiramisu)
Expand All @@ -261,7 +261,7 @@ class SamSprungOverlay : AppCompatActivity() {
ScaledContext(applicationContext).cover()
).peekDrawable()
}
} catch (ignored: SecurityException) { }
} catch (_: SecurityException) { }
}
if (null != background) coordinator.background = background
}
Expand Down Expand Up @@ -915,7 +915,7 @@ class SamSprungOverlay : AppCompatActivity() {
if (packageManager.getApplicationLabel(ai).contains(launchCommand, true)) {
matchedApps.add(packageInfo)
}
} catch (ignored: PackageManager.NameNotFoundException) { }
} catch (_: PackageManager.NameNotFoundException) { }
}
if (matchedApps.isNotEmpty()) {
if (matchedApps.size == 1) {
Expand Down Expand Up @@ -1160,12 +1160,12 @@ class SamSprungOverlay : AppCompatActivity() {
}

fun onStopOverlay() {
try { camManager.unregisterTorchCallback(torchCallback) } catch (ignored: Exception) { }
try { camManager.unregisterTorchCallback(torchCallback) } catch (_: Exception) { }
timeoutHandler.removeCallbacksAndMessages(null)
fabShowHandler.removeCallbacksAndMessages(null)
findViewById<View>(R.id.bottom_sheet_main).keepScreenOn = false
try { unregisterReceiver(battReceiver) } catch (ignored: Exception) { }
try { unregisterReceiver(offReceiver) } catch (ignored: Exception) { }
try { unregisterReceiver(battReceiver) } catch (_: Exception) { }
try { unregisterReceiver(offReceiver) } catch (_: Exception) { }
finish()
}

Expand All @@ -1175,7 +1175,7 @@ class SamSprungOverlay : AppCompatActivity() {
if (prefs.getBoolean(getString(R.string.toggle_widgets).toPref, true)) {
try {
appWidgetHost?.stopListening()
} catch (ignored: NullPointerException) { }
} catch (_: NullPointerException) { }
model.unbind()
model.abortLoaders()
contentResolver.unregisterContentObserver(mObserver)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -317,16 +317,16 @@ class AppDisplayListener : Service() {
with (getSystemService(DISPLAY_SERVICE) as DisplayManager) {
unregisterDisplayListener(mDisplayListener)
}
} catch (ignored: Exception) { }
try { unregisterReceiver(offReceiver) } catch (ignored: Exception) { }
} catch (_: Exception) { }
try { unregisterReceiver(offReceiver) } catch (_: Exception) { }
ScaledContext(
ScaledContext(applicationContext).cover(R.style.Theme_SecondScreen)
).internal(1.5f).run {
with (getSystemService(WINDOW_SERVICE) as WindowManager) {
try {
removeViewImmediate(floatView)
} catch (rvi: Exception) {
try { removeView(floatView) } catch (ignored: Exception) { }
try { removeView(floatView) } catch (_: Exception) { }
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,6 @@ class AppDrawerFragment : Fragment(), DrawerAppAdapter.OnAppClickListener {

override fun onDestroyView() {
super.onDestroyView()
try { requireActivity().unregisterReceiver(packReceiver) } catch (ignored: Exception) { }
try { requireActivity().unregisterReceiver(packReceiver) } catch (_: Exception) { }
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ class DrawerAppAdapter(
} catch (ex: Exception) {
try {
resolveInfo.nonLocalizedLabel
} catch (ignored: Exception) {
} catch (_: Exception) {
null
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ class OrientationManager(context: Context) {
try {
windowManager.removeViewImmediate(it.get())
} catch (rvi: Exception) {
try { windowManager.removeView(it.get()) } catch (ignored: Exception) { }
try { windowManager.removeView(it.get()) } catch (_: Exception) { }
}
} ?: windowManager.run {
orientationLayout.screenOrientation = ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED
Expand All @@ -49,9 +49,9 @@ class OrientationManager(context: Context) {
} catch (rvi: Exception) {
try {
removeView(orientationManager)
} catch (ignored: Exception) { }
} catch (_: Exception) { }
}
}
} catch (ignored: Exception) { }
} catch (_: Exception) { }
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ class PanelWidgetManager(
layout.children.forEach { child ->
if (child is AppWidgetHostView) layout.removeView(child)
}
} catch (ignored: Exception) { }
} catch (_: Exception) { }
layout.addView(launcherInfo.hostView, params)
}
})
Expand Down Expand Up @@ -203,7 +203,7 @@ class PanelWidgetManager(
layout.children.forEach {
if (it is AppWidgetHostView) layout.removeView(it)
}
} catch (ignored: Exception) { }
} catch (_: Exception) { }
val layout = view as LinearLayout
layout.addView(item.hostView, params)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ class WidgetModel {
appWidgetInfo.container = c.getInt(containerIndex).toLong()
desktopAppWidgets.add(appWidgetInfo)
}
} catch (ignored: Exception) { }
} catch (_: Exception) { }
}
}
if (!mStopped) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ class WidgetPreviews(mLauncher: SamSprungOverlay) {
// Delete everything
try {
mDb?.writableDatabase?.delete(CacheDb.TABLE_NAME, null, null)
} catch (ignored: SQLiteDiskIOException) { }
} catch (_: SQLiteDiskIOException) { }
}

fun generateWidgetPreview(
Expand Down Expand Up @@ -213,7 +213,7 @@ class WidgetPreviews(mLauncher: SamSprungOverlay) {
(mAppIconSize * iconScale).toInt()
)
}
} catch (ignored: NotFoundException) { }
} catch (_: NotFoundException) { }
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -858,7 +858,7 @@ class CoverPreferences : AppCompatActivity() {
Uri.parse("package:apps.ijp.coveros")
))
dialog.dismiss()
} catch (ignored: Exception) { }
} catch (_: Exception) { }
}
.setNegativeButton(R.string.button_disable) { dialog, _ ->
startActivity(Intent(
Expand Down Expand Up @@ -961,7 +961,7 @@ class CoverPreferences : AppCompatActivity() {
} catch (ex: SecurityException) {
WallpaperManager.getInstance(this@CoverPreferences).peekDrawable()
}
} catch (ignored: SecurityException) { }
} catch (_: SecurityException) { }
}
}
}
Expand Down Expand Up @@ -1202,7 +1202,7 @@ class CoverPreferences : AppCompatActivity() {
if (this == AppOpsManager.MODE_ALLOWED) return true
}
}
} catch (ignored: SecurityException) { }
} catch (_: SecurityException) { }
return false
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ class FilteredAppsAdapter(
} catch (ex: Exception) {
try {
item.nonLocalizedLabel
} catch (ignored: Exception) {
} catch (_: Exception) {
null
}
}
Expand Down Expand Up @@ -102,7 +102,7 @@ class FilteredAppsAdapter(
} catch (ex: Exception) {
try {
application.nonLocalizedLabel
} catch (ignored: Exception) {
} catch (_: Exception) {
null
}
}
Expand Down
Loading

0 comments on commit 25c8b7c

Please sign in to comment.