add menu buttons for "Open file" and "Save as file"

This commit is contained in:
tibbi 2017-03-06 23:40:43 +01:00
parent 7571c9095a
commit e2d44d7285
11 changed files with 85 additions and 11 deletions

View File

@ -10,6 +10,7 @@ import android.view.MenuItem
import android.view.View
import com.simplemobiletools.commons.dialogs.ConfirmationDialog
import com.simplemobiletools.commons.extensions.checkWhatsNew
import com.simplemobiletools.commons.extensions.storeStoragePaths
import com.simplemobiletools.commons.extensions.toast
import com.simplemobiletools.commons.extensions.updateTextColors
import com.simplemobiletools.commons.helpers.LICENSE_KOTLIN
@ -45,9 +46,10 @@ class MainActivity : SimpleActivity(), ViewPager.OnPageChangeListener {
pager_title_strip.setTextSize(TypedValue.COMPLEX_UNIT_PX, getTextSize())
pager_title_strip.layoutParams.height = (pager_title_strip.height + resources.getDimension(R.dimen.activity_margin) * 2).toInt()
checkWhatsNewDialog()
storeStoragePaths()
}
fun initViewPager() {
private fun initViewPager() {
mNotes = mDb.getNotes()
mCurrentNote = mNotes[0]
val itemIndex = getNoteIndexWithId(config.currentNoteId)
@ -101,6 +103,8 @@ class MainActivity : SimpleActivity(), ViewPager.OnPageChangeListener {
R.id.new_note -> displayNewNoteDialog()
R.id.rename_note -> displayRenameDialog()
R.id.share -> shareText()
R.id.open_file -> openFile()
R.id.save_as_file -> saveAsFile()
R.id.delete_note -> displayDeleteNotePrompt()
R.id.settings -> startActivity(Intent(applicationContext, SettingsActivity::class.java))
R.id.about -> launchAbout()
@ -123,7 +127,7 @@ class MainActivity : SimpleActivity(), ViewPager.OnPageChangeListener {
mCurrentNote = mNotes[index]
}
fun displayNewNoteDialog() {
private fun displayNewNoteDialog() {
NewNoteDialog(this, mDb) {
val newNote = Note(0, it, "", TYPE_NOTE)
val id = mDb.insertNote(newNote)
@ -139,6 +143,14 @@ class MainActivity : SimpleActivity(), ViewPager.OnPageChangeListener {
startAboutActivity(R.string.app_name, LICENSE_KOTLIN or LICENSE_STETHO or LICENSE_RTL, BuildConfig.VERSION_NAME)
}
private fun openFile() {
}
private fun saveAsFile() {
}
private fun displayDeleteNotePrompt() {
val message = String.format(getString(R.string.delete_note_prompt_message), mCurrentNote.title)
ConfirmationDialog(this, message) {

View File

@ -21,6 +21,14 @@
android:icon="@drawable/ic_share"
android:title="@string/share"
app:showAsAction="ifRoom"/>
<item
android:id="@+id/open_file"
android:title="@string/open_file"
app:showAsAction="ifRoom"/>
<item
android:id="@+id/save_as_file"
android:title="@string/save_as_file"
app:showAsAction="ifRoom"/>
<item
android:id="@+id/delete_note"
android:icon="@drawable/ic_delete"

View File

@ -14,6 +14,8 @@
<string name="pick_a_note">Notiz auswählen</string>
<string name="rename_note">Notiz umbenennen</string>
<string name="general_note">Hauptnotiz</string>
<string name="open_file">Open file</string>
<string name="save_as_file">Save as file</string>
<!-- Settings -->
<string name="widget_note">Widget Notiz</string>
@ -29,7 +31,11 @@
<string name="right">Rechtsbündig</string>
<!-- Release notes -->
<string name="release_29">Added an option to make emails and links clickable</string>
<string name="release_29">
Added an option to make emails and links clickable\n
Allow importing text from files\n
Allow saving notes to files
</string>
<string name="release_28">Allow picking colors by hex codes</string>
<string name="release_25">
Added more color customization options\n

View File

@ -14,6 +14,8 @@
<string name="pick_a_note">Seleccione una nota</string>
<string name="rename_note">Renombrar nota</string>
<string name="general_note">Nota principal</string>
<string name="open_file">Open file</string>
<string name="save_as_file">Save as file</string>
<!-- Settings -->
<string name="note_font_size">Tamaño de fuente</string>
@ -29,7 +31,11 @@
<string name="right">Derecha</string>
<!-- Release notes -->
<string name="release_29">Added an option to make emails and links clickable</string>
<string name="release_29">
Added an option to make emails and links clickable\n
Allow importing text from files\n
Allow saving notes to files
</string>
<string name="release_28">Allow picking colors by hex codes</string>
<string name="release_25">
Added more color customization options\n

View File

@ -14,6 +14,8 @@
<string name="pick_a_note">Choisir une note</string>
<string name="rename_note">Renomme la note</string>
<string name="general_note">Note générale</string>
<string name="open_file">Open file</string>
<string name="save_as_file">Save as file</string>
<!-- Settings -->
<string name="widget_note">Note utilisée dans le widget</string>
@ -29,7 +31,11 @@
<string name="right">Droite</string>
<!-- Release notes -->
<string name="release_29">Added an option to make emails and links clickable</string>
<string name="release_29">
Added an option to make emails and links clickable\n
Allow importing text from files\n
Allow saving notes to files
</string>
<string name="release_28">Allow picking colors by hex codes</string>
<string name="release_25">
Added more color customization options\n

View File

@ -14,6 +14,8 @@
<string name="pick_a_note">Válassz egy jegyzetet</string>
<string name="rename_note">Jegyzet átnevezése</string>
<string name="general_note">Alapértelmezett jegyzet</string>
<string name="open_file">Open file</string>
<string name="save_as_file">Save as file</string>
<!-- Settings -->
<string name="widget_note">A widget-ben használt jegyzet</string>
@ -29,7 +31,11 @@
<string name="right">Jobbra</string>
<!-- Release notes -->
<string name="release_29">Added an option to make emails and links clickable</string>
<string name="release_29">
Added an option to make emails and links clickable\n
Allow importing text from files\n
Allow saving notes to files
</string>
<string name="release_28">Allow picking colors by hex codes</string>
<string name="release_25">
Added more color customization options\n

View File

@ -14,6 +14,8 @@
<string name="pick_a_note">Pick a note</string>
<string name="rename_note">Rename note</string>
<string name="general_note">General note</string>
<string name="open_file">Open file</string>
<string name="save_as_file">Save as file</string>
<!-- Settings -->
<string name="note_font_size">Note font size</string>
@ -29,7 +31,11 @@
<string name="right">Right</string>
<!-- Release notes -->
<string name="release_29">Added an option to make emails and links clickable</string>
<string name="release_29">
Added an option to make emails and links clickable\n
Allow importing text from files\n
Allow saving notes to files
</string>
<string name="release_28">Allow picking colors by hex codes</string>
<string name="release_25">
Added more color customization options\n

View File

@ -14,6 +14,8 @@
<string name="pick_a_note">メモを選択</string>
<string name="rename_note">メモの名前を変更</string>
<string name="general_note">全般メモ</string>
<string name="open_file">Open file</string>
<string name="save_as_file">Save as file</string>
<!-- Settings -->
<string name="note_font_size">メモのフォントサイズ</string>
@ -29,7 +31,11 @@
<string name="right"></string>
<!-- Release notes -->
<string name="release_29">Added an option to make emails and links clickable</string>
<string name="release_29">
Added an option to make emails and links clickable\n
Allow importing text from files\n
Allow saving notes to files
</string>
<string name="release_28">Allow picking colors by hex codes</string>
<string name="release_25">
Added more color customization options\n

View File

@ -14,6 +14,8 @@
<string name="pick_a_note">Selecione uma nota</string>
<string name="rename_note">Renomear nota</string>
<string name="general_note">Nota genérica</string>
<string name="open_file">Open file</string>
<string name="save_as_file">Save as file</string>
<!-- Settings -->
<string name="note_font_size">Tamanho do texto da nota</string>
@ -29,7 +31,11 @@
<string name="right">Direita</string>
<!-- Release notes -->
<string name="release_29">Added an option to make emails and links clickable</string>
<string name="release_29">
Added an option to make emails and links clickable\n
Allow importing text from files\n
Allow saving notes to files
</string>
<string name="release_28">Allow picking colors by hex codes</string>
<string name="release_25">
Added more color customization options\n

View File

@ -14,6 +14,8 @@
<string name="pick_a_note">Pick a note</string>
<string name="rename_note">Rename note</string>
<string name="general_note">General note</string>
<string name="open_file">Open file</string>
<string name="save_as_file">Save as file</string>
<!-- Settings -->
<string name="note_font_size">Note font size</string>
@ -29,7 +31,11 @@
<string name="right">Right</string>
<!-- Release notes -->
<string name="release_29">Added an option to make emails and links clickable</string>
<string name="release_29">
Added an option to make emails and links clickable\n
Allow importing text from files\n
Allow saving notes to files
</string>
<string name="release_28">Allow picking colors by hex codes</string>
<string name="release_25">
Added more color customization options\n

View File

@ -14,6 +14,8 @@
<string name="pick_a_note">Pick a note</string>
<string name="rename_note">Rename note</string>
<string name="general_note">General note</string>
<string name="open_file">Open file</string>
<string name="save_as_file">Save as file</string>
<!-- Settings -->
<string name="widget_note">Note used in widget</string>
@ -29,7 +31,11 @@
<string name="right">Right</string>
<!-- Release notes -->
<string name="release_29">Added an option to make emails and links clickable</string>
<string name="release_29">
Added an option to make emails and links clickable\n
Allow importing text from files\n
Allow saving notes to files
</string>
<string name="release_28">Allow picking colors by hex codes</string>
<string name="release_25">
Added more color customization options\n