mirror of
https://github.com/SimpleMobileTools/Simple-Notes.git
synced 2025-02-11 17:00:36 +01:00
change "Save as file" to "Export as file" to make it clear its not synced
This commit is contained in:
parent
70550d022e
commit
5db4ed8b92
@ -33,7 +33,7 @@ import java.nio.charset.Charset
|
||||
|
||||
class MainActivity : SimpleActivity(), ViewPager.OnPageChangeListener {
|
||||
val STORAGE_OPEN_FILE = 1
|
||||
val STORAGE_SAVE_AS_FILE = 2
|
||||
val STORAGE_EXPORT_AS_FILE = 2
|
||||
|
||||
lateinit var mCurrentNote: Note
|
||||
lateinit var mAdapter: NotesPagerAdapter
|
||||
@ -113,7 +113,7 @@ class MainActivity : SimpleActivity(), ViewPager.OnPageChangeListener {
|
||||
R.id.rename_note -> displayRenameDialog()
|
||||
R.id.share -> shareText()
|
||||
R.id.open_file -> tryOpenFile()
|
||||
R.id.save_as_file -> trySaveAsFile()
|
||||
R.id.export_as_file -> tryExportAsFile()
|
||||
R.id.delete_note -> displayDeleteNotePrompt()
|
||||
R.id.settings -> startActivity(Intent(applicationContext, SettingsActivity::class.java))
|
||||
R.id.about -> launchAbout()
|
||||
@ -181,21 +181,21 @@ class MainActivity : SimpleActivity(), ViewPager.OnPageChangeListener {
|
||||
}
|
||||
}
|
||||
|
||||
private fun trySaveAsFile() {
|
||||
private fun tryExportAsFile() {
|
||||
if (hasWriteStoragePermission()) {
|
||||
saveAsFile()
|
||||
exportAsFile()
|
||||
} else {
|
||||
ActivityCompat.requestPermissions(this, arrayOf(Manifest.permission.WRITE_EXTERNAL_STORAGE), STORAGE_SAVE_AS_FILE)
|
||||
ActivityCompat.requestPermissions(this, arrayOf(Manifest.permission.WRITE_EXTERNAL_STORAGE), STORAGE_EXPORT_AS_FILE)
|
||||
}
|
||||
}
|
||||
|
||||
private fun saveAsFile() {
|
||||
SaveAsDialog(this, mCurrentNote) {
|
||||
saveNoteValueToFile(it, getCurrentNoteText())
|
||||
private fun exportAsFile() {
|
||||
ExportAsDialog(this, mCurrentNote) {
|
||||
exportNoteValueToFile(it, getCurrentNoteText())
|
||||
}
|
||||
}
|
||||
|
||||
fun saveNoteValueToFile(path: String, content: String) {
|
||||
fun exportNoteValueToFile(path: String, content: String) {
|
||||
try {
|
||||
val file = File(path)
|
||||
if (file.isDirectory) {
|
||||
@ -306,8 +306,8 @@ class MainActivity : SimpleActivity(), ViewPager.OnPageChangeListener {
|
||||
if (grantResults.isNotEmpty() && grantResults[0] == PackageManager.PERMISSION_GRANTED) {
|
||||
if (requestCode == STORAGE_OPEN_FILE) {
|
||||
openFile()
|
||||
} else if (requestCode == STORAGE_SAVE_AS_FILE) {
|
||||
saveAsFile()
|
||||
} else if (requestCode == STORAGE_EXPORT_AS_FILE) {
|
||||
exportAsFile()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -9,14 +9,14 @@ import com.simplemobiletools.commons.extensions.*
|
||||
import com.simplemobiletools.notes.R
|
||||
import com.simplemobiletools.notes.activities.SimpleActivity
|
||||
import com.simplemobiletools.notes.models.Note
|
||||
import kotlinx.android.synthetic.main.dialog_save_as.view.*
|
||||
import kotlinx.android.synthetic.main.dialog_export_as.view.*
|
||||
import java.io.File
|
||||
|
||||
class SaveAsDialog(val activity: SimpleActivity, val note: Note, val callback: (savePath: String) -> Unit) {
|
||||
class ExportAsDialog(val activity: SimpleActivity, val note: Note, val callback: (exportPath: String) -> Unit) {
|
||||
|
||||
init {
|
||||
var realPath = File(note.path).parent ?: Environment.getExternalStorageDirectory().toString()
|
||||
val view = LayoutInflater.from(activity).inflate(R.layout.dialog_save_as, null).apply {
|
||||
val view = LayoutInflater.from(activity).inflate(R.layout.dialog_export_as, null).apply {
|
||||
file_path.text = activity.humanizePath(realPath)
|
||||
|
||||
file_name.setText(note.title)
|
||||
@ -33,7 +33,7 @@ class SaveAsDialog(val activity: SimpleActivity, val note: Note, val callback: (
|
||||
.setNegativeButton(R.string.cancel, null)
|
||||
.create().apply {
|
||||
window!!.setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_VISIBLE)
|
||||
activity.setupDialogStuff(view, this, R.string.save_as)
|
||||
activity.setupDialogStuff(view, this, R.string.export_as_file)
|
||||
getButton(AlertDialog.BUTTON_POSITIVE).setOnClickListener({
|
||||
val filename = view.file_name.value
|
||||
|
@ -94,7 +94,7 @@ class NoteFragment : Fragment() {
|
||||
mDb.updateNoteValue(note)
|
||||
(activity as MainActivity).noteSavedSuccessfully(note.title)
|
||||
} else {
|
||||
(activity as MainActivity).saveNoteValueToFile(note.path, getCurrentNoteViewText())
|
||||
(activity as MainActivity).exportNoteValueToFile(note.path, getCurrentNoteViewText())
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:id="@+id/save_as_holder"
|
||||
android:id="@+id/export_as_holder"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical"
|
@ -24,16 +24,16 @@
|
||||
<item
|
||||
android:id="@+id/open_file"
|
||||
android:title="@string/open_file"
|
||||
app:showAsAction="ifRoom"/>
|
||||
app:showAsAction="never"/>
|
||||
<item
|
||||
android:id="@+id/save_as_file"
|
||||
android:title="@string/save_as_file"
|
||||
app:showAsAction="ifRoom"/>
|
||||
android:id="@+id/export_as_file"
|
||||
android:title="@string/export_as_file"
|
||||
app:showAsAction="never"/>
|
||||
<item
|
||||
android:id="@+id/delete_note"
|
||||
android:icon="@drawable/ic_delete"
|
||||
android:title="@string/delete_note"
|
||||
app:showAsAction="never"/>
|
||||
app:showAsAction="ifRoom"/>
|
||||
<item
|
||||
android:id="@+id/settings"
|
||||
android:title="@string/settings"
|
||||
|
@ -17,7 +17,7 @@
|
||||
|
||||
<!-- File notes -->
|
||||
<string name="open_file">Open file</string>
|
||||
<string name="save_as_file">Save as file</string>
|
||||
<string name="export_as_file">Export as file</string>
|
||||
<string name="file_too_large">File too large, the limit is 10MB</string>
|
||||
<string name="only_import_file_content">Only import the file content</string>
|
||||
<string name="update_file_at_note">Update the file itself at updating the note</string>
|
||||
|
@ -17,7 +17,7 @@
|
||||
|
||||
<!-- File notes -->
|
||||
<string name="open_file">Open file</string>
|
||||
<string name="save_as_file">Save as file</string>
|
||||
<string name="export_as_file">Export as file</string>
|
||||
<string name="file_too_large">File too large, the limit is 10MB</string>
|
||||
<string name="only_import_file_content">Only import the file content</string>
|
||||
<string name="update_file_at_note">Update the file itself at updating the note</string>
|
||||
|
@ -17,7 +17,7 @@
|
||||
|
||||
<!-- File notes -->
|
||||
<string name="open_file">Open file</string>
|
||||
<string name="save_as_file">Save as file</string>
|
||||
<string name="export_as_file">Export as file</string>
|
||||
<string name="file_too_large">File too large, the limit is 10MB</string>
|
||||
<string name="only_import_file_content">Only import the file content</string>
|
||||
<string name="update_file_at_note">Update the file itself at updating the note</string>
|
||||
|
@ -17,7 +17,7 @@
|
||||
|
||||
<!-- File notes -->
|
||||
<string name="open_file">Open file</string>
|
||||
<string name="save_as_file">Save as file</string>
|
||||
<string name="export_as_file">Export as file</string>
|
||||
<string name="file_too_large">File too large, the limit is 10MB</string>
|
||||
<string name="only_import_file_content">Only import the file content</string>
|
||||
<string name="update_file_at_note">Update the file itself at updating the note</string>
|
||||
|
@ -17,7 +17,7 @@
|
||||
|
||||
<!-- File notes -->
|
||||
<string name="open_file">Open file</string>
|
||||
<string name="save_as_file">Save as file</string>
|
||||
<string name="export_as_file">Export as file</string>
|
||||
<string name="file_too_large">File too large, the limit is 10MB</string>
|
||||
<string name="only_import_file_content">Only import the file content</string>
|
||||
<string name="update_file_at_note">Update the file itself at updating the note</string>
|
||||
|
@ -17,7 +17,7 @@
|
||||
|
||||
<!-- File notes -->
|
||||
<string name="open_file">Open file</string>
|
||||
<string name="save_as_file">Save as file</string>
|
||||
<string name="export_as_file">Export as file</string>
|
||||
<string name="file_too_large">File too large, the limit is 10MB</string>
|
||||
<string name="only_import_file_content">Only import the file content</string>
|
||||
<string name="update_file_at_note">Update the file itself at updating the note</string>
|
||||
|
@ -17,7 +17,7 @@
|
||||
<string name="open_file">Abrir ficheiro</string>
|
||||
|
||||
<!-- File notes -->
|
||||
<string name="save_as_file">Guardar como ficheiro</string>
|
||||
<string name="export_as_file">Export as file</string>
|
||||
<string name="file_too_large">Ficheiro muito grande, o limite são 10 MB</string>
|
||||
<string name="only_import_file_content">Importar apenas o conteúdo do ficheiro</string>
|
||||
<string name="update_file_at_note">Atualizar o ficheiro ao atualizar a nota</string>
|
||||
|
@ -17,7 +17,7 @@
|
||||
<string name="open_file">Open file</string>
|
||||
|
||||
<!-- File notes -->
|
||||
<string name="save_as_file">Save as file</string>
|
||||
<string name="export_as_file">Export as file</string>
|
||||
<string name="file_too_large">File too large, the limit is 10MB</string>
|
||||
<string name="only_import_file_content">Only import the file content</string>
|
||||
<string name="update_file_at_note">Update the file itself at updating the note</string>
|
||||
|
@ -17,7 +17,7 @@
|
||||
|
||||
<!-- File notes -->
|
||||
<string name="open_file">Open file</string>
|
||||
<string name="save_as_file">Save as file</string>
|
||||
<string name="export_as_file">Export as file</string>
|
||||
<string name="file_too_large">File too large, the limit is 10MB</string>
|
||||
<string name="only_import_file_content">Only import the file content</string>
|
||||
<string name="update_file_at_note">Update the file itself at updating the note</string>
|
||||
|
Loading…
x
Reference in New Issue
Block a user