Skip to content

Commit a0cbedd

Browse files
committed
materializing the dialogs
1 parent 797ac60 commit a0cbedd

15 files changed

+147
-129
lines changed

app/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ android {
6363
}
6464

6565
dependencies {
66-
implementation 'com.github.SimpleMobileTools:Simple-Commons:4f9c2f94ff'
66+
implementation 'com.github.SimpleMobileTools:Simple-Commons:5d40d6640c'
6767
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
6868
implementation 'androidx.documentfile:documentfile:1.0.1'
6969

app/src/main/kotlin/com/simplemobiletools/notes/pro/activities/MainActivity.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -442,8 +442,8 @@ class MainActivity : SimpleActivity() {
442442
.forEach(::removeProtection)
443443

444444
mNotes = notes
445-
refreshMenuItems()
446445
mCurrentNote = mNotes[0]
446+
refreshMenuItems()
447447
mAdapter = NotesPagerAdapter(supportFragmentManager, mNotes, this)
448448
view_pager.apply {
449449
adapter = mAdapter

app/src/main/kotlin/com/simplemobiletools/notes/pro/dialogs/ExportFileDialog.kt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,13 @@ class ExportFileDialog(val activity: SimpleActivity, val note: Note, val callbac
1515
init {
1616
var realPath = File(note.path).parent ?: activity.config.lastUsedSavePath
1717
val view = activity.layoutInflater.inflate(R.layout.dialog_export_file, null).apply {
18-
file_path.text = activity.humanizePath(realPath)
18+
file_path.setText(activity.humanizePath(realPath))
1919

2020
file_name.setText(note.title)
21-
file_extension.setText(activity.config.lastUsedExtension)
21+
extension.setText(activity.config.lastUsedExtension)
2222
file_path.setOnClickListener {
2323
FilePickerDialog(activity, realPath, false, false, true, true) {
24-
file_path.text = activity.humanizePath(it)
24+
file_path.setText(activity.humanizePath(it))
2525
realPath = it
2626
}
2727
}
@@ -35,7 +35,7 @@ class ExportFileDialog(val activity: SimpleActivity, val note: Note, val callbac
3535
alertDialog.showKeyboard(view.file_name)
3636
alertDialog.getButton(AlertDialog.BUTTON_POSITIVE).setOnClickListener {
3737
val filename = view.file_name.value
38-
val extension = view.file_extension.value
38+
val extension = view.extension.value
3939

4040
if (filename.isEmpty()) {
4141
activity.toast(R.string.filename_cannot_be_empty)

app/src/main/kotlin/com/simplemobiletools/notes/pro/dialogs/ExportFilesDialog.kt

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,12 @@ class ExportFilesDialog(val activity: SimpleActivity, val notes: ArrayList<Note>
1313
init {
1414
var realPath = activity.config.lastUsedSavePath
1515
val view = activity.layoutInflater.inflate(R.layout.dialog_export_files, null).apply {
16-
folder_path.text = activity.humanizePath(realPath)
16+
folder_path.setText(activity.humanizePath(realPath))
1717

18-
file_extension.setText(activity.config.lastUsedExtension)
18+
extension.setText(activity.config.lastUsedExtension)
1919
folder_path.setOnClickListener {
2020
FilePickerDialog(activity, realPath, false, false, true, true) {
21-
folder_path.text = activity.humanizePath(it)
21+
folder_path.setText(activity.humanizePath(it))
2222
realPath = it
2323
}
2424
}
@@ -29,10 +29,10 @@ class ExportFilesDialog(val activity: SimpleActivity, val notes: ArrayList<Note>
2929
.setNegativeButton(R.string.cancel, null)
3030
.apply {
3131
activity.setupDialogStuff(view, this, R.string.export_as_file) { alertDialog ->
32-
alertDialog.showKeyboard(view.file_extension)
32+
alertDialog.showKeyboard(view.extension)
3333
alertDialog.getButton(AlertDialog.BUTTON_POSITIVE).setOnClickListener {
3434
activity.handleSAFDialog(realPath) {
35-
val extension = view.file_extension.value
35+
val extension = view.extension.value
3636
activity.config.lastUsedExtension = extension
3737
activity.config.lastUsedSavePath = realPath
3838
callback(realPath, extension)

app/src/main/kotlin/com/simplemobiletools/notes/pro/dialogs/ImportFolderDialog.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ class ImportFolderDialog(val activity: SimpleActivity, val path: String, val cal
2020

2121
init {
2222
val view = (activity.layoutInflater.inflate(R.layout.dialog_import_folder, null) as ViewGroup).apply {
23-
open_file_filename.text = activity.humanizePath(path)
23+
open_file_filename.setText(activity.humanizePath(path))
2424
}
2525

2626
activity.getAlertDialogBuilder()

app/src/main/kotlin/com/simplemobiletools/notes/pro/dialogs/NewChecklistItemDialog.kt

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import android.view.ViewGroup
88
import android.view.inputmethod.EditorInfo
99
import androidx.appcompat.widget.AppCompatEditText
1010
import com.simplemobiletools.commons.extensions.*
11+
import com.simplemobiletools.commons.helpers.DARK_GREY
1112
import com.simplemobiletools.notes.pro.R
1213
import kotlinx.android.synthetic.main.dialog_new_checklist_item.view.*
1314
import kotlinx.android.synthetic.main.item_add_checklist.view.*
@@ -19,9 +20,14 @@ class NewChecklistItemDialog(val activity: Activity, callback: (titles: ArrayLis
1920

2021
init {
2122
addNewEditText()
23+
val plusTextColor = if (activity.isWhiteTheme()) {
24+
DARK_GREY
25+
} else {
26+
activity.getProperPrimaryColor().getContrastColor()
27+
}
28+
2229
view.apply {
23-
add_item.applyColorFilter(activity.getProperPrimaryColor())
24-
add_item.background.applyColorFilter(textColor)
30+
add_item.applyColorFilter(plusTextColor)
2531
add_item.setOnClickListener {
2632
addNewEditText()
2733
}

app/src/main/kotlin/com/simplemobiletools/notes/pro/dialogs/OpenFileDialog.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ class OpenFileDialog(val activity: SimpleActivity, val path: String, val callbac
1919

2020
init {
2121
val view = (activity.layoutInflater.inflate(R.layout.dialog_open_file, null) as ViewGroup).apply {
22-
open_file_filename.text = activity.humanizePath(path)
22+
open_file_filename.setText(activity.humanizePath(path))
2323
}
2424

2525
activity.getAlertDialogBuilder()

app/src/main/res/layout/dialog_export_file.xml

Lines changed: 38 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -6,56 +6,52 @@
66
android:orientation="vertical"
77
android:padding="@dimen/activity_margin">
88

9-
<com.simplemobiletools.commons.views.MyTextView
10-
android:id="@+id/file_path_label"
11-
android:layout_width="wrap_content"
12-
android:layout_height="wrap_content"
13-
android:text="@string/path"
14-
android:textSize="@dimen/smaller_text_size" />
15-
16-
<com.simplemobiletools.commons.views.MyTextView
17-
android:id="@+id/file_path"
9+
<com.simplemobiletools.commons.views.MyTextInputLayout
10+
android:id="@+id/file_path_hint"
1811
android:layout_width="match_parent"
1912
android:layout_height="wrap_content"
20-
android:paddingStart="@dimen/normal_margin"
21-
android:paddingTop="@dimen/small_margin"
22-
android:paddingEnd="@dimen/small_margin"
23-
android:paddingBottom="@dimen/activity_margin" />
24-
25-
<com.simplemobiletools.commons.views.MyTextView
26-
android:id="@+id/file_name_label"
27-
android:layout_width="wrap_content"
28-
android:layout_height="wrap_content"
29-
android:text="@string/filename"
30-
android:textSize="@dimen/smaller_text_size" />
13+
android:layout_marginBottom="@dimen/activity_margin"
14+
android:hint="@string/path">
15+
16+
<com.google.android.material.textfield.TextInputEditText
17+
android:id="@+id/file_path"
18+
style="@style/UnclickableEditText"
19+
android:layout_width="match_parent"
20+
android:layout_height="wrap_content" />
21+
22+
</com.simplemobiletools.commons.views.MyTextInputLayout>
3123

32-
<com.simplemobiletools.commons.views.MyEditText
33-
android:id="@+id/file_name"
24+
<com.simplemobiletools.commons.views.MyTextInputLayout
25+
android:id="@+id/file_name_hint"
3426
android:layout_width="match_parent"
3527
android:layout_height="wrap_content"
36-
android:layout_marginStart="@dimen/medium_margin"
3728
android:layout_marginBottom="@dimen/activity_margin"
38-
android:inputType="text"
39-
android:singleLine="true"
40-
android:textCursorDrawable="@null"
41-
android:textSize="@dimen/normal_text_size" />
42-
43-
<com.simplemobiletools.commons.views.MyTextView
44-
android:id="@+id/file_extension_label"
45-
android:layout_width="wrap_content"
46-
android:layout_height="wrap_content"
47-
android:text="@string/extension"
48-
android:textSize="@dimen/smaller_text_size" />
29+
android:hint="@string/filename">
30+
31+
<com.google.android.material.textfield.TextInputEditText
32+
android:id="@+id/file_name"
33+
android:layout_width="match_parent"
34+
android:layout_height="wrap_content"
35+
android:inputType="textCapWords"
36+
android:singleLine="true"
37+
android:textCursorDrawable="@null"
38+
android:textSize="@dimen/bigger_text_size" />
39+
40+
</com.simplemobiletools.commons.views.MyTextInputLayout>
4941

50-
<com.simplemobiletools.commons.views.MyEditText
51-
android:id="@+id/file_extension"
42+
<com.simplemobiletools.commons.views.MyTextInputLayout
43+
android:id="@+id/extension_hint"
5244
android:layout_width="match_parent"
5345
android:layout_height="wrap_content"
54-
android:layout_marginStart="@dimen/medium_margin"
55-
android:layout_marginBottom="@dimen/activity_margin"
56-
android:inputType="text"
57-
android:singleLine="true"
58-
android:textCursorDrawable="@null"
59-
android:textSize="@dimen/normal_text_size" />
46+
android:hint="@string/extension">
47+
48+
<com.google.android.material.textfield.TextInputEditText
49+
android:id="@+id/extension"
50+
android:layout_width="match_parent"
51+
android:layout_height="wrap_content"
52+
android:singleLine="true"
53+
android:textCursorDrawable="@null"
54+
android:textSize="@dimen/bigger_text_size" />
6055

56+
</com.simplemobiletools.commons.views.MyTextInputLayout>
6157
</LinearLayout>

app/src/main/res/layout/dialog_export_files.xml

Lines changed: 23 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -6,38 +6,34 @@
66
android:orientation="vertical"
77
android:padding="@dimen/activity_margin">
88

9-
<com.simplemobiletools.commons.views.MyTextView
10-
android:id="@+id/folder_path_label"
11-
android:layout_width="wrap_content"
12-
android:layout_height="wrap_content"
13-
android:text="@string/path"
14-
android:textSize="@dimen/smaller_text_size" />
15-
16-
<com.simplemobiletools.commons.views.MyTextView
17-
android:id="@+id/folder_path"
9+
<com.simplemobiletools.commons.views.MyTextInputLayout
10+
android:id="@+id/folder_path_hint"
1811
android:layout_width="match_parent"
1912
android:layout_height="wrap_content"
20-
android:paddingStart="@dimen/normal_margin"
21-
android:paddingTop="@dimen/small_margin"
22-
android:paddingEnd="@dimen/small_margin"
23-
android:paddingBottom="@dimen/activity_margin" />
13+
android:layout_marginBottom="@dimen/activity_margin"
14+
android:hint="@string/path">
2415

25-
<com.simplemobiletools.commons.views.MyTextView
26-
android:id="@+id/file_extension_label"
27-
android:layout_width="wrap_content"
28-
android:layout_height="wrap_content"
29-
android:text="@string/extension"
30-
android:textSize="@dimen/smaller_text_size" />
16+
<com.google.android.material.textfield.TextInputEditText
17+
android:id="@+id/folder_path"
18+
style="@style/UnclickableEditText"
19+
android:layout_width="match_parent"
20+
android:layout_height="wrap_content" />
3121

32-
<com.simplemobiletools.commons.views.MyEditText
33-
android:id="@+id/file_extension"
22+
</com.simplemobiletools.commons.views.MyTextInputLayout>
23+
24+
<com.simplemobiletools.commons.views.MyTextInputLayout
25+
android:id="@+id/extension_hint"
3426
android:layout_width="match_parent"
3527
android:layout_height="wrap_content"
36-
android:layout_marginStart="@dimen/medium_margin"
37-
android:layout_marginBottom="@dimen/activity_margin"
38-
android:inputType="text"
39-
android:singleLine="true"
40-
android:textCursorDrawable="@null"
41-
android:textSize="@dimen/normal_text_size" />
28+
android:hint="@string/extension">
29+
30+
<com.google.android.material.textfield.TextInputEditText
31+
android:id="@+id/extension"
32+
android:layout_width="match_parent"
33+
android:layout_height="wrap_content"
34+
android:singleLine="true"
35+
android:textCursorDrawable="@null"
36+
android:textSize="@dimen/bigger_text_size" />
4237

38+
</com.simplemobiletools.commons.views.MyTextInputLayout>
4339
</LinearLayout>

app/src/main/res/layout/dialog_import_folder.xml

Lines changed: 11 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
3-
xmlns:tools="http://schemas.android.com/tools"
43
android:id="@+id/open_file_holder"
54
android:layout_width="match_parent"
65
android:layout_height="match_parent"
@@ -9,22 +8,20 @@
98
android:paddingTop="@dimen/activity_margin"
109
android:paddingEnd="@dimen/activity_margin">
1110

12-
<com.simplemobiletools.commons.views.MyTextView
13-
android:id="@+id/open_file_filename_label"
14-
android:layout_width="wrap_content"
15-
android:layout_height="wrap_content"
16-
android:text="@string/folder"
17-
android:textSize="@dimen/smaller_text_size" />
18-
19-
<com.simplemobiletools.commons.views.MyTextView
20-
android:id="@+id/open_file_filename"
11+
<com.simplemobiletools.commons.views.MyTextInputLayout
12+
android:id="@+id/open_file_filename_hint"
2113
android:layout_width="match_parent"
2214
android:layout_height="wrap_content"
23-
android:layout_marginStart="@dimen/activity_margin"
2415
android:layout_marginBottom="@dimen/activity_margin"
25-
android:paddingTop="@dimen/small_margin"
26-
android:paddingEnd="@dimen/small_margin"
27-
tools:text="myfile.txt" />
16+
android:hint="@string/folder">
17+
18+
<com.google.android.material.textfield.TextInputEditText
19+
android:id="@+id/open_file_filename"
20+
style="@style/UnclickableEditText"
21+
android:layout_width="match_parent"
22+
android:layout_height="wrap_content" />
23+
24+
</com.simplemobiletools.commons.views.MyTextInputLayout>
2825

2926
<RadioGroup
3027
android:id="@+id/open_file_type"

0 commit comments

Comments
 (0)