Skip to content

Commit e68052b

Browse files
committed
updating Commons and SDK to 27
1 parent efccbde commit e68052b

File tree

4 files changed

+32
-29
lines changed

4 files changed

+32
-29
lines changed

app/build.gradle

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,13 @@ apply plugin: 'kotlin-android'
33
apply plugin: 'kotlin-android-extensions'
44

55
android {
6-
compileSdkVersion 26
7-
buildToolsVersion "26.0.2"
6+
compileSdkVersion 27
7+
buildToolsVersion "27.0.1"
88

99
defaultConfig {
1010
applicationId "com.simplemobiletools.filemanager"
1111
minSdkVersion 16
12-
targetSdkVersion 26
12+
targetSdkVersion 27
1313
versionCode 37
1414
versionName "2.6.0"
1515
}
@@ -37,7 +37,7 @@ android {
3737
}
3838

3939
dependencies {
40-
compile 'com.simplemobiletools:commons:2.34.2'
40+
compile 'com.simplemobiletools:commons:2.38.2'
4141
compile 'com.bignerdranch.android:recyclerview-multiselect:0.2'
4242
compile "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
4343

app/src/main/AndroidManifest.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
package="com.simplemobiletools.filemanager">
55

66
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
7+
<uses-permission android:name="android.permission.VIBRATE"/>
78

89
<application
910
android:name=".App"

app/src/main/kotlin/com/simplemobiletools/filemanager/activities/SettingsActivity.kt

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -66,17 +66,19 @@ class SettingsActivity : SimpleActivity() {
6666
settings_password_protection.isChecked = config.isPasswordProtectionOn
6767
settings_password_protection_holder.setOnClickListener {
6868
val tabToShow = if (config.isPasswordProtectionOn) config.protectionType else SHOW_ALL_TABS
69-
SecurityDialog(this, config.passwordHash, tabToShow) { hash, type ->
70-
val hasPasswordProtection = config.isPasswordProtectionOn
71-
settings_password_protection.isChecked = !hasPasswordProtection
72-
config.isPasswordProtectionOn = !hasPasswordProtection
73-
config.passwordHash = if (hasPasswordProtection) "" else hash
74-
config.protectionType = type
69+
SecurityDialog(this, config.passwordHash, tabToShow) { hash, type, success ->
70+
if (success) {
71+
val hasPasswordProtection = config.isPasswordProtectionOn
72+
settings_password_protection.isChecked = !hasPasswordProtection
73+
config.isPasswordProtectionOn = !hasPasswordProtection
74+
config.passwordHash = if (hasPasswordProtection) "" else hash
75+
config.protectionType = type
7576

76-
if (config.isPasswordProtectionOn) {
77-
val confirmationTextId = if (config.protectionType == PROTECTION_FINGERPRINT)
78-
R.string.fingerprint_setup_successfully else R.string.protection_setup_successfully
79-
ConfirmationDialog(this, "", confirmationTextId, R.string.ok, 0) { }
77+
if (config.isPasswordProtectionOn) {
78+
val confirmationTextId = if (config.protectionType == PROTECTION_FINGERPRINT)
79+
R.string.fingerprint_setup_successfully else R.string.protection_setup_successfully
80+
ConfirmationDialog(this, "", confirmationTextId, R.string.ok, 0) { }
81+
}
8082
}
8183
}
8284
}

app/src/main/kotlin/com/simplemobiletools/filemanager/fragments/ItemsFragment.kt

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -45,13 +45,13 @@ class ItemsFragment : Fragment(), ItemsAdapter.ItemOperationsListener, Breadcrum
4545

4646
private lateinit var mView: View
4747

48-
override fun onCreateView(inflater: LayoutInflater?, container: ViewGroup?, savedInstanceState: Bundle?): View {
49-
mView = inflater!!.inflate(R.layout.items_fragment, container, false)!!
48+
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View {
49+
mView = inflater.inflate(R.layout.items_fragment, container, false)!!
5050
storeConfigVariables()
5151
return mView
5252
}
5353

54-
override fun onViewCreated(view: View?, savedInstanceState: Bundle?) {
54+
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
5555
super.onViewCreated(view, savedInstanceState)
5656
mView.apply {
5757
items_swipe_refresh.setOnRefreshListener({ refreshItems() })
@@ -62,9 +62,9 @@ class ItemsFragment : Fragment(), ItemsAdapter.ItemOperationsListener, Breadcrum
6262

6363
override fun onResume() {
6464
super.onResume()
65-
context.updateTextColors(mView as ViewGroup)
65+
context!!.updateTextColors(mView as ViewGroup)
6666
mView.items_fastscroller.updateHandleColor()
67-
val newColor = context.config.textColor
67+
val newColor = context!!.config.textColor
6868
if (storedTextColor != newColor) {
6969
storedItems = ArrayList()
7070
(items_list.adapter as ItemsAdapter).updateTextColor(newColor)
@@ -81,7 +81,7 @@ class ItemsFragment : Fragment(), ItemsAdapter.ItemOperationsListener, Breadcrum
8181
}
8282

8383
private fun storeConfigVariables() {
84-
storedTextColor = context.config.textColor
84+
storedTextColor = context!!.config.textColor
8585
}
8686

8787
fun openPath(path: String) {
@@ -95,14 +95,14 @@ class ItemsFragment : Fragment(), ItemsAdapter.ItemOperationsListener, Breadcrum
9595

9696
scrollStates.put(currentPath, getScrollState())
9797
currentPath = realPath
98-
showHidden = context.config.shouldShowHidden
98+
showHidden = context!!.config.shouldShowHidden
9999
getItems(currentPath) {
100100
if (!isAdded)
101101
return@getItems
102102

103-
FileDirItem.sorting = context.config.getFolderSorting(currentPath)
103+
FileDirItem.sorting = context!!.config.getFolderSorting(currentPath)
104104
it.sort()
105-
activity.runOnUiThread {
105+
activity!!.runOnUiThread {
106106
addItems(it)
107107
}
108108
}
@@ -176,7 +176,7 @@ class ItemsFragment : Fragment(), ItemsAdapter.ItemOperationsListener, Breadcrum
176176

177177
private fun getItems(path: String, callback: (items: ArrayList<FileDirItem>) -> Unit) {
178178
Thread({
179-
if (!context.config.enableRootAccess || !context.isPathOnRoot(path)) {
179+
if (!context!!.config.enableRootAccess || !context!!.isPathOnRoot(path)) {
180180
getRegularItemsOf(path, callback)
181181
} else {
182182
RootHelpers().getFiles(activity as SimpleActivity, path, callback)
@@ -225,7 +225,7 @@ class ItemsFragment : Fragment(), ItemsAdapter.ItemOperationsListener, Breadcrum
225225
(activity as MainActivity).pickedPath(path)
226226
} else {
227227
val file = File(path)
228-
activity.openFile(Uri.fromFile(file), false)
228+
activity!!.openFile(Uri.fromFile(file), false)
229229
}
230230
}
231231
}
@@ -240,7 +240,7 @@ class ItemsFragment : Fragment(), ItemsAdapter.ItemOperationsListener, Breadcrum
240240

241241
override fun breadcrumbClicked(id: Int) {
242242
if (id == 0) {
243-
StoragePickerDialog(activity, currentPath) {
243+
StoragePickerDialog(activity!!, currentPath) {
244244
openPath(it)
245245
}
246246
} else {
@@ -255,15 +255,15 @@ class ItemsFragment : Fragment(), ItemsAdapter.ItemOperationsListener, Breadcrum
255255

256256
override fun deleteFiles(files: ArrayList<File>) {
257257
val hasFolder = files.any { it.isDirectory }
258-
if (context.isPathOnRoot(files.firstOrNull()?.absolutePath ?: context.config.internalStoragePath)) {
258+
if (context!!.isPathOnRoot(files.firstOrNull()?.absolutePath ?: context!!.config.internalStoragePath)) {
259259
files.forEach {
260260
RootTools.deleteFileOrDirectory(it.path, false)
261261
}
262262
} else {
263263
(activity as SimpleActivity).deleteFiles(files, hasFolder) {
264264
if (!it) {
265-
activity.runOnUiThread {
266-
activity.toast(R.string.unknown_error_occurred)
265+
activity!!.runOnUiThread {
266+
activity!!.toast(R.string.unknown_error_occurred)
267267
}
268268
}
269269
}

0 commit comments

Comments
 (0)