Show dictionary actual size in appropriate units
app/src/main/java/eu/lepiller/nani/DictionaryDownloadActivity.java
85 | 85 | remove_layout.setVisibility(d.isDownloaded()? View.VISIBLE: View.INVISIBLE); | |
86 | 86 | ||
87 | 87 | TextView size_view = findViewById(R.id.size_view); | |
88 | - | size_view.setText(String.format(getResources().getString(R.string.dictionary_size), d.getSize())); | |
88 | + | int size = d.getSize(); | |
89 | + | if(size < 1500) | |
90 | + | size_view.setText(String.format(getResources().getString(R.string.dictionary_size_b), size)); | |
91 | + | else if(size < 1500000) | |
92 | + | size_view.setText(String.format(getResources().getString(R.string.dictionary_size_kb), size/1000)); | |
93 | + | else | |
94 | + | size_view.setText(String.format(getResources().getString(R.string.dictionary_size_mb), size/1000000)); | |
89 | 95 | ||
90 | 96 | download_button.setOnClickListener(new View.OnClickListener() { | |
91 | 97 | @Override |
app/src/main/java/eu/lepiller/nani/dictionary/FileDictionary.java
75 | 75 | if(!isDownloaded()) | |
76 | 76 | return 0; | |
77 | 77 | ||
78 | - | return (int)(getFile().length() / 1000000); | |
78 | + | return (int)(getFile().length()); | |
79 | 79 | } | |
80 | 80 | ||
81 | 81 | String getString(RandomAccessFile file) throws IOException { |
app/src/main/res/values-fr/strings.xml
22 | 22 | <string name="kanji_description">??criture</string> | |
23 | 23 | <string name="close">fermer</string> | |
24 | 24 | ||
25 | - | <string name="dictionary_size">Taille r??elle : %d???Mo</string> | |
25 | + | <string name="dictionary_size_mb">Taille r??elle : %d???Mo</string> | |
26 | + | <string name="dictionary_size_kb">Taille r??elle : %d???Ko</string> | |
27 | + | <string name="dictionary_size_b">Taille r??elle : %d???o</string> | |
26 | 28 | <string name="feedback_no_result">Pas de r??sultat</string> | |
27 | 29 | <string name="feedback_progress">Recherche???</string> | |
28 | 30 | <string name="feedback_didyoumean">Vouliez-vous dire ?? %s ?? ?</string> |
app/src/main/res/values/strings.xml
18 | 18 | <string name="kanji_description">Writing</string> | |
19 | 19 | <string name="close">close</string> | |
20 | 20 | ||
21 | - | <string name="dictionary_size">Actual size: %dMB</string> | |
21 | + | <string name="dictionary_size_mb">Actual size: %dMB</string> | |
22 | + | <string name="dictionary_size_kb">Actual size: %dKB</string> | |
23 | + | <string name="dictionary_size_b">Actual size: %dB</string> | |
22 | 24 | <string name="feedback_no_result">No result</string> | |
23 | - | <string name="feedback_progress">Searching...</string> | |
25 | + | <string name="feedback_progress">Searching???</string> | |
24 | 26 | <string name="feedback_didyoumean">Did you mean "%s"?</string> | |
25 | 27 | ||
26 | 28 | <!-- Dictionnary descriptions --> |