updating Commons and SDK to 27

This commit is contained in:
tibbi 2017-11-09 20:42:30 +01:00
parent efccbde581
commit e68052bbbf
4 changed files with 32 additions and 29 deletions

View File

@ -3,13 +3,13 @@ apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions' apply plugin: 'kotlin-android-extensions'
android { android {
compileSdkVersion 26 compileSdkVersion 27
buildToolsVersion "26.0.2" buildToolsVersion "27.0.1"
defaultConfig { defaultConfig {
applicationId "com.simplemobiletools.filemanager" applicationId "com.simplemobiletools.filemanager"
minSdkVersion 16 minSdkVersion 16
targetSdkVersion 26 targetSdkVersion 27
versionCode 37 versionCode 37
versionName "2.6.0" versionName "2.6.0"
} }
@ -37,7 +37,7 @@ android {
} }
dependencies { dependencies {
compile 'com.simplemobiletools:commons:2.34.2' compile 'com.simplemobiletools:commons:2.38.2'
compile 'com.bignerdranch.android:recyclerview-multiselect:0.2' compile 'com.bignerdranch.android:recyclerview-multiselect:0.2'
compile "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version" compile "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"

View File

@ -4,6 +4,7 @@
package="com.simplemobiletools.filemanager"> package="com.simplemobiletools.filemanager">
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/> <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.VIBRATE"/>
<application <application
android:name=".App" android:name=".App"

View File

@ -66,7 +66,8 @@ class SettingsActivity : SimpleActivity() {
settings_password_protection.isChecked = config.isPasswordProtectionOn settings_password_protection.isChecked = config.isPasswordProtectionOn
settings_password_protection_holder.setOnClickListener { settings_password_protection_holder.setOnClickListener {
val tabToShow = if (config.isPasswordProtectionOn) config.protectionType else SHOW_ALL_TABS val tabToShow = if (config.isPasswordProtectionOn) config.protectionType else SHOW_ALL_TABS
SecurityDialog(this, config.passwordHash, tabToShow) { hash, type -> SecurityDialog(this, config.passwordHash, tabToShow) { hash, type, success ->
if (success) {
val hasPasswordProtection = config.isPasswordProtectionOn val hasPasswordProtection = config.isPasswordProtectionOn
settings_password_protection.isChecked = !hasPasswordProtection settings_password_protection.isChecked = !hasPasswordProtection
config.isPasswordProtectionOn = !hasPasswordProtection config.isPasswordProtectionOn = !hasPasswordProtection
@ -81,6 +82,7 @@ class SettingsActivity : SimpleActivity() {
} }
} }
} }
}
private fun setupKeepLastModified() { private fun setupKeepLastModified() {
settings_keep_last_modified.isChecked = config.keepLastModified settings_keep_last_modified.isChecked = config.keepLastModified

View File

@ -45,13 +45,13 @@ class ItemsFragment : Fragment(), ItemsAdapter.ItemOperationsListener, Breadcrum
private lateinit var mView: View private lateinit var mView: View
override fun onCreateView(inflater: LayoutInflater?, container: ViewGroup?, savedInstanceState: Bundle?): View { override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View {
mView = inflater!!.inflate(R.layout.items_fragment, container, false)!! mView = inflater.inflate(R.layout.items_fragment, container, false)!!
storeConfigVariables() storeConfigVariables()
return mView return mView
} }
override fun onViewCreated(view: View?, savedInstanceState: Bundle?) { override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState) super.onViewCreated(view, savedInstanceState)
mView.apply { mView.apply {
items_swipe_refresh.setOnRefreshListener({ refreshItems() }) items_swipe_refresh.setOnRefreshListener({ refreshItems() })
@ -62,9 +62,9 @@ class ItemsFragment : Fragment(), ItemsAdapter.ItemOperationsListener, Breadcrum
override fun onResume() { override fun onResume() {
super.onResume() super.onResume()
context.updateTextColors(mView as ViewGroup) context!!.updateTextColors(mView as ViewGroup)
mView.items_fastscroller.updateHandleColor() mView.items_fastscroller.updateHandleColor()
val newColor = context.config.textColor val newColor = context!!.config.textColor
if (storedTextColor != newColor) { if (storedTextColor != newColor) {
storedItems = ArrayList() storedItems = ArrayList()
(items_list.adapter as ItemsAdapter).updateTextColor(newColor) (items_list.adapter as ItemsAdapter).updateTextColor(newColor)
@ -81,7 +81,7 @@ class ItemsFragment : Fragment(), ItemsAdapter.ItemOperationsListener, Breadcrum
} }
private fun storeConfigVariables() { private fun storeConfigVariables() {
storedTextColor = context.config.textColor storedTextColor = context!!.config.textColor
} }
fun openPath(path: String) { fun openPath(path: String) {
@ -95,14 +95,14 @@ class ItemsFragment : Fragment(), ItemsAdapter.ItemOperationsListener, Breadcrum
scrollStates.put(currentPath, getScrollState()) scrollStates.put(currentPath, getScrollState())
currentPath = realPath currentPath = realPath
showHidden = context.config.shouldShowHidden showHidden = context!!.config.shouldShowHidden
getItems(currentPath) { getItems(currentPath) {
if (!isAdded) if (!isAdded)
return@getItems return@getItems
FileDirItem.sorting = context.config.getFolderSorting(currentPath) FileDirItem.sorting = context!!.config.getFolderSorting(currentPath)
it.sort() it.sort()
activity.runOnUiThread { activity!!.runOnUiThread {
addItems(it) addItems(it)
} }
} }
@ -176,7 +176,7 @@ class ItemsFragment : Fragment(), ItemsAdapter.ItemOperationsListener, Breadcrum
private fun getItems(path: String, callback: (items: ArrayList<FileDirItem>) -> Unit) { private fun getItems(path: String, callback: (items: ArrayList<FileDirItem>) -> Unit) {
Thread({ Thread({
if (!context.config.enableRootAccess || !context.isPathOnRoot(path)) { if (!context!!.config.enableRootAccess || !context!!.isPathOnRoot(path)) {
getRegularItemsOf(path, callback) getRegularItemsOf(path, callback)
} else { } else {
RootHelpers().getFiles(activity as SimpleActivity, path, callback) RootHelpers().getFiles(activity as SimpleActivity, path, callback)
@ -225,7 +225,7 @@ class ItemsFragment : Fragment(), ItemsAdapter.ItemOperationsListener, Breadcrum
(activity as MainActivity).pickedPath(path) (activity as MainActivity).pickedPath(path)
} else { } else {
val file = File(path) 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) { override fun breadcrumbClicked(id: Int) {
if (id == 0) { if (id == 0) {
StoragePickerDialog(activity, currentPath) { StoragePickerDialog(activity!!, currentPath) {
openPath(it) openPath(it)
} }
} else { } else {
@ -255,15 +255,15 @@ class ItemsFragment : Fragment(), ItemsAdapter.ItemOperationsListener, Breadcrum
override fun deleteFiles(files: ArrayList<File>) { override fun deleteFiles(files: ArrayList<File>) {
val hasFolder = files.any { it.isDirectory } 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 { files.forEach {
RootTools.deleteFileOrDirectory(it.path, false) RootTools.deleteFileOrDirectory(it.path, false)
} }
} else { } else {
(activity as SimpleActivity).deleteFiles(files, hasFolder) { (activity as SimpleActivity).deleteFiles(files, hasFolder) {
if (!it) { if (!it) {
activity.runOnUiThread { activity!!.runOnUiThread {
activity.toast(R.string.unknown_error_occurred) activity!!.toast(R.string.unknown_error_occurred)
} }
} }
} }