format expected dictionary size
app/src/main/java/eu/lepiller/nani/dictionary/DictionariesAdapter.java
66 | 66 | convertView.setBackgroundColor(0); | |
67 | 67 | ||
68 | 68 | int size = dictionary.getExpectedFileSize(); | |
69 | + | NumberFormat nf = NumberFormat.getInstance(); | |
69 | 70 | if(size < 1500) | |
70 | - | size_view.setText(String.format(context.getString(R.string.dictionary_expected_size_b), size)); | |
71 | + | size_view.setText(String.format(context.getString(R.string.dictionary_expected_size_b), nf.format(size))); | |
71 | 72 | else if(size < 1500000) | |
72 | - | size_view.setText(String.format(context.getString(R.string.dictionary_expected_size_kb), size/1000)); | |
73 | + | size_view.setText(String.format(context.getString(R.string.dictionary_expected_size_kb), nf.format(size/1000))); | |
73 | 74 | else | |
74 | - | size_view.setText(String.format(context.getString(R.string.dictionary_expected_size_mb), size/1000000)); | |
75 | + | size_view.setText(String.format(context.getString(R.string.dictionary_expected_size_mb), nf.format(size/1000000))); | |
75 | 76 | ||
76 | - | int entries = dictionary.getExpectedEntries(); | |
77 | - | NumberFormat nf = NumberFormat.getInstance(); | |
78 | - | String formated = nf.format(entries); | |
79 | - | entry_count_view.setText(context.getResources().getQuantityString(R.plurals.dico_entry_count, entries, formated)); | |
77 | + | int entries = dictionary.getExpectedEntries(); | |
78 | + | entry_count_view.setText(context.getResources().getQuantityString(R.plurals.dico_entry_count, entries, nf.format(entries))); | |
80 | 79 | ||
81 | 80 | // Return the completed view to render on screen | |
82 | 81 | return convertView; |
app/src/main/res/values/strings.xml
49 | 49 | <item quantity="one">%s entry</item> | |
50 | 50 | <item quantity="other">%s entries</item> | |
51 | 51 | </plurals> | |
52 | - | <string name="dictionary_expected_size_b">File size: %dB</string> | |
53 | - | <string name="dictionary_expected_size_kb">File size: %dKB</string> | |
54 | - | <string name="dictionary_expected_size_mb">File size: %dMB</string> | |
52 | + | <string name="dictionary_expected_size_b">File size: %sB</string> | |
53 | + | <string name="dictionary_expected_size_kb">File size: %sKB</string> | |
54 | + | <string name="dictionary_expected_size_mb">File size: %sMB</string> | |
55 | 55 | ||
56 | 56 | <!-- Result view --> | |
57 | 57 | <string name="sense_number">%d.</string> |