Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Import Issues #102

Merged
merged 2 commits into from
Sep 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ continuation_indent_size = 4
wildcard_import_limit = 999
ij_kotlin_name_count_to_use_star_import = 999
ij_kotlin_name_count_to_use_star_import_for_members = 999
ktlint_standard_no-wildcard-imports = disabled
ktlint_standard_backing-property-naming = disabled
ktlint_standard_filename = disabled

Expand Down
54 changes: 52 additions & 2 deletions app/src/main/java/be/scri/activities/BaseSimpleActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,59 @@ import be.scri.R
import be.scri.dialogs.ConfirmationDialog
import be.scri.dialogs.WritePermissionDialog
import be.scri.dialogs.WritePermissionDialog.Mode
import be.scri.extensions.*
import be.scri.extensions.addBit
import be.scri.extensions.baseConfig
import be.scri.extensions.buildDocumentUriSdk30
import be.scri.extensions.createAndroidDataOrObbPath
import be.scri.extensions.createAndroidDataOrObbUri
import be.scri.extensions.createFirstParentTreeUri
import be.scri.extensions.getAppIconColors
import be.scri.extensions.getColoredDrawableWithColor
import be.scri.extensions.getContrastColor
import be.scri.extensions.getFirstParentLevel
import be.scri.extensions.getFirstParentPath
import be.scri.extensions.getPermissionString
import be.scri.extensions.getProperStatusBarColor
import be.scri.extensions.getProperTextColor
import be.scri.extensions.getThemeId
import be.scri.extensions.hasPermission
import be.scri.extensions.hideKeyboard
import be.scri.extensions.humanizePath
import be.scri.extensions.isAppInstalledOnSDCard
import be.scri.extensions.isPathOnOTG
import be.scri.extensions.isPathOnSD
import be.scri.extensions.isShowingAndroidSAFDialog
import be.scri.extensions.isShowingOTGDialog
import be.scri.extensions.isShowingSAFCreateDocumentDialogSdk30
import be.scri.extensions.isShowingSAFDialog
import be.scri.extensions.isShowingSAFDialogSdk30
import be.scri.extensions.removeBit
import be.scri.extensions.showErrorToast
import be.scri.extensions.storeAndroidTreeUri
import be.scri.extensions.toast
import be.scri.extensions.updateActionBarTitle
import be.scri.extensions.updateOTGPathFromPartition
import be.scri.fragments.AboutFragment
import be.scri.helpers.*
import be.scri.helpers.APP_ICON_IDS
import be.scri.helpers.APP_LAUNCHER_NAME
import be.scri.helpers.APP_LICENSES
import be.scri.helpers.APP_NAME
import be.scri.helpers.APP_VERSION_NAME
import be.scri.helpers.CREATE_DOCUMENT_SDK_30
import be.scri.helpers.EXTERNAL_STORAGE_PROVIDER_AUTHORITY
import be.scri.helpers.INVALID_NAVIGATION_BAR_COLOR
import be.scri.helpers.MyContextWrapper
import be.scri.helpers.OPEN_DOCUMENT_TREE_FOR_ANDROID_DATA_OR_OBB
import be.scri.helpers.OPEN_DOCUMENT_TREE_FOR_SDK_30
import be.scri.helpers.OPEN_DOCUMENT_TREE_OTG
import be.scri.helpers.OPEN_DOCUMENT_TREE_SD
import be.scri.helpers.REQUEST_CODE_SET_DEFAULT_DIALER
import be.scri.helpers.SD_OTG_SHORT
import be.scri.helpers.SHOW_FAQ_BEFORE_MAIL
import be.scri.helpers.isMarshmallowPlus
import be.scri.helpers.isOreoPlus
import be.scri.helpers.isQPlus
import be.scri.helpers.isRPlus
import java.util.regex.Pattern

