diff --git a/build.gradle b/build.gradle index a1ca7ce85..820f498bb 100644 --- a/build.gradle +++ b/build.gradle @@ -7,7 +7,7 @@ buildscript { propMinSdkVersion = 21 propTargetSdkVersion = propCompileSdkVersion propVersionCode = 1 - propVersionName = '5.26.27' + propVersionName = '5.26.28' kotlin_version = '1.3.72' } diff --git a/commons/src/main/kotlin/com/simplemobiletools/commons/asynctasks/CopyMoveTask.kt b/commons/src/main/kotlin/com/simplemobiletools/commons/asynctasks/CopyMoveTask.kt index 39d89f60e..82d84870b 100644 --- a/commons/src/main/kotlin/com/simplemobiletools/commons/asynctasks/CopyMoveTask.kt +++ b/commons/src/main/kotlin/com/simplemobiletools/commons/asynctasks/CopyMoveTask.kt @@ -35,7 +35,6 @@ class CopyMoveTask(val activity: BaseSimpleActivity, val copyOnly: Boolean, val private var mDestinationPath = "" // progress indication - private var mNotificationManager: NotificationManager private var mNotificationBuilder: NotificationCompat.Builder private var mCurrFilename = "" private var mCurrentProgress = 0L @@ -46,7 +45,6 @@ class CopyMoveTask(val activity: BaseSimpleActivity, val copyOnly: Boolean, val init { mListener = WeakReference(listener) - mNotificationManager = activity.getSystemService(Context.NOTIFICATION_SERVICE) as NotificationManager mNotificationBuilder = NotificationCompat.Builder(activity) } @@ -114,7 +112,7 @@ class CopyMoveTask(val activity: BaseSimpleActivity, val copyOnly: Boolean, val } mProgressHandler.removeCallbacksAndMessages(null) - mNotificationManager.cancel(mNotifId) + activity.notificationManager.cancel(mNotifId) val listener = mListener?.get() ?: return if (success) { @@ -132,7 +130,7 @@ class CopyMoveTask(val activity: BaseSimpleActivity, val copyOnly: Boolean, val NotificationChannel(channelId, title, importance).apply { enableLights(false) enableVibration(false) - mNotificationManager.createNotificationChannel(this) + activity.notificationManager.createNotificationChannel(this) } } @@ -143,7 +141,7 @@ class CopyMoveTask(val activity: BaseSimpleActivity, val copyOnly: Boolean, val private fun updateProgress() { if (mIsTaskOver) { - mNotificationManager.cancel(mNotifId) + activity.notificationManager.cancel(mNotifId) cancel(true) return } @@ -151,7 +149,7 @@ class CopyMoveTask(val activity: BaseSimpleActivity, val copyOnly: Boolean, val mNotificationBuilder.apply { setContentText(mCurrFilename) setProgress(mMaxSize, (mCurrentProgress / 1000).toInt(), false) - mNotificationManager.notify(mNotifId, build()) + activity.notificationManager.notify(mNotifId, build()) } mProgressHandler.removeCallbacksAndMessages(null) diff --git a/commons/src/main/kotlin/com/simplemobiletools/commons/extensions/Context.kt b/commons/src/main/kotlin/com/simplemobiletools/commons/extensions/Context.kt index fd21fd1f4..4bec1f3c0 100644 --- a/commons/src/main/kotlin/com/simplemobiletools/commons/extensions/Context.kt +++ b/commons/src/main/kotlin/com/simplemobiletools/commons/extensions/Context.kt @@ -3,6 +3,7 @@ package com.simplemobiletools.commons.extensions import android.Manifest import android.annotation.TargetApi import android.app.Activity +import android.app.NotificationManager import android.app.role.RoleManager import android.content.* import android.content.pm.PackageManager @@ -73,21 +74,21 @@ fun Context.updateTextColors(viewGroup: ViewGroup, tmpTextColor: Int = 0, tmpAcc val cnt = viewGroup.childCount (0 until cnt).map { viewGroup.getChildAt(it) } - .forEach { - when (it) { - is MyTextView -> it.setColors(textColor, accentColor, backgroundColor) - is MyAppCompatSpinner -> it.setColors(textColor, accentColor, backgroundColor) - is MySwitchCompat -> it.setColors(textColor, accentColor, backgroundColor) - is MyCompatRadioButton -> it.setColors(textColor, accentColor, backgroundColor) - is MyAppCompatCheckbox -> it.setColors(textColor, accentColor, backgroundColor) - is MyEditText -> it.setColors(textColor, accentColor, backgroundColor) - is MyAutoCompleteTextView -> it.setColors(textColor, accentColor, backgroundColor) - is MyFloatingActionButton -> it.setColors(textColor, accentColor, backgroundColor) - is MySeekBar -> it.setColors(textColor, accentColor, backgroundColor) - is MyButton -> it.setColors(textColor, accentColor, backgroundColor) - is ViewGroup -> updateTextColors(it, textColor, accentColor) - } + .forEach { + when (it) { + is MyTextView -> it.setColors(textColor, accentColor, backgroundColor) + is MyAppCompatSpinner -> it.setColors(textColor, accentColor, backgroundColor) + is MySwitchCompat -> it.setColors(textColor, accentColor, backgroundColor) + is MyCompatRadioButton -> it.setColors(textColor, accentColor, backgroundColor) + is MyAppCompatCheckbox -> it.setColors(textColor, accentColor, backgroundColor) + is MyEditText -> it.setColors(textColor, accentColor, backgroundColor) + is MyAutoCompleteTextView -> it.setColors(textColor, accentColor, backgroundColor) + is MyFloatingActionButton -> it.setColors(textColor, accentColor, backgroundColor) + is MySeekBar -> it.setColors(textColor, accentColor, backgroundColor) + is MyButton -> it.setColors(textColor, accentColor, backgroundColor) + is ViewGroup -> updateTextColors(it, textColor, accentColor) } + } } fun Context.getLinkTextColor(): Int { @@ -152,7 +153,7 @@ fun Context.isFingerPrintSensorAvailable() = isMarshmallowPlus() && Reprint.isHa fun Context.getLatestMediaId(uri: Uri = Files.getContentUri("external")): Long { val projection = arrayOf( - BaseColumns._ID + BaseColumns._ID ) val sortOrder = "${BaseColumns._ID} DESC LIMIT 1" try { @@ -169,7 +170,7 @@ fun Context.getLatestMediaId(uri: Uri = Files.getContentUri("external")): Long { fun Context.getLatestMediaByDateId(uri: Uri = Files.getContentUri("external")): Long { val projection = arrayOf( - BaseColumns._ID + BaseColumns._ID ) val sortOrder = "${Images.ImageColumns.DATE_TAKEN} DESC LIMIT 1" try { @@ -316,13 +317,13 @@ fun Context.getMediaContent(path: String, uri: Uri): Uri? { } fun Context.queryCursor( - uri: Uri, - projection: Array, - selection: String? = null, - selectionArgs: Array? = null, - sortOrder: String? = null, - showErrors: Boolean = false, - callback: (cursor: Cursor) -> Unit + uri: Uri, + projection: Array, + selection: String? = null, + selectionArgs: Array? = null, + sortOrder: String? = null, + showErrors: Boolean = false, + callback: (cursor: Cursor) -> Unit ) { try { val cursor = contentResolver.query(uri, projection, selection, selectionArgs, sortOrder) @@ -718,6 +719,7 @@ fun Context.getTextSize() = when (baseConfig.fontSize) { val Context.telecomManager: TelecomManager get() = getSystemService(Context.TELECOM_SERVICE) as TelecomManager val Context.windowManager: WindowManager get() = getSystemService(Context.WINDOW_SERVICE) as WindowManager +val Context.notificationManager: NotificationManager get() = getSystemService(Context.NOTIFICATION_SERVICE) as NotificationManager val Context.portrait get() = resources.configuration.orientation == Configuration.ORIENTATION_PORTRAIT val Context.navigationBarRight: Boolean get() = usableScreenSize.x < realScreenSize.x val Context.navigationBarBottom: Boolean get() = usableScreenSize.y < realScreenSize.y @@ -796,9 +798,9 @@ fun Context.getBlockedNumbers(): ArrayList { val uri = BlockedNumbers.CONTENT_URI val projection = arrayOf( - BlockedNumbers.COLUMN_ID, - BlockedNumbers.COLUMN_ORIGINAL_NUMBER, - BlockedNumbers.COLUMN_E164_NUMBER + BlockedNumbers.COLUMN_ID, + BlockedNumbers.COLUMN_ORIGINAL_NUMBER, + BlockedNumbers.COLUMN_E164_NUMBER ) queryCursor(uri, projection) { cursor -> diff --git a/commons/src/main/res/drawable/ic_phone_vector.xml b/commons/src/main/res/drawable/ic_phone_vector.xml index b10b03cd7..95a2a2ba4 100644 --- a/commons/src/main/res/drawable/ic_phone_vector.xml +++ b/commons/src/main/res/drawable/ic_phone_vector.xml @@ -3,7 +3,7 @@ android:height="24dp" android:viewportWidth="24" android:viewportHeight="24"> - +