mirror of
https://github.com/SimpleMobileTools/Simple-Notes.git
synced 2025-04-20 02:07:25 +02:00
make the save success message optional
This commit is contained in:
parent
13d09de4be
commit
ae4e811ab7
@ -223,11 +223,13 @@ class MainActivity : SimpleActivity(), ViewPager.OnPageChangeListener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fun noteSavedSuccessfully() {
|
fun noteSavedSuccessfully() {
|
||||||
val message = String.format(getString(R.string.note_saved_successfully), mCurrentNote.title)
|
if (config.displaySuccess) {
|
||||||
toast(message)
|
val message = String.format(getString(R.string.note_saved_successfully), mCurrentNote.title)
|
||||||
|
toast(message)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun getCurrentNoteText() = (view_pager.adapter as NotesPagerAdapter).getCurrentNoteText(view_pager.currentItem)
|
private fun getCurrentNoteText() = (view_pager.adapter as NotesPagerAdapter).getCurrentNoteViewText(view_pager.currentItem)
|
||||||
|
|
||||||
private fun displayDeleteNotePrompt() {
|
private fun displayDeleteNotePrompt() {
|
||||||
val message = String.format(getString(R.string.delete_note_prompt_message), mCurrentNote.title)
|
val message = String.format(getString(R.string.delete_note_prompt_message), mCurrentNote.title)
|
||||||
|
@ -22,6 +22,7 @@ class SettingsActivity : SimpleActivity() {
|
|||||||
super.onResume()
|
super.onResume()
|
||||||
|
|
||||||
setupCustomizeColors()
|
setupCustomizeColors()
|
||||||
|
setupDisplaySuccess()
|
||||||
setupClickableLinks()
|
setupClickableLinks()
|
||||||
setupFontSize()
|
setupFontSize()
|
||||||
setupWidgetNote()
|
setupWidgetNote()
|
||||||
@ -35,6 +36,14 @@ class SettingsActivity : SimpleActivity() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private fun setupDisplaySuccess() {
|
||||||
|
settings_display_success.isChecked = config.displaySuccess
|
||||||
|
settings_display_success_holder.setOnClickListener {
|
||||||
|
settings_display_success.toggle()
|
||||||
|
config.displaySuccess = settings_display_success.isChecked
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private fun setupClickableLinks() {
|
private fun setupClickableLinks() {
|
||||||
settings_clickable_links.isChecked = config.clickableLinks
|
settings_clickable_links.isChecked = config.clickableLinks
|
||||||
settings_clickable_links_holder.setOnClickListener {
|
settings_clickable_links_holder.setOnClickListener {
|
||||||
|
@ -30,7 +30,7 @@ class NotesPagerAdapter(fm: FragmentManager, private val notes: List<Note>) : Fr
|
|||||||
|
|
||||||
override fun getPageTitle(position: Int) = notes[position].title
|
override fun getPageTitle(position: Int) = notes[position].title
|
||||||
|
|
||||||
fun getCurrentNoteText(position: Int) = fragments[position].getCurrentNoteViewText()
|
fun getCurrentNoteViewText(position: Int) = fragments[position].getCurrentNoteViewText()
|
||||||
|
|
||||||
fun showKeyboard(position: Int) = fragments[position]?.showKeyboard()
|
fun showKeyboard(position: Int) = fragments[position]?.showKeyboard()
|
||||||
}
|
}
|
||||||
|
@ -8,6 +8,10 @@ class Config(context: Context) : BaseConfig(context) {
|
|||||||
fun newInstance(context: Context) = Config(context)
|
fun newInstance(context: Context) = Config(context)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var displaySuccess: Boolean
|
||||||
|
get() = prefs.getBoolean(DISPLAY_SUCCESS, true)
|
||||||
|
set(displaySuccess) = prefs.edit().putBoolean(DISPLAY_SUCCESS, displaySuccess).apply()
|
||||||
|
|
||||||
var clickableLinks: Boolean
|
var clickableLinks: Boolean
|
||||||
get() = prefs.getBoolean(CLICKABLE_LINKS, false)
|
get() = prefs.getBoolean(CLICKABLE_LINKS, false)
|
||||||
set(clickableLinks) = prefs.edit().putBoolean(CLICKABLE_LINKS, clickableLinks).apply()
|
set(clickableLinks) = prefs.edit().putBoolean(CLICKABLE_LINKS, clickableLinks).apply()
|
||||||
|
@ -4,6 +4,7 @@ val NOTE_ID = "note_id"
|
|||||||
|
|
||||||
// shared preferences
|
// shared preferences
|
||||||
val CURRENT_NOTE_ID = "current_note_id"
|
val CURRENT_NOTE_ID = "current_note_id"
|
||||||
|
val DISPLAY_SUCCESS = "display_success"
|
||||||
val CLICKABLE_LINKS = "clickable_links"
|
val CLICKABLE_LINKS = "clickable_links"
|
||||||
val WIDGET_NOTE_ID = "widget_note_id"
|
val WIDGET_NOTE_ID = "widget_note_id"
|
||||||
val FONT_SIZE = "font_size"
|
val FONT_SIZE = "font_size"
|
||||||
|
@ -30,6 +30,26 @@
|
|||||||
|
|
||||||
</RelativeLayout>
|
</RelativeLayout>
|
||||||
|
|
||||||
|
<RelativeLayout
|
||||||
|
android:id="@+id/settings_display_success_holder"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginTop="@dimen/medium_margin"
|
||||||
|
android:background="?attr/selectableItemBackground"
|
||||||
|
android:padding="@dimen/activity_margin">
|
||||||
|
|
||||||
|
<com.simplemobiletools.commons.views.MySwitchCompat
|
||||||
|
android:id="@+id/settings_display_success"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:background="@null"
|
||||||
|
android:clickable="false"
|
||||||
|
android:paddingLeft="@dimen/medium_margin"
|
||||||
|
android:paddingStart="@dimen/medium_margin"
|
||||||
|
android:text="@string/display_success_message"/>
|
||||||
|
|
||||||
|
</RelativeLayout>
|
||||||
|
|
||||||
<RelativeLayout
|
<RelativeLayout
|
||||||
android:id="@+id/settings_clickable_links_holder"
|
android:id="@+id/settings_clickable_links_holder"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
|
@ -24,7 +24,7 @@
|
|||||||
<string name="delete_note_only">This will delete the note only.</string>
|
<string name="delete_note_only">This will delete the note only.</string>
|
||||||
<string name="delete_file_itself">Delete the file itself too</string>
|
<string name="delete_file_itself">Delete the file itself too</string>
|
||||||
<string name="note_saved_successfully">Note saved successfully</string>
|
<string name="note_saved_successfully">Note saved successfully</string>
|
||||||
<string name="display_success_message">Display success message after saving a note</string>
|
<string name="display_success_message">Display save success message</string>
|
||||||
|
|
||||||
<!-- Settings -->
|
<!-- Settings -->
|
||||||
<string name="widget_note">Widget Notiz</string>
|
<string name="widget_note">Widget Notiz</string>
|
||||||
|
@ -24,7 +24,7 @@
|
|||||||
<string name="delete_note_only">This will delete the note only.</string>
|
<string name="delete_note_only">This will delete the note only.</string>
|
||||||
<string name="delete_file_itself">Delete the file itself too</string>
|
<string name="delete_file_itself">Delete the file itself too</string>
|
||||||
<string name="note_saved_successfully">Note \"%1$s\" saved successfully</string>
|
<string name="note_saved_successfully">Note \"%1$s\" saved successfully</string>
|
||||||
<string name="display_success_message">Display success message after saving a note</string>
|
<string name="display_success_message">Display save success message</string>
|
||||||
|
|
||||||
<!-- Settings -->
|
<!-- Settings -->
|
||||||
<string name="note_font_size">Tamaño de fuente</string>
|
<string name="note_font_size">Tamaño de fuente</string>
|
||||||
|
@ -24,7 +24,7 @@
|
|||||||
<string name="delete_note_only">This will delete the note only.</string>
|
<string name="delete_note_only">This will delete the note only.</string>
|
||||||
<string name="delete_file_itself">Delete the file itself too</string>
|
<string name="delete_file_itself">Delete the file itself too</string>
|
||||||
<string name="note_saved_successfully">Note \"%1$s\" saved successfully</string>
|
<string name="note_saved_successfully">Note \"%1$s\" saved successfully</string>
|
||||||
<string name="display_success_message">Display success message after saving a note</string>
|
<string name="display_success_message">Display save success message</string>
|
||||||
|
|
||||||
<!-- Settings -->
|
<!-- Settings -->
|
||||||
<string name="widget_note">Note utilisée dans le widget</string>
|
<string name="widget_note">Note utilisée dans le widget</string>
|
||||||
|
@ -24,7 +24,7 @@
|
|||||||
<string name="delete_note_only">This will delete the note only.</string>
|
<string name="delete_note_only">This will delete the note only.</string>
|
||||||
<string name="delete_file_itself">Delete the file itself too</string>
|
<string name="delete_file_itself">Delete the file itself too</string>
|
||||||
<string name="note_saved_successfully">Note \"%1$s\" saved successfully</string>
|
<string name="note_saved_successfully">Note \"%1$s\" saved successfully</string>
|
||||||
<string name="display_success_message">Display success message after saving a note</string>
|
<string name="display_success_message">Display save success message</string>
|
||||||
|
|
||||||
<!-- Settings -->
|
<!-- Settings -->
|
||||||
<string name="widget_note">A widget-ben használt jegyzet</string>
|
<string name="widget_note">A widget-ben használt jegyzet</string>
|
||||||
|
@ -24,7 +24,7 @@
|
|||||||
<string name="delete_note_only">This will delete the note only.</string>
|
<string name="delete_note_only">This will delete the note only.</string>
|
||||||
<string name="delete_file_itself">Delete the file itself too</string>
|
<string name="delete_file_itself">Delete the file itself too</string>
|
||||||
<string name="note_saved_successfully">Note \"%1$s\" saved successfully</string>
|
<string name="note_saved_successfully">Note \"%1$s\" saved successfully</string>
|
||||||
<string name="display_success_message">Display success message after saving a note</string>
|
<string name="display_success_message">Display save success message</string>
|
||||||
|
|
||||||
<!-- Settings -->
|
<!-- Settings -->
|
||||||
<string name="note_font_size">Note font size</string>
|
<string name="note_font_size">Note font size</string>
|
||||||
|
@ -24,7 +24,7 @@
|
|||||||
<string name="delete_note_only">This will delete the note only.</string>
|
<string name="delete_note_only">This will delete the note only.</string>
|
||||||
<string name="delete_file_itself">Delete the file itself too</string>
|
<string name="delete_file_itself">Delete the file itself too</string>
|
||||||
<string name="note_saved_successfully">Note \"%1$s\" saved successfully</string>
|
<string name="note_saved_successfully">Note \"%1$s\" saved successfully</string>
|
||||||
<string name="display_success_message">Display success message after saving a note</string>
|
<string name="display_success_message">Display save success message</string>
|
||||||
|
|
||||||
<!-- Settings -->
|
<!-- Settings -->
|
||||||
<string name="note_font_size">メモのフォントサイズ</string>
|
<string name="note_font_size">メモのフォントサイズ</string>
|
||||||
|
@ -24,7 +24,7 @@
|
|||||||
<string name="delete_note_only">This will delete the note only.</string>
|
<string name="delete_note_only">This will delete the note only.</string>
|
||||||
<string name="delete_file_itself">Delete the file itself too</string>
|
<string name="delete_file_itself">Delete the file itself too</string>
|
||||||
<string name="note_saved_successfully">Note \"%1$s\" saved successfully</string>
|
<string name="note_saved_successfully">Note \"%1$s\" saved successfully</string>
|
||||||
<string name="display_success_message">Display success message after saving a note</string>
|
<string name="display_success_message">Display save success message</string>
|
||||||
|
|
||||||
<!-- Settings -->
|
<!-- Settings -->
|
||||||
<string name="note_font_size">Tamanho do texto da nota</string>
|
<string name="note_font_size">Tamanho do texto da nota</string>
|
||||||
|
@ -24,7 +24,7 @@
|
|||||||
<string name="delete_note_only">This will delete the note only.</string>
|
<string name="delete_note_only">This will delete the note only.</string>
|
||||||
<string name="delete_file_itself">Delete the file itself too</string>
|
<string name="delete_file_itself">Delete the file itself too</string>
|
||||||
<string name="note_saved_successfully">Note \"%1$s\" saved successfully</string>
|
<string name="note_saved_successfully">Note \"%1$s\" saved successfully</string>
|
||||||
<string name="display_success_message">Display success message after saving a note</string>
|
<string name="display_success_message">Display save success message</string>
|
||||||
|
|
||||||
<!-- Settings -->
|
<!-- Settings -->
|
||||||
<string name="note_font_size">Note font size</string>
|
<string name="note_font_size">Note font size</string>
|
||||||
|
@ -24,7 +24,7 @@
|
|||||||
<string name="delete_note_only">This will delete the note only.</string>
|
<string name="delete_note_only">This will delete the note only.</string>
|
||||||
<string name="delete_file_itself">Delete the file itself too</string>
|
<string name="delete_file_itself">Delete the file itself too</string>
|
||||||
<string name="note_saved_successfully">Note \"%1$s\" saved successfully</string>
|
<string name="note_saved_successfully">Note \"%1$s\" saved successfully</string>
|
||||||
<string name="display_success_message">Display success message after saving a note</string>
|
<string name="display_success_message">Display save success message</string>
|
||||||
|
|
||||||
<!-- Settings -->
|
<!-- Settings -->
|
||||||
<string name="widget_note">Note used in widget</string>
|
<string name="widget_note">Note used in widget</string>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user