materializing the dialogs

This commit is contained in:
tibbi 2022-07-12 10:46:57 +02:00
parent 797ac60d56
commit a0cbedd54d
15 changed files with 151 additions and 133 deletions

View File

@ -63,7 +63,7 @@ android {
} }
dependencies { dependencies {
implementation 'com.github.SimpleMobileTools:Simple-Commons:4f9c2f94ff' implementation 'com.github.SimpleMobileTools:Simple-Commons:5d40d6640c'
implementation 'androidx.constraintlayout:constraintlayout:2.1.4' implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
implementation 'androidx.documentfile:documentfile:1.0.1' implementation 'androidx.documentfile:documentfile:1.0.1'

View File

@ -442,8 +442,8 @@ class MainActivity : SimpleActivity() {
.forEach(::removeProtection) .forEach(::removeProtection)
mNotes = notes mNotes = notes
refreshMenuItems()
mCurrentNote = mNotes[0] mCurrentNote = mNotes[0]
refreshMenuItems()
mAdapter = NotesPagerAdapter(supportFragmentManager, mNotes, this) mAdapter = NotesPagerAdapter(supportFragmentManager, mNotes, this)
view_pager.apply { view_pager.apply {
adapter = mAdapter adapter = mAdapter

View File

@ -15,13 +15,13 @@ class ExportFileDialog(val activity: SimpleActivity, val note: Note, val callbac
init { init {
var realPath = File(note.path).parent ?: activity.config.lastUsedSavePath var realPath = File(note.path).parent ?: activity.config.lastUsedSavePath
val view = activity.layoutInflater.inflate(R.layout.dialog_export_file, null).apply { val view = activity.layoutInflater.inflate(R.layout.dialog_export_file, null).apply {
file_path.text = activity.humanizePath(realPath) file_path.setText(activity.humanizePath(realPath))
file_name.setText(note.title) file_name.setText(note.title)
file_extension.setText(activity.config.lastUsedExtension) extension.setText(activity.config.lastUsedExtension)
file_path.setOnClickListener { file_path.setOnClickListener {
FilePickerDialog(activity, realPath, false, false, true, true) { FilePickerDialog(activity, realPath, false, false, true, true) {
file_path.text = activity.humanizePath(it) file_path.setText(activity.humanizePath(it))
realPath = it realPath = it
} }
} }
@ -35,7 +35,7 @@ class ExportFileDialog(val activity: SimpleActivity, val note: Note, val callbac
alertDialog.showKeyboard(view.file_name) alertDialog.showKeyboard(view.file_name)
alertDialog.getButton(AlertDialog.BUTTON_POSITIVE).setOnClickListener { alertDialog.getButton(AlertDialog.BUTTON_POSITIVE).setOnClickListener {
val filename = view.file_name.value val filename = view.file_name.value
val extension = view.file_extension.value val extension = view.extension.value
if (filename.isEmpty()) { if (filename.isEmpty()) {
activity.toast(R.string.filename_cannot_be_empty) activity.toast(R.string.filename_cannot_be_empty)

View File

@ -13,12 +13,12 @@ class ExportFilesDialog(val activity: SimpleActivity, val notes: ArrayList<Note>
init { init {
var realPath = activity.config.lastUsedSavePath var realPath = activity.config.lastUsedSavePath
val view = activity.layoutInflater.inflate(R.layout.dialog_export_files, null).apply { val view = activity.layoutInflater.inflate(R.layout.dialog_export_files, null).apply {
folder_path.text = activity.humanizePath(realPath) folder_path.setText(activity.humanizePath(realPath))
file_extension.setText(activity.config.lastUsedExtension) extension.setText(activity.config.lastUsedExtension)
folder_path.setOnClickListener { folder_path.setOnClickListener {
FilePickerDialog(activity, realPath, false, false, true, true) { FilePickerDialog(activity, realPath, false, false, true, true) {
folder_path.text = activity.humanizePath(it) folder_path.setText(activity.humanizePath(it))
realPath = it realPath = it
} }
} }
@ -29,10 +29,10 @@ class ExportFilesDialog(val activity: SimpleActivity, val notes: ArrayList<Note>
.setNegativeButton(R.string.cancel, null) .setNegativeButton(R.string.cancel, null)
.apply { .apply {
activity.setupDialogStuff(view, this, R.string.export_as_file) { alertDialog -> activity.setupDialogStuff(view, this, R.string.export_as_file) { alertDialog ->
alertDialog.showKeyboard(view.file_extension) alertDialog.showKeyboard(view.extension)
alertDialog.getButton(AlertDialog.BUTTON_POSITIVE).setOnClickListener { alertDialog.getButton(AlertDialog.BUTTON_POSITIVE).setOnClickListener {
activity.handleSAFDialog(realPath) { activity.handleSAFDialog(realPath) {
val extension = view.file_extension.value val extension = view.extension.value
activity.config.lastUsedExtension = extension activity.config.lastUsedExtension = extension
activity.config.lastUsedSavePath = realPath activity.config.lastUsedSavePath = realPath
callback(realPath, extension) callback(realPath, extension)

View File

@ -20,7 +20,7 @@ class ImportFolderDialog(val activity: SimpleActivity, val path: String, val cal
init { init {
val view = (activity.layoutInflater.inflate(R.layout.dialog_import_folder, null) as ViewGroup).apply { val view = (activity.layoutInflater.inflate(R.layout.dialog_import_folder, null) as ViewGroup).apply {
open_file_filename.text = activity.humanizePath(path) open_file_filename.setText(activity.humanizePath(path))
} }
activity.getAlertDialogBuilder() activity.getAlertDialogBuilder()

View File

@ -8,6 +8,7 @@ import android.view.ViewGroup
import android.view.inputmethod.EditorInfo import android.view.inputmethod.EditorInfo
import androidx.appcompat.widget.AppCompatEditText import androidx.appcompat.widget.AppCompatEditText
import com.simplemobiletools.commons.extensions.* import com.simplemobiletools.commons.extensions.*
import com.simplemobiletools.commons.helpers.DARK_GREY
import com.simplemobiletools.notes.pro.R import com.simplemobiletools.notes.pro.R
import kotlinx.android.synthetic.main.dialog_new_checklist_item.view.* import kotlinx.android.synthetic.main.dialog_new_checklist_item.view.*
import kotlinx.android.synthetic.main.item_add_checklist.view.* import kotlinx.android.synthetic.main.item_add_checklist.view.*
@ -19,9 +20,14 @@ class NewChecklistItemDialog(val activity: Activity, callback: (titles: ArrayLis
init { init {
addNewEditText() addNewEditText()
val plusTextColor = if (activity.isWhiteTheme()) {
DARK_GREY
} else {
activity.getProperPrimaryColor().getContrastColor()
}
view.apply { view.apply {
add_item.applyColorFilter(activity.getProperPrimaryColor()) add_item.applyColorFilter(plusTextColor)
add_item.background.applyColorFilter(textColor)
add_item.setOnClickListener { add_item.setOnClickListener {
addNewEditText() addNewEditText()
} }

View File

@ -19,7 +19,7 @@ class OpenFileDialog(val activity: SimpleActivity, val path: String, val callbac
init { init {
val view = (activity.layoutInflater.inflate(R.layout.dialog_open_file, null) as ViewGroup).apply { val view = (activity.layoutInflater.inflate(R.layout.dialog_open_file, null) as ViewGroup).apply {
open_file_filename.text = activity.humanizePath(path) open_file_filename.setText(activity.humanizePath(path))
} }
activity.getAlertDialogBuilder() activity.getAlertDialogBuilder()

View File

@ -6,56 +6,52 @@
android:orientation="vertical" android:orientation="vertical"
android:padding="@dimen/activity_margin"> android:padding="@dimen/activity_margin">
<com.simplemobiletools.commons.views.MyTextView <com.simplemobiletools.commons.views.MyTextInputLayout
android:id="@+id/file_path_label" android:id="@+id/file_path_hint"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/path"
android:textSize="@dimen/smaller_text_size" />
<com.simplemobiletools.commons.views.MyTextView
android:id="@+id/file_path"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:paddingStart="@dimen/normal_margin"
android:paddingTop="@dimen/small_margin"
android:paddingEnd="@dimen/small_margin"
android:paddingBottom="@dimen/activity_margin" />
<com.simplemobiletools.commons.views.MyTextView
android:id="@+id/file_name_label"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/filename"
android:textSize="@dimen/smaller_text_size" />
<com.simplemobiletools.commons.views.MyEditText
android:id="@+id/file_name"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/medium_margin"
android:layout_marginBottom="@dimen/activity_margin" android:layout_marginBottom="@dimen/activity_margin"
android:inputType="text" android:hint="@string/path">
android:singleLine="true"
android:textCursorDrawable="@null"
android:textSize="@dimen/normal_text_size" />
<com.simplemobiletools.commons.views.MyTextView <com.google.android.material.textfield.TextInputEditText
android:id="@+id/file_extension_label" android:id="@+id/file_path"
android:layout_width="wrap_content" style="@style/UnclickableEditText"
android:layout_height="wrap_content" android:layout_width="match_parent"
android:text="@string/extension" android:layout_height="wrap_content" />
android:textSize="@dimen/smaller_text_size" />
<com.simplemobiletools.commons.views.MyEditText </com.simplemobiletools.commons.views.MyTextInputLayout>
android:id="@+id/file_extension"
<com.simplemobiletools.commons.views.MyTextInputLayout
android:id="@+id/file_name_hint"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginStart="@dimen/medium_margin"
android:layout_marginBottom="@dimen/activity_margin" android:layout_marginBottom="@dimen/activity_margin"
android:inputType="text" android:hint="@string/filename">
android:singleLine="true"
android:textCursorDrawable="@null"
android:textSize="@dimen/normal_text_size" />
<com.google.android.material.textfield.TextInputEditText
android:id="@+id/file_name"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:inputType="textCapWords"
android:singleLine="true"
android:textCursorDrawable="@null"
android:textSize="@dimen/bigger_text_size" />
</com.simplemobiletools.commons.views.MyTextInputLayout>
<com.simplemobiletools.commons.views.MyTextInputLayout
android:id="@+id/extension_hint"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="@string/extension">
<com.google.android.material.textfield.TextInputEditText
android:id="@+id/extension"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:singleLine="true"
android:textCursorDrawable="@null"
android:textSize="@dimen/bigger_text_size" />
</com.simplemobiletools.commons.views.MyTextInputLayout>
</LinearLayout> </LinearLayout>

View File

@ -6,38 +6,34 @@
android:orientation="vertical" android:orientation="vertical"
android:padding="@dimen/activity_margin"> android:padding="@dimen/activity_margin">
<com.simplemobiletools.commons.views.MyTextView <com.simplemobiletools.commons.views.MyTextInputLayout
android:id="@+id/folder_path_label" android:id="@+id/folder_path_hint"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/path"
android:textSize="@dimen/smaller_text_size" />
<com.simplemobiletools.commons.views.MyTextView
android:id="@+id/folder_path"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:paddingStart="@dimen/normal_margin"
android:paddingTop="@dimen/small_margin"
android:paddingEnd="@dimen/small_margin"
android:paddingBottom="@dimen/activity_margin" />
<com.simplemobiletools.commons.views.MyTextView
android:id="@+id/file_extension_label"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/extension"
android:textSize="@dimen/smaller_text_size" />
<com.simplemobiletools.commons.views.MyEditText
android:id="@+id/file_extension"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/medium_margin"
android:layout_marginBottom="@dimen/activity_margin" android:layout_marginBottom="@dimen/activity_margin"
android:inputType="text" android:hint="@string/path">
android:singleLine="true"
android:textCursorDrawable="@null"
android:textSize="@dimen/normal_text_size" />
<com.google.android.material.textfield.TextInputEditText
android:id="@+id/folder_path"
style="@style/UnclickableEditText"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
</com.simplemobiletools.commons.views.MyTextInputLayout>
<com.simplemobiletools.commons.views.MyTextInputLayout
android:id="@+id/extension_hint"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="@string/extension">
<com.google.android.material.textfield.TextInputEditText
android:id="@+id/extension"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:singleLine="true"
android:textCursorDrawable="@null"
android:textSize="@dimen/bigger_text_size" />
</com.simplemobiletools.commons.views.MyTextInputLayout>
</LinearLayout> </LinearLayout>

View File

@ -1,6 +1,5 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/open_file_holder" android:id="@+id/open_file_holder"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
@ -9,22 +8,20 @@
android:paddingTop="@dimen/activity_margin" android:paddingTop="@dimen/activity_margin"
android:paddingEnd="@dimen/activity_margin"> android:paddingEnd="@dimen/activity_margin">
<com.simplemobiletools.commons.views.MyTextView <com.simplemobiletools.commons.views.MyTextInputLayout
android:id="@+id/open_file_filename_label" android:id="@+id/open_file_filename_hint"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/folder"
android:textSize="@dimen/smaller_text_size" />
<com.simplemobiletools.commons.views.MyTextView
android:id="@+id/open_file_filename"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginStart="@dimen/activity_margin"
android:layout_marginBottom="@dimen/activity_margin" android:layout_marginBottom="@dimen/activity_margin"
android:paddingTop="@dimen/small_margin" android:hint="@string/folder">
android:paddingEnd="@dimen/small_margin"
tools:text="myfile.txt" /> <com.google.android.material.textfield.TextInputEditText
android:id="@+id/open_file_filename"
style="@style/UnclickableEditText"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
</com.simplemobiletools.commons.views.MyTextInputLayout>
<RadioGroup <RadioGroup
android:id="@+id/open_file_type" android:id="@+id/open_file_type"

View File

@ -21,11 +21,11 @@
<ImageView <ImageView
android:id="@+id/add_item" android:id="@+id/add_item"
style="@style/ColoredButtonStyle"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginTop="@dimen/medium_margin" android:layout_marginTop="@dimen/medium_margin"
android:layout_marginBottom="@dimen/medium_margin" android:layout_marginBottom="@dimen/medium_margin"
android:background="@drawable/button_background"
android:paddingStart="@dimen/activity_margin" android:paddingStart="@dimen/activity_margin"
android:paddingTop="@dimen/medium_margin" android:paddingTop="@dimen/medium_margin"
android:paddingEnd="@dimen/activity_margin" android:paddingEnd="@dimen/activity_margin"

View File

@ -8,14 +8,24 @@
android:paddingTop="@dimen/small_margin" android:paddingTop="@dimen/small_margin"
android:paddingEnd="@dimen/activity_margin"> android:paddingEnd="@dimen/activity_margin">
<com.simplemobiletools.commons.views.MyEditText <com.simplemobiletools.commons.views.MyTextInputLayout
android:id="@+id/note_title" android:id="@+id/note_title_hint"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginTop="@dimen/medium_margin"
android:layout_marginBottom="@dimen/activity_margin" android:layout_marginBottom="@dimen/activity_margin"
android:inputType="textCapSentences" android:hint="@string/label">
android:textCursorDrawable="@null"
android:textSize="@dimen/normal_text_size" /> <com.google.android.material.textfield.TextInputEditText
android:id="@+id/note_title"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:inputType="textCapSentences"
android:singleLine="true"
android:textCursorDrawable="@null"
android:textSize="@dimen/bigger_text_size" />
</com.simplemobiletools.commons.views.MyTextInputLayout>
<com.simplemobiletools.commons.views.MyTextView <com.simplemobiletools.commons.views.MyTextView
android:id="@+id/new_note_type_label" android:id="@+id/new_note_type_label"

View File

@ -8,21 +8,20 @@
android:paddingTop="@dimen/activity_margin" android:paddingTop="@dimen/activity_margin"
android:paddingEnd="@dimen/activity_margin"> android:paddingEnd="@dimen/activity_margin">
<com.simplemobiletools.commons.views.MyTextView <com.simplemobiletools.commons.views.MyTextInputLayout
android:id="@+id/open_file_filename_label" android:id="@+id/open_file_filename_hint"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/filename"
android:textSize="@dimen/smaller_text_size" />
<com.simplemobiletools.commons.views.MyTextView
android:id="@+id/open_file_filename"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginStart="@dimen/activity_margin"
android:layout_marginBottom="@dimen/activity_margin" android:layout_marginBottom="@dimen/activity_margin"
android:paddingTop="@dimen/small_margin" android:hint="@string/path">
android:paddingEnd="@dimen/small_margin" />
<com.google.android.material.textfield.TextInputEditText
android:id="@+id/open_file_filename"
style="@style/UnclickableEditText"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
</com.simplemobiletools.commons.views.MyTextInputLayout>
<RadioGroup <RadioGroup
android:id="@+id/open_file_type" android:id="@+id/open_file_type"

View File

@ -8,14 +8,21 @@
android:paddingTop="@dimen/activity_margin" android:paddingTop="@dimen/activity_margin"
android:paddingEnd="@dimen/activity_margin"> android:paddingEnd="@dimen/activity_margin">
<com.simplemobiletools.commons.views.MyEditText <com.simplemobiletools.commons.views.MyTextInputLayout
android:id="@+id/checklist_item_title" android:id="@+id/checklist_item_hint"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginTop="@dimen/small_margin" android:layout_marginBottom="@dimen/activity_margin"
android:layout_marginBottom="@dimen/small_margin" android:hint="@string/label">
android:inputType="textCapSentences"
android:textCursorDrawable="@null"
android:textSize="@dimen/bigger_text_size" />
<com.google.android.material.textfield.TextInputEditText
android:id="@+id/checklist_item_title"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:inputType="textCapSentences"
android:singleLine="true"
android:textCursorDrawable="@null"
android:textSize="@dimen/bigger_text_size" />
</com.simplemobiletools.commons.views.MyTextInputLayout>
</LinearLayout> </LinearLayout>

View File

@ -6,14 +6,21 @@
android:orientation="vertical" android:orientation="vertical"
android:padding="@dimen/activity_margin"> android:padding="@dimen/activity_margin">
<com.simplemobiletools.commons.views.MyEditText <com.simplemobiletools.commons.views.MyTextInputLayout
android:id="@+id/note_title" android:id="@+id/note_title_hint"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginBottom="@dimen/activity_margin" android:layout_marginBottom="@dimen/activity_margin"
android:inputType="textCapSentences" android:hint="@string/title">
android:singleLine="true"
android:textCursorDrawable="@null"
android:textSize="@dimen/normal_text_size" />
<com.google.android.material.textfield.TextInputEditText
android:id="@+id/note_title"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:inputType="textCapSentences"
android:singleLine="true"
android:textCursorDrawable="@null"
android:textSize="@dimen/bigger_text_size" />
</com.simplemobiletools.commons.views.MyTextInputLayout>
</LinearLayout> </LinearLayout>