@@ -28,6 +28,7 @@ import android.view.View
28
28
import android.view.ViewGroup
29
29
import androidx.annotation.VisibleForTesting
30
30
import androidx.core.content.ContextCompat
31
+ import androidx.core.content.edit
31
32
import androidx.preference.PreferenceManager
32
33
import androidx.recyclerview.widget.LinearLayoutManager
33
34
import com.amaze.filemanager.R
@@ -71,6 +72,7 @@ class OpenFolderInTerminalFragment : BaseBottomSheetFragment(), AdjustListViewFo
71
72
private lateinit var sharedPreferences: SharedPreferences
72
73
73
74
companion object {
75
+ @JvmStatic
74
76
private val logger = LoggerFactory .getLogger(OpenFileDialogFragment ::class .java)
75
77
76
78
const val KEY_PREFERENCES_DEFAULT = " terminal._DEFAULT"
@@ -80,6 +82,14 @@ class OpenFolderInTerminalFragment : BaseBottomSheetFragment(), AdjustListViewFo
80
82
private const val ANDROID_TERM_PERMISSION = " jackpal.androidterm.permission.RUN_SCRIPT"
81
83
private const val TERMUX_PERMISSION = " com.termux.permission.RUN_COMMAND"
82
84
85
+ @JvmStatic
86
+ val TERMINAL_PERMISSIONS =
87
+ arrayOf(
88
+ TERMONE_PLUS_PERMISSION ,
89
+ ANDROID_TERM_PERMISSION ,
90
+ TERMUX_PERMISSION ,
91
+ )
92
+
83
93
@SuppressLint(" SdCardPath" )
84
94
private const val TERMUX_SHELL_LOCATION = " /data/data/com.termux/files/usr/bin/bash"
85
95
@@ -196,10 +206,12 @@ class OpenFolderInTerminalFragment : BaseBottomSheetFragment(), AdjustListViewFo
196
206
appDataParcelable : AppDataParcelable ,
197
207
sharedPreferences : SharedPreferences ,
198
208
) {
199
- sharedPreferences.edit().putString(
200
- KEY_PREFERENCES_LAST ,
201
- appDataParcelable.packageName,
202
- ).apply ()
209
+ sharedPreferences.edit {
210
+ putString(
211
+ KEY_PREFERENCES_LAST ,
212
+ appDataParcelable.packageName,
213
+ )
214
+ }
203
215
}
204
216
205
217
/* *
@@ -209,10 +221,12 @@ class OpenFolderInTerminalFragment : BaseBottomSheetFragment(), AdjustListViewFo
209
221
appDataParcelable : AppDataParcelable ,
210
222
sharedPreferences : SharedPreferences ,
211
223
) {
212
- sharedPreferences.edit().putString(
213
- KEY_PREFERENCES_DEFAULT ,
214
- appDataParcelable.packageName,
215
- ).apply ()
224
+ sharedPreferences.edit {
225
+ putString(
226
+ KEY_PREFERENCES_DEFAULT ,
227
+ appDataParcelable.packageName,
228
+ )
229
+ }
216
230
}
217
231
218
232
/* *
@@ -221,7 +235,7 @@ class OpenFolderInTerminalFragment : BaseBottomSheetFragment(), AdjustListViewFo
221
235
fun clearPreferences (sharedPreferences : SharedPreferences ) {
222
236
AppConfig .getInstance().runInBackground {
223
237
arrayOf(KEY_PREFERENCES_DEFAULT , KEY_PREFERENCES_LAST ).forEach {
224
- sharedPreferences.edit(). remove(it). apply ()
238
+ sharedPreferences.edit { remove(it) }
225
239
}
226
240
}
227
241
}
0 commit comments