Skip to content

Commit

Permalink
Fixing issue with Alphabetical Sorting
Browse files Browse the repository at this point in the history
  • Loading branch information
BijoySingh committed Feb 21, 2019
1 parent eb9d6bc commit 16b8f71
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 5 deletions.
4 changes: 2 additions & 2 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ android {
applicationId "com.bijoysingh.quicknote"
minSdkVersion 17
targetSdkVersion 28
versionCode 122
versionName '6.9.4'
versionCode 123
versionName '6.9.5'
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package com.maubis.scarlet.base.core.note

import com.maubis.scarlet.base.database.room.note.Note
import com.maubis.scarlet.base.note.getAlphabets
import com.maubis.scarlet.base.note.getFullText
import com.maubis.scarlet.base.note.getText

Expand All @@ -23,7 +24,7 @@ fun sort(notes: List<Note>, sortingTechnique: SortingTechnique): List<Note> {
else note.timestamp
}
SortingTechnique.ALPHABETICAL -> notes.sortedBy { note ->
val content = note.getFullText()
val content = note.getAlphabets()
if (note.pinned || content.isBlank()) 0
else content[0].toInt()
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,13 @@ fun Note.getFullText(): String {
return formats.map { it -> it.markdownText }.joinToString(separator = "\n").trim()
}

fun Note.getAlphabets(): String {
val formats = getFormats()
return formats.map { it -> it.markdownText }.joinToString(separator = "\n").trim().filter {
((it in 'a'..'z') || (it in 'A'..'Z'))
}
}

fun Note.getUnreliablyStrippedText(context: Context): String {
val builder = StringBuilder()
builder.append(Markdown.render(removeMarkdownHeaders(getTitle())), true)
Expand Down
4 changes: 2 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ buildscript {
ext.android_support_version = '28.0.0'

// NOTE: Keep this in sync with the build.gradle for app/
ext.appconfig_version_code = 122
ext.appconfig_version = '6.9.4'
ext.appconfig_version_code = 123
ext.appconfig_version = '6.9.5'
ext.appconfig_min_os_version = 17
ext.appconfig_target_os_version = 28
ext.appconfig_build_tool_version = '28.0.3'
Expand Down

0 comments on commit 16b8f71

Please sign in to comment.