Skip to content

Commit

Permalink
fix: Handle format exception
Browse files Browse the repository at this point in the history
  • Loading branch information
timschneeb committed Jul 16, 2023
1 parent 03d0c30 commit 9817df9
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ import me.timschneeberger.rootlessjamesdsp.model.GraphicEqNodeList
import me.timschneeberger.rootlessjamesdsp.utils.Constants
import me.timschneeberger.rootlessjamesdsp.utils.extensions.ContextExtensions.registerLocalReceiver
import me.timschneeberger.rootlessjamesdsp.utils.extensions.ContextExtensions.unregisterLocalReceiver
import timber.log.Timber
import java.util.MissingFormatArgumentException

class GraphicEqualizerPreference : Preference {

Expand Down Expand Up @@ -81,6 +83,13 @@ class GraphicEqualizerPreference : Preference {
nodes.deserialize(value)

binding?.layoutEqualizer?.setNodes(nodes)
binding?.nodeCount?.text = context.resources.getQuantityString(R.plurals.nodes, nodes.size, nodes.size)
try {
binding?.nodeCount?.text =
context.resources.getQuantityString(R.plurals.nodes, nodes.size, nodes.size)
}
catch (ex: MissingFormatArgumentException) {
Timber.e(ex)
binding?.nodeCount?.text = context.getString(R.string.geq_node_editor)
}
}
}
12 changes: 4 additions & 8 deletions app/src/main/res/values-tr-rTR/plurals.xml
Original file line number Diff line number Diff line change
@@ -1,19 +1,15 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<plurals name="nodes">
<item quantity="one">One
%d düğüm</item>
<item quantity="other">Other
%d düğümler</item>
<item quantity="one">%d düğüm</item>
<item quantity="other">%d düğümler</item>
</plurals>
<plurals name="custom_parameters">
<item quantity="one">%d özelleştirilebilir parametre</item>
<item quantity="other">%d özelleştirilebilir parametre</item>
</plurals>
<plurals name="unsupported_apps">
<item quantity="one">Bir
%d desteklenmeyen uygulama otomatik olarak dışlandı. Ayrıntılar için dokun.</item>
<item quantity="other">Diğer
%d desteklenmeyen uygulama otomatik olarak hariç tutulur. Ayrıntılar için dokun.</item>
<item quantity="one">%d desteklenmeyen uygulama otomatik olarak dışlandı. Ayrıntılar için dokun.</item>
<item quantity="other">%d desteklenmeyen uygulama otomatik olarak hariç tutulur. Ayrıntılar için dokun.</item>
</plurals>
</resources>

0 comments on commit 9817df9

Please sign in to comment.