updating Commons and SDK to 27
This commit is contained in:
parent
efccbde581
commit
e68052bbbf
4 changed files with 32 additions and 29 deletions
|
@ -3,13 +3,13 @@ apply plugin: 'kotlin-android'
|
|||
apply plugin: 'kotlin-android-extensions'
|
||||
|
||||
android {
|
||||
compileSdkVersion 26
|
||||
buildToolsVersion "26.0.2"
|
||||
compileSdkVersion 27
|
||||
buildToolsVersion "27.0.1"
|
||||
|
||||
defaultConfig {
|
||||
applicationId "com.simplemobiletools.filemanager"
|
||||
minSdkVersion 16
|
||||
targetSdkVersion 26
|
||||
targetSdkVersion 27
|
||||
versionCode 37
|
||||
versionName "2.6.0"
|
||||
}
|
||||
|
@ -37,7 +37,7 @@ android {
|
|||
}
|
||||
|
||||
dependencies {
|
||||
compile 'com.simplemobiletools:commons:2.34.2'
|
||||
compile 'com.simplemobiletools:commons:2.38.2'
|
||||
compile 'com.bignerdranch.android:recyclerview-multiselect:0.2'
|
||||
compile "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
|
||||
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
package="com.simplemobiletools.filemanager">
|
||||
|
||||
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
|
||||
<uses-permission android:name="android.permission.VIBRATE"/>
|
||||
|
||||
<application
|
||||
android:name=".App"
|
||||
|
|
|
@ -66,17 +66,19 @@ class SettingsActivity : SimpleActivity() {
|
|||
settings_password_protection.isChecked = config.isPasswordProtectionOn
|
||||
settings_password_protection_holder.setOnClickListener {
|
||||
val tabToShow = if (config.isPasswordProtectionOn) config.protectionType else SHOW_ALL_TABS
|
||||
SecurityDialog(this, config.passwordHash, tabToShow) { hash, type ->
|
||||
val hasPasswordProtection = config.isPasswordProtectionOn
|
||||
settings_password_protection.isChecked = !hasPasswordProtection
|
||||
config.isPasswordProtectionOn = !hasPasswordProtection
|
||||
config.passwordHash = if (hasPasswordProtection) "" else hash
|
||||
config.protectionType = type
|
||||
SecurityDialog(this, config.passwordHash, tabToShow) { hash, type, success ->
|
||||
if (success) {
|
||||
val hasPasswordProtection = config.isPasswordProtectionOn
|
||||
settings_password_protection.isChecked = !hasPasswordProtection
|
||||
config.isPasswordProtectionOn = !hasPasswordProtection
|
||||
config.passwordHash = if (hasPasswordProtection) "" else hash
|
||||
config.protectionType = type
|
||||
|
||||
if (config.isPasswordProtectionOn) {
|
||||
val confirmationTextId = if (config.protectionType == PROTECTION_FINGERPRINT)
|
||||
R.string.fingerprint_setup_successfully else R.string.protection_setup_successfully
|
||||
ConfirmationDialog(this, "", confirmationTextId, R.string.ok, 0) { }
|
||||
if (config.isPasswordProtectionOn) {
|
||||
val confirmationTextId = if (config.protectionType == PROTECTION_FINGERPRINT)
|
||||
R.string.fingerprint_setup_successfully else R.string.protection_setup_successfully
|
||||
ConfirmationDialog(this, "", confirmationTextId, R.string.ok, 0) { }
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -45,13 +45,13 @@ class ItemsFragment : Fragment(), ItemsAdapter.ItemOperationsListener, Breadcrum
|
|||
|
||||
private lateinit var mView: View
|
||||
|
||||
override fun onCreateView(inflater: LayoutInflater?, container: ViewGroup?, savedInstanceState: Bundle?): View {
|
||||
mView = inflater!!.inflate(R.layout.items_fragment, container, false)!!
|
||||
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View {
|
||||
mView = inflater.inflate(R.layout.items_fragment, container, false)!!
|
||||
storeConfigVariables()
|
||||
return mView
|
||||
}
|
||||
|
||||
override fun onViewCreated(view: View?, savedInstanceState: Bundle?) {
|
||||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
||||
super.onViewCreated(view, savedInstanceState)
|
||||
mView.apply {
|
||||
items_swipe_refresh.setOnRefreshListener({ refreshItems() })
|
||||
|
@ -62,9 +62,9 @@ class ItemsFragment : Fragment(), ItemsAdapter.ItemOperationsListener, Breadcrum
|
|||
|
||||
override fun onResume() {
|
||||
super.onResume()
|
||||
context.updateTextColors(mView as ViewGroup)
|
||||
context!!.updateTextColors(mView as ViewGroup)
|
||||
mView.items_fastscroller.updateHandleColor()
|
||||
val newColor = context.config.textColor
|
||||
val newColor = context!!.config.textColor
|
||||
if (storedTextColor != newColor) {
|
||||
storedItems = ArrayList()
|
||||
(items_list.adapter as ItemsAdapter).updateTextColor(newColor)
|
||||
|
@ -81,7 +81,7 @@ class ItemsFragment : Fragment(), ItemsAdapter.ItemOperationsListener, Breadcrum
|
|||
}
|
||||
|
||||
private fun storeConfigVariables() {
|
||||
storedTextColor = context.config.textColor
|
||||
storedTextColor = context!!.config.textColor
|
||||
}
|
||||
|
||||
fun openPath(path: String) {
|
||||
|
@ -95,14 +95,14 @@ class ItemsFragment : Fragment(), ItemsAdapter.ItemOperationsListener, Breadcrum
|
|||
|
||||
scrollStates.put(currentPath, getScrollState())
|
||||
currentPath = realPath
|
||||
showHidden = context.config.shouldShowHidden
|
||||
showHidden = context!!.config.shouldShowHidden
|
||||
getItems(currentPath) {
|
||||
if (!isAdded)
|
||||
return@getItems
|
||||
|
||||
FileDirItem.sorting = context.config.getFolderSorting(currentPath)
|
||||
FileDirItem.sorting = context!!.config.getFolderSorting(currentPath)
|
||||
it.sort()
|
||||
activity.runOnUiThread {
|
||||
activity!!.runOnUiThread {
|
||||
addItems(it)
|
||||
}
|
||||
}
|
||||
|
@ -176,7 +176,7 @@ class ItemsFragment : Fragment(), ItemsAdapter.ItemOperationsListener, Breadcrum
|
|||
|
||||
private fun getItems(path: String, callback: (items: ArrayList<FileDirItem>) -> Unit) {
|
||||
Thread({
|
||||
if (!context.config.enableRootAccess || !context.isPathOnRoot(path)) {
|
||||
if (!context!!.config.enableRootAccess || !context!!.isPathOnRoot(path)) {
|
||||
getRegularItemsOf(path, callback)
|
||||
} else {
|
||||
RootHelpers().getFiles(activity as SimpleActivity, path, callback)
|
||||
|
@ -225,7 +225,7 @@ class ItemsFragment : Fragment(), ItemsAdapter.ItemOperationsListener, Breadcrum
|
|||
(activity as MainActivity).pickedPath(path)
|
||||
} else {
|
||||
val file = File(path)
|
||||
activity.openFile(Uri.fromFile(file), false)
|
||||
activity!!.openFile(Uri.fromFile(file), false)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -240,7 +240,7 @@ class ItemsFragment : Fragment(), ItemsAdapter.ItemOperationsListener, Breadcrum
|
|||
|
||||
override fun breadcrumbClicked(id: Int) {
|
||||
if (id == 0) {
|
||||
StoragePickerDialog(activity, currentPath) {
|
||||
StoragePickerDialog(activity!!, currentPath) {
|
||||
openPath(it)
|
||||
}
|
||||
} else {
|
||||
|
@ -255,15 +255,15 @@ class ItemsFragment : Fragment(), ItemsAdapter.ItemOperationsListener, Breadcrum
|
|||
|
||||
override fun deleteFiles(files: ArrayList<File>) {
|
||||
val hasFolder = files.any { it.isDirectory }
|
||||
if (context.isPathOnRoot(files.firstOrNull()?.absolutePath ?: context.config.internalStoragePath)) {
|
||||
if (context!!.isPathOnRoot(files.firstOrNull()?.absolutePath ?: context!!.config.internalStoragePath)) {
|
||||
files.forEach {
|
||||
RootTools.deleteFileOrDirectory(it.path, false)
|
||||
}
|
||||
} else {
|
||||
(activity as SimpleActivity).deleteFiles(files, hasFolder) {
|
||||
if (!it) {
|
||||
activity.runOnUiThread {
|
||||
activity.toast(R.string.unknown_error_occurred)
|
||||
activity!!.runOnUiThread {
|
||||
activity!!.toast(R.string.unknown_error_occurred)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue