diff --git a/app/build.gradle b/app/build.gradle index 471385c0..681a5ee1 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -64,7 +64,7 @@ android { } dependencies { - implementation 'com.github.SimpleMobileTools:Simple-Commons:387fbe81cc' + implementation 'com.github.SimpleMobileTools:Simple-Commons:1123a20745' implementation 'com.github.tibbi:AndroidPdfViewer:da57ff410e' implementation 'com.github.Stericson:RootTools:df729dcb13' implementation 'com.github.Stericson:RootShell:1.6' diff --git a/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/activities/DecompressActivity.kt b/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/activities/DecompressActivity.kt index 9e3048b4..1acb5dd6 100644 --- a/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/activities/DecompressActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/activities/DecompressActivity.kt @@ -3,10 +3,9 @@ package com.simplemobiletools.filemanager.pro.activities import android.annotation.SuppressLint import android.net.Uri import android.os.Bundle -import android.view.Menu -import android.view.MenuItem import com.simplemobiletools.commons.dialogs.FilePickerDialog import com.simplemobiletools.commons.extensions.* +import com.simplemobiletools.commons.helpers.NavigationIcon import com.simplemobiletools.commons.helpers.ensureBackgroundThread import com.simplemobiletools.commons.helpers.isOreoPlus import com.simplemobiletools.filemanager.pro.R @@ -26,6 +25,8 @@ class DecompressActivity : SimpleActivity() { override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) setContentView(R.layout.activity_decompress) + setupOptionsMenu() + uri = intent.data if (uri == null) { toast(R.string.unknown_error_occurred) @@ -33,11 +34,35 @@ class DecompressActivity : SimpleActivity() { } val realPath = getRealPathFromURI(uri!!) - title = realPath?.getFilenameFromPath() ?: Uri.decode(uri.toString().getFilenameFromPath()) + decompress_toolbar.title = realPath?.getFilenameFromPath() ?: Uri.decode(uri.toString().getFilenameFromPath()) fillAllListItems(uri!!) updateCurrentPath("") } + override fun onResume() { + super.onResume() + setupToolbar(decompress_toolbar, NavigationIcon.Arrow) + } + + private fun setupOptionsMenu() { + decompress_toolbar.setOnMenuItemClickListener { menuItem -> + when (menuItem.itemId) { + R.id.decompress -> decompressFiles() + else -> return@setOnMenuItemClickListener false + } + return@setOnMenuItemClickListener true + } + } + + override fun onBackPressed() { + if (currentPath.isEmpty()) { + super.onBackPressed() + } else { + val newPath = if (currentPath.contains("/")) currentPath.getParentPath() else "" + updateCurrentPath(newPath) + } + } + private fun updateCurrentPath(path: String) { currentPath = path try { @@ -54,29 +79,6 @@ class DecompressActivity : SimpleActivity() { } } - override fun onCreateOptionsMenu(menu: Menu): Boolean { - menuInflater.inflate(R.menu.menu_decompress, menu) - updateMenuItemColors(menu) - return true - } - - override fun onOptionsItemSelected(item: MenuItem): Boolean { - when (item.itemId) { - R.id.decompress -> decompressFiles() - } - - return true - } - - override fun onBackPressed() { - if (currentPath.isEmpty()) { - super.onBackPressed() - } else { - val newPath = if (currentPath.contains("/")) currentPath.getParentPath() else "" - updateCurrentPath(newPath) - } - } - private fun decompressFiles() { val defaultFolder = getRealPathFromURI(uri!!) ?: internalStoragePath FilePickerDialog(this, defaultFolder, false, config.showHidden, true, true, showFavoritesButton = true) { destination -> diff --git a/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/activities/ReadTextActivity.kt b/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/activities/ReadTextActivity.kt index 5978d951..bf831225 100644 --- a/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/activities/ReadTextActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/activities/ReadTextActivity.kt @@ -7,8 +7,6 @@ import android.net.Uri import android.os.Bundle import android.print.PrintAttributes import android.print.PrintManager -import android.view.Menu -import android.view.MenuItem import android.view.inputmethod.EditorInfo import android.webkit.WebResourceRequest import android.webkit.WebView @@ -47,6 +45,8 @@ class ReadTextActivity : SimpleActivity() { override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) setContentView(R.layout.activity_read_text) + setupOptionsMenu() + searchQueryET = findViewById(R.id.search_query) searchPrevBtn = findViewById(R.id.search_previous) searchNextBtn = findViewById(R.id.search_next) @@ -70,7 +70,7 @@ class ReadTextActivity : SimpleActivity() { val filename = getFilenameFromUri(uri) if (filename.isNotEmpty()) { - title = Uri.decode(filename) + read_text_toolbar.title = Uri.decode(filename) } read_text_view.onGlobalLayout { @@ -82,21 +82,9 @@ class ReadTextActivity : SimpleActivity() { setupSearchButtons() } - override fun onCreateOptionsMenu(menu: Menu): Boolean { - menuInflater.inflate(R.menu.menu_editor, menu) - updateMenuItemColors(menu) - return true - } - - override fun onOptionsItemSelected(item: MenuItem): Boolean { - when (item.itemId) { - R.id.menu_search -> openSearch() - R.id.menu_save -> saveText() - R.id.menu_open_with -> openPath(intent.dataString!!, true) - R.id.menu_print -> printText() - else -> return super.onOptionsItemSelected(item) - } - return true + override fun onResume() { + super.onResume() + setupToolbar(read_text_toolbar, NavigationIcon.Arrow) } override fun onActivityResult(requestCode: Int, resultCode: Int, resultData: Intent?) { @@ -131,6 +119,19 @@ class ReadTextActivity : SimpleActivity() { } } + private fun setupOptionsMenu() { + read_text_toolbar.setOnMenuItemClickListener { menuItem -> + when (menuItem.itemId) { + R.id.menu_search -> openSearch() + R.id.menu_save -> saveText() + R.id.menu_open_with -> openPath(intent.dataString!!, true) + R.id.menu_print -> printText() + else -> return@setOnMenuItemClickListener false + } + return@setOnMenuItemClickListener true + } + } + private fun openSearch() { isSearchActive = true search_wrapper.beVisible() diff --git a/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/activities/SaveAsActivity.kt b/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/activities/SaveAsActivity.kt index 315e3286..4672bc2b 100644 --- a/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/activities/SaveAsActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/activities/SaveAsActivity.kt @@ -5,9 +5,11 @@ import android.net.Uri import android.os.Bundle import com.simplemobiletools.commons.dialogs.FilePickerDialog import com.simplemobiletools.commons.extensions.* +import com.simplemobiletools.commons.helpers.NavigationIcon import com.simplemobiletools.commons.helpers.ensureBackgroundThread import com.simplemobiletools.filemanager.pro.R import com.simplemobiletools.filemanager.pro.extensions.config +import kotlinx.android.synthetic.main.activity_save_as.* import java.io.File class SaveAsActivity : SimpleActivity() { @@ -54,4 +56,9 @@ class SaveAsActivity : SimpleActivity() { finish() } } + + override fun onResume() { + super.onResume() + setupToolbar(activity_save_as_toolbar, NavigationIcon.Arrow) + } } diff --git a/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/dialogs/CompressAsDialog.kt b/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/dialogs/CompressAsDialog.kt index 9c2b1db6..dfc37ae4 100644 --- a/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/dialogs/CompressAsDialog.kt +++ b/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/dialogs/CompressAsDialog.kt @@ -19,12 +19,12 @@ class CompressAsDialog(val activity: BaseSimpleActivity, val path: String, val c var realPath = path.getParentPath() view.apply { - file_name.setText(baseFilename) + filename_value.setText(baseFilename) - file_path.text = activity.humanizePath(realPath) - file_path.setOnClickListener { + folder.setText(activity.humanizePath(realPath)) + folder.setOnClickListener { FilePickerDialog(activity, realPath, false, activity.config.shouldShowHidden, true, true, showFavoritesButton = true) { - file_path.text = activity.humanizePath(it) + folder.setText(activity.humanizePath(it)) realPath = it } } @@ -35,9 +35,9 @@ class CompressAsDialog(val activity: BaseSimpleActivity, val path: String, val c .setNegativeButton(R.string.cancel, null) .apply { activity.setupDialogStuff(view, this, R.string.compress_as) { alertDialog -> - alertDialog.showKeyboard(view.file_name) + alertDialog.showKeyboard(view.filename_value) alertDialog.getButton(AlertDialog.BUTTON_POSITIVE).setOnClickListener(View.OnClickListener { - val name = view.file_name.value + val name = view.filename_value.value when { name.isEmpty() -> activity.toast(R.string.empty_name) name.isAValidFilename() -> { diff --git a/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/dialogs/CreateNewItemDialog.kt b/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/dialogs/CreateNewItemDialog.kt index c9e89d18..c0e3da5d 100644 --- a/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/dialogs/CreateNewItemDialog.kt +++ b/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/dialogs/CreateNewItemDialog.kt @@ -20,9 +20,9 @@ class CreateNewItemDialog(val activity: SimpleActivity, val path: String, val ca .setNegativeButton(R.string.cancel, null) .apply { activity.setupDialogStuff(view, this, R.string.create_new) { alertDialog -> - alertDialog.showKeyboard(view.item_name) + alertDialog.showKeyboard(view.item_title) alertDialog.getButton(AlertDialog.BUTTON_POSITIVE).setOnClickListener(View.OnClickListener { - val name = view.item_name.value + val name = view.item_title.value if (name.isEmpty()) { activity.toast(R.string.empty_name) } else if (name.isAValidFilename()) { diff --git a/app/src/main/res/layout/activity_decompress.xml b/app/src/main/res/layout/activity_decompress.xml index 1b4ce42b..138f86f2 100644 --- a/app/src/main/res/layout/activity_decompress.xml +++ b/app/src/main/res/layout/activity_decompress.xml @@ -1,17 +1,40 @@ - + android:layout_height="match_parent"> - + android:layout_height="wrap_content"> - + + + + + + + + + + diff --git a/app/src/main/res/layout/activity_read_text.xml b/app/src/main/res/layout/activity_read_text.xml index 8255f1d6..b64849fe 100644 --- a/app/src/main/res/layout/activity_read_text.xml +++ b/app/src/main/res/layout/activity_read_text.xml @@ -1,30 +1,54 @@ - + android:layout_height="match_parent"> - - - + android:layout_height="wrap_content"> - + android:layout_height="?attr/actionBarSize" + android:background="@color/color_primary" + app:menu="@menu/menu_editor" + app:title="@string/file_editor" + app:titleTextAppearance="@style/AppTheme.ActionBar.TitleTextStyle" /> - - + + + + + + + + + + + + + diff --git a/app/src/main/res/layout/activity_save_as.xml b/app/src/main/res/layout/activity_save_as.xml index f2b66acf..1cbcbaf5 100644 --- a/app/src/main/res/layout/activity_save_as.xml +++ b/app/src/main/res/layout/activity_save_as.xml @@ -1,7 +1,29 @@ - - + + + + + + + + + diff --git a/app/src/main/res/layout/dialog_compress_as.xml b/app/src/main/res/layout/dialog_compress_as.xml index 7ac20bf7..e6642758 100644 --- a/app/src/main/res/layout/dialog_compress_as.xml +++ b/app/src/main/res/layout/dialog_compress_as.xml @@ -1,6 +1,5 @@ - + android:layout_marginBottom="@dimen/activity_margin" + android:hint="@string/folder"> - + + + + android:layout_below="@+id/folder_hint" + android:hint="@string/filename_without_zip"> - + android:textSize="@dimen/bigger_text_size" /> + - - - diff --git a/app/src/main/res/layout/dialog_create_new.xml b/app/src/main/res/layout/dialog_create_new.xml index 0088536f..6d92cd42 100644 --- a/app/src/main/res/layout/dialog_create_new.xml +++ b/app/src/main/res/layout/dialog_create_new.xml @@ -8,15 +8,23 @@ android:paddingTop="@dimen/activity_margin" android:paddingEnd="@dimen/activity_margin"> - + android:hint="@string/title"> + + + +