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;
return dictDir;
}
+ static public boolean checkFileCreate(File dir) {
+ boolean res = false;
+ File testfile = new File(dir, "quickdic_writetest");
+ try {
+ testfile.delete();
+ res = testfile.createNewFile() & testfile.delete();
+ } catch (Exception e) {
+ }
+ return res;
+ }
+
public File getWordListFile() {
final SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this);
String file = prefs.getString(getString(R.string.wordListFileKey), "");
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) {