mirror of
				https://github.com/SimpleMobileTools/Simple-File-Manager.git
				synced 2025-06-05 22:09:15 +02:00 
			
		
		
		
	update commons to 3.0.21
This commit is contained in:
		| @@ -46,7 +46,7 @@ ext { | ||||
| } | ||||
|  | ||||
| dependencies { | ||||
|     implementation 'com.simplemobiletools:commons:3.0.9' | ||||
|     implementation 'com.simplemobiletools:commons:3.0.21' | ||||
|  | ||||
|     implementation files('../libs/RootTools.jar') | ||||
|  | ||||
|   | ||||
| @@ -2,10 +2,9 @@ package com.simplemobiletools.filemanager | ||||
|  | ||||
| import android.app.Application | ||||
| import com.github.ajalt.reprint.core.Reprint | ||||
| import com.simplemobiletools.commons.extensions.checkUseEnglish | ||||
| import com.simplemobiletools.filemanager.BuildConfig.USE_LEAK_CANARY | ||||
| import com.simplemobiletools.filemanager.extensions.config | ||||
| import com.squareup.leakcanary.LeakCanary | ||||
| import java.util.* | ||||
|  | ||||
| class App : Application() { | ||||
|     override fun onCreate() { | ||||
| @@ -17,11 +16,7 @@ class App : Application() { | ||||
|             LeakCanary.install(this) | ||||
|         } | ||||
|  | ||||
|         if (config.useEnglish) { | ||||
|             val conf = resources.configuration | ||||
|             conf.locale = Locale.ENGLISH | ||||
|             resources.updateConfiguration(conf, resources.displayMetrics) | ||||
|         } | ||||
|         checkUseEnglish() | ||||
|         Reprint.initialize(this) | ||||
|     } | ||||
| } | ||||
|   | ||||
| @@ -28,7 +28,6 @@ import java.util.* | ||||
| class MainActivity : SimpleActivity() { | ||||
|     private val BACK_PRESS_TIMEOUT = 5000 | ||||
|     private var wasBackJustPressed = false | ||||
|  | ||||
|     private var mStoredUseEnglish = false | ||||
|  | ||||
|     private lateinit var fragment: ItemsFragment | ||||
| @@ -36,7 +35,7 @@ class MainActivity : SimpleActivity() { | ||||
|     override fun onCreate(savedInstanceState: Bundle?) { | ||||
|         super.onCreate(savedInstanceState) | ||||
|         setContentView(R.layout.activity_main) | ||||
|         storeStoragePaths() | ||||
|         appLaunched() | ||||
|  | ||||
|         fragment = (fragment_holder as ItemsFragment).apply { | ||||
|             isGetRingtonePicker = intent.action == RingtoneManager.ACTION_RINGTONE_PICKER | ||||
| @@ -47,6 +46,7 @@ class MainActivity : SimpleActivity() { | ||||
|         if (savedInstanceState == null) { | ||||
|             tryInitFileManager() | ||||
|         } | ||||
|  | ||||
|         checkWhatsNewDialog() | ||||
|         checkIfRootAvailable() | ||||
|         storeStateVariables() | ||||
| @@ -230,14 +230,14 @@ class MainActivity : SimpleActivity() { | ||||
|     } | ||||
|  | ||||
|     private fun checkIfRootAvailable() { | ||||
|         Thread({ | ||||
|         Thread { | ||||
|             config.isRootAvailable = RootTools.isRootAvailable() | ||||
|             if (config.isRootAvailable && config.enableRootAccess) { | ||||
|                 RootHelpers().askRootIFNeeded(this) { | ||||
|                     config.enableRootAccess = it | ||||
|                 } | ||||
|             } | ||||
|         }).start() | ||||
|         }.start() | ||||
|     } | ||||
|  | ||||
|     fun pickedPath(path: String) { | ||||
|   | ||||
| @@ -187,7 +187,7 @@ class ItemsAdapter(activity: SimpleActivity, var fileDirItems: MutableList<FileD | ||||
|  | ||||
|     private fun copyRootItems(files: ArrayList<File>, destinationPath: String) { | ||||
|         activity.toast(R.string.copying) | ||||
|         Thread({ | ||||
|         Thread { | ||||
|             var fileCnt = files.count() | ||||
|             files.forEach { | ||||
|                 if (RootTools.copyFile(it.absolutePath, destinationPath, false, true)) { | ||||
| @@ -205,7 +205,7 @@ class ItemsAdapter(activity: SimpleActivity, var fileDirItems: MutableList<FileD | ||||
|                 listener?.refreshItems() | ||||
|                 finishActMode() | ||||
|             } | ||||
|         }).start() | ||||
|         }.start() | ||||
|     } | ||||
|  | ||||
|     private fun compressSelection() { | ||||
| @@ -217,7 +217,7 @@ class ItemsAdapter(activity: SimpleActivity, var fileDirItems: MutableList<FileD | ||||
|             activity.handleSAFDialog(File(firstPath)) { | ||||
|                 activity.toast(R.string.compressing) | ||||
|                 val paths = selectedPositions.map { fileDirItems[it].path } | ||||
|                 Thread({ | ||||
|                 Thread { | ||||
|                     if (zipPaths(paths, it)) { | ||||
|                         activity.toast(R.string.compression_successful) | ||||
|                         activity.runOnUiThread { | ||||
| @@ -227,7 +227,7 @@ class ItemsAdapter(activity: SimpleActivity, var fileDirItems: MutableList<FileD | ||||
|                     } else { | ||||
|                         activity.toast(R.string.compressing_failed) | ||||
|                     } | ||||
|                 }).start() | ||||
|                 }.start() | ||||
|             } | ||||
|         } | ||||
|     } | ||||
| @@ -240,7 +240,7 @@ class ItemsAdapter(activity: SimpleActivity, var fileDirItems: MutableList<FileD | ||||
|         activity.handleSAFDialog(File(firstPath)) { | ||||
|             activity.toast(R.string.decompressing) | ||||
|             val paths = selectedPositions.map { fileDirItems[it].path }.filter { it.isZipFile() } | ||||
|             Thread({ | ||||
|             Thread { | ||||
|                 if (unzipPaths(paths)) { | ||||
|                     activity.toast(R.string.decompression_successful) | ||||
|                     activity.runOnUiThread { | ||||
| @@ -250,7 +250,7 @@ class ItemsAdapter(activity: SimpleActivity, var fileDirItems: MutableList<FileD | ||||
|                 } else { | ||||
|                     activity.toast(R.string.decompressing_failed) | ||||
|                 } | ||||
|             }).start() | ||||
|             }.start() | ||||
|         } | ||||
|     } | ||||
|  | ||||
|   | ||||
| @@ -1,19 +1,17 @@ | ||||
| package com.simplemobiletools.filemanager.dialogs | ||||
|  | ||||
| import android.support.v7.app.AlertDialog | ||||
| import android.view.LayoutInflater | ||||
| import com.simplemobiletools.commons.activities.BaseSimpleActivity | ||||
| import com.simplemobiletools.commons.extensions.setupDialogStuff | ||||
| import com.simplemobiletools.commons.helpers.* | ||||
| import com.simplemobiletools.filemanager.R | ||||
| import com.simplemobiletools.filemanager.activities.SimpleActivity | ||||
| import com.simplemobiletools.filemanager.extensions.config | ||||
| import kotlinx.android.synthetic.main.dialog_change_sorting.view.* | ||||
|  | ||||
| class ChangeSortingDialog(val activity: BaseSimpleActivity, val path: String = "", val callback: () -> Unit) { | ||||
|     private var currSorting = 0 | ||||
|     private var config = activity.config | ||||
|     private var view = LayoutInflater.from(activity).inflate(R.layout.dialog_change_sorting, null) | ||||
|     private var view = activity.layoutInflater.inflate(R.layout.dialog_change_sorting, null) | ||||
|  | ||||
|     init { | ||||
|         view.sorting_dialog_use_for_this_folder.isChecked = config.hasCustomSorting(path) | ||||
|   | ||||
| @@ -37,7 +37,7 @@ class CompressAsDialog(val activity: BaseSimpleActivity, val path: String, val c | ||||
|                 .setPositiveButton(R.string.ok, null) | ||||
|                 .setNegativeButton(R.string.cancel, null) | ||||
|                 .create().apply { | ||||
|             activity.setupDialogStuff(view, this, R.string.compress_as) | ||||
|             activity.setupDialogStuff(view, this, R.string.compress_as) { | ||||
|                 window!!.setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_VISIBLE) | ||||
|                 getButton(AlertDialog.BUTTON_POSITIVE).setOnClickListener(View.OnClickListener { | ||||
|                     val name = view.file_name.value | ||||
| @@ -58,4 +58,5 @@ class CompressAsDialog(val activity: BaseSimpleActivity, val path: String, val c | ||||
|                 }) | ||||
|             } | ||||
|         } | ||||
|     } | ||||
| } | ||||
|   | ||||
| @@ -6,7 +6,6 @@ import android.view.WindowManager | ||||
| import com.simplemobiletools.commons.activities.BaseSimpleActivity | ||||
| import com.simplemobiletools.commons.extensions.* | ||||
| import com.simplemobiletools.filemanager.R | ||||
| import com.simplemobiletools.filemanager.activities.SimpleActivity | ||||
| import kotlinx.android.synthetic.main.dialog_create_new.view.* | ||||
| import java.io.File | ||||
| import java.io.IOException | ||||
| @@ -19,7 +18,7 @@ class CreateNewItemDialog(val activity: BaseSimpleActivity, val path: String, va | ||||
|                 .setPositiveButton(R.string.ok, null) | ||||
|                 .setNegativeButton(R.string.cancel, null) | ||||
|                 .create().apply { | ||||
|             activity.setupDialogStuff(view, this, R.string.create_new) | ||||
|             activity.setupDialogStuff(view, this, R.string.create_new) { | ||||
|                 window!!.setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_VISIBLE) | ||||
|                 getButton(AlertDialog.BUTTON_POSITIVE).setOnClickListener(View.OnClickListener { | ||||
|                     val name = view.item_name.value | ||||
| @@ -47,6 +46,7 @@ class CreateNewItemDialog(val activity: BaseSimpleActivity, val path: String, va | ||||
|                 }) | ||||
|             } | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     private fun createDirectory(file: File, alertDialog: AlertDialog, callback: (Boolean) -> Unit) { | ||||
|         when { | ||||
|   | ||||
| @@ -1,14 +1,12 @@ | ||||
| package com.simplemobiletools.filemanager.dialogs | ||||
|  | ||||
| import android.support.v7.app.AlertDialog | ||||
| import android.view.LayoutInflater | ||||
| import android.view.WindowManager | ||||
| import com.simplemobiletools.commons.activities.BaseSimpleActivity | ||||
| import com.simplemobiletools.commons.dialogs.ConfirmationDialog | ||||
| import com.simplemobiletools.commons.dialogs.FilePickerDialog | ||||
| import com.simplemobiletools.commons.extensions.* | ||||
| import com.simplemobiletools.filemanager.R | ||||
| import com.simplemobiletools.filemanager.activities.SimpleActivity | ||||
| import kotlinx.android.synthetic.main.dialog_save_as.view.* | ||||
| import java.io.File | ||||
|  | ||||
| @@ -20,7 +18,7 @@ class SaveAsDialog(val activity: BaseSimpleActivity, var path: String, val callb | ||||
|         } | ||||
|  | ||||
|         var realPath = File(path).parent.trimEnd('/') | ||||
|         val view = LayoutInflater.from(activity).inflate(R.layout.dialog_save_as, null).apply { | ||||
|         val view = activity.layoutInflater.inflate(R.layout.dialog_save_as, null).apply { | ||||
|             save_as_path.text = activity.humanizePath(realPath) | ||||
|  | ||||
|             val fullName = path.getFilenameFromPath() | ||||
| @@ -47,8 +45,8 @@ class SaveAsDialog(val activity: BaseSimpleActivity, var path: String, val callb | ||||
|                 .setNegativeButton(R.string.cancel, null) | ||||
|                 .create().apply { | ||||
|             window!!.setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_VISIBLE) | ||||
|             activity.setupDialogStuff(view, this, R.string.save_as) | ||||
|             getButton(AlertDialog.BUTTON_POSITIVE).setOnClickListener({ | ||||
|             activity.setupDialogStuff(view, this, R.string.save_as) { | ||||
|                 getButton(AlertDialog.BUTTON_POSITIVE).setOnClickListener { | ||||
|                     val filename = view.save_as_name.value | ||||
|                     val extension = view.save_as_extension.value | ||||
|  | ||||
| @@ -78,7 +76,8 @@ class SaveAsDialog(val activity: BaseSimpleActivity, var path: String, val callb | ||||
|                         callback(newFile.absolutePath) | ||||
|                         dismiss() | ||||
|                     } | ||||
|             }) | ||||
|                 } | ||||
|             } | ||||
|         } | ||||
|     } | ||||
| } | ||||
|   | ||||
| @@ -51,7 +51,7 @@ class ItemsFragment : Fragment(), ItemsAdapter.ItemOperationsListener, Breadcrum | ||||
|     override fun onViewCreated(view: View, savedInstanceState: Bundle?) { | ||||
|         super.onViewCreated(view, savedInstanceState) | ||||
|         mView.apply { | ||||
|             items_swipe_refresh.setOnRefreshListener({ refreshItems() }) | ||||
|             items_swipe_refresh.setOnRefreshListener { refreshItems() } | ||||
|             items_fab.setOnClickListener { createNewItem() } | ||||
|             breadcrumbs.listener = this@ItemsFragment | ||||
|         } | ||||
| @@ -160,13 +160,13 @@ class ItemsFragment : Fragment(), ItemsAdapter.ItemOperationsListener, Breadcrum | ||||
|     private fun getRecyclerLayoutManager() = (mView.items_list.layoutManager as LinearLayoutManager) | ||||
|  | ||||
|     private fun getItems(path: String, callback: (items: ArrayList<FileDirItem>) -> Unit) { | ||||
|         Thread({ | ||||
|         Thread { | ||||
|             if (!context!!.config.enableRootAccess || !context!!.isPathOnRoot(path)) { | ||||
|                 getRegularItemsOf(path, callback) | ||||
|             } else { | ||||
|                 RootHelpers().getFiles(activity as SimpleActivity, path, callback) | ||||
|             } | ||||
|         }).start() | ||||
|         }.start() | ||||
|     } | ||||
|  | ||||
|     private fun getRegularItemsOf(path: String, callback: (items: ArrayList<FileDirItem>) -> Unit) { | ||||
|   | ||||
| @@ -1,7 +1,5 @@ | ||||
| <resources> | ||||
|  | ||||
|     <style name="AppTheme" parent="AppTheme.Base"> | ||||
|  | ||||
|     </style> | ||||
|     <style name="AppTheme" parent="AppTheme.Base"/> | ||||
|  | ||||
| </resources> | ||||
|   | ||||
		Reference in New Issue
	
	Block a user