bind activities lazily
This commit is contained in:
parent
a380eb9c3c
commit
4cc19c933d
|
@ -26,8 +26,8 @@ class DecompressActivity : SimpleActivity() {
|
|||
private const val PASSWORD = "password"
|
||||
}
|
||||
|
||||
private val binding by lazy(LazyThreadSafetyMode.NONE) { ActivityDecompressBinding.inflate(layoutInflater) }
|
||||
private val allFiles = ArrayList<ListItem>()
|
||||
private lateinit var binding: ActivityDecompressBinding
|
||||
private var currentPath = ""
|
||||
private var uri: Uri? = null
|
||||
private var password: String? = null
|
||||
|
@ -36,7 +36,6 @@ class DecompressActivity : SimpleActivity() {
|
|||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
isMaterialActivity = true
|
||||
super.onCreate(savedInstanceState)
|
||||
binding = ActivityDecompressBinding.inflate(layoutInflater)
|
||||
setContentView(binding.root)
|
||||
setupOptionsMenu()
|
||||
binding.apply {
|
||||
|
|
|
@ -14,12 +14,11 @@ import com.simplemobiletools.filemanager.pro.databinding.ActivityFavoritesBindin
|
|||
import com.simplemobiletools.filemanager.pro.extensions.config
|
||||
|
||||
class FavoritesActivity : SimpleActivity(), RefreshRecyclerViewListener {
|
||||
private lateinit var binding: ActivityFavoritesBinding
|
||||
private val binding by lazy(LazyThreadSafetyMode.NONE) { ActivityFavoritesBinding.inflate(layoutInflater) }
|
||||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
isMaterialActivity = true
|
||||
super.onCreate(savedInstanceState)
|
||||
binding = ActivityFavoritesBinding.inflate(layoutInflater)
|
||||
setContentView(binding.root)
|
||||
setupOptionsMenu()
|
||||
updateFavorites()
|
||||
|
|
|
@ -46,7 +46,8 @@ class MainActivity : SimpleActivity() {
|
|||
private val BACK_PRESS_TIMEOUT = 5000
|
||||
private val MANAGE_STORAGE_RC = 201
|
||||
private val PICKED_PATH = "picked_path"
|
||||
private lateinit var binding: ActivityMainBinding
|
||||
private val binding by lazy(LazyThreadSafetyMode.NONE) { ActivityMainBinding.inflate(layoutInflater) }
|
||||
|
||||
private var wasBackJustPressed = false
|
||||
private var mIsPasswordProtectionPending = false
|
||||
private var mWasProtectionHandled = false
|
||||
|
@ -60,7 +61,6 @@ class MainActivity : SimpleActivity() {
|
|||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
isMaterialActivity = true
|
||||
super.onCreate(savedInstanceState)
|
||||
binding = ActivityMainBinding.inflate(layoutInflater)
|
||||
setContentView(binding.root)
|
||||
appLaunched(BuildConfig.APPLICATION_ID)
|
||||
setupOptionsMenu()
|
||||
|
|
|
@ -32,7 +32,7 @@ import com.simplemobiletools.filemanager.pro.models.ListItem
|
|||
import java.util.Locale
|
||||
|
||||
class MimeTypesActivity : SimpleActivity(), ItemOperationsListener {
|
||||
private lateinit var binding: ActivityMimetypesBinding
|
||||
private val binding by lazy(LazyThreadSafetyMode.NONE) { ActivityMimetypesBinding.inflate(layoutInflater) }
|
||||
private var isSearchOpen = false
|
||||
private var currentMimeType = ""
|
||||
private var lastSearchedText = ""
|
||||
|
@ -44,7 +44,6 @@ class MimeTypesActivity : SimpleActivity(), ItemOperationsListener {
|
|||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
isMaterialActivity = true
|
||||
super.onCreate(savedInstanceState)
|
||||
binding = ActivityMimetypesBinding.inflate(layoutInflater)
|
||||
setContentView(binding.root)
|
||||
setupOptionsMenu()
|
||||
refreshMenuItems()
|
||||
|
|
|
@ -22,7 +22,7 @@ import com.simplemobiletools.filemanager.pro.extensions.showSystemUI
|
|||
import com.simplemobiletools.filemanager.pro.helpers.PdfDocumentAdapter
|
||||
|
||||
class PDFViewerActivity : SimpleActivity() {
|
||||
private lateinit var binding: ActivityPdfViewerBinding
|
||||
private val binding by lazy(LazyThreadSafetyMode.NONE) { ActivityPdfViewerBinding.inflate(layoutInflater) }
|
||||
private var realFilePath = ""
|
||||
private var isFullScreen = false
|
||||
private var passwordDialog: EnterPasswordDialog? = null
|
||||
|
@ -31,7 +31,6 @@ class PDFViewerActivity : SimpleActivity() {
|
|||
showTransparentTop = true
|
||||
|
||||
super.onCreate(savedInstanceState)
|
||||
binding = ActivityPdfViewerBinding.inflate(layoutInflater)
|
||||
setContentView(binding.root)
|
||||
|
||||
if (checkAppSideloading()) {
|
||||
|
|
|
@ -31,6 +31,7 @@ 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) }
|
||||
|
||||
private var filePath = ""
|
||||
private var originalText = ""
|
||||
|
@ -39,7 +40,6 @@ class ReadTextActivity : SimpleActivity() {
|
|||
private var searchMatches = emptyList<Int>()
|
||||
private var isSearchActive = false
|
||||
|
||||
private lateinit var binding: ActivityReadTextBinding
|
||||
private lateinit var searchQueryET: MyEditText
|
||||
private lateinit var searchPrevBtn: ImageView
|
||||
private lateinit var searchNextBtn: ImageView
|
||||
|
@ -48,7 +48,6 @@ class ReadTextActivity : SimpleActivity() {
|
|||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
isMaterialActivity = true
|
||||
super.onCreate(savedInstanceState)
|
||||
binding = ActivityReadTextBinding.inflate(layoutInflater)
|
||||
setContentView(binding.root)
|
||||
setupOptionsMenu()
|
||||
binding.apply {
|
||||
|
|
|
@ -13,11 +13,10 @@ import com.simplemobiletools.filemanager.pro.extensions.config
|
|||
import java.io.File
|
||||
|
||||
class SaveAsActivity : SimpleActivity() {
|
||||
private lateinit var binding: ActivitySaveAsBinding
|
||||
private val binding by lazy(LazyThreadSafetyMode.NONE) { ActivitySaveAsBinding.inflate(layoutInflater) }
|
||||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
binding = ActivitySaveAsBinding.inflate(layoutInflater)
|
||||
setContentView(binding.root)
|
||||
|
||||
if (intent.action == Intent.ACTION_SEND && intent.extras?.containsKey(Intent.EXTRA_STREAM) == true) {
|
||||
|
|
|
@ -18,12 +18,11 @@ import java.util.Locale
|
|||
import kotlin.system.exitProcess
|
||||
|
||||
class SettingsActivity : SimpleActivity() {
|
||||
private lateinit var binding: ActivitySettingsBinding
|
||||
private val binding by lazy(LazyThreadSafetyMode.NONE) { ActivitySettingsBinding.inflate(layoutInflater) }
|
||||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
isMaterialActivity = true
|
||||
super.onCreate(savedInstanceState)
|
||||
binding = ActivitySettingsBinding.inflate(layoutInflater)
|
||||
setContentView(binding.root)
|
||||
binding.apply {
|
||||
updateMaterialActivityViews(settingsCoordinator, settingsHolder, useTransparentNavigation = true, useTopSearchMenu = false)
|
||||
|
|
|
@ -942,8 +942,7 @@ class ItemsAdapter(
|
|||
else -> {
|
||||
if (isListViewType) {
|
||||
ItemFileDirList
|
||||
} else {
|
||||
if (viewType == TYPE_DIR) {
|
||||
} else if (viewType == TYPE_DIR) {
|
||||
ItemDirGrid
|
||||
} else {
|
||||
ItemFileGrid
|
||||
|
@ -952,7 +951,6 @@ class ItemsAdapter(
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fun inflate(layoutInflater: LayoutInflater, viewGroup: ViewGroup, attachToRoot: Boolean): ItemViewBinding
|
||||
fun bind(view: View): ItemViewBinding
|
||||
|
|
Loading…
Reference in New Issue