Loading commons/src/main/kotlin/com/simplemobiletools/commons/asynctasks/CopyMoveTask.kt +2 −1 Original line number Diff line number Diff line Loading @@ -16,6 +16,7 @@ import com.simplemobiletools.commons.extensions.* import com.simplemobiletools.commons.helpers.CONFLICT_OVERWRITE import com.simplemobiletools.commons.helpers.CONFLICT_SKIP import com.simplemobiletools.commons.helpers.OTG_PATH import com.simplemobiletools.commons.helpers.isOreoPlus import com.simplemobiletools.commons.interfaces.CopyMoveListener import com.simplemobiletools.commons.models.FileDirItem import java.io.File Loading Loading @@ -121,7 +122,7 @@ class CopyMoveTask(val activity: BaseSimpleActivity, val copyOnly: Boolean = fal private fun initProgressNotification() { val channelId = "copying_moving_channel" val title = activity.getString(if (copyOnly) R.string.copying else R.string.moving) if (activity.isOreoPlus()) { if (isOreoPlus()) { val importance = NotificationManager.IMPORTANCE_LOW NotificationChannel(channelId, title, importance).apply { enableLights(false) Loading commons/src/main/kotlin/com/simplemobiletools/commons/extensions/Context-storage.kt +3 −0 Original line number Diff line number Diff line Loading @@ -14,6 +14,9 @@ import android.support.v4.provider.DocumentFile import android.text.TextUtils import com.simplemobiletools.commons.R import com.simplemobiletools.commons.helpers.OTG_PATH import com.simplemobiletools.commons.helpers.isLollipopPlus import com.simplemobiletools.commons.helpers.isMarshmallowPlus import com.simplemobiletools.commons.helpers.isNougatPlus import com.simplemobiletools.commons.models.FileDirItem import java.io.File import java.net.URLDecoder Loading commons/src/main/kotlin/com/simplemobiletools/commons/extensions/Context.kt +0 −11 Original line number Diff line number Diff line Loading @@ -8,9 +8,7 @@ import android.content.pm.PackageManager import android.database.Cursor import android.graphics.Color import android.net.Uri import android.os.Build import android.os.Environment import android.os.Looper import android.provider.BaseColumns import android.provider.DocumentsContract import android.provider.MediaStore Loading @@ -34,17 +32,8 @@ import java.io.File import java.text.SimpleDateFormat import java.util.* fun Context.isOnMainThread() = Looper.myLooper() == Looper.getMainLooper() fun Context.getSharedPrefs() = getSharedPreferences(PREFS_KEY, Context.MODE_PRIVATE) fun Context.isJellyBean1Plus() = Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1 fun Context.isAndroidFour() = Build.VERSION.SDK_INT <= Build.VERSION_CODES.KITKAT_WATCH fun Context.isKitkatPlus() = Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT fun Context.isLollipopPlus() = Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP fun Context.isMarshmallowPlus() = Build.VERSION.SDK_INT >= Build.VERSION_CODES.M fun Context.isNougatPlus() = Build.VERSION.SDK_INT >= Build.VERSION_CODES.N fun Context.isOreoPlus() = Build.VERSION.SDK_INT >= Build.VERSION_CODES.O val Context.isRTLLayout: Boolean get() = if (isJellyBean1Plus()) resources.configuration.layoutDirection == View.LAYOUT_DIRECTION_RTL else false fun Context.updateTextColors(viewGroup: ViewGroup, tmpTextColor: Int = 0, tmpAccentColor: Int = 0) { Loading commons/src/main/kotlin/com/simplemobiletools/commons/helpers/BaseConfig.kt +1 −2 Original line number Diff line number Diff line package com.simplemobiletools.commons.helpers import android.content.Context import android.content.SharedPreferences import android.text.format.DateFormat import com.simplemobiletools.commons.R import com.simplemobiletools.commons.extensions.getInternalStoragePath Loading @@ -10,7 +9,7 @@ import com.simplemobiletools.commons.extensions.getSharedPrefs import java.util.* open class BaseConfig(val context: Context) { protected val prefs: SharedPreferences = context.getSharedPrefs() protected val prefs = context.getSharedPrefs() companion object { fun newInstance(context: Context) = BaseConfig(context) Loading commons/src/main/kotlin/com/simplemobiletools/commons/helpers/Constants.kt +14 −0 Original line number Diff line number Diff line package com.simplemobiletools.commons.helpers import android.content.Context import android.os.Build import android.os.Looper const val APP_NAME = "app_name" const val APP_LICENSES = "app_licenses" const val APP_FAQ = "app_faq" Loading Loading @@ -136,6 +140,16 @@ const val EVERY_DAY_BIT = MONDAY_BIT or TUESDAY_BIT or WEDNESDAY_BIT or THURSDAY const val WEEK_DAYS_BIT = MONDAY_BIT or TUESDAY_BIT or WEDNESDAY_BIT or THURSDAY_BIT or FRIDAY_BIT const val WEEKENDS_BIT = SATURDAY_BIT or SUNDAY_BIT fun Context.isOnMainThread() = Looper.myLooper() == Looper.getMainLooper() fun isJellyBean1Plus() = Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1 fun isAndroidFour() = Build.VERSION.SDK_INT <= Build.VERSION_CODES.KITKAT_WATCH fun isKitkatPlus() = Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT fun isLollipopPlus() = Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP fun isMarshmallowPlus() = Build.VERSION.SDK_INT >= Build.VERSION_CODES.M fun isNougatPlus() = Build.VERSION.SDK_INT >= Build.VERSION_CODES.N fun isOreoPlus() = Build.VERSION.SDK_INT >= Build.VERSION_CODES.O fun getDateFormats() = arrayListOf( "yyyy-MM-dd", "yyyyMMdd", Loading Loading
commons/src/main/kotlin/com/simplemobiletools/commons/asynctasks/CopyMoveTask.kt +2 −1 Original line number Diff line number Diff line Loading @@ -16,6 +16,7 @@ import com.simplemobiletools.commons.extensions.* import com.simplemobiletools.commons.helpers.CONFLICT_OVERWRITE import com.simplemobiletools.commons.helpers.CONFLICT_SKIP import com.simplemobiletools.commons.helpers.OTG_PATH import com.simplemobiletools.commons.helpers.isOreoPlus import com.simplemobiletools.commons.interfaces.CopyMoveListener import com.simplemobiletools.commons.models.FileDirItem import java.io.File Loading Loading @@ -121,7 +122,7 @@ class CopyMoveTask(val activity: BaseSimpleActivity, val copyOnly: Boolean = fal private fun initProgressNotification() { val channelId = "copying_moving_channel" val title = activity.getString(if (copyOnly) R.string.copying else R.string.moving) if (activity.isOreoPlus()) { if (isOreoPlus()) { val importance = NotificationManager.IMPORTANCE_LOW NotificationChannel(channelId, title, importance).apply { enableLights(false) Loading
commons/src/main/kotlin/com/simplemobiletools/commons/extensions/Context-storage.kt +3 −0 Original line number Diff line number Diff line Loading @@ -14,6 +14,9 @@ import android.support.v4.provider.DocumentFile import android.text.TextUtils import com.simplemobiletools.commons.R import com.simplemobiletools.commons.helpers.OTG_PATH import com.simplemobiletools.commons.helpers.isLollipopPlus import com.simplemobiletools.commons.helpers.isMarshmallowPlus import com.simplemobiletools.commons.helpers.isNougatPlus import com.simplemobiletools.commons.models.FileDirItem import java.io.File import java.net.URLDecoder Loading
commons/src/main/kotlin/com/simplemobiletools/commons/extensions/Context.kt +0 −11 Original line number Diff line number Diff line Loading @@ -8,9 +8,7 @@ import android.content.pm.PackageManager import android.database.Cursor import android.graphics.Color import android.net.Uri import android.os.Build import android.os.Environment import android.os.Looper import android.provider.BaseColumns import android.provider.DocumentsContract import android.provider.MediaStore Loading @@ -34,17 +32,8 @@ import java.io.File import java.text.SimpleDateFormat import java.util.* fun Context.isOnMainThread() = Looper.myLooper() == Looper.getMainLooper() fun Context.getSharedPrefs() = getSharedPreferences(PREFS_KEY, Context.MODE_PRIVATE) fun Context.isJellyBean1Plus() = Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1 fun Context.isAndroidFour() = Build.VERSION.SDK_INT <= Build.VERSION_CODES.KITKAT_WATCH fun Context.isKitkatPlus() = Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT fun Context.isLollipopPlus() = Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP fun Context.isMarshmallowPlus() = Build.VERSION.SDK_INT >= Build.VERSION_CODES.M fun Context.isNougatPlus() = Build.VERSION.SDK_INT >= Build.VERSION_CODES.N fun Context.isOreoPlus() = Build.VERSION.SDK_INT >= Build.VERSION_CODES.O val Context.isRTLLayout: Boolean get() = if (isJellyBean1Plus()) resources.configuration.layoutDirection == View.LAYOUT_DIRECTION_RTL else false fun Context.updateTextColors(viewGroup: ViewGroup, tmpTextColor: Int = 0, tmpAccentColor: Int = 0) { Loading
commons/src/main/kotlin/com/simplemobiletools/commons/helpers/BaseConfig.kt +1 −2 Original line number Diff line number Diff line package com.simplemobiletools.commons.helpers import android.content.Context import android.content.SharedPreferences import android.text.format.DateFormat import com.simplemobiletools.commons.R import com.simplemobiletools.commons.extensions.getInternalStoragePath Loading @@ -10,7 +9,7 @@ import com.simplemobiletools.commons.extensions.getSharedPrefs import java.util.* open class BaseConfig(val context: Context) { protected val prefs: SharedPreferences = context.getSharedPrefs() protected val prefs = context.getSharedPrefs() companion object { fun newInstance(context: Context) = BaseConfig(context) Loading
commons/src/main/kotlin/com/simplemobiletools/commons/helpers/Constants.kt +14 −0 Original line number Diff line number Diff line package com.simplemobiletools.commons.helpers import android.content.Context import android.os.Build import android.os.Looper const val APP_NAME = "app_name" const val APP_LICENSES = "app_licenses" const val APP_FAQ = "app_faq" Loading Loading @@ -136,6 +140,16 @@ const val EVERY_DAY_BIT = MONDAY_BIT or TUESDAY_BIT or WEDNESDAY_BIT or THURSDAY const val WEEK_DAYS_BIT = MONDAY_BIT or TUESDAY_BIT or WEDNESDAY_BIT or THURSDAY_BIT or FRIDAY_BIT const val WEEKENDS_BIT = SATURDAY_BIT or SUNDAY_BIT fun Context.isOnMainThread() = Looper.myLooper() == Looper.getMainLooper() fun isJellyBean1Plus() = Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1 fun isAndroidFour() = Build.VERSION.SDK_INT <= Build.VERSION_CODES.KITKAT_WATCH fun isKitkatPlus() = Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT fun isLollipopPlus() = Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP fun isMarshmallowPlus() = Build.VERSION.SDK_INT >= Build.VERSION_CODES.M fun isNougatPlus() = Build.VERSION.SDK_INT >= Build.VERSION_CODES.N fun isOreoPlus() = Build.VERSION.SDK_INT >= Build.VERSION_CODES.O fun getDateFormats() = arrayListOf( "yyyy-MM-dd", "yyyyMMdd", Loading