From cb4b63a8362b60da99b78fcabb3ac1d605af2647 Mon Sep 17 00:00:00 2001 From: tibbi Date: Mon, 23 Oct 2017 12:00:35 +0200 Subject: [PATCH] add a Save menu button --- app/build.gradle | 2 +- .../activities/ReadTextActivity.kt | 19 +++++++++++++++++++ app/src/main/res/menu/menu_editor.xml | 9 +++++++++ 3 files changed, 29 insertions(+), 1 deletion(-) create mode 100644 app/src/main/res/menu/menu_editor.xml diff --git a/app/build.gradle b/app/build.gradle index 9a282877..b6af4f09 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -37,7 +37,7 @@ android { } dependencies { - compile 'com.simplemobiletools:commons:2.30.14' + compile 'com.simplemobiletools:commons:2.31.0' compile 'com.bignerdranch.android:recyclerview-multiselect:0.2' compile "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version" diff --git a/app/src/main/kotlin/com/simplemobiletools/filemanager/activities/ReadTextActivity.kt b/app/src/main/kotlin/com/simplemobiletools/filemanager/activities/ReadTextActivity.kt index bf3977bb..e88d6352 100644 --- a/app/src/main/kotlin/com/simplemobiletools/filemanager/activities/ReadTextActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/filemanager/activities/ReadTextActivity.kt @@ -1,6 +1,8 @@ package com.simplemobiletools.filemanager.activities import android.os.Bundle +import android.view.Menu +import android.view.MenuItem import com.simplemobiletools.commons.extensions.toast import com.simplemobiletools.commons.helpers.PERMISSION_WRITE_STORAGE import com.simplemobiletools.filemanager.R @@ -23,6 +25,23 @@ class ReadTextActivity : SimpleActivity() { } } + override fun onCreateOptionsMenu(menu: Menu): Boolean { + menuInflater.inflate(R.menu.menu_editor, menu) + return true + } + + override fun onOptionsItemSelected(item: MenuItem): Boolean { + when (item.itemId) { + R.id.menu_save -> saveText() + else -> return super.onOptionsItemSelected(item) + } + return true + } + + private fun saveText() { + + } + private fun checkIntent() { read_text_view.setTextColor(config.textColor) val uri = intent.data diff --git a/app/src/main/res/menu/menu_editor.xml b/app/src/main/res/menu/menu_editor.xml new file mode 100644 index 00000000..96421a0c --- /dev/null +++ b/app/src/main/res/menu/menu_editor.xml @@ -0,0 +1,9 @@ + + + +