Skip to content

Commit 911619e

Browse files
committed
Updated dependencies
1 parent c25c84b commit 911619e

File tree

7 files changed

+45
-80
lines changed

7 files changed

+45
-80
lines changed

app/build.gradle

+3-3
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ android {
1212
applicationId "com.omgodse.notally"
1313
minSdk 21
1414
targetSdk 30
15-
versionCode 41
16-
versionName "4.6"
15+
versionCode 42
16+
versionName "4.7"
1717
resConfigs "en", "ca", "cs", "da", "de", "es", "fr", "hu", "in", "it", "ja", "nb", "nl", "nn", "pl", "pt-rBR", "pt-rPT", "ru", "sk", "sv", "tl", "tr", "uk", "zh-rCN"
1818
vectorDrawables.generatedDensities = []
1919
}
@@ -44,7 +44,7 @@ android {
4444

4545
dependencies {
4646
final def navVersion = "2.3.5"
47-
final def roomVersion = "2.4.1"
47+
final def roomVersion = "2.4.2"
4848

4949
implementation "androidx.preference:preference-ktx:1.1.1"
5050

app/src/main/java/com/omgodse/notally/miscellaneous/Extensions.kt

+31-62
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
package com.omgodse.notally.miscellaneous
22

3-
import android.content.Context
43
import android.graphics.Typeface
5-
import android.os.Build
64
import android.text.Editable
75
import android.text.InputType
86
import android.text.Spannable
@@ -11,55 +9,42 @@ import android.text.style.StrikethroughSpan
119
import android.text.style.StyleSpan
1210
import android.text.style.TypefaceSpan
1311
import android.text.style.URLSpan
14-
import android.view.*
12+
import android.view.KeyEvent
13+
import android.view.Menu
14+
import android.view.MenuItem
1515
import android.view.inputmethod.EditorInfo
1616
import android.widget.EditText
17-
import com.google.android.material.chip.ChipGroup
1817
import com.omgodse.notally.activities.TakeNote
19-
import com.omgodse.notally.databinding.LabelBinding
20-
import com.omgodse.notally.room.ListItem
2118
import com.omgodse.notally.room.SpanRepresentation
22-
import java.util.*
23-
24-
fun List<ListItem>?.getBody() = buildString {
25-
this@getBody?.forEachIndexed { index, (body) ->
26-
appendLine("${(index + 1)}) $body")
27-
}
28-
}
29-
30-
31-
fun ChipGroup.bindLabels(labels: HashSet<String>) {
32-
if (labels.isEmpty()) {
33-
visibility = View.GONE
34-
} else {
35-
visibility = View.VISIBLE
36-
removeAllViews()
37-
val inflater = LayoutInflater.from(context)
38-
for (label in labels) {
39-
val view = LabelBinding.inflate(inflater, this, true).root
40-
view.text = label
41-
}
42-
}
43-
}
4419

20+
/**
21+
* For some reason, this method crashes sometimes with an
22+
* IndexOutOfBoundsException that I've not been able to replicate.
23+
* When this happens, to prevent the entire app from crashing and becoming
24+
* unusable, the exception is suppressed.
25+
*/
4526
fun String.applySpans(representations: List<SpanRepresentation>): Editable {
4627
val editable = Editable.Factory.getInstance().newEditable(this)
4728
representations.forEach { (bold, link, italic, monospace, strikethrough, start, end) ->
48-
if (bold) {
49-
editable.setSpan(StyleSpan(Typeface.BOLD), start, end)
50-
}
51-
if (italic) {
52-
editable.setSpan(StyleSpan(Typeface.ITALIC), start, end)
53-
}
54-
if (link) {
55-
val url = getURL(start, end)
56-
editable.setSpan(URLSpan(url), start, end)
57-
}
58-
if (monospace) {
59-
editable.setSpan(TypefaceSpan("monospace"), start, end)
60-
}
61-
if (strikethrough) {
62-
editable.setSpan(StrikethroughSpan(), start, end)
29+
try {
30+
if (bold) {
31+
editable.setSpan(StyleSpan(Typeface.BOLD), start, end)
32+
}
33+
if (italic) {
34+
editable.setSpan(StyleSpan(Typeface.ITALIC), start, end)
35+
}
36+
if (link) {
37+
val url = getURL(start, end)
38+
editable.setSpan(URLSpan(url), start, end)
39+
}
40+
if (monospace) {
41+
editable.setSpan(TypefaceSpan("monospace"), start, end)
42+
}
43+
if (strikethrough) {
44+
editable.setSpan(StrikethroughSpan(), start, end)
45+
}
46+
} catch (exception: Exception) {
47+
exception.printStackTrace()
6348
}
6449
}
6550
return editable
@@ -72,29 +57,13 @@ private fun String.getURL(start: Int, end: Int): String {
7257
} else TakeNote.getURLFrom(substring(start, length))
7358
}
7459

75-
/**
76-
* For some reason, this method crashes sometimes with an
77-
* IndexOutOfBoundsException that I've not been able to replicate.
78-
* When this happens, to prevent the entire app from crashing and becoming
79-
* unusable, the exception is suppressed.
80-
*/
8160
private fun Spannable.setSpan(span: Any, start: Int, end: Int) {
82-
try {
83-
if (end <= length) {
84-
setSpan(span, start, end, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE)
85-
} else setSpan(span, start, length, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE)
86-
} catch (exception: Exception) {
87-
exception.printStackTrace()
88-
}
61+
if (end <= length) {
62+
setSpan(span, start, end, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE)
63+
} else setSpan(span, start, length, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE)
8964
}
9065

9166

92-
fun Context.getLocale(): Locale {
93-
return if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
94-
resources.configuration.locales[0]
95-
} else resources.configuration.locale
96-
}
97-
9867
fun EditText.setOnNextAction(onNext: () -> Unit) {
9968
setRawInputType(InputType.TYPE_CLASS_TEXT or InputType.TYPE_TEXT_FLAG_CAP_SENTENCES)
10069

app/src/main/java/com/omgodse/notally/viewmodels/BaseNoteModel.kt

+7-11
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ class BaseNoteModel(private val app: Application) : AndroidViewModel(app) {
111111
fun exportBackup(uri: Uri) {
112112
viewModelScope.launch {
113113
withContext(Dispatchers.IO) {
114-
val labels = labelDao.getListOfAll().toHashSet()
114+
val labels = labelDao.getListOfAll()
115115
val baseNotes = baseNoteDao.getListFrom(Folder.NOTES)
116116
val deletedNotes = baseNoteDao.getListFrom(Folder.DELETED)
117117
val archivedNotes = baseNoteDao.getListFrom(Folder.ARCHIVED)
@@ -158,41 +158,36 @@ class BaseNoteModel(private val app: Application) : AndroidViewModel(app) {
158158

159159

160160
suspend fun getXMLFile(baseNote: BaseNote) = withContext(Dispatchers.IO) {
161-
val name = getFileName(baseNote)
162-
val file = File(getExportedPath(), "$name.xml")
161+
val file = File(getExportedPath(), "Untitled.xml")
163162
val outputStream = FileOutputStream(file)
164163
XMLUtils.writeBaseNoteToStream(baseNote, outputStream)
165164
outputStream.close()
166165
file
167166
}
168167

169168
suspend fun getJSONFile(baseNote: BaseNote) = withContext(Dispatchers.IO) {
170-
val name = getFileName(baseNote)
171-
val file = File(getExportedPath(), "$name.json")
169+
val file = File(getExportedPath(), "Untitled.json")
172170
val json = getJSON(baseNote)
173171
file.writeText(json)
174172
file
175173
}
176174

177175
suspend fun getTXTFile(baseNote: BaseNote, showDateCreated: Boolean) = withContext(Dispatchers.IO) {
178-
val name = getFileName(baseNote)
179-
val file = File(getExportedPath(), "$name.txt")
176+
val file = File(getExportedPath(), "Untitled.txt")
180177
val text = getTXT(baseNote, showDateCreated)
181178
file.writeText(text)
182179
file
183180
}
184181

185182
suspend fun getHTMLFile(baseNote: BaseNote, showDateCreated: Boolean) = withContext(Dispatchers.IO) {
186-
val name = getFileName(baseNote)
187-
val file = File(getExportedPath(), "$name.html")
183+
val file = File(getExportedPath(), "Untitled.html")
188184
val html = getHTML(baseNote, showDateCreated)
189185
file.writeText(html)
190186
file
191187
}
192188

193189
fun getPDFFile(baseNote: BaseNote, showDateCreated: Boolean, onResult: PostPDFGenerator.OnResult) {
194-
val name = getFileName(baseNote)
195-
val file = File(getExportedPath(), "$name.pdf")
190+
val file = File(getExportedPath(), "Untitled.pdf")
196191
val html = getHTML(baseNote, showDateCreated)
197192
PostPDFGenerator.create(file, html, app, onResult)
198193
}
@@ -246,6 +241,7 @@ class BaseNoteModel(private val app: Application) : AndroidViewModel(app) {
246241

247242
val jsonObject = JSONObject()
248243
.put("type", baseNote.type.name)
244+
.put("color", baseNote.color.name)
249245
.put(XMLTags.Title, baseNote.title)
250246
.put(XMLTags.Pinned, baseNote.pinned)
251247
.put(XMLTags.DateCreated, baseNote.timestamp)

app/src/main/java/com/omgodse/notally/xml/Backup.kt

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,5 @@ class Backup(
66
val baseNotes: List<BaseNote>,
77
val deletedNotes: List<BaseNote>,
88
val archivedNotes: List<BaseNote>,
9-
val labels: HashSet<String>
9+
val labels: List<String>
1010
)

app/src/main/java/com/omgodse/notally/xml/XMLUtils.kt

+1-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ object XMLUtils {
2828
var baseNotes = listOf<BaseNote>()
2929
var deletedNotes = listOf<BaseNote>()
3030
var archivedNotes = listOf<BaseNote>()
31-
val labels = HashSet<String>()
31+
val labels = ArrayList<String>()
3232

3333
while (parser.next() != XmlPullParser.END_DOCUMENT) {
3434
if (parser.eventType == XmlPullParser.START_TAG) {

build.gradle

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ buildscript {
77

88
dependencies {
99
classpath "com.android.tools.build:gradle:7.0.4"
10-
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.6.10"
10+
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.6.21"
1111
}
1212
}
1313

fastlane/metadata/android/en-US/full_description.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ Notally is a minimalistic note taking app with a beautiful material design and p
44

55
Create lists to stay on track
66
Pin notes to always keep them at the top
7-
Add labels to your notes for quick organisation
7+
Color and label your notes for quick organisation
88
Archive notes to keep them around, but out of your way
99
Create rich text notes with support for bold, italics, mono space and strike-through
1010
Add clickable links to notes with support for phone numbers, email addresses and web urls

0 commit comments

Comments
 (0)