Merge pull request #740 from fatihergin/feature/use-binding-extensions-to-inflate-activies

use binding extension to inflate activities
This commit is contained in:
Tibor Kaputa 2023-08-25 22:41:19 +02:00 committed by GitHub
commit 4a09d03440
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 20 additions and 13 deletions

View File

@ -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<ListItem>()
private var currentPath = ""
private var uri: Uri? = null

View File

@ -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

View File

@ -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

View File

@ -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 = ""

View File

@ -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

View File

@ -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 = ""

View File

@ -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)

View File

@ -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