import android.widget.Button;
import android.widget.ImageButton;
import android.widget.ImageView.ScaleType;
+import android.widget.LinearLayout;
import android.widget.Toast;
import com.hughes.android.dictionary.DictionaryInfo.IndexInfo;
static final String LOG = "QuickDicApp";
+ // If set to false, avoid use of ICU collator
+ // Works well enough for most european languages,
+ // gives faster startup and avoids crashes on some
+ // devices due to Dalvik bugs (e.g. ARMv6, S5570i, CM11).
+ // Leave it enabled by default for correctness except
+ // for my known broken development/performance test device config.
+ static public final boolean USE_COLLATOR = !android.os.Build.FINGERPRINT.equals("Samsung/cm_tassve/tassve:4.4.4/KTU84Q/20150211:userdebug/release-keys");
+
// Static, determined by resources (and locale).
// Unordered.
static Map<String, DictionaryInfo> DOWNLOADABLE_UNCOMPRESSED_FILENAME_NAME_TO_DICTIONARY_INFO = null;
button.setScaleType(ScaleType.FIT_CENTER);
result = button;
}
- result.setMinimumWidth(languageButtonPixels);
- result.setMinimumHeight(languageButtonPixels * 2 / 3);
- // result.setLayoutParams(new LayoutParams(LayoutParams.WRAP_CONTENT,
- // LayoutParams.WRAP_CONTENT));
+ result.setLayoutParams(new LinearLayout.LayoutParams(languageButtonPixels, LinearLayout.LayoutParams.MATCH_PARENT));
return result;
}
PersistentObjectCache.getInstance().write(C.DICTIONARY_CONFIGS, dictionaryConfig);
}
- final Collator collator = Collator.getInstance();
+ final Comparator collator = USE_COLLATOR ? Collator.getInstance() : String.CASE_INSENSITIVE_ORDER;
final Comparator<String> uncompressedFilenameComparator = new Comparator<String>() {
@Override
public int compare(String uncompressedFilename1, String uncompressedFilename2) {
newDictionaryConfig.dictionaryFilesOrdered.addAll(toAddSorted);
}
- PersistentObjectCache.getInstance()
- .write(C.DICTIONARY_CONFIGS, newDictionaryConfig);
+ try {
+ PersistentObjectCache.getInstance()
+ .write(C.DICTIONARY_CONFIGS, newDictionaryConfig);
+ } catch (Exception e) {
+ Log.e(LOG, "Failed persisting dictionary configs", e);
+ }
+
synchronized (this) {
dictionaryConfig = newDictionaryConfig;
}