diff --git a/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/activities/DecompressActivity.kt b/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/activities/DecompressActivity.kt index ce7a501f..ee1e1b7b 100644 --- a/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/activities/DecompressActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/activities/DecompressActivity.kt @@ -26,7 +26,7 @@ class DecompressActivity : SimpleActivity() { private const val PASSWORD = "password" } - private val binding by lazy(LazyThreadSafetyMode.NONE) { ActivityDecompressBinding.inflate(layoutInflater) } + private val binding by viewBinding(ActivityDecompressBinding::inflate) private val allFiles = ArrayList() private var currentPath = "" private var uri: Uri? = null diff --git a/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/activities/FavoritesActivity.kt b/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/activities/FavoritesActivity.kt index 0adf4089..a635e249 100644 --- a/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/activities/FavoritesActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/activities/FavoritesActivity.kt @@ -6,6 +6,7 @@ import com.simplemobiletools.commons.dialogs.FilePickerDialog import com.simplemobiletools.commons.extensions.beVisibleIf import com.simplemobiletools.commons.extensions.getProperPrimaryColor import com.simplemobiletools.commons.extensions.getProperTextColor +import com.simplemobiletools.commons.extensions.viewBinding import com.simplemobiletools.commons.helpers.NavigationIcon import com.simplemobiletools.commons.interfaces.RefreshRecyclerViewListener import com.simplemobiletools.filemanager.pro.R @@ -14,7 +15,7 @@ import com.simplemobiletools.filemanager.pro.databinding.ActivityFavoritesBindin import com.simplemobiletools.filemanager.pro.extensions.config class FavoritesActivity : SimpleActivity(), RefreshRecyclerViewListener { - private val binding by lazy(LazyThreadSafetyMode.NONE) { ActivityFavoritesBinding.inflate(layoutInflater) } + private val binding by viewBinding(ActivityFavoritesBinding::inflate) override fun onCreate(savedInstanceState: Bundle?) { isMaterialActivity = true diff --git a/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/activities/MainActivity.kt b/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/activities/MainActivity.kt index ce2a2e83..721618e1 100644 --- a/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/activities/MainActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/activities/MainActivity.kt @@ -43,10 +43,13 @@ import me.grantland.widget.AutofitHelper import java.io.File class MainActivity : SimpleActivity() { - private val BACK_PRESS_TIMEOUT = 5000 - private val MANAGE_STORAGE_RC = 201 - private val PICKED_PATH = "picked_path" - private val binding by lazy(LazyThreadSafetyMode.NONE) { ActivityMainBinding.inflate(layoutInflater) } + companion object { + private const val BACK_PRESS_TIMEOUT = 5000 + private const val MANAGE_STORAGE_RC = 201 + private const val PICKED_PATH = "picked_path" + } + + private val binding by viewBinding(ActivityMainBinding::inflate) private var wasBackJustPressed = false private var mIsPasswordProtectionPending = false diff --git a/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/activities/MimeTypesActivity.kt b/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/activities/MimeTypesActivity.kt index aadb2f5c..85942400 100644 --- a/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/activities/MimeTypesActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/activities/MimeTypesActivity.kt @@ -32,7 +32,7 @@ import com.simplemobiletools.filemanager.pro.models.ListItem import java.util.Locale class MimeTypesActivity : SimpleActivity(), ItemOperationsListener { - private val binding by lazy(LazyThreadSafetyMode.NONE) { ActivityMimetypesBinding.inflate(layoutInflater) } + private val binding by viewBinding(ActivityMimetypesBinding::inflate) private var isSearchOpen = false private var currentMimeType = "" private var lastSearchedText = "" diff --git a/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/activities/PDFViewerActivity.kt b/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/activities/PDFViewerActivity.kt index 53c75398..b414c712 100644 --- a/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/activities/PDFViewerActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/activities/PDFViewerActivity.kt @@ -22,7 +22,7 @@ import com.simplemobiletools.filemanager.pro.extensions.showSystemUI import com.simplemobiletools.filemanager.pro.helpers.PdfDocumentAdapter class PDFViewerActivity : SimpleActivity() { - private val binding by lazy(LazyThreadSafetyMode.NONE) { ActivityPdfViewerBinding.inflate(layoutInflater) } + private val binding by viewBinding(ActivityPdfViewerBinding::inflate) private var realFilePath = "" private var isFullScreen = false private var passwordDialog: EnterPasswordDialog? = null diff --git a/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/activities/ReadTextActivity.kt b/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/activities/ReadTextActivity.kt index 04085aba..3fb77e18 100644 --- a/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/activities/ReadTextActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/activities/ReadTextActivity.kt @@ -29,9 +29,12 @@ import java.io.File import java.io.OutputStream class ReadTextActivity : SimpleActivity() { - private val SELECT_SAVE_FILE_INTENT = 1 - private val SELECT_SAVE_FILE_AND_EXIT_INTENT = 2 - private val binding by lazy(LazyThreadSafetyMode.NONE) { ActivityReadTextBinding.inflate(layoutInflater) } + companion object { + private const val SELECT_SAVE_FILE_INTENT = 1 + private const val SELECT_SAVE_FILE_AND_EXIT_INTENT = 2 + } + + private val binding by viewBinding(ActivityReadTextBinding::inflate) private var filePath = "" private var originalText = "" diff --git a/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/activities/SaveAsActivity.kt b/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/activities/SaveAsActivity.kt index 73d10323..e8a71348 100644 --- a/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/activities/SaveAsActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/activities/SaveAsActivity.kt @@ -13,7 +13,7 @@ import com.simplemobiletools.filemanager.pro.extensions.config import java.io.File class SaveAsActivity : SimpleActivity() { - private val binding by lazy(LazyThreadSafetyMode.NONE) { ActivitySaveAsBinding.inflate(layoutInflater) } + private val binding by viewBinding(ActivitySaveAsBinding::inflate) override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) diff --git a/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/activities/SettingsActivity.kt b/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/activities/SettingsActivity.kt index afadbd3b..b7e1e136 100644 --- a/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/activities/SettingsActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/activities/SettingsActivity.kt @@ -18,7 +18,7 @@ import java.util.Locale import kotlin.system.exitProcess class SettingsActivity : SimpleActivity() { - private val binding by lazy(LazyThreadSafetyMode.NONE) { ActivitySettingsBinding.inflate(layoutInflater) } + private val binding by viewBinding(ActivitySettingsBinding::inflate) override fun onCreate(savedInstanceState: Bundle?) { isMaterialActivity = true