mirror of
https://github.com/SimpleMobileTools/Simple-Notes.git
synced 2025-04-13 23:12:02 +02:00
add a widget note picker at the config screen, if more notes are available
This commit is contained in:
parent
f52aa7f245
commit
4743db8dc0
@ -4,19 +4,20 @@ import android.app.Activity
|
||||
import android.appwidget.AppWidgetManager
|
||||
import android.content.Intent
|
||||
import android.graphics.Color
|
||||
import android.graphics.drawable.ColorDrawable
|
||||
import android.os.Bundle
|
||||
import android.util.TypedValue
|
||||
import android.widget.RemoteViews
|
||||
import android.widget.SeekBar
|
||||
import com.simplemobiletools.commons.dialogs.ColorPickerDialog
|
||||
import com.simplemobiletools.commons.extensions.adjustAlpha
|
||||
import com.simplemobiletools.commons.extensions.setBackgroundColor
|
||||
import com.simplemobiletools.commons.extensions.setFillWithStroke
|
||||
import com.simplemobiletools.commons.extensions.*
|
||||
import com.simplemobiletools.commons.helpers.IS_CUSTOMIZING_COLORS
|
||||
import com.simplemobiletools.notes.R
|
||||
import com.simplemobiletools.notes.extensions.config
|
||||
import com.simplemobiletools.notes.extensions.dbHelper
|
||||
import com.simplemobiletools.notes.extensions.getTextSize
|
||||
import com.simplemobiletools.notes.helpers.MyWidgetProvider
|
||||
import com.simplemobiletools.notes.models.Note
|
||||
import kotlinx.android.synthetic.main.widget_config.*
|
||||
|
||||
class WidgetConfigureActivity : SimpleActivity() {
|
||||
@ -25,6 +26,7 @@ class WidgetConfigureActivity : SimpleActivity() {
|
||||
private var mBgColor = 0
|
||||
private var mBgColorWithoutTransparency = 0
|
||||
private var mTextColor = 0
|
||||
private var mNotes = ArrayList<Note>()
|
||||
|
||||
public override fun onCreate(savedInstanceState: Bundle?) {
|
||||
useDynamicTheme = false
|
||||
@ -40,9 +42,12 @@ class WidgetConfigureActivity : SimpleActivity() {
|
||||
finish()
|
||||
}
|
||||
|
||||
updateTextColors(notes_picker_holder)
|
||||
config_save.setOnClickListener { saveConfig() }
|
||||
config_bg_color.setOnClickListener { pickBackgroundColor() }
|
||||
config_text_color.setOnClickListener { pickTextColor() }
|
||||
notes_picker_value.setOnClickListener { showNoteSelector() }
|
||||
notes_picker_holder.background = ColorDrawable(config.backgroundColor)
|
||||
}
|
||||
|
||||
override fun onResume() {
|
||||
@ -68,6 +73,12 @@ class WidgetConfigureActivity : SimpleActivity() {
|
||||
|
||||
mTextColor = config.widgetTextColor
|
||||
updateTextColor()
|
||||
mNotes = dbHelper.getNotes()
|
||||
notes_picker_holder.beVisibleIf(mNotes.size > 1)
|
||||
}
|
||||
|
||||
private fun showNoteSelector() {
|
||||
|
||||
}
|
||||
|
||||
private fun saveConfig() {
|
||||
|
@ -7,11 +7,36 @@
|
||||
android:layout_centerHorizontal="true"
|
||||
android:layout_margin="@dimen/activity_margin">
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/notes_picker_holder"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:padding="@dimen/activity_margin">
|
||||
|
||||
<com.simplemobiletools.commons.views.MyTextView
|
||||
android:id="@+id/notes_picker_label"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="@dimen/normal_margin"
|
||||
android:text="@string/note_shown_widget"/>
|
||||
|
||||
<com.simplemobiletools.commons.views.MyTextView
|
||||
android:id="@+id/notes_picker_value"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@+id/notes_picker_label"
|
||||
android:background="@drawable/button_background"
|
||||
android:padding="@dimen/normal_margin"
|
||||
android:text="@string/general_note"/>
|
||||
|
||||
</RelativeLayout>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/notes_view"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_above="@+id/config_bg_color"
|
||||
android:layout_below="@+id/notes_picker_holder"
|
||||
android:layout_marginBottom="@dimen/activity_margin"
|
||||
android:background="@null"
|
||||
android:gravity="top"
|
||||
|
@ -16,6 +16,7 @@
|
||||
<string name="create_new_note">Yeni qeyd yarat</string>
|
||||
<string name="add_to_note">Qeydə əlavə et</string>
|
||||
<string name="unsaved_changes_warning">You have some unsaved changes. What do you want to do with them?</string>
|
||||
<string name="note_shown_widget">Note shown in the widget:</string>
|
||||
|
||||
<!-- File notes -->
|
||||
<string name="open_file">Faylı Aç</string>
|
||||
|
@ -16,6 +16,7 @@
|
||||
<string name="create_new_note">Opret en ny note</string>
|
||||
<string name="add_to_note">Føj til note</string>
|
||||
<string name="unsaved_changes_warning">You have some unsaved changes. What do you want to do with them?</string>
|
||||
<string name="note_shown_widget">Note shown in the widget:</string>
|
||||
|
||||
<!-- File notes -->
|
||||
<string name="open_file">Åbn fil …</string>
|
||||
|
@ -16,6 +16,7 @@
|
||||
<string name="create_new_note">Neue Notiz erstellen</string>
|
||||
<string name="add_to_note">Zu Notiz hinzufügen</string>
|
||||
<string name="unsaved_changes_warning">You have some unsaved changes. What do you want to do with them?</string>
|
||||
<string name="note_shown_widget">Note shown in the widget:</string>
|
||||
|
||||
<!-- File notes -->
|
||||
<string name="open_file">Datei öffnen</string>
|
||||
|
@ -16,6 +16,7 @@
|
||||
<string name="create_new_note">Crear una nota nueva</string>
|
||||
<string name="add_to_note">Añadir a la nota</string>
|
||||
<string name="unsaved_changes_warning">You have some unsaved changes. What do you want to do with them?</string>
|
||||
<string name="note_shown_widget">Note shown in the widget:</string>
|
||||
|
||||
<!-- File notes -->
|
||||
<string name="open_file">Abrir archivo</string>
|
||||
|
@ -16,6 +16,7 @@
|
||||
<string name="create_new_note">Créer une nouvelle note</string>
|
||||
<string name="add_to_note">Ajouter à la note</string>
|
||||
<string name="unsaved_changes_warning">You have some unsaved changes. What do you want to do with them?</string>
|
||||
<string name="note_shown_widget">Note shown in the widget:</string>
|
||||
|
||||
<!-- File notes -->
|
||||
<string name="open_file">Ouvrir le fichier</string>
|
||||
|
@ -18,6 +18,7 @@
|
||||
<string name="create_new_note">Crear unha nova nota</string>
|
||||
<string name="add_to_note">Engadir a nota</string>
|
||||
<string name="unsaved_changes_warning">You have some unsaved changes. What do you want to do with them?</string>
|
||||
<string name="note_shown_widget">Note shown in the widget:</string>
|
||||
|
||||
<!-- File notes -->
|
||||
<string name="open_file">Abrir ficheiro</string>
|
||||
|
@ -16,6 +16,7 @@
|
||||
<string name="create_new_note">Stvori novu bilješku</string>
|
||||
<string name="add_to_note">Dodaj u bilješku</string>
|
||||
<string name="unsaved_changes_warning">You have some unsaved changes. What do you want to do with them?</string>
|
||||
<string name="note_shown_widget">Note shown in the widget:</string>
|
||||
|
||||
<!-- File notes -->
|
||||
<string name="open_file">Otvori datoteku</string>
|
||||
|
@ -16,6 +16,7 @@
|
||||
<string name="create_new_note">Create a new note</string>
|
||||
<string name="add_to_note">Add to note</string>
|
||||
<string name="unsaved_changes_warning">You have some unsaved changes. What do you want to do with them?</string>
|
||||
<string name="note_shown_widget">Note shown in the widget:</string>
|
||||
|
||||
<!-- File notes -->
|
||||
<string name="open_file">Fájl megnyitása</string>
|
||||
|
@ -16,6 +16,7 @@
|
||||
<string name="create_new_note">Create a new note</string>
|
||||
<string name="add_to_note">Add to note</string>
|
||||
<string name="unsaved_changes_warning">You have some unsaved changes. What do you want to do with them?</string>
|
||||
<string name="note_shown_widget">Note shown in the widget:</string>
|
||||
|
||||
<!-- File notes -->
|
||||
<string name="open_file">Open file</string>
|
||||
|
@ -16,6 +16,7 @@
|
||||
<string name="create_new_note">Create a new note</string>
|
||||
<string name="add_to_note">Add to note</string>
|
||||
<string name="unsaved_changes_warning">You have some unsaved changes. What do you want to do with them?</string>
|
||||
<string name="note_shown_widget">Note shown in the widget:</string>
|
||||
|
||||
<!-- File notes -->
|
||||
<string name="open_file">Open file</string>
|
||||
|
@ -16,6 +16,7 @@
|
||||
<string name="create_new_note">Kurti naują įrašą</string>
|
||||
<string name="add_to_note">Papildyti įrašą</string>
|
||||
<string name="unsaved_changes_warning">You have some unsaved changes. What do you want to do with them?</string>
|
||||
<string name="note_shown_widget">Note shown in the widget:</string>
|
||||
|
||||
<!-- File notes -->
|
||||
<string name="open_file">Atverti failą</string>
|
||||
|
@ -16,6 +16,7 @@
|
||||
<string name="create_new_note">Nieuwe notitie maken</string>
|
||||
<string name="add_to_note">Aan notitie toevoegen</string>
|
||||
<string name="unsaved_changes_warning">You have some unsaved changes. What do you want to do with them?</string>
|
||||
<string name="note_shown_widget">Note shown in the widget:</string>
|
||||
|
||||
<!-- File notes -->
|
||||
<string name="open_file">Bestand openen</string>
|
||||
|
@ -16,6 +16,7 @@
|
||||
<string name="create_new_note">Utwórz nową notatkę</string>
|
||||
<string name="add_to_note">Dodaj do notatki</string>
|
||||
<string name="unsaved_changes_warning">You have some unsaved changes. What do you want to do with them?</string>
|
||||
<string name="note_shown_widget">Note shown in the widget:</string>
|
||||
|
||||
<!-- File notes -->
|
||||
<string name="open_file">Otwórz plik</string>
|
||||
|
@ -16,6 +16,7 @@
|
||||
<string name="create_new_note">Criar uma nova nota</string>
|
||||
<string name="add_to_note">Adicionar à nota</string>
|
||||
<string name="unsaved_changes_warning">You have some unsaved changes. What do you want to do with them?</string>
|
||||
<string name="note_shown_widget">Note shown in the widget:</string>
|
||||
|
||||
<!-- File notes -->
|
||||
<string name="open_file">Abrir arquivo</string>
|
||||
|
@ -16,6 +16,7 @@
|
||||
<string name="create_new_note">Criar uma nota</string>
|
||||
<string name="add_to_note">Adicionar a uma nota</string>
|
||||
<string name="unsaved_changes_warning">You have some unsaved changes. What do you want to do with them?</string>
|
||||
<string name="note_shown_widget">Note shown in the widget:</string>
|
||||
|
||||
<!-- File notes -->
|
||||
<string name="open_file">Abrir ficheiro</string>
|
||||
|
@ -16,6 +16,7 @@
|
||||
<string name="create_new_note">Новая заметка</string>
|
||||
<string name="add_to_note">Добавить к заметке</string>
|
||||
<string name="unsaved_changes_warning">You have some unsaved changes. What do you want to do with them?</string>
|
||||
<string name="note_shown_widget">Note shown in the widget:</string>
|
||||
|
||||
<!-- File notes -->
|
||||
<string name="open_file">Открыть файл</string>
|
||||
|
@ -16,6 +16,7 @@
|
||||
<string name="create_new_note">Vytvoriť novú poznámku</string>
|
||||
<string name="add_to_note">Pridať k poznámke</string>
|
||||
<string name="unsaved_changes_warning">Máte nejaké neuložené zmeny. Čo s nimi chcete spraviť?</string>
|
||||
<string name="note_shown_widget">Poznámka zobrazená vo widgete:</string>
|
||||
|
||||
<!-- File notes -->
|
||||
<string name="open_file">Otvoriť súbor</string>
|
||||
|
@ -16,6 +16,7 @@
|
||||
<string name="create_new_note">Skapa en ny anteckning</string>
|
||||
<string name="add_to_note">Lägg till i anteckning</string>
|
||||
<string name="unsaved_changes_warning">You have some unsaved changes. What do you want to do with them?</string>
|
||||
<string name="note_shown_widget">Note shown in the widget:</string>
|
||||
|
||||
<!-- File notes -->
|
||||
<string name="open_file">Öppna fil</string>
|
||||
|
@ -16,6 +16,7 @@
|
||||
<string name="create_new_note">Yeni not oluştur</string>
|
||||
<string name="add_to_note">Nota ekle</string>
|
||||
<string name="unsaved_changes_warning">You have some unsaved changes. What do you want to do with them?</string>
|
||||
<string name="note_shown_widget">Note shown in the widget:</string>
|
||||
|
||||
<!-- File notes -->
|
||||
<string name="open_file">Dosya aç</string>
|
||||
|
@ -16,6 +16,7 @@
|
||||
<string name="create_new_note">创建一个新的笔记</string>
|
||||
<string name="add_to_note">添加到笔记</string>
|
||||
<string name="unsaved_changes_warning">You have some unsaved changes. What do you want to do with them?</string>
|
||||
<string name="note_shown_widget">Note shown in the widget:</string>
|
||||
|
||||
<!-- File notes -->
|
||||
<string name="open_file">打开文件</string>
|
||||
|
@ -16,6 +16,7 @@
|
||||
<string name="create_new_note">建立新筆記</string>
|
||||
<string name="add_to_note">添加到筆記</string>
|
||||
<string name="unsaved_changes_warning">You have some unsaved changes. What do you want to do with them?</string>
|
||||
<string name="note_shown_widget">Note shown in the widget:</string>
|
||||
|
||||
<!-- File notes -->
|
||||
<string name="open_file">打開檔案</string>
|
||||
|
@ -16,6 +16,7 @@
|
||||
<string name="create_new_note">Create a new note</string>
|
||||
<string name="add_to_note">Add to note</string>
|
||||
<string name="unsaved_changes_warning">You have some unsaved changes. What do you want to do with them?</string>
|
||||
<string name="note_shown_widget">Note shown in the widget:</string>
|
||||
|
||||
<!-- File notes -->
|
||||
<string name="open_file">Open file</string>
|
||||
|
Loading…
x
Reference in New Issue
Block a user