mirror of
https://github.com/FossifyOrg/File-Manager.git
synced 2026-04-13 10:59:02 -04:00
Merge pull request #146 from FossifyOrg/update_deps
Update AGP and dependencies
This commit is contained in:
@@ -94,6 +94,13 @@ android {
|
||||
warningsAsErrors = true
|
||||
baseline = file("lint-baseline.xml")
|
||||
}
|
||||
|
||||
bundle {
|
||||
language {
|
||||
@Suppress("UnstableApiUsage")
|
||||
enableSplit = false
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
detekt {
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
package org.fossify.filemanager
|
||||
|
||||
import android.app.Application
|
||||
import com.github.ajalt.reprint.core.Reprint
|
||||
import org.fossify.commons.extensions.checkUseEnglish
|
||||
import org.fossify.commons.FossifyApp
|
||||
|
||||
class App : FossifyApp() {
|
||||
override val isAppLockFeatureAvailable = true
|
||||
|
||||
class App : Application() {
|
||||
override fun onCreate() {
|
||||
super.onCreate()
|
||||
checkUseEnglish()
|
||||
Reprint.initialize(this)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,10 +8,20 @@ import net.lingala.zip4j.io.inputstream.ZipInputStream
|
||||
import net.lingala.zip4j.model.LocalFileHeader
|
||||
import org.fossify.commons.dialogs.EnterPasswordDialog
|
||||
import org.fossify.commons.dialogs.FilePickerDialog
|
||||
import org.fossify.commons.extensions.*
|
||||
import org.fossify.commons.extensions.createDirectorySync
|
||||
import org.fossify.commons.extensions.getDoesFilePathExist
|
||||
import org.fossify.commons.extensions.getFileOutputStreamSync
|
||||
import org.fossify.commons.extensions.getFilenameFromPath
|
||||
import org.fossify.commons.extensions.getMimeType
|
||||
import org.fossify.commons.extensions.getParentPath
|
||||
import org.fossify.commons.extensions.getRealPathFromURI
|
||||
import org.fossify.commons.extensions.internalStoragePath
|
||||
import org.fossify.commons.extensions.isGone
|
||||
import org.fossify.commons.extensions.showErrorToast
|
||||
import org.fossify.commons.extensions.toast
|
||||
import org.fossify.commons.extensions.viewBinding
|
||||
import org.fossify.commons.helpers.NavigationIcon
|
||||
import org.fossify.commons.helpers.ensureBackgroundThread
|
||||
import org.fossify.commons.helpers.isOreoPlus
|
||||
import org.fossify.filemanager.R
|
||||
import org.fossify.filemanager.adapters.DecompressItemsAdapter
|
||||
import org.fossify.filemanager.databinding.ActivityDecompressBinding
|
||||
@@ -247,7 +257,7 @@ class DecompressActivity : SimpleActivity() {
|
||||
passwordDialog = null
|
||||
}
|
||||
|
||||
val lastModified = if (isOreoPlus()) zipEntry.lastModifiedTime else 0
|
||||
val lastModified = zipEntry.lastModifiedTime
|
||||
val filename = zipEntry.fileName.removeSuffix("/")
|
||||
allFiles.add(
|
||||
ListItem(
|
||||
|
||||
@@ -18,8 +18,48 @@ import com.stericson.RootTools.RootTools
|
||||
import me.grantland.widget.AutofitHelper
|
||||
import org.fossify.commons.dialogs.ConfirmationAdvancedDialog
|
||||
import org.fossify.commons.dialogs.RadioGroupDialog
|
||||
import org.fossify.commons.extensions.*
|
||||
import org.fossify.commons.helpers.*
|
||||
import org.fossify.commons.extensions.appLaunched
|
||||
import org.fossify.commons.extensions.appLockManager
|
||||
import org.fossify.commons.extensions.beGoneIf
|
||||
import org.fossify.commons.extensions.checkWhatsNew
|
||||
import org.fossify.commons.extensions.getBottomNavigationBackgroundColor
|
||||
import org.fossify.commons.extensions.getColoredDrawableWithColor
|
||||
import org.fossify.commons.extensions.getFilePublicUri
|
||||
import org.fossify.commons.extensions.getMimeType
|
||||
import org.fossify.commons.extensions.getProperBackgroundColor
|
||||
import org.fossify.commons.extensions.getProperTextColor
|
||||
import org.fossify.commons.extensions.getRealPathFromURI
|
||||
import org.fossify.commons.extensions.getStorageDirectories
|
||||
import org.fossify.commons.extensions.getTimeFormat
|
||||
import org.fossify.commons.extensions.handleHiddenFolderPasswordProtection
|
||||
import org.fossify.commons.extensions.hasOTGConnected
|
||||
import org.fossify.commons.extensions.hasPermission
|
||||
import org.fossify.commons.extensions.hideKeyboard
|
||||
import org.fossify.commons.extensions.humanizePath
|
||||
import org.fossify.commons.extensions.internalStoragePath
|
||||
import org.fossify.commons.extensions.isPathOnOTG
|
||||
import org.fossify.commons.extensions.isPathOnSD
|
||||
import org.fossify.commons.extensions.launchMoreAppsFromUsIntent
|
||||
import org.fossify.commons.extensions.onGlobalLayout
|
||||
import org.fossify.commons.extensions.onTabSelectionChanged
|
||||
import org.fossify.commons.extensions.sdCardPath
|
||||
import org.fossify.commons.extensions.showErrorToast
|
||||
import org.fossify.commons.extensions.toast
|
||||
import org.fossify.commons.extensions.updateBottomTabItemColors
|
||||
import org.fossify.commons.extensions.viewBinding
|
||||
import org.fossify.commons.helpers.LICENSE_AUTOFITTEXTVIEW
|
||||
import org.fossify.commons.helpers.LICENSE_GESTURE_VIEWS
|
||||
import org.fossify.commons.helpers.LICENSE_GLIDE
|
||||
import org.fossify.commons.helpers.LICENSE_PATTERN
|
||||
import org.fossify.commons.helpers.LICENSE_REPRINT
|
||||
import org.fossify.commons.helpers.LICENSE_ZIP4J
|
||||
import org.fossify.commons.helpers.PERMISSION_WRITE_STORAGE
|
||||
import org.fossify.commons.helpers.TAB_FILES
|
||||
import org.fossify.commons.helpers.TAB_RECENT_FILES
|
||||
import org.fossify.commons.helpers.TAB_STORAGE_ANALYSIS
|
||||
import org.fossify.commons.helpers.VIEW_TYPE_GRID
|
||||
import org.fossify.commons.helpers.ensureBackgroundThread
|
||||
import org.fossify.commons.helpers.isRPlus
|
||||
import org.fossify.commons.models.FAQItem
|
||||
import org.fossify.commons.models.RadioItem
|
||||
import org.fossify.commons.models.Release
|
||||
@@ -51,8 +91,6 @@ class MainActivity : SimpleActivity() {
|
||||
private val binding by viewBinding(ActivityMainBinding::inflate)
|
||||
|
||||
private var wasBackJustPressed = false
|
||||
private var mIsPasswordProtectionPending = false
|
||||
private var mWasProtectionHandled = false
|
||||
private var mTabsToShow = ArrayList<Int>()
|
||||
|
||||
private var mStoredFontSize = 0
|
||||
@@ -69,7 +107,7 @@ class MainActivity : SimpleActivity() {
|
||||
refreshMenuItems()
|
||||
mTabsToShow = getTabsList()
|
||||
|
||||
if (!config.wasStorageAnalysisTabAdded && isOreoPlus()) {
|
||||
if (!config.wasStorageAnalysisTabAdded) {
|
||||
config.wasStorageAnalysisTabAdded = true
|
||||
if (config.showTabs and TAB_STORAGE_ANALYSIS == 0) {
|
||||
config.showTabs += TAB_STORAGE_ANALYSIS
|
||||
@@ -81,22 +119,12 @@ class MainActivity : SimpleActivity() {
|
||||
|
||||
updateMaterialActivityViews(binding.mainCoordinator, null, useTransparentNavigation = false, useTopSearchMenu = true)
|
||||
|
||||
mIsPasswordProtectionPending = config.isAppPasswordProtectionOn
|
||||
|
||||
if (savedInstanceState == null) {
|
||||
handleAppPasswordProtection {
|
||||
mWasProtectionHandled = it
|
||||
if (it) {
|
||||
initFragments()
|
||||
mIsPasswordProtectionPending = false
|
||||
tryInitFileManager()
|
||||
checkWhatsNewDialog()
|
||||
checkIfRootAvailable()
|
||||
checkInvalidFavorites()
|
||||
} else {
|
||||
finish()
|
||||
}
|
||||
}
|
||||
initFragments()
|
||||
tryInitFileManager()
|
||||
checkWhatsNewDialog()
|
||||
checkIfRootAvailable()
|
||||
checkInvalidFavorites()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -128,7 +156,7 @@ class MainActivity : SimpleActivity() {
|
||||
}
|
||||
}
|
||||
|
||||
if (binding.mainViewPager.adapter == null && mWasProtectionHandled) {
|
||||
if (binding.mainViewPager.adapter == null) {
|
||||
initFragments()
|
||||
}
|
||||
}
|
||||
@@ -158,6 +186,7 @@ class MainActivity : SimpleActivity() {
|
||||
wasBackJustPressed = false
|
||||
}, BACK_PRESS_TIMEOUT.toLong())
|
||||
} else {
|
||||
appLockManager.lock()
|
||||
finish()
|
||||
}
|
||||
} else {
|
||||
@@ -241,20 +270,18 @@ class MainActivity : SimpleActivity() {
|
||||
override fun onSaveInstanceState(outState: Bundle) {
|
||||
super.onSaveInstanceState(outState)
|
||||
outState.putString(PICKED_PATH, getItemsFragment()?.currentPath ?: "")
|
||||
outState.putBoolean(WAS_PROTECTION_HANDLED, mWasProtectionHandled)
|
||||
}
|
||||
|
||||
override fun onRestoreInstanceState(savedInstanceState: Bundle) {
|
||||
super.onRestoreInstanceState(savedInstanceState)
|
||||
mWasProtectionHandled = savedInstanceState.getBoolean(WAS_PROTECTION_HANDLED, false)
|
||||
val path = savedInstanceState.getString(PICKED_PATH) ?: internalStoragePath
|
||||
|
||||
if (binding.mainViewPager.adapter == null) {
|
||||
binding.mainViewPager.onGlobalLayout {
|
||||
restorePath(path)
|
||||
openPath(path, true)
|
||||
}
|
||||
} else {
|
||||
restorePath(path)
|
||||
openPath(path, true)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -267,22 +294,6 @@ class MainActivity : SimpleActivity() {
|
||||
}
|
||||
}
|
||||
|
||||
private fun restorePath(path: String) {
|
||||
if (!mWasProtectionHandled) {
|
||||
handleAppPasswordProtection {
|
||||
mWasProtectionHandled = it
|
||||
if (it) {
|
||||
mIsPasswordProtectionPending = false
|
||||
openPath(path, true)
|
||||
} else {
|
||||
finish()
|
||||
}
|
||||
}
|
||||
} else {
|
||||
openPath(path, true)
|
||||
}
|
||||
}
|
||||
|
||||
private fun updateMenuColors() {
|
||||
updateStatusbarColor(getProperBackgroundColor())
|
||||
binding.mainMenu.updateColors()
|
||||
@@ -494,10 +505,6 @@ class MainActivity : SimpleActivity() {
|
||||
}
|
||||
|
||||
private fun openPath(path: String, forceRefresh: Boolean = false) {
|
||||
if (mIsPasswordProtectionPending && !mWasProtectionHandled) {
|
||||
return
|
||||
}
|
||||
|
||||
var newPath = path
|
||||
val file = File(path)
|
||||
if (config.OTGPath.isNotEmpty() && config.OTGPath == path.trimEnd('/')) {
|
||||
|
||||
@@ -33,6 +33,8 @@ open class SimpleActivity : BaseSimpleActivity() {
|
||||
|
||||
override fun getAppLauncherName() = getString(R.string.app_launcher_name)
|
||||
|
||||
override fun getRepositoryName() = "File-Manager"
|
||||
|
||||
@SuppressLint("NewApi")
|
||||
fun hasStoragePermission(): Boolean {
|
||||
return if (isRPlus()) {
|
||||
|
||||
@@ -35,19 +35,81 @@ import net.lingala.zip4j.model.LocalFileHeader
|
||||
import net.lingala.zip4j.model.ZipParameters
|
||||
import net.lingala.zip4j.model.enums.EncryptionMethod
|
||||
import org.fossify.commons.adapters.MyRecyclerViewAdapter
|
||||
import org.fossify.commons.dialogs.*
|
||||
import org.fossify.commons.extensions.*
|
||||
import org.fossify.commons.helpers.*
|
||||
import org.fossify.commons.dialogs.ConfirmationDialog
|
||||
import org.fossify.commons.dialogs.FilePickerDialog
|
||||
import org.fossify.commons.dialogs.PropertiesDialog
|
||||
import org.fossify.commons.dialogs.RadioGroupDialog
|
||||
import org.fossify.commons.dialogs.RenameDialog
|
||||
import org.fossify.commons.dialogs.RenameItemDialog
|
||||
import org.fossify.commons.dialogs.RenameItemsDialog
|
||||
import org.fossify.commons.extensions.applyColorFilter
|
||||
import org.fossify.commons.extensions.beGone
|
||||
import org.fossify.commons.extensions.beVisible
|
||||
import org.fossify.commons.extensions.beVisibleIf
|
||||
import org.fossify.commons.extensions.convertToBitmap
|
||||
import org.fossify.commons.extensions.copyToClipboard
|
||||
import org.fossify.commons.extensions.createDirectorySync
|
||||
import org.fossify.commons.extensions.deleteFile
|
||||
import org.fossify.commons.extensions.deleteFileBg
|
||||
import org.fossify.commons.extensions.deleteFolderBg
|
||||
import org.fossify.commons.extensions.formatDate
|
||||
import org.fossify.commons.extensions.formatSize
|
||||
import org.fossify.commons.extensions.getAndroidSAFFileItems
|
||||
import org.fossify.commons.extensions.getAndroidSAFUri
|
||||
import org.fossify.commons.extensions.getColoredDrawableWithColor
|
||||
import org.fossify.commons.extensions.getDefaultCopyDestinationPath
|
||||
import org.fossify.commons.extensions.getDocumentFile
|
||||
import org.fossify.commons.extensions.getDoesFilePathExist
|
||||
import org.fossify.commons.extensions.getFileCount
|
||||
import org.fossify.commons.extensions.getFileInputStreamSync
|
||||
import org.fossify.commons.extensions.getFileOutputStreamSync
|
||||
import org.fossify.commons.extensions.getFilenameFromPath
|
||||
import org.fossify.commons.extensions.getIsPathDirectory
|
||||
import org.fossify.commons.extensions.getMimeType
|
||||
import org.fossify.commons.extensions.getParentPath
|
||||
import org.fossify.commons.extensions.getProperSize
|
||||
import org.fossify.commons.extensions.getTextSize
|
||||
import org.fossify.commons.extensions.getTimeFormat
|
||||
import org.fossify.commons.extensions.handleDeletePasswordProtection
|
||||
import org.fossify.commons.extensions.hasOTGConnected
|
||||
import org.fossify.commons.extensions.highlightTextPart
|
||||
import org.fossify.commons.extensions.isPathOnOTG
|
||||
import org.fossify.commons.extensions.isRestrictedSAFOnlyRoot
|
||||
import org.fossify.commons.extensions.relativizeWith
|
||||
import org.fossify.commons.extensions.setupViewBackground
|
||||
import org.fossify.commons.extensions.showErrorToast
|
||||
import org.fossify.commons.extensions.toFileDirItem
|
||||
import org.fossify.commons.extensions.toast
|
||||
import org.fossify.commons.helpers.CONFLICT_OVERWRITE
|
||||
import org.fossify.commons.helpers.CONFLICT_SKIP
|
||||
import org.fossify.commons.helpers.VIEW_TYPE_LIST
|
||||
import org.fossify.commons.helpers.ensureBackgroundThread
|
||||
import org.fossify.commons.helpers.getFilePlaceholderDrawables
|
||||
import org.fossify.commons.models.FileDirItem
|
||||
import org.fossify.commons.models.RadioItem
|
||||
import org.fossify.commons.views.MyRecyclerView
|
||||
import org.fossify.filemanager.R
|
||||
import org.fossify.filemanager.activities.SimpleActivity
|
||||
import org.fossify.filemanager.activities.SplashActivity
|
||||
import org.fossify.filemanager.databinding.*
|
||||
import org.fossify.filemanager.databinding.ItemDirGridBinding
|
||||
import org.fossify.filemanager.databinding.ItemEmptyBinding
|
||||
import org.fossify.filemanager.databinding.ItemFileDirListBinding
|
||||
import org.fossify.filemanager.databinding.ItemFileGridBinding
|
||||
import org.fossify.filemanager.databinding.ItemSectionBinding
|
||||
import org.fossify.filemanager.dialogs.CompressAsDialog
|
||||
import org.fossify.filemanager.extensions.*
|
||||
import org.fossify.filemanager.helpers.*
|
||||
import org.fossify.filemanager.extensions.config
|
||||
import org.fossify.filemanager.extensions.isPathOnRoot
|
||||
import org.fossify.filemanager.extensions.isZipFile
|
||||
import org.fossify.filemanager.extensions.setAs
|
||||
import org.fossify.filemanager.extensions.sharePaths
|
||||
import org.fossify.filemanager.extensions.toggleItemVisibility
|
||||
import org.fossify.filemanager.extensions.tryOpenPathIntent
|
||||
import org.fossify.filemanager.helpers.OPEN_AS_AUDIO
|
||||
import org.fossify.filemanager.helpers.OPEN_AS_IMAGE
|
||||
import org.fossify.filemanager.helpers.OPEN_AS_OTHER
|
||||
import org.fossify.filemanager.helpers.OPEN_AS_TEXT
|
||||
import org.fossify.filemanager.helpers.OPEN_AS_VIDEO
|
||||
import org.fossify.filemanager.helpers.RootHelpers
|
||||
import org.fossify.filemanager.interfaces.ItemOperationsListener
|
||||
import org.fossify.filemanager.models.ListItem
|
||||
import java.io.BufferedInputStream
|
||||
@@ -112,7 +174,7 @@ class ItemsAdapter(
|
||||
findItem(R.id.cab_open_with).isVisible = isOneFileSelected()
|
||||
findItem(R.id.cab_open_as).isVisible = isOneFileSelected()
|
||||
findItem(R.id.cab_set_as).isVisible = isOneFileSelected()
|
||||
findItem(R.id.cab_create_shortcut).isVisible = isOreoPlus() && isOneItemSelected()
|
||||
findItem(R.id.cab_create_shortcut).isVisible = isOneItemSelected()
|
||||
|
||||
checkHideBtnVisibility(this)
|
||||
}
|
||||
|
||||
@@ -1,13 +1,11 @@
|
||||
package org.fossify.filemanager.dialogs
|
||||
|
||||
import org.fossify.commons.activities.BaseSimpleActivity
|
||||
import org.fossify.commons.extensions.beGone
|
||||
import org.fossify.commons.extensions.getAlertDialogBuilder
|
||||
import org.fossify.commons.extensions.setupDialogStuff
|
||||
import org.fossify.commons.helpers.TAB_FILES
|
||||
import org.fossify.commons.helpers.TAB_RECENT_FILES
|
||||
import org.fossify.commons.helpers.TAB_STORAGE_ANALYSIS
|
||||
import org.fossify.commons.helpers.isOreoPlus
|
||||
import org.fossify.commons.views.MyAppCompatCheckbox
|
||||
import org.fossify.filemanager.R
|
||||
import org.fossify.filemanager.databinding.DialogManageVisibleTabsBinding
|
||||
@@ -25,10 +23,6 @@ class ManageVisibleTabsDialog(val activity: BaseSimpleActivity) {
|
||||
put(TAB_STORAGE_ANALYSIS, R.id.manage_visible_tabs_storage_analysis)
|
||||
}
|
||||
|
||||
if (!isOreoPlus()) {
|
||||
binding.manageVisibleTabsStorageAnalysis.beGone()
|
||||
}
|
||||
|
||||
val showTabs = activity.config.showTabs
|
||||
for ((key, value) in tabs) {
|
||||
binding.root.findViewById<MyAppCompatCheckbox>(value).isChecked = showTabs and key != 0
|
||||
|
||||
@@ -2,15 +2,24 @@ package org.fossify.filemanager.extensions
|
||||
|
||||
import android.app.Activity
|
||||
import android.content.Intent
|
||||
import android.net.Uri
|
||||
import android.view.View
|
||||
import androidx.appcompat.app.AppCompatActivity
|
||||
import androidx.core.content.FileProvider
|
||||
import org.fossify.commons.activities.BaseSimpleActivity
|
||||
import org.fossify.commons.extensions.*
|
||||
import org.fossify.commons.helpers.isNougatPlus
|
||||
import org.fossify.commons.extensions.getFilenameFromPath
|
||||
import org.fossify.commons.extensions.getMimeTypeFromUri
|
||||
import org.fossify.commons.extensions.getParentPath
|
||||
import org.fossify.commons.extensions.launchActivityIntent
|
||||
import org.fossify.commons.extensions.openPathIntent
|
||||
import org.fossify.commons.extensions.renameFile
|
||||
import org.fossify.commons.extensions.setAsIntent
|
||||
import org.fossify.commons.extensions.sharePathsIntent
|
||||
import org.fossify.filemanager.BuildConfig
|
||||
import org.fossify.filemanager.helpers.*
|
||||
import org.fossify.filemanager.helpers.OPEN_AS_AUDIO
|
||||
import org.fossify.filemanager.helpers.OPEN_AS_DEFAULT
|
||||
import org.fossify.filemanager.helpers.OPEN_AS_IMAGE
|
||||
import org.fossify.filemanager.helpers.OPEN_AS_TEXT
|
||||
import org.fossify.filemanager.helpers.OPEN_AS_VIDEO
|
||||
import java.io.File
|
||||
|
||||
fun Activity.sharePaths(paths: ArrayList<String>) {
|
||||
@@ -19,11 +28,9 @@ fun Activity.sharePaths(paths: ArrayList<String>) {
|
||||
|
||||
fun Activity.tryOpenPathIntent(path: String, forceChooser: Boolean, openAsType: Int = OPEN_AS_DEFAULT, finishActivity: Boolean = false) {
|
||||
if (!forceChooser && path.endsWith(".apk", true)) {
|
||||
val uri = if (isNougatPlus()) {
|
||||
FileProvider.getUriForFile(this, "${BuildConfig.APPLICATION_ID}.provider", File(path))
|
||||
} else {
|
||||
Uri.fromFile(File(path))
|
||||
}
|
||||
val uri = FileProvider.getUriForFile(
|
||||
this, "${BuildConfig.APPLICATION_ID}.provider", File(path)
|
||||
)
|
||||
|
||||
Intent().apply {
|
||||
action = Intent.ACTION_VIEW
|
||||
|
||||
@@ -4,7 +4,6 @@ import android.content.Context
|
||||
import android.os.storage.StorageManager
|
||||
import org.fossify.commons.extensions.isPathOnOTG
|
||||
import org.fossify.commons.extensions.isPathOnSD
|
||||
import org.fossify.commons.helpers.isNougatPlus
|
||||
import org.fossify.filemanager.helpers.Config
|
||||
import org.fossify.filemanager.helpers.PRIMARY_VOLUME_NAME
|
||||
import java.util.Locale
|
||||
@@ -15,15 +14,13 @@ fun Context.isPathOnRoot(path: String) = !(path.startsWith(config.internalStorag
|
||||
|
||||
fun Context.getAllVolumeNames(): List<String> {
|
||||
val volumeNames = mutableListOf(PRIMARY_VOLUME_NAME)
|
||||
if (isNougatPlus()) {
|
||||
val storageManager = getSystemService(Context.STORAGE_SERVICE) as StorageManager
|
||||
getExternalFilesDirs(null)
|
||||
.mapNotNull { storageManager.getStorageVolume(it) }
|
||||
.filterNot { it.isPrimary }
|
||||
.mapNotNull { it.uuid?.lowercase(Locale.US) }
|
||||
.forEach {
|
||||
volumeNames.add(it)
|
||||
}
|
||||
}
|
||||
val storageManager = getSystemService(Context.STORAGE_SERVICE) as StorageManager
|
||||
getExternalFilesDirs(null)
|
||||
.mapNotNull { storageManager.getStorageVolume(it) }
|
||||
.filterNot { it.isPrimary }
|
||||
.mapNotNull { it.uuid?.lowercase(Locale.US) }
|
||||
.forEach {
|
||||
volumeNames.add(it)
|
||||
}
|
||||
return volumeNames
|
||||
}
|
||||
|
||||
@@ -6,11 +6,16 @@ import android.provider.MediaStore.Files
|
||||
import android.provider.MediaStore.Files.FileColumns
|
||||
import android.util.AttributeSet
|
||||
import androidx.core.os.bundleOf
|
||||
import org.fossify.commons.extensions.*
|
||||
import org.fossify.commons.extensions.areSystemAnimationsEnabled
|
||||
import org.fossify.commons.extensions.beVisibleIf
|
||||
import org.fossify.commons.extensions.getDoesFilePathExist
|
||||
import org.fossify.commons.extensions.getFilenameFromPath
|
||||
import org.fossify.commons.extensions.getLongValue
|
||||
import org.fossify.commons.extensions.getStringValue
|
||||
import org.fossify.commons.extensions.showErrorToast
|
||||
import org.fossify.commons.helpers.VIEW_TYPE_GRID
|
||||
import org.fossify.commons.helpers.VIEW_TYPE_LIST
|
||||
import org.fossify.commons.helpers.ensureBackgroundThread
|
||||
import org.fossify.commons.helpers.isOreoPlus
|
||||
import org.fossify.commons.models.FileDirItem
|
||||
import org.fossify.commons.views.MyGridLayoutManager
|
||||
import org.fossify.commons.views.MyRecyclerView
|
||||
@@ -156,17 +161,13 @@ class RecentsFragment(context: Context, attributeSet: AttributeSet) : MyViewPage
|
||||
)
|
||||
|
||||
try {
|
||||
if (isOreoPlus()) {
|
||||
val queryArgs = bundleOf(
|
||||
ContentResolver.QUERY_ARG_LIMIT to RECENTS_LIMIT,
|
||||
ContentResolver.QUERY_ARG_SORT_COLUMNS to arrayOf(FileColumns.DATE_MODIFIED),
|
||||
ContentResolver.QUERY_ARG_SORT_DIRECTION to ContentResolver.QUERY_SORT_DIRECTION_DESCENDING
|
||||
)
|
||||
context?.contentResolver?.query(uri, projection, queryArgs, null)
|
||||
} else {
|
||||
val sortOrder = "${FileColumns.DATE_MODIFIED} DESC LIMIT $RECENTS_LIMIT"
|
||||
context?.contentResolver?.query(uri, projection, null, null, sortOrder)
|
||||
}?.use { cursor ->
|
||||
val queryArgs = bundleOf(
|
||||
ContentResolver.QUERY_ARG_LIMIT to RECENTS_LIMIT,
|
||||
ContentResolver.QUERY_ARG_SORT_COLUMNS to arrayOf(FileColumns.DATE_MODIFIED),
|
||||
ContentResolver.QUERY_ARG_SORT_DIRECTION to ContentResolver.QUERY_SORT_DIRECTION_DESCENDING
|
||||
)
|
||||
|
||||
context?.contentResolver?.query(uri, projection, queryArgs, null)?.use { cursor ->
|
||||
if (cursor.moveToFirst()) {
|
||||
do {
|
||||
val path = cursor.getStringValue(FileColumns.DATA)
|
||||
|
||||
@@ -16,8 +16,26 @@ import androidx.appcompat.app.AppCompatActivity
|
||||
import androidx.core.os.bundleOf
|
||||
import androidx.core.view.children
|
||||
import androidx.core.view.isVisible
|
||||
import org.fossify.commons.extensions.*
|
||||
import org.fossify.commons.helpers.*
|
||||
import org.fossify.commons.extensions.adjustAlpha
|
||||
import org.fossify.commons.extensions.applyColorFilter
|
||||
import org.fossify.commons.extensions.beGone
|
||||
import org.fossify.commons.extensions.beVisible
|
||||
import org.fossify.commons.extensions.beVisibleIf
|
||||
import org.fossify.commons.extensions.fadeIn
|
||||
import org.fossify.commons.extensions.formatSize
|
||||
import org.fossify.commons.extensions.getIsPathDirectory
|
||||
import org.fossify.commons.extensions.getLongValue
|
||||
import org.fossify.commons.extensions.getProperBackgroundColor
|
||||
import org.fossify.commons.extensions.getProperPrimaryColor
|
||||
import org.fossify.commons.extensions.getStringValue
|
||||
import org.fossify.commons.extensions.queryCursor
|
||||
import org.fossify.commons.extensions.showErrorToast
|
||||
import org.fossify.commons.extensions.updateTextColors
|
||||
import org.fossify.commons.helpers.LOWER_ALPHA
|
||||
import org.fossify.commons.helpers.SHORT_ANIMATION_DURATION
|
||||
import org.fossify.commons.helpers.VIEW_TYPE_GRID
|
||||
import org.fossify.commons.helpers.VIEW_TYPE_LIST
|
||||
import org.fossify.commons.helpers.ensureBackgroundThread
|
||||
import org.fossify.commons.models.FileDirItem
|
||||
import org.fossify.commons.views.MyGridLayoutManager
|
||||
import org.fossify.filemanager.R
|
||||
@@ -29,7 +47,19 @@ import org.fossify.filemanager.databinding.StorageFragmentBinding
|
||||
import org.fossify.filemanager.extensions.config
|
||||
import org.fossify.filemanager.extensions.formatSizeThousand
|
||||
import org.fossify.filemanager.extensions.getAllVolumeNames
|
||||
import org.fossify.filemanager.helpers.*
|
||||
import org.fossify.filemanager.helpers.ARCHIVES
|
||||
import org.fossify.filemanager.helpers.AUDIO
|
||||
import org.fossify.filemanager.helpers.DOCUMENTS
|
||||
import org.fossify.filemanager.helpers.IMAGES
|
||||
import org.fossify.filemanager.helpers.OTHERS
|
||||
import org.fossify.filemanager.helpers.PRIMARY_VOLUME_NAME
|
||||
import org.fossify.filemanager.helpers.SHOW_MIMETYPE
|
||||
import org.fossify.filemanager.helpers.VIDEOS
|
||||
import org.fossify.filemanager.helpers.VOLUME_NAME
|
||||
import org.fossify.filemanager.helpers.archiveMimeTypes
|
||||
import org.fossify.filemanager.helpers.extraAudioMimeTypes
|
||||
import org.fossify.filemanager.helpers.extraDocumentMimeTypes
|
||||
import org.fossify.filemanager.helpers.getListItemsFromFileDirItems
|
||||
import org.fossify.filemanager.interfaces.ItemOperationsListener
|
||||
import org.fossify.filemanager.models.ListItem
|
||||
import java.util.Locale
|
||||
@@ -173,10 +203,6 @@ class StorageFragment(context: Context, attributeSet: AttributeSet) : MyViewPage
|
||||
}
|
||||
|
||||
private fun getSizes(volumeName: String) {
|
||||
if (!isOreoPlus()) {
|
||||
return
|
||||
}
|
||||
|
||||
ensureBackgroundThread {
|
||||
val filesSize = getSizesByMimeType(volumeName)
|
||||
val fileSizeImages = filesSize[IMAGES]!!
|
||||
@@ -284,15 +310,10 @@ class StorageFragment(context: Context, attributeSet: AttributeSet) : MyViewPage
|
||||
if (storageVolume.isPrimary) {
|
||||
// internal storage
|
||||
volumeName = PRIMARY_VOLUME_NAME
|
||||
if (isOreoPlus()) {
|
||||
val storageStatsManager = context.getSystemService(AppCompatActivity.STORAGE_STATS_SERVICE) as StorageStatsManager
|
||||
val uuid = StorageManager.UUID_DEFAULT
|
||||
totalStorageSpace = storageStatsManager.getTotalBytes(uuid)
|
||||
freeStorageSpace = storageStatsManager.getFreeBytes(uuid)
|
||||
} else {
|
||||
totalStorageSpace = file.totalSpace
|
||||
freeStorageSpace = file.freeSpace
|
||||
}
|
||||
val storageStatsManager = context.getSystemService(AppCompatActivity.STORAGE_STATS_SERVICE) as StorageStatsManager
|
||||
val uuid = StorageManager.UUID_DEFAULT
|
||||
totalStorageSpace = storageStatsManager.getTotalBytes(uuid)
|
||||
freeStorageSpace = storageStatsManager.getFreeBytes(uuid)
|
||||
} else {
|
||||
volumeName = storageVolume.uuid!!.lowercase(Locale.US)
|
||||
totalStorageSpace = file.totalSpace
|
||||
@@ -405,16 +426,12 @@ class StorageFragment(context: Context, attributeSet: AttributeSet) : MyViewPage
|
||||
)
|
||||
|
||||
try {
|
||||
if (isOreoPlus()) {
|
||||
val queryArgs = bundleOf(
|
||||
ContentResolver.QUERY_ARG_SORT_COLUMNS to arrayOf(MediaStore.Files.FileColumns.DATE_MODIFIED),
|
||||
ContentResolver.QUERY_ARG_SORT_DIRECTION to ContentResolver.QUERY_SORT_DIRECTION_DESCENDING
|
||||
)
|
||||
context?.contentResolver?.query(uri, projection, queryArgs, null)
|
||||
} else {
|
||||
val sortOrder = "${MediaStore.Files.FileColumns.DATE_MODIFIED} DESC"
|
||||
context?.contentResolver?.query(uri, projection, null, null, sortOrder)
|
||||
}?.use { cursor ->
|
||||
val queryArgs = bundleOf(
|
||||
ContentResolver.QUERY_ARG_SORT_COLUMNS to arrayOf(MediaStore.Files.FileColumns.DATE_MODIFIED),
|
||||
ContentResolver.QUERY_ARG_SORT_DIRECTION to ContentResolver.QUERY_SORT_DIRECTION_DESCENDING
|
||||
)
|
||||
|
||||
context?.contentResolver?.query(uri, projection, queryArgs, null)?.use { cursor ->
|
||||
if (cursor.moveToFirst()) {
|
||||
do {
|
||||
try {
|
||||
|
||||
@@ -62,12 +62,12 @@
|
||||
android:id="@+id/settings"
|
||||
android:icon="@drawable/ic_settings_cog_vector"
|
||||
android:title="@string/settings"
|
||||
app:showAsAction="ifRoom" />
|
||||
app:showAsAction="never" />
|
||||
<item
|
||||
android:id="@+id/about"
|
||||
android:icon="@drawable/ic_info_vector"
|
||||
android:title="@string/about"
|
||||
app:showAsAction="ifRoom" />
|
||||
app:showAsAction="never" />
|
||||
<item
|
||||
android:id="@+id/more_apps_from_us"
|
||||
android:title="@string/more_apps_from_us"
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
android:id="@+id/menu_print"
|
||||
android:icon="@drawable/ic_print_vector"
|
||||
android:title="@string/print"
|
||||
app:showAsAction="always" />
|
||||
app:showAsAction="ifRoom" />
|
||||
<item
|
||||
android:id="@+id/menu_open_with"
|
||||
android:showAsAction="never"
|
||||
|
||||
@@ -1,9 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<menu xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto">
|
||||
<item
|
||||
android:id="@+id/menu_print"
|
||||
android:icon="@drawable/ic_print_vector"
|
||||
android:title="@string/print"
|
||||
app:showAsAction="always" />
|
||||
</menu>
|
||||
@@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<bool name="show_donate_in_about">false</bool>
|
||||
<bool name="hide_google_relations">true</bool>
|
||||
<bool name="hide_google_relations">false</bool>
|
||||
<bool name="hide_all_external_links">true</bool>
|
||||
</resources>
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
[versions]
|
||||
#jetbrains
|
||||
kotlin = "1.9.10"
|
||||
kotlin = "1.9.25"
|
||||
#Detekt
|
||||
detekt = "1.23.3"
|
||||
#AndroidX
|
||||
androidx-swiperefreshlayout = "1.1.0"
|
||||
androidx-documentfile = "1.0.1"
|
||||
#Fossify
|
||||
commons = "18ad1dd308"
|
||||
commons = "3dd1f7f33e"
|
||||
#Other
|
||||
autofittextview = "0.2.1"
|
||||
gestureviews = "2.5.2"
|
||||
@@ -15,11 +15,11 @@ rootshell = "1.6"
|
||||
roottools = "87d3d22e93"
|
||||
zip4j = "2.11.5"
|
||||
#Gradle
|
||||
gradlePlugins-agp = "8.3.0"
|
||||
gradlePlugins-agp = "8.9.0"
|
||||
#build
|
||||
app-build-compileSDKVersion = "34"
|
||||
app-build-targetSDK = "34"
|
||||
app-build-minimumSDK = "23"
|
||||
app-build-minimumSDK = "26"
|
||||
app-build-javaVersion = "VERSION_17"
|
||||
app-build-kotlinJVMTarget = "17"
|
||||
#versioning
|
||||
|
||||
BIN
gradle/wrapper/gradle-wrapper.jar
vendored
BIN
gradle/wrapper/gradle-wrapper.jar
vendored
Binary file not shown.
5
gradle/wrapper/gradle-wrapper.properties
vendored
5
gradle/wrapper/gradle-wrapper.properties
vendored
@@ -1,6 +1,7 @@
|
||||
#Tue Nov 10 11:30:44 CET 2020
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.11.1-bin.zip
|
||||
networkTimeout=10000
|
||||
validateDistributionUrl=true
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.4-bin.zip
|
||||
|
||||
320
gradlew
vendored
320
gradlew
vendored
@@ -1,74 +1,130 @@
|
||||
#!/usr/bin/env bash
|
||||
#!/bin/sh
|
||||
|
||||
#
|
||||
# Copyright © 2015-2021 the original authors.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# https://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
#
|
||||
|
||||
##############################################################################
|
||||
##
|
||||
## Gradle start up script for UN*X
|
||||
##
|
||||
#
|
||||
# Gradle start up script for POSIX generated by Gradle.
|
||||
#
|
||||
# Important for running:
|
||||
#
|
||||
# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is
|
||||
# noncompliant, but you have some other compliant shell such as ksh or
|
||||
# bash, then to run this script, type that shell name before the whole
|
||||
# command line, like:
|
||||
#
|
||||
# ksh Gradle
|
||||
#
|
||||
# Busybox and similar reduced shells will NOT work, because this script
|
||||
# requires all of these POSIX shell features:
|
||||
# * functions;
|
||||
# * expansions «$var», «${var}», «${var:-default}», «${var+SET}»,
|
||||
# «${var#prefix}», «${var%suffix}», and «$( cmd )»;
|
||||
# * compound commands having a testable exit status, especially «case»;
|
||||
# * various built-in commands including «command», «set», and «ulimit».
|
||||
#
|
||||
# Important for patching:
|
||||
#
|
||||
# (2) This script targets any POSIX shell, so it avoids extensions provided
|
||||
# by Bash, Ksh, etc; in particular arrays are avoided.
|
||||
#
|
||||
# The "traditional" practice of packing multiple parameters into a
|
||||
# space-separated string is a well documented source of bugs and security
|
||||
# problems, so this is (mostly) avoided, by progressively accumulating
|
||||
# options in "$@", and eventually passing that to Java.
|
||||
#
|
||||
# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS,
|
||||
# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly;
|
||||
# see the in-line comments for details.
|
||||
#
|
||||
# There are tweaks for specific operating systems such as AIX, CygWin,
|
||||
# Darwin, MinGW, and NonStop.
|
||||
#
|
||||
# (3) This script is generated from the Groovy template
|
||||
# https://github.com/gradle/gradle/blob/HEAD/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
|
||||
# within the Gradle project.
|
||||
#
|
||||
# You can find Gradle at https://github.com/gradle/gradle/.
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||
DEFAULT_JVM_OPTS=""
|
||||
# Attempt to set APP_HOME
|
||||
|
||||
APP_NAME="Gradle"
|
||||
APP_BASE_NAME=`basename "$0"`
|
||||
# Resolve links: $0 may be a link
|
||||
app_path=$0
|
||||
|
||||
# Need this for daisy-chained symlinks.
|
||||
while
|
||||
APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path
|
||||
[ -h "$app_path" ]
|
||||
do
|
||||
ls=$( ls -ld "$app_path" )
|
||||
link=${ls#*' -> '}
|
||||
case $link in #(
|
||||
/*) app_path=$link ;; #(
|
||||
*) app_path=$APP_HOME$link ;;
|
||||
esac
|
||||
done
|
||||
|
||||
# This is normally unused
|
||||
# shellcheck disable=SC2034
|
||||
APP_BASE_NAME=${0##*/}
|
||||
# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
|
||||
APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s
|
||||
' "$PWD" ) || exit
|
||||
|
||||
# Use the maximum available, or set MAX_FD != -1 to use that value.
|
||||
MAX_FD="maximum"
|
||||
MAX_FD=maximum
|
||||
|
||||
warn ( ) {
|
||||
warn () {
|
||||
echo "$*"
|
||||
}
|
||||
} >&2
|
||||
|
||||
die ( ) {
|
||||
die () {
|
||||
echo
|
||||
echo "$*"
|
||||
echo
|
||||
exit 1
|
||||
}
|
||||
} >&2
|
||||
|
||||
# OS specific support (must be 'true' or 'false').
|
||||
cygwin=false
|
||||
msys=false
|
||||
darwin=false
|
||||
case "`uname`" in
|
||||
CYGWIN* )
|
||||
cygwin=true
|
||||
;;
|
||||
Darwin* )
|
||||
darwin=true
|
||||
;;
|
||||
MINGW* )
|
||||
msys=true
|
||||
;;
|
||||
nonstop=false
|
||||
case "$( uname )" in #(
|
||||
CYGWIN* ) cygwin=true ;; #(
|
||||
Darwin* ) darwin=true ;; #(
|
||||
MSYS* | MINGW* ) msys=true ;; #(
|
||||
NONSTOP* ) nonstop=true ;;
|
||||
esac
|
||||
|
||||
# Attempt to set APP_HOME
|
||||
# Resolve links: $0 may be a link
|
||||
PRG="$0"
|
||||
# Need this for relative symlinks.
|
||||
while [ -h "$PRG" ] ; do
|
||||
ls=`ls -ld "$PRG"`
|
||||
link=`expr "$ls" : '.*-> \(.*\)$'`
|
||||
if expr "$link" : '/.*' > /dev/null; then
|
||||
PRG="$link"
|
||||
else
|
||||
PRG=`dirname "$PRG"`"/$link"
|
||||
fi
|
||||
done
|
||||
SAVED="`pwd`"
|
||||
cd "`dirname \"$PRG\"`/" >/dev/null
|
||||
APP_HOME="`pwd -P`"
|
||||
cd "$SAVED" >/dev/null
|
||||
|
||||
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
|
||||
|
||||
|
||||
# Determine the Java command to use to start the JVM.
|
||||
if [ -n "$JAVA_HOME" ] ; then
|
||||
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
|
||||
# IBM's JDK on AIX uses strange locations for the executables
|
||||
JAVACMD="$JAVA_HOME/jre/sh/java"
|
||||
JAVACMD=$JAVA_HOME/jre/sh/java
|
||||
else
|
||||
JAVACMD="$JAVA_HOME/bin/java"
|
||||
JAVACMD=$JAVA_HOME/bin/java
|
||||
fi
|
||||
if [ ! -x "$JAVACMD" ] ; then
|
||||
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
|
||||
@@ -77,84 +133,120 @@ Please set the JAVA_HOME variable in your environment to match the
|
||||
location of your Java installation."
|
||||
fi
|
||||
else
|
||||
JAVACMD="java"
|
||||
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||
JAVACMD=java
|
||||
if ! command -v java >/dev/null 2>&1
|
||||
then
|
||||
die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||
|
||||
Please set the JAVA_HOME variable in your environment to match the
|
||||
location of your Java installation."
|
||||
fi
|
||||
fi
|
||||
|
||||
# Increase the maximum file descriptors if we can.
|
||||
if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then
|
||||
MAX_FD_LIMIT=`ulimit -H -n`
|
||||
if [ $? -eq 0 ] ; then
|
||||
if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
|
||||
MAX_FD="$MAX_FD_LIMIT"
|
||||
fi
|
||||
ulimit -n $MAX_FD
|
||||
if [ $? -ne 0 ] ; then
|
||||
warn "Could not set maximum file descriptor limit: $MAX_FD"
|
||||
fi
|
||||
else
|
||||
warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
|
||||
fi
|
||||
fi
|
||||
|
||||
# For Darwin, add options to specify how the application appears in the dock
|
||||
if $darwin; then
|
||||
GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
|
||||
fi
|
||||
|
||||
# For Cygwin, switch paths to Windows format before running java
|
||||
if $cygwin ; then
|
||||
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
|
||||
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
|
||||
JAVACMD=`cygpath --unix "$JAVACMD"`
|
||||
|
||||
# We build the pattern for arguments to be converted via cygpath
|
||||
ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
|
||||
SEP=""
|
||||
for dir in $ROOTDIRSRAW ; do
|
||||
ROOTDIRS="$ROOTDIRS$SEP$dir"
|
||||
SEP="|"
|
||||
done
|
||||
OURCYGPATTERN="(^($ROOTDIRS))"
|
||||
# Add a user-defined pattern to the cygpath arguments
|
||||
if [ "$GRADLE_CYGPATTERN" != "" ] ; then
|
||||
OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
|
||||
fi
|
||||
# Now convert the arguments - kludge to limit ourselves to /bin/sh
|
||||
i=0
|
||||
for arg in "$@" ; do
|
||||
CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
|
||||
CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
|
||||
|
||||
if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
|
||||
eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
|
||||
else
|
||||
eval `echo args$i`="\"$arg\""
|
||||
fi
|
||||
i=$((i+1))
|
||||
done
|
||||
case $i in
|
||||
(0) set -- ;;
|
||||
(1) set -- "$args0" ;;
|
||||
(2) set -- "$args0" "$args1" ;;
|
||||
(3) set -- "$args0" "$args1" "$args2" ;;
|
||||
(4) set -- "$args0" "$args1" "$args2" "$args3" ;;
|
||||
(5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
|
||||
(6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
|
||||
(7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
|
||||
(8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
|
||||
(9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
|
||||
if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
|
||||
case $MAX_FD in #(
|
||||
max*)
|
||||
# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
|
||||
# shellcheck disable=SC2039,SC3045
|
||||
MAX_FD=$( ulimit -H -n ) ||
|
||||
warn "Could not query maximum file descriptor limit"
|
||||
esac
|
||||
case $MAX_FD in #(
|
||||
'' | soft) :;; #(
|
||||
*)
|
||||
# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
|
||||
# shellcheck disable=SC2039,SC3045
|
||||
ulimit -n "$MAX_FD" ||
|
||||
warn "Could not set maximum file descriptor limit to $MAX_FD"
|
||||
esac
|
||||
fi
|
||||
|
||||
# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules
|
||||
function splitJvmOpts() {
|
||||
JVM_OPTS=("$@")
|
||||
}
|
||||
eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS
|
||||
JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME"
|
||||
# Collect all arguments for the java command, stacking in reverse order:
|
||||
# * args from the command line
|
||||
# * the main class name
|
||||
# * -classpath
|
||||
# * -D...appname settings
|
||||
# * --module-path (only if needed)
|
||||
# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables.
|
||||
|
||||
exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@"
|
||||
# For Cygwin or MSYS, switch paths to Windows format before running java
|
||||
if "$cygwin" || "$msys" ; then
|
||||
APP_HOME=$( cygpath --path --mixed "$APP_HOME" )
|
||||
CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" )
|
||||
|
||||
JAVACMD=$( cygpath --unix "$JAVACMD" )
|
||||
|
||||
# Now convert the arguments - kludge to limit ourselves to /bin/sh
|
||||
for arg do
|
||||
if
|
||||
case $arg in #(
|
||||
-*) false ;; # don't mess with options #(
|
||||
/?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath
|
||||
[ -e "$t" ] ;; #(
|
||||
*) false ;;
|
||||
esac
|
||||
then
|
||||
arg=$( cygpath --path --ignore --mixed "$arg" )
|
||||
fi
|
||||
# Roll the args list around exactly as many times as the number of
|
||||
# args, so each arg winds up back in the position where it started, but
|
||||
# possibly modified.
|
||||
#
|
||||
# NB: a `for` loop captures its iteration list before it begins, so
|
||||
# changing the positional parameters here affects neither the number of
|
||||
# iterations, nor the values presented in `arg`.
|
||||
shift # remove old arg
|
||||
set -- "$@" "$arg" # push replacement arg
|
||||
done
|
||||
fi
|
||||
|
||||
|
||||
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
|
||||
|
||||
# Collect all arguments for the java command:
|
||||
# * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments,
|
||||
# and any embedded shellness will be escaped.
|
||||
# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be
|
||||
# treated as '${Hostname}' itself on the command line.
|
||||
|
||||
set -- \
|
||||
"-Dorg.gradle.appname=$APP_BASE_NAME" \
|
||||
-classpath "$CLASSPATH" \
|
||||
org.gradle.wrapper.GradleWrapperMain \
|
||||
"$@"
|
||||
|
||||
# Stop when "xargs" is not available.
|
||||
if ! command -v xargs >/dev/null 2>&1
|
||||
then
|
||||
die "xargs is not available"
|
||||
fi
|
||||
|
||||
# Use "xargs" to parse quoted args.
|
||||
#
|
||||
# With -n1 it outputs one arg per line, with the quotes and backslashes removed.
|
||||
#
|
||||
# In Bash we could simply go:
|
||||
#
|
||||
# readarray ARGS < <( xargs -n1 <<<"$var" ) &&
|
||||
# set -- "${ARGS[@]}" "$@"
|
||||
#
|
||||
# but POSIX shell has neither arrays nor command substitution, so instead we
|
||||
# post-process each arg (as a line of input to sed) to backslash-escape any
|
||||
# character that might be a shell metacharacter, then use eval to reverse
|
||||
# that process (while maintaining the separation between arguments), and wrap
|
||||
# the whole thing up as a single "set" statement.
|
||||
#
|
||||
# This will of course break if any of these variables contains a newline or
|
||||
# an unmatched quote.
|
||||
#
|
||||
|
||||
eval "set -- $(
|
||||
printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" |
|
||||
xargs -n1 |
|
||||
sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' |
|
||||
tr '\n' ' '
|
||||
)" '"$@"'
|
||||
|
||||
exec "$JAVACMD" "$@"
|
||||
|
||||
88
gradlew.bat
vendored
88
gradlew.bat
vendored
@@ -1,4 +1,22 @@
|
||||
@if "%DEBUG%" == "" @echo off
|
||||
@rem
|
||||
@rem Copyright 2015 the original author or authors.
|
||||
@rem
|
||||
@rem Licensed under the Apache License, Version 2.0 (the "License");
|
||||
@rem you may not use this file except in compliance with the License.
|
||||
@rem You may obtain a copy of the License at
|
||||
@rem
|
||||
@rem https://www.apache.org/licenses/LICENSE-2.0
|
||||
@rem
|
||||
@rem Unless required by applicable law or agreed to in writing, software
|
||||
@rem distributed under the License is distributed on an "AS IS" BASIS,
|
||||
@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
@rem See the License for the specific language governing permissions and
|
||||
@rem limitations under the License.
|
||||
@rem
|
||||
@rem SPDX-License-Identifier: Apache-2.0
|
||||
@rem
|
||||
|
||||
@if "%DEBUG%"=="" @echo off
|
||||
@rem ##########################################################################
|
||||
@rem
|
||||
@rem Gradle startup script for Windows
|
||||
@@ -8,26 +26,30 @@
|
||||
@rem Set local scope for the variables with windows NT shell
|
||||
if "%OS%"=="Windows_NT" setlocal
|
||||
|
||||
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||
set DEFAULT_JVM_OPTS=
|
||||
|
||||
set DIRNAME=%~dp0
|
||||
if "%DIRNAME%" == "" set DIRNAME=.
|
||||
if "%DIRNAME%"=="" set DIRNAME=.
|
||||
@rem This is normally unused
|
||||
set APP_BASE_NAME=%~n0
|
||||
set APP_HOME=%DIRNAME%
|
||||
|
||||
@rem Resolve any "." and ".." in APP_HOME to make it shorter.
|
||||
for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
|
||||
|
||||
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||
set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
|
||||
|
||||
@rem Find java.exe
|
||||
if defined JAVA_HOME goto findJavaFromJavaHome
|
||||
|
||||
set JAVA_EXE=java.exe
|
||||
%JAVA_EXE% -version >NUL 2>&1
|
||||
if "%ERRORLEVEL%" == "0" goto init
|
||||
if %ERRORLEVEL% equ 0 goto execute
|
||||
|
||||
echo.
|
||||
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||
echo.
|
||||
echo Please set the JAVA_HOME variable in your environment to match the
|
||||
echo location of your Java installation.
|
||||
echo. 1>&2
|
||||
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2
|
||||
echo. 1>&2
|
||||
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
|
||||
echo location of your Java installation. 1>&2
|
||||
|
||||
goto fail
|
||||
|
||||
@@ -35,54 +57,36 @@ goto fail
|
||||
set JAVA_HOME=%JAVA_HOME:"=%
|
||||
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
|
||||
|
||||
if exist "%JAVA_EXE%" goto init
|
||||
if exist "%JAVA_EXE%" goto execute
|
||||
|
||||
echo.
|
||||
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
|
||||
echo.
|
||||
echo Please set the JAVA_HOME variable in your environment to match the
|
||||
echo location of your Java installation.
|
||||
echo. 1>&2
|
||||
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2
|
||||
echo. 1>&2
|
||||
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
|
||||
echo location of your Java installation. 1>&2
|
||||
|
||||
goto fail
|
||||
|
||||
:init
|
||||
@rem Get command-line arguments, handling Windowz variants
|
||||
|
||||
if not "%OS%" == "Windows_NT" goto win9xME_args
|
||||
if "%@eval[2+2]" == "4" goto 4NT_args
|
||||
|
||||
:win9xME_args
|
||||
@rem Slurp the command line arguments.
|
||||
set CMD_LINE_ARGS=
|
||||
set _SKIP=2
|
||||
|
||||
:win9xME_args_slurp
|
||||
if "x%~1" == "x" goto execute
|
||||
|
||||
set CMD_LINE_ARGS=%*
|
||||
goto execute
|
||||
|
||||
:4NT_args
|
||||
@rem Get arguments from the 4NT Shell from JP Software
|
||||
set CMD_LINE_ARGS=%$
|
||||
|
||||
:execute
|
||||
@rem Setup the command line
|
||||
|
||||
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
|
||||
|
||||
|
||||
@rem Execute Gradle
|
||||
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
|
||||
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
|
||||
|
||||
:end
|
||||
@rem End local scope for the variables with windows NT shell
|
||||
if "%ERRORLEVEL%"=="0" goto mainEnd
|
||||
if %ERRORLEVEL% equ 0 goto mainEnd
|
||||
|
||||
:fail
|
||||
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
|
||||
rem the _cmd.exe /c_ return code!
|
||||
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
|
||||
exit /b 1
|
||||
set EXIT_CODE=%ERRORLEVEL%
|
||||
if %EXIT_CODE% equ 0 set EXIT_CODE=1
|
||||
if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE%
|
||||
exit /b %EXIT_CODE%
|
||||
|
||||
:mainEnd
|
||||
if "%OS%"=="Windows_NT" endlocal
|
||||
|
||||
Reference in New Issue
Block a user