mirror of
https://github.com/SimpleMobileTools/Simple-Notes.git
synced 2025-04-02 18:00:12 +02:00
apply the selected gravity at checklist items too
This commit is contained in:
parent
0dc3f4d7f5
commit
e7be99c528
@ -17,6 +17,7 @@ import com.simplemobiletools.commons.extensions.getColoredDrawableWithColor
|
|||||||
import com.simplemobiletools.commons.views.MyRecyclerView
|
import com.simplemobiletools.commons.views.MyRecyclerView
|
||||||
import com.simplemobiletools.notes.pro.R
|
import com.simplemobiletools.notes.pro.R
|
||||||
import com.simplemobiletools.notes.pro.dialogs.RenameChecklistItemDialog
|
import com.simplemobiletools.notes.pro.dialogs.RenameChecklistItemDialog
|
||||||
|
import com.simplemobiletools.notes.pro.extensions.config
|
||||||
import com.simplemobiletools.notes.pro.extensions.getTextSize
|
import com.simplemobiletools.notes.pro.extensions.getTextSize
|
||||||
import com.simplemobiletools.notes.pro.helpers.DONE_CHECKLIST_ITEM_ALPHA
|
import com.simplemobiletools.notes.pro.helpers.DONE_CHECKLIST_ITEM_ALPHA
|
||||||
import com.simplemobiletools.notes.pro.interfaces.ChecklistItemsListener
|
import com.simplemobiletools.notes.pro.interfaces.ChecklistItemsListener
|
||||||
@ -154,6 +155,7 @@ class ChecklistAdapter(activity: BaseSimpleActivity, var items: ArrayList<Checkl
|
|||||||
text = checklistItem.title
|
text = checklistItem.title
|
||||||
setTextColor(textColor)
|
setTextColor(textColor)
|
||||||
setTextSize(TypedValue.COMPLEX_UNIT_PX, context.getTextSize())
|
setTextSize(TypedValue.COMPLEX_UNIT_PX, context.getTextSize())
|
||||||
|
gravity = context.config.getTextGravity()
|
||||||
|
|
||||||
if (checklistItem.isDone) {
|
if (checklistItem.isDone) {
|
||||||
paintFlags = Paint.STRIKE_THRU_TEXT_FLAG
|
paintFlags = Paint.STRIKE_THRU_TEXT_FLAG
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
package com.simplemobiletools.notes.pro.fragments
|
package com.simplemobiletools.notes.pro.fragments
|
||||||
|
|
||||||
import android.annotation.SuppressLint
|
|
||||||
import android.graphics.Typeface
|
import android.graphics.Typeface
|
||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
import android.text.Editable
|
import android.text.Editable
|
||||||
@ -9,7 +8,6 @@ import android.text.TextWatcher
|
|||||||
import android.text.style.UnderlineSpan
|
import android.text.style.UnderlineSpan
|
||||||
import android.text.util.Linkify
|
import android.text.util.Linkify
|
||||||
import android.util.TypedValue
|
import android.util.TypedValue
|
||||||
import android.view.Gravity
|
|
||||||
import android.view.LayoutInflater
|
import android.view.LayoutInflater
|
||||||
import android.view.View
|
import android.view.View
|
||||||
import android.view.ViewGroup
|
import android.view.ViewGroup
|
||||||
@ -20,7 +18,9 @@ import com.simplemobiletools.notes.pro.activities.MainActivity
|
|||||||
import com.simplemobiletools.notes.pro.extensions.config
|
import com.simplemobiletools.notes.pro.extensions.config
|
||||||
import com.simplemobiletools.notes.pro.extensions.getTextSize
|
import com.simplemobiletools.notes.pro.extensions.getTextSize
|
||||||
import com.simplemobiletools.notes.pro.extensions.updateWidgets
|
import com.simplemobiletools.notes.pro.extensions.updateWidgets
|
||||||
import com.simplemobiletools.notes.pro.helpers.*
|
import com.simplemobiletools.notes.pro.helpers.MyMovementMethod
|
||||||
|
import com.simplemobiletools.notes.pro.helpers.NOTE_ID
|
||||||
|
import com.simplemobiletools.notes.pro.helpers.NotesHelper
|
||||||
import com.simplemobiletools.notes.pro.models.Note
|
import com.simplemobiletools.notes.pro.models.Note
|
||||||
import com.simplemobiletools.notes.pro.models.TextHistory
|
import com.simplemobiletools.notes.pro.models.TextHistory
|
||||||
import com.simplemobiletools.notes.pro.models.TextHistoryItem
|
import com.simplemobiletools.notes.pro.models.TextHistoryItem
|
||||||
@ -124,7 +124,7 @@ class TextFragment : NoteFragment() {
|
|||||||
|
|
||||||
setColors(config.textColor, config.primaryColor, config.backgroundColor)
|
setColors(config.textColor, config.primaryColor, config.backgroundColor)
|
||||||
setTextSize(TypedValue.COMPLEX_UNIT_PX, context.getTextSize())
|
setTextSize(TypedValue.COMPLEX_UNIT_PX, context.getTextSize())
|
||||||
gravity = getTextGravity()
|
gravity = config.getTextGravity()
|
||||||
if (text.toString() != fileContents) {
|
if (text.toString() != fileContents) {
|
||||||
if (!skipTextUpdating) {
|
if (!skipTextUpdating) {
|
||||||
setText(fileContents)
|
setText(fileContents)
|
||||||
@ -209,13 +209,6 @@ class TextFragment : NoteFragment() {
|
|||||||
|
|
||||||
fun getCurrentNoteViewText() = view.text_note_view?.text?.toString()
|
fun getCurrentNoteViewText() = view.text_note_view?.text?.toString()
|
||||||
|
|
||||||
@SuppressLint("RtlHardcoded")
|
|
||||||
private fun getTextGravity() = when (config!!.gravity) {
|
|
||||||
GRAVITY_CENTER -> Gravity.CENTER_HORIZONTAL
|
|
||||||
GRAVITY_RIGHT -> Gravity.RIGHT
|
|
||||||
else -> Gravity.LEFT
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun setWordCounter(text: String) {
|
private fun setWordCounter(text: String) {
|
||||||
val words = text.replace("\n", " ").split(" ")
|
val words = text.replace("\n", " ").split(" ")
|
||||||
view.notes_counter.text = words.count { it.isNotEmpty() }.toString()
|
view.notes_counter.text = words.count { it.isNotEmpty() }.toString()
|
||||||
|
@ -1,7 +1,9 @@
|
|||||||
package com.simplemobiletools.notes.pro.helpers
|
package com.simplemobiletools.notes.pro.helpers
|
||||||
|
|
||||||
|
import android.annotation.SuppressLint
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
import android.os.Environment
|
import android.os.Environment
|
||||||
|
import android.view.Gravity
|
||||||
import com.simplemobiletools.commons.helpers.BaseConfig
|
import com.simplemobiletools.commons.helpers.BaseConfig
|
||||||
|
|
||||||
class Config(context: Context) : BaseConfig(context) {
|
class Config(context: Context) : BaseConfig(context) {
|
||||||
@ -80,4 +82,11 @@ class Config(context: Context) : BaseConfig(context) {
|
|||||||
var moveUndoneChecklistItems: Boolean
|
var moveUndoneChecklistItems: Boolean
|
||||||
get() = prefs.getBoolean(MOVE_UNDONE_CHECKLIST_ITEMS, false)
|
get() = prefs.getBoolean(MOVE_UNDONE_CHECKLIST_ITEMS, false)
|
||||||
set(moveUndoneChecklistItems) = prefs.edit().putBoolean(MOVE_UNDONE_CHECKLIST_ITEMS, moveUndoneChecklistItems).apply()
|
set(moveUndoneChecklistItems) = prefs.edit().putBoolean(MOVE_UNDONE_CHECKLIST_ITEMS, moveUndoneChecklistItems).apply()
|
||||||
|
|
||||||
|
@SuppressLint("RtlHardcoded")
|
||||||
|
fun getTextGravity() = when (gravity) {
|
||||||
|
GRAVITY_CENTER -> Gravity.CENTER_HORIZONTAL
|
||||||
|
GRAVITY_RIGHT -> Gravity.RIGHT
|
||||||
|
else -> Gravity.LEFT
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -13,12 +13,13 @@
|
|||||||
|
|
||||||
<com.simplemobiletools.commons.views.MyTextView
|
<com.simplemobiletools.commons.views.MyTextView
|
||||||
android:id="@+id/checklist_title"
|
android:id="@+id/checklist_title"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="0dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:paddingStart="@dimen/activity_margin"
|
android:paddingStart="@dimen/activity_margin"
|
||||||
android:textSize="@dimen/bigger_text_size"
|
android:textSize="@dimen/bigger_text_size"
|
||||||
app:layout_constraintBottom_toBottomOf="parent"
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
app:layout_constraintEnd_toStartOf="@+id/checklist_image"
|
app:layout_constraintEnd_toStartOf="@+id/checklist_image"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
app:layout_constraintTop_toTopOf="parent"
|
app:layout_constraintTop_toTopOf="parent"
|
||||||
tools:text="Butter" />
|
tools:text="Butter" />
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user