mirror of
https://gitlab.futo.org/keyboard/latinime.git
synced 2024-09-28 14:54:30 +01:00
Specify argument nullability.
Bug 19996229. Change-Id: I26938b26cd171b7947671a8406af6e3b7c8539f4
This commit is contained in:
parent
6d63989197
commit
88f03707aa
@ -20,6 +20,9 @@ import java.io.File;
|
|||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
|
|
||||||
|
import javax.annotation.Nonnull;
|
||||||
|
import javax.annotation.Nullable;
|
||||||
|
|
||||||
public class DictionaryStats {
|
public class DictionaryStats {
|
||||||
public static final int NOT_AN_ENTRY_COUNT = -1;
|
public static final int NOT_AN_ENTRY_COUNT = -1;
|
||||||
|
|
||||||
@ -29,8 +32,12 @@ public class DictionaryStats {
|
|||||||
public final long mDictFileSize;
|
public final long mDictFileSize;
|
||||||
public final int mContentVersion;
|
public final int mContentVersion;
|
||||||
|
|
||||||
public DictionaryStats(final Locale locale, final String dictType, final String dictFileName,
|
public DictionaryStats(
|
||||||
final File dictFile, final int contentVersion) {
|
@Nonnull final Locale locale,
|
||||||
|
@Nonnull final String dictType,
|
||||||
|
@Nonnull final String dictFileName,
|
||||||
|
@Nullable final File dictFile,
|
||||||
|
final int contentVersion) {
|
||||||
mLocale = locale;
|
mLocale = locale;
|
||||||
mDictType = dictType;
|
mDictType = dictType;
|
||||||
mDictFileSize = (dictFile == null || !dictFile.exists()) ? 0 : dictFile.length();
|
mDictFileSize = (dictFile == null || !dictFile.exists()) ? 0 : dictFile.length();
|
||||||
@ -39,9 +46,6 @@ public class DictionaryStats {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public String getFileSizeString() {
|
public String getFileSizeString() {
|
||||||
if (mDictFileSize == 0) {
|
|
||||||
return "0";
|
|
||||||
}
|
|
||||||
BigDecimal bytes = new BigDecimal(mDictFileSize);
|
BigDecimal bytes = new BigDecimal(mDictFileSize);
|
||||||
BigDecimal kb = bytes.divide(new BigDecimal(1024), 2, BigDecimal.ROUND_HALF_UP);
|
BigDecimal kb = bytes.divide(new BigDecimal(1024), 2, BigDecimal.ROUND_HALF_UP);
|
||||||
if (kb.longValue() == 0) {
|
if (kb.longValue() == 0) {
|
||||||
|
Loading…
Reference in New Issue
Block a user