mirror of
https://github.com/SimpleMobileTools/Simple-Notes.git
synced 2025-03-27 22:10:09 +01:00
removing some unused functions
This commit is contained in:
parent
2255027792
commit
9003e55709
@ -61,7 +61,7 @@ class MainActivity : SimpleActivity() {
|
|||||||
private var showRedoButton = false
|
private var showRedoButton = false
|
||||||
private var searchIndex = 0
|
private var searchIndex = 0
|
||||||
private var searchMatches = emptyList<Int>()
|
private var searchMatches = emptyList<Int>()
|
||||||
private var searchIsActive = false
|
private var isSearchActive = false
|
||||||
|
|
||||||
override fun onCreate(savedInstanceState: Bundle?) {
|
override fun onCreate(savedInstanceState: Bundle?) {
|
||||||
super.onCreate(savedInstanceState)
|
super.onCreate(savedInstanceState)
|
||||||
@ -89,7 +89,7 @@ class MainActivity : SimpleActivity() {
|
|||||||
search_query.onTextChangeListener { query ->
|
search_query.onTextChangeListener { query ->
|
||||||
currentNotesView()?.let { noteView ->
|
currentNotesView()?.let { noteView ->
|
||||||
currentTextFragment?.removeTextWatcher()
|
currentTextFragment?.removeTextWatcher()
|
||||||
searchClearSpans(noteView.text)
|
noteView.text.clearSpans()
|
||||||
|
|
||||||
if (query.isNotBlank() && query.length > 1) {
|
if (query.isNotBlank() && query.length > 1) {
|
||||||
searchMatches = searchMatches(query, noteView.value)
|
searchMatches = searchMatches(query, noteView.value)
|
||||||
@ -141,7 +141,7 @@ class MainActivity : SimpleActivity() {
|
|||||||
view_pager.onPageChangeListener {
|
view_pager.onPageChangeListener {
|
||||||
currentTextFragment?.removeTextWatcher()
|
currentTextFragment?.removeTextWatcher()
|
||||||
currentNotesView()?.let { noteView ->
|
currentNotesView()?.let { noteView ->
|
||||||
searchClearSpans(noteView.text)
|
noteView.text.clearSpans()
|
||||||
}
|
}
|
||||||
|
|
||||||
searchHide()
|
searchHide()
|
||||||
@ -160,15 +160,6 @@ class MainActivity : SimpleActivity() {
|
|||||||
|
|
||||||
private val currentTextFragment: TextFragment? get() = mAdapter?.textFragment(view_pager.currentItem)
|
private val currentTextFragment: TextFragment? get() = mAdapter?.textFragment(view_pager.currentItem)
|
||||||
|
|
||||||
private fun searchClearSpans(editable: Editable) {
|
|
||||||
val spans = editable.getSpans(0, editable.length, Any::class.java)
|
|
||||||
for (span in spans) {
|
|
||||||
if (span is BackgroundColorSpan) {
|
|
||||||
editable.removeSpan(span)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun selectMatch(noteView: MyEditText) {
|
private fun selectMatch(noteView: MyEditText) {
|
||||||
if (searchMatches.isNotEmpty()) {
|
if (searchMatches.isNotEmpty()) {
|
||||||
noteView.requestFocus()
|
noteView.requestFocus()
|
||||||
@ -220,7 +211,7 @@ class MainActivity : SimpleActivity() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private fun searchShow() {
|
private fun searchShow() {
|
||||||
searchIsActive = true
|
isSearchActive = true
|
||||||
search_root.beVisible()
|
search_root.beVisible()
|
||||||
showKeyboard(search_query)
|
showKeyboard(search_query)
|
||||||
|
|
||||||
@ -236,7 +227,7 @@ class MainActivity : SimpleActivity() {
|
|||||||
|
|
||||||
private fun searchHide() {
|
private fun searchHide() {
|
||||||
search_query.text?.clear()
|
search_query.text?.clear()
|
||||||
searchIsActive = false
|
isSearchActive = false
|
||||||
search_root.beGone()
|
search_root.beGone()
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -356,7 +347,7 @@ class MainActivity : SimpleActivity() {
|
|||||||
}
|
}
|
||||||
super.onBackPressed()
|
super.onBackPressed()
|
||||||
}
|
}
|
||||||
} else if (searchIsActive) {
|
} else if (isSearchActive) {
|
||||||
searchHide()
|
searchHide()
|
||||||
} else {
|
} else {
|
||||||
super.onBackPressed()
|
super.onBackPressed()
|
||||||
@ -916,7 +907,7 @@ class MainActivity : SimpleActivity() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fun currentNoteTextChanged(newText: String, showUndo: Boolean, showRedo: Boolean) {
|
fun currentNoteTextChanged(newText: String, showUndo: Boolean, showRedo: Boolean) {
|
||||||
if (searchIsActive.not()) {
|
if (isSearchActive.not()) {
|
||||||
var shouldRecreateMenu = false
|
var shouldRecreateMenu = false
|
||||||
if (showUndo != showUndoButton) {
|
if (showUndo != showUndoButton) {
|
||||||
showUndoButton = showUndo
|
showUndoButton = showUndo
|
||||||
|
@ -4,7 +4,6 @@ import android.appwidget.AppWidgetManager
|
|||||||
import android.content.ComponentName
|
import android.content.ComponentName
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
import android.content.Intent
|
import android.content.Intent
|
||||||
import androidx.core.content.ContextCompat
|
|
||||||
import com.simplemobiletools.notes.pro.databases.NotesDatabase
|
import com.simplemobiletools.notes.pro.databases.NotesDatabase
|
||||||
import com.simplemobiletools.notes.pro.helpers.Config
|
import com.simplemobiletools.notes.pro.helpers.Config
|
||||||
import com.simplemobiletools.notes.pro.helpers.MyWidgetProvider
|
import com.simplemobiletools.notes.pro.helpers.MyWidgetProvider
|
||||||
@ -27,5 +26,3 @@ fun Context.updateWidgets() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fun Context.color(id: Int) = ContextCompat.getColor(this, id)
|
|
||||||
|
@ -1,12 +1,7 @@
|
|||||||
package com.simplemobiletools.notes.pro.extensions
|
package com.simplemobiletools.notes.pro.extensions
|
||||||
|
|
||||||
import android.os.Build
|
|
||||||
import android.text.Html
|
|
||||||
import androidx.annotation.RequiresApi
|
|
||||||
import com.google.gson.Gson
|
import com.google.gson.Gson
|
||||||
import com.google.gson.reflect.TypeToken
|
import com.google.gson.reflect.TypeToken
|
||||||
import com.simplemobiletools.commons.helpers.isMarshmallowPlus
|
|
||||||
import com.simplemobiletools.commons.helpers.isNougatPlus
|
|
||||||
import com.simplemobiletools.notes.pro.models.ChecklistItem
|
import com.simplemobiletools.notes.pro.models.ChecklistItem
|
||||||
|
|
||||||
fun String.parseChecklistItems(): ArrayList<ChecklistItem>? {
|
fun String.parseChecklistItems(): ArrayList<ChecklistItem>? {
|
||||||
@ -19,12 +14,3 @@ fun String.parseChecklistItems(): ArrayList<ChecklistItem>? {
|
|||||||
}
|
}
|
||||||
return null
|
return null
|
||||||
}
|
}
|
||||||
|
|
||||||
@RequiresApi(Build.VERSION_CODES.N)
|
|
||||||
fun String.toHtml() =
|
|
||||||
if (isNougatPlus()) {
|
|
||||||
Html.fromHtml(this, Html.FROM_HTML_MODE_LEGACY)
|
|
||||||
} else {
|
|
||||||
Html.fromHtml(this)
|
|
||||||
}
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user