Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
60 changes: 30 additions & 30 deletions TRANSLATIONS.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,34 +19,34 @@ See [Android Translations Converter](https://github.com/Crustack/android-transla
<!-- translations:start -->
| Language | Coverage |
|----------|----------|
| 🇺🇸 English | 100% (331/331) |
| 🇪🇸 Catalan | 19% (65/331) |
| 🇨🇿 Czech | 94% (313/331) |
| 🇩🇰 Danish | 20% (69/331) |
| 🇩🇪 German | 98% (327/331) |
| 🇬🇷 Greek | 21% (72/331) |
| 🇪🇸 Spanish | 94% (314/331) |
| 🇫🇷 French | 98% (327/331) |
| 🇭🇺 Hungarian | 19% (65/331) |
| 🇮🇩 Indonesian | 22% (75/331) |
| 🇮🇹 Italian | 87% (291/331) |
| 🇯🇵 Japanese | 22% (73/331) |
| 🇲🇲 Burmese | 27% (90/331) |
| 🇳🇴 Norwegian Bokmål | 32% (106/331) |
| 🇳🇱 Dutch | 64% (212/331) |
| 🇳🇴 Norwegian Nynorsk | 32% (106/331) |
| 🇵🇱 Polish | 90% (300/331) |
| 🇧🇷 Portuguese (Brazil) | 94% (312/331) |
| 🇵🇹 Portuguese (Portugal) | 21% (71/331) |
| 🇷🇴 Romanian | 90% (301/331) |
| 🇷🇺 Russian | 92% (305/331) |
| 🇸🇰 Slovak | 19% (65/331) |
| 🇸🇮 Slovenian | 32% (109/331) |
| 🇸🇪 Swedish | 19% (63/331) |
| 🇵🇭 Tagalog | 19% (65/331) |
| 🇹🇷 Turkish | 22% (73/331) |
| 🇺🇦 Ukrainian | 98% (326/331) |
| 🇻🇳 Vietnamese | 32% (107/331) |
| 🇨🇳 Chinese (Simplified) | 97% (323/331) |
| 🇹🇼 Chinese (Traditional) | 88% (294/331) |
| 🇺🇸 English | 100% (333/333) |
| 🇪🇸 Catalan | 19% (65/333) |
| 🇨🇿 Czech | 93% (313/333) |
| 🇩🇰 Danish | 20% (69/333) |
| 🇩🇪 German | 98% (327/333) |
| 🇬🇷 Greek | 21% (72/333) |
| 🇪🇸 Spanish | 94% (314/333) |
| 🇫🇷 French | 98% (327/333) |
| 🇭🇺 Hungarian | 19% (65/333) |
| 🇮🇩 Indonesian | 22% (75/333) |
| 🇮🇹 Italian | 87% (291/333) |
| 🇯🇵 Japanese | 21% (73/333) |
| 🇲🇲 Burmese | 27% (90/333) |
| 🇳🇴 Norwegian Bokmål | 31% (106/333) |
| 🇳🇱 Dutch | 63% (212/333) |
| 🇳🇴 Norwegian Nynorsk | 31% (106/333) |
| 🇵🇱 Polish | 90% (300/333) |
| 🇧🇷 Portuguese (Brazil) | 93% (312/333) |
| 🇵🇹 Portuguese (Portugal) | 21% (71/333) |
| 🇷🇴 Romanian | 90% (301/333) |
| 🇷🇺 Russian | 91% (305/333) |
| 🇸🇰 Slovak | 19% (65/333) |
| 🇸🇮 Slovenian | 32% (109/333) |
| 🇸🇪 Swedish | 18% (63/333) |
| 🇵🇭 Tagalog | 19% (65/333) |
| 🇹🇷 Turkish | 21% (73/333) |
| 🇺🇦 Ukrainian | 97% (326/333) |
| 🇻🇳 Vietnamese | 32% (107/333) |
| 🇨🇳 Chinese (Simplified) | 96% (323/333) |
| 🇹🇼 Chinese (Traditional) | 88% (294/333) |
<!-- translations:end -->
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ import com.philkes.notallyx.utils.findWebUrls
import com.philkes.notallyx.utils.getFileName
import com.philkes.notallyx.utils.getMimeType
import com.philkes.notallyx.utils.getUriForFile
import com.philkes.notallyx.utils.isInLandscapeMode
import com.philkes.notallyx.utils.log
import com.philkes.notallyx.utils.mergeSkipFirst
import com.philkes.notallyx.utils.observeSkipFirst
Expand Down Expand Up @@ -132,6 +133,8 @@ abstract class EditActivity(private val type: Type) :
internal lateinit var changeHistory: ChangeHistory
protected var undo: View? = null
protected var redo: View? = null
protected var jumpToTop: View? = null
protected var jumpToBottom: View? = null

protected var colorInt: Int = -1
protected var inputMethodManager: InputMethodManager? = null
Expand Down Expand Up @@ -546,6 +549,22 @@ abstract class EditActivity(private val type: Type) :

protected fun isInSearchMode(): Boolean = binding.EnterSearchKeyword.visibility == VISIBLE

protected fun updateJumpButtonsVisibility(manualSize: Int? = null) {
jumpToTop?.post {
val show =
when (notallyModel.type) {
Type.NOTE ->
(manualSize ?: binding.EnterBody.lineCount) >
(if (isInLandscapeMode) 30 else 75)
Type.LIST ->
(manualSize ?: notallyModel.items.size) >
(if (isInLandscapeMode) 15 else 25)
}
jumpToTop?.isVisible = show
jumpToBottom?.isVisible = show
}
}

protected fun endSearch() {
binding.EnterSearchKeyword.apply {
visibility = GONE
Expand All @@ -570,6 +589,14 @@ abstract class EditActivity(private val type: Type) :
}
binding.BottomAppBarCenter.apply {
removeAllViews()
jumpToTop =
addIconButton(
R.string.jump_to_top,
R.drawable.vertical_align_top,
marginStart = 0,
) {
binding.ScrollView.apply { post { fullScroll(View.FOCUS_UP) } }
}
undo =
addIconButton(
R.string.undo,
Expand Down Expand Up @@ -613,6 +640,26 @@ abstract class EditActivity(private val type: Type) :
}
}
.apply { isEnabled = changeHistory.canRedo.value }
jumpToBottom =
addIconButton(
R.string.jump_to_bottom,
R.drawable.vertical_align_bottom,
marginStart = 2,
) {
binding.ScrollView.apply {
post {
val lastChild: View? = binding.ScrollView.getChildAt(0)
if (lastChild != null) {
val bottom: Int =
lastChild.bottom + binding.ScrollView.paddingBottom
binding.ScrollView.smoothScrollTo(0, bottom)
} else {
fullScroll(View.FOCUS_DOWN)
}
}
}
}
updateJumpButtonsVisibility()
}
binding.BottomAppBarRight.apply {
removeAllViews()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -241,11 +241,13 @@ class EditListActivity : EditActivity(Type.LIST), MoreListActions {
endSearch()
}
},
) { _ ->
if (isInSearchMode() && search.results.value > 0) {
updateSearchResults(search.query)
}
}
{ _ ->
if (isInSearchMode() && search.results.value > 0) {
updateSearchResults(search.query)
}
},
{ items -> updateJumpButtonsVisibility(items) },
)
adapter =
ListItemAdapter(
colorInt,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,7 @@ class EditNoteActivity : EditActivity(Type.NOTE), AddNoteActions {
notallyModel.body = text
if (textChanged) {
updateSearchResults(search.query)
updateJumpButtonsVisibility()
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package com.philkes.notallyx.presentation.view.note.listitem
import android.util.Log
import android.view.View
import android.view.inputmethod.InputMethodManager
import android.widget.EditText
import androidx.recyclerview.widget.RecyclerView
import com.philkes.notallyx.data.model.ListItem
import com.philkes.notallyx.data.model.check
Expand Down Expand Up @@ -48,6 +47,7 @@ class ListManager(
private val inputMethodManager: InputMethodManager?,
private val endSearch: (() -> Unit)?,
val refreshSearch: ((refocusView: View?) -> Unit)?,
val onItemSizeChanged: ((items: Int) -> Unit)?,
) {
lateinit var adapter: ListItemAdapter
var checkedAdapter: CheckedListItemAdapter? = null
Expand Down Expand Up @@ -151,6 +151,7 @@ class ListManager(
inputMethodManager?.let { viewHolder.focusEditText(inputMethodManager = it) }
}
}
onItemSizeChanged?.invoke(items.size + (itemsChecked?.size() ?: 0))
}

/**
Expand Down Expand Up @@ -201,6 +202,7 @@ class ListManager(
if (pushChange && result) {
changeHistory.push(ListDeleteChange(stateBefore, getState(), this))
}
onItemSizeChanged?.invoke(items.size + (itemsChecked?.size() ?: 0))
return result
}

Expand Down Expand Up @@ -372,6 +374,7 @@ class ListManager(
if (pushChange) {
changeHistory.push(DeleteCheckedChange(stateBefore, getState(), this))
}
onItemSizeChanged?.invoke(items.size + (itemsChecked?.size() ?: 0))
}

fun findParent(item: ListItem) = items.findParent(item) ?: itemsChecked?.findParent(item)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,9 @@ fun Activity.showErrorDialog(
.show()
}

val Activity.isInLandscapeMode
get() = resources.configuration.orientation == Configuration.ORIENTATION_LANDSCAPE

private const val MAX_LOGS_FILE_SIZE_KB: Long = 2048

private fun Context.logToFile(
Expand Down
10 changes: 10 additions & 0 deletions app/src/main/res/drawable/vertical_align_bottom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="960"
android:viewportHeight="960"
android:tint="?attr/colorControlNormal">
<path
android:fillColor="@android:color/white"
android:pathData="M160,840L160,760L800,760L800,840L160,840ZM480,680L280,480L336,424L440,528L440,120L520,120L520,528L624,424L680,480L480,680Z"/>
</vector>
10 changes: 10 additions & 0 deletions app/src/main/res/drawable/vertical_align_top.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="960"
android:viewportHeight="960"
android:tint="?attr/colorControlNormal">
<path
android:fillColor="@android:color/white"
android:pathData="M160,200L160,120L800,120L800,200L160,200ZM440,840L440,432L336,536L280,480L480,280L680,480L624,536L520,432L520,840L440,840Z"/>
</vector>
2 changes: 2 additions & 0 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,8 @@
<string name="item">Item</string>
<string name="json_files">JSON Files</string>
<string name="json_files_help">In order to import your Notes from JSON files (single file or folder), click Import. Every valid JSON file is imported as a separate note, the file’s name becomes the note’s title.</string>
<string name="jump_to_bottom">Jump to bottom</string>
<string name="jump_to_top">Jump to top</string>
<string name="label_exists">Label exists</string>
<string name="label_visibility">Hide/Show the label in the navigation panel</string>
<string name="labels">Labels</string>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ open class ListManagerTestBase {
listItemVH = mock(ListItemVH::class.java)
preferences = mock(NotallyXPreferences::class.java)
listManager =
ListManager(recyclerView, changeHistory, preferences, inputMethodManager, {}) {}
ListManager(recyclerView, changeHistory, preferences, inputMethodManager, {}, {}, null)
// Prepare view holder
`when`(recyclerView.findViewHolderForAdapterPosition(anyInt())).thenReturn(listItemVH)
}
Expand Down
Binary file modified app/translations.xlsx
Binary file not shown.