abstract class BaseSimpleActivity : AppCompatActivity() {
Expand Down
8 changes: 7 additions & 1 deletion app/src/main/java/be/scri/activities/BaseSplashActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,13 @@ import android.graphics.Color
import android.os.Bundle
import androidx.appcompat.app.AppCompatActivity
import be.scri.R
import be.scri.extensions.*
import be.scri.extensions.baseConfig
import be.scri.extensions.checkAppIconColor
import be.scri.extensions.checkAppSideloading
import be.scri.extensions.getSharedTheme
import be.scri.extensions.isThankYouInstalled
import be.scri.extensions.isUsingSystemDarkTheme
import be.scri.extensions.showSideloadingDialog
import be.scri.helpers.SIDELOADING_TRUE
import be.scri.helpers.SIDELOADING_UNCHECKED

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,11 @@ import android.app.Activity
import androidx.appcompat.app.AlertDialog
import be.scri.R
import be.scri.databinding.DialogCustomIntervalPickerBinding
import be.scri.extensions.*
import be.scri.extensions.beVisibleIf
import be.scri.extensions.hideKeyboard
import be.scri.extensions.setupDialogStuff
import be.scri.extensions.showKeyboard
import be.scri.extensions.value
import be.scri.helpers.DAY_SECONDS
import be.scri.helpers.HOUR_SECONDS
import be.scri.helpers.MINUTE_SECONDS
Expand Down
44 changes: 39 additions & 5 deletions app/src/main/java/be/scri/extensions/Activity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,11 @@ package be.scri.extensions
import android.annotation.SuppressLint
import android.app.Activity
import android.app.TimePickerDialog
import android.content.*
import android.content.ActivityNotFoundException
import android.content.ComponentName
import android.content.ContentValues
import android.content.Context
import android.content.Intent
import android.content.Intent.EXTRA_STREAM
import android.content.pm.ApplicationInfo
import android.content.pm.PackageManager
Expand Down Expand Up @@ -38,16 +42,46 @@ import androidx.fragment.app.FragmentActivity
import be.scri.R
import be.scri.activities.BaseSimpleActivity
import be.scri.databinding.DialogTitleBinding
import be.scri.dialogs.*
import be.scri.dialogs.AppSideloadedDialog
import be.scri.dialogs.ConfirmationAdvancedDialog
import be.scri.dialogs.CustomIntervalPickerDialog
import be.scri.dialogs.RadioGroupDialog
import be.scri.dialogs.WritePermissionDialog
import be.scri.dialogs.WritePermissionDialog.Mode
import be.scri.helpers.*
import be.scri.models.*
import be.scri.helpers.CREATE_DOCUMENT_SDK_30
import be.scri.helpers.EXTRA_SHOW_ADVANCED
import be.scri.helpers.INVALID_NAVIGATION_BAR_COLOR
import be.scri.helpers.IS_FROM_GALLERY
import be.scri.helpers.MINUTE_SECONDS
import be.scri.helpers.MyContentProvider
import be.scri.helpers.OPEN_DOCUMENT_TREE_FOR_ANDROID_DATA_OR_OBB
import be.scri.helpers.OPEN_DOCUMENT_TREE_FOR_SDK_30
import be.scri.helpers.OPEN_DOCUMENT_TREE_OTG
import be.scri.helpers.OPEN_DOCUMENT_TREE_SD
import be.scri.helpers.PERMISSION_CALL_PHONE
import be.scri.helpers.PERMISSION_READ_STORAGE
import be.scri.helpers.PROTECTION_FINGERPRINT
import be.scri.helpers.REAL_FILE_PATH
import be.scri.helpers.REQUEST_EDIT_IMAGE
import be.scri.helpers.REQUEST_SET_AS
import be.scri.helpers.SIDELOADING_FALSE
import be.scri.helpers.SIDELOADING_TRUE
import be.scri.helpers.SILENT
import be.scri.helpers.ensureBackgroundThread
import be.scri.helpers.isMarshmallowPlus
import be.scri.helpers.isOnMainThread
import be.scri.helpers.isRPlus
import be.scri.models.AlarmSound
import be.scri.models.Android30RenameFormat
import be.scri.models.FileDirItem
import be.scri.models.RadioItem
import be.scri.models.SharedTheme
import be.scri.views.MyTextView
import java.io.File
import java.io.FileNotFoundException
import java.io.FileOutputStream
import java.io.OutputStream
import java.util.*
import java.util.TreeSet

private lateinit var binding: DialogTitleBinding

Expand Down
2 changes: 1 addition & 1 deletion app/src/main/java/be/scri/extensions/App.kt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package be.scri.extensions

import android.app.Application
import be.scri.helpers.isNougatPlus
import java.util.*
import java.util.Locale

fun Application.checkUseEnglish() {
if (baseConfig.useEnglish && !isNougatPlus()) {
Expand Down
61 changes: 57 additions & 4 deletions app/src/main/java/be/scri/extensions/CommonsContext.kt
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,13 @@ import android.annotation.TargetApi
import android.app.Activity
import android.app.NotificationManager
import android.app.role.RoleManager
import android.content.*
import android.content.ActivityNotFoundException
import android.content.ClipData
import android.content.ClipboardManager
import android.content.ContentUris
import android.content.ContentValues
import android.content.Context
import android.content.Intent
import android.content.pm.PackageManager
import android.content.pm.ShortcutManager
import android.content.res.Configuration
Expand All @@ -24,7 +30,11 @@ import android.provider.BlockedNumberContract.BlockedNumbers
import android.provider.ContactsContract.CommonDataKinds.BaseTypes
import android.provider.ContactsContract.CommonDataKinds.Phone
import android.provider.DocumentsContract
import android.provider.MediaStore.*
import android.provider.MediaStore.Audio
import android.provider.MediaStore.Files
import android.provider.MediaStore.Images
import android.provider.MediaStore.MediaColumns
import android.provider.MediaStore.Video
import android.provider.OpenableColumns
import android.provider.Settings
import android.telecom.TelecomManager
Expand All @@ -39,15 +49,58 @@ import androidx.core.content.FileProvider
import androidx.exifinterface.media.ExifInterface
import androidx.loader.content.CursorLoader
import be.scri.R
import be.scri.helpers.*
import be.scri.helpers.BaseConfig
import be.scri.helpers.DAY_SECONDS
import be.scri.helpers.FONT_SIZE_LARGE
import be.scri.helpers.FONT_SIZE_MEDIUM
import be.scri.helpers.FONT_SIZE_SMALL
import be.scri.helpers.FRIDAY_BIT
import be.scri.helpers.HOUR_SECONDS
import be.scri.helpers.MINUTE_SECONDS
import be.scri.helpers.MONDAY_BIT
import be.scri.helpers.MONTH_SECONDS
import be.scri.helpers.MyContentProvider
import be.scri.helpers.PERMISSION_CALL_PHONE
import be.scri.helpers.PERMISSION_CAMERA
import be.scri.helpers.PERMISSION_GET_ACCOUNTS
import be.scri.helpers.PERMISSION_READ_CALENDAR
import be.scri.helpers.PERMISSION_READ_CALL_LOG
import be.scri.helpers.PERMISSION_READ_CONTACTS
import be.scri.helpers.PERMISSION_READ_PHONE_STATE
import be.scri.helpers.PERMISSION_READ_SMS
import be.scri.helpers.PERMISSION_READ_STORAGE
import be.scri.helpers.PERMISSION_RECORD_AUDIO
import be.scri.helpers.PERMISSION_SEND_SMS
import be.scri.helpers.PERMISSION_WRITE_CALENDAR
import be.scri.helpers.PERMISSION_WRITE_CALL_LOG
import be.scri.helpers.PERMISSION_WRITE_CONTACTS
import be.scri.helpers.PERMISSION_WRITE_STORAGE
import be.scri.helpers.PREFS_KEY
import be.scri.helpers.SATURDAY_BIT
import be.scri.helpers.SUNDAY_BIT
import be.scri.helpers.THURSDAY_BIT
import be.scri.helpers.TIME_FORMAT_12
import be.scri.helpers.TIME_FORMAT_24
import be.scri.helpers.TUESDAY_BIT
import be.scri.helpers.WEDNESDAY_BIT
import be.scri.helpers.WEEK_SECONDS
import be.scri.helpers.YEAR_SECONDS
import be.scri.helpers.YOUR_ALARM_SOUNDS_MIN_ID
import be.scri.helpers.ensureBackgroundThread
import be.scri.helpers.isMarshmallowPlus
import be.scri.helpers.isNougatPlus
import be.scri.helpers.isOnMainThread
import be.scri.helpers.isQPlus
import be.scri.helpers.proPackages
import be.scri.models.AlarmSound
import be.scri.models.BlockedNumber
import com.github.ajalt.reprint.core.Reprint
import com.google.gson.Gson
import com.google.gson.reflect.TypeToken
import java.io.File
import java.text.SimpleDateFormat
import java.util.*
import java.util.Date
import java.util.Locale

fun Context.getSharedPrefs() = getSharedPreferences(PREFS_KEY, Context.MODE_PRIVATE)

Expand Down
20 changes: 16 additions & 4 deletions app/src/main/java/be/scri/extensions/Context-storage.kt
Original file line number Diff line number Diff line change
Expand Up @@ -14,20 +14,32 @@ import android.os.Handler
import android.os.Looper
import android.provider.DocumentsContract
import android.provider.DocumentsContract.Document
import android.provider.MediaStore.*
import android.provider.MediaStore
import android.provider.MediaStore.Audio
import android.provider.MediaStore.Files
import android.provider.MediaStore.Images
import android.provider.MediaStore.MediaColumns
import android.provider.MediaStore.Video
import android.text.TextUtils
import androidx.annotation.RequiresApi
import androidx.core.content.FileProvider
import androidx.core.net.toUri
import androidx.documentfile.provider.DocumentFile
import be.scri.R
import be.scri.helpers.*
import be.scri.helpers.EXTERNAL_STORAGE_PROVIDER_AUTHORITY
import be.scri.helpers.ExternalStorageProviderHack
import be.scri.helpers.SD_OTG_PATTERN
import be.scri.helpers.SD_OTG_SHORT
import be.scri.helpers.ensureBackgroundThread
import be.scri.helpers.isMarshmallowPlus
import be.scri.helpers.isNougatPlus
import be.scri.helpers.isRPlus
import be.scri.models.FileDirItem
import java.io.File
import java.io.FileInputStream
import java.io.InputStream
import java.net.URLDecoder
import java.util.*
import java.util.Collections
import java.util.regex.Pattern

private const val ANDROID_DATA_DIR = "/Android/data/"
Expand Down Expand Up @@ -428,7 +440,7 @@ fun getPaths(file: File): ArrayList<String> {

fun Context.getFileUri(path: String) =
when {
path.isImageSlow() -> Images.Media.EXTERNAL_CONTENT_URI
path.isImageSlow() -> MediaStore.Images.Media.EXTERNAL_CONTENT_URI
path.isVideoSlow() -> Video.Media.EXTERNAL_CONTENT_URI
path.isAudioSlow() -> Audio.Media.EXTERNAL_CONTENT_URI
else -> Files.getContentUri("external")
Expand Down
6 changes: 5 additions & 1 deletion app/src/main/java/be/scri/extensions/Context-styling.kt
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,11 @@ import android.graphics.Color
import android.view.ViewGroup
import androidx.loader.content.CursorLoader
import be.scri.R
import be.scri.helpers.*
import be.scri.helpers.DARK_GREY
import be.scri.helpers.INVALID_NAVIGATION_BAR_COLOR
import be.scri.helpers.MyContentProvider
import be.scri.helpers.appIconColorStrings
import be.scri.helpers.ensureBackgroundThread
import be.scri.models.SharedTheme
import be.scri.views.MyAppCompatCheckbox
import be.scri.views.MyEditText
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/java/be/scri/extensions/ExifInterface.kt
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import android.content.Context
import android.os.Build
import androidx.exifinterface.media.ExifInterface
import java.text.SimpleDateFormat
import java.util.*
import java.util.Locale

fun ExifInterface.copyTo(
destination: ExifInterface,
Expand Down
7 changes: 6 additions & 1 deletion app/src/main/java/be/scri/extensions/File.kt
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
package be.scri.extensions

import android.content.Context
import be.scri.helpers.*
import be.scri.helpers.MD5
import be.scri.helpers.NOMEDIA
import be.scri.helpers.audioExtensions
import be.scri.helpers.photoExtensions
import be.scri.helpers.rawExtensions
import be.scri.helpers.videoExtensions
import be.scri.models.FileDirItem
import java.io.File

Expand Down
4 changes: 3 additions & 1 deletion app/src/main/java/be/scri/extensions/Int.kt
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@ import android.text.format.DateUtils
import android.text.format.Time
import be.scri.helpers.DARK_GREY
import java.text.DecimalFormat
import java.util.*
import java.util.Calendar
import java.util.Locale
import java.util.Random

fun Int.getContrastColor(): Int {
val y = (299 * Color.red(this) + 587 * Color.green(this) + 114 * Color.blue(this)) / 1000
Expand Down
3 changes: 2 additions & 1 deletion app/src/main/java/be/scri/extensions/Long.kt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ package be.scri.extensions
import android.content.Context
import android.text.format.DateFormat
import java.text.DecimalFormat
import java.util.*
import java.util.Calendar
import java.util.Locale

fun Long.formatSize(): String {
if (this <= 0) {
Expand Down
10 changes: 8 additions & 2 deletions app/src/main/java/be/scri/extensions/String.kt
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,13 @@ import android.text.SpannableString
import android.text.TextUtils
import android.text.style.ForegroundColorSpan
import android.widget.TextView
import be.scri.helpers.*
import be.scri.helpers.audioExtensions
import be.scri.helpers.extensionsSupportingEXIF
import be.scri.helpers.getDateFormats
import be.scri.helpers.normalizeRegex
import be.scri.helpers.photoExtensions
import be.scri.helpers.rawExtensions
import be.scri.helpers.videoExtensions
import com.bumptech.glide.signature.ObjectKey
import org.joda.time.DateTime
import org.joda.time.Years
Expand All @@ -21,7 +27,7 @@ import java.io.File
import java.text.DateFormat
import java.text.Normalizer
import java.text.SimpleDateFormat
import java.util.*
import java.util.Locale
import java.util.regex.Pattern

fun String.getFilenameFromPath() = substring(lastIndexOf("/") + 1)
Expand Down
4 changes: 3 additions & 1 deletion app/src/main/java/be/scri/fragments/SettingsFragment.kt
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@ import android.os.Bundle
import android.provider.Settings.ACTION_APPLICATION_DETAILS_SETTINGS
import android.provider.Settings.ACTION_APP_LOCALE_SETTINGS
import android.provider.Settings.ACTION_INPUT_METHOD_SETTINGS
import android.view.*
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.view.inputmethod.InputMethodManager
import androidx.activity.addCallback
import androidx.appcompat.app.AppCompatDelegate
Expand Down
Loading