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

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

View File

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

View File

@ -13,12 +13,12 @@ class ExportFilesDialog(val activity: SimpleActivity, val notes: ArrayList<Note>
init {
var realPath = activity.config.lastUsedSavePath
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 {
FilePickerDialog(activity, realPath, false, false, true, true) {
folder_path.text = activity.humanizePath(it)
folder_path.setText(activity.humanizePath(it))
realPath = it
}
}
@ -29,10 +29,10 @@ class ExportFilesDialog(val activity: SimpleActivity, val notes: ArrayList<Note>
.setNegativeButton(R.string.cancel, null)
.apply {
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 {
activity.handleSAFDialog(realPath) {
val extension = view.file_extension.value
val extension = view.extension.value
activity.config.lastUsedExtension = extension
activity.config.lastUsedSavePath = realPath
callback(realPath, extension)

View File

@ -20,7 +20,7 @@ class ImportFolderDialog(val activity: SimpleActivity, val path: String, val cal
init {
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()

View File

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

View File

@ -19,7 +19,7 @@ class OpenFileDialog(val activity: SimpleActivity, val path: String, val callbac
init {
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()