-Subproject commit 1923f0d7df985ebcf5a7bc01d8a2f9ceabd21550
+Subproject commit ad3bdc6d114c4714e14985d7526036e50cbadbc6
}
} catch (Exception e) {
}
- TextView titleView = (TextView)findViewById(R.id.titleText);
+ TextView titleView = findViewById(R.id.titleText);
titleView.setText("QuickDic " + ver);
}
final List<DictionaryInfo> installedDicts = application.getDictionariesOnDevice(null);
- ListView listView = (ListView) dialog.findViewById(android.R.id.list);
+ ListView listView = dialog.findViewById(android.R.id.list);
final Button button = new Button(listView.getContext());
final String name = getString(R.string.dictionaryManager);
button.setText(name);
final Context context = getListView().getContext();
final Dialog dialog = new Dialog(context);
dialog.setContentView(R.layout.about_dictionary_dialog);
- final TextView textView = (TextView) dialog.findViewById(R.id.text);
+ final TextView textView = dialog.findViewById(R.id.text);
dialog.setTitle(dictFileTitleName);
});
}
- application.onCreateGlobalOptionsMenu(this, menu);
+ DictionaryApplication.onCreateGlobalOptionsMenu(this, menu);
return true;
}
if (clickOpensContextMenu && (row instanceof HtmlEntry.Row ||
(row instanceof TokenRow && ((TokenRow)row).getIndexEntry().htmlEntries.size() > 0))) {
final List<HtmlEntry> html = row instanceof TokenRow ? ((TokenRow)row).getIndexEntry().htmlEntries : Collections.singletonList(((HtmlEntry.Row)row).getEntry());
- final String highlight = row instanceof HtmlEntry.Row ? ((HtmlEntry.Row)row).getTokenRow(true).getToken() : null;
+ final String highlight = row instanceof HtmlEntry.Row ? row.getTokenRow(true).getToken() : null;
final MenuItem open = menu.add("Open");
open.setOnMenuItemClickListener(new MenuItem.OnMenuItemClickListener() {
public boolean onMenuItemClick(MenuItem item) {
final Dialog dialog = new Dialog(getListView().getContext());
dialog.setContentView(R.layout.thadolina_dialog);
dialog.setTitle("Ti amo, amore mio!");
- final ImageView imageView = (ImageView) dialog.findViewById(R.id.thadolina_image);
+ final ImageView imageView = dialog.findViewById(R.id.thadolina_image);
imageView.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
} catch (Exception e) {
String msg = getString(R.string.unzippingFailed, dest + ": " + e.getMessage());
File dir = application.getDictDir();
- if (!dir.canWrite() || !application.checkFileCreate(dir)) {
+ if (!dir.canWrite() || !DictionaryApplication.checkFileCreate(dir)) {
msg = getString(R.string.notWritable, dir.getAbsolutePath());
}
new AlertDialog.Builder(context).setTitle(getString(R.string.error)).setMessage(msg).setNeutralButton("Close", null).show();
getListView().getContext()).inflate(
R.layout.dictionary_manager_header_row_downloadable, getListView(), false);
- showDownloadable = (ToggleButton) downloadableDictionariesHeaderRow
+ showDownloadable = downloadableDictionariesHeaderRow
.findViewById(R.id.hideDownloadable);
showDownloadable.setOnCheckedChangeListener(new OnCheckedChangeListener() {
@Override
}
});
- application.onCreateGlobalOptionsMenu(this, menu);
+ DictionaryApplication.onCreateGlobalOptionsMenu(this, menu);
return true;
}
row = LayoutInflater.from(parent.getContext()).inflate(
R.layout.dictionary_manager_row, parent, false);
}
- final TextView name = (TextView) row.findViewById(R.id.dictionaryName);
- final TextView details = (TextView) row.findViewById(R.id.dictionaryDetails);
+ final TextView name = row.findViewById(R.id.dictionaryName);
+ final TextView details = row.findViewById(R.id.dictionaryDetails);
name.setText(application.getDictionaryName(dictionaryInfo.uncompressedFilename));
final boolean updateAvailable = application.updateAvailable(dictionaryInfo);
- final Button downloadButton = (Button) row.findViewById(R.id.downloadButton);
+ final Button downloadButton = row.findViewById(R.id.downloadButton);
final DictionaryInfo downloadable = application.getDownloadable(dictionaryInfo.uncompressedFilename);
boolean broken = false;
if (!dictionaryInfo.isValid()) {
downloadButton.setVisibility(View.GONE);
}
- LinearLayout buttons = (LinearLayout) row.findViewById(R.id.dictionaryLauncherButtons);
+ LinearLayout buttons = row.findViewById(R.id.dictionaryLauncherButtons);
final List<IndexInfo> sortedIndexInfos = application
.sortedIndexInfos(dictionaryInfo.indexInfos);
// Useful:
// http://www.loc.gov/standards/iso639-2/php/code_list.php
private final Map<String, LanguageResources> isoCodeToResources = new HashMap<String, LanguageResources>();
- private IsoUtils() {
+ IsoUtils() {
isoCodeToResources.put("AF", new LanguageResources("Afrikaans", R.string.AF,
R.drawable.flag_of_south_africa));
isoCodeToResources.put("SQ", new LanguageResources("Albanian", R.string.SQ,
final DictionaryApplication application = DictionaryApplication.INSTANCE;
File dictDir = application.getDictDir();
if (!dictDir.isDirectory() || !dictDir.canWrite() ||
- !application.checkFileCreate(dictDir)) {
+ !DictionaryApplication.checkFileCreate(dictDir)) {
String dirs = "";
String externalDir = Environment.getExternalStorageDirectory().getAbsolutePath();
if (new File(externalDir).canWrite())
indices = CachingList.createFullyCached(RAFList.create(ch, new IndexSerializer(ch),
ch.position(), dictFileVersion, dictInfo + " index: "));
} catch (RuntimeException e) {
- final IOException ioe = new IOException("RuntimeException loading dictionary");
- ioe.initCause(e);
+ final IOException ioe = new IOException("RuntimeException loading dictionary", e);
throw ioe;
}
final String end = raf.readUTF();
public void write(DataOutput raf, Index t) throws IOException {
t.write(raf);
}
- };
+ }
final RAFListSerializer<HtmlEntry> htmlEntryIndexSerializer = new RAFListSerializer<HtmlEntry>() {
@Override
- public void write(DataOutput raf, HtmlEntry t) throws IOException {
+ public void write(DataOutput raf, HtmlEntry t) {
assert false;
}
static final class DataSerializer implements RAFListSerializer<HtmlEntry> {
@Override
- public HtmlEntry read(DataInput raf, final int index) throws IOException {
+ public HtmlEntry read(DataInput raf, final int index) {
assert false;
return null;
}
}
@Override
- public void write(DataOutput raf, byte[] t) throws IOException {
+ public void write(DataOutput raf, byte[] t) {
assert false;
}
}
public void write(DataOutput raf, IndexEntry t) throws IOException {
t.write(raf);
}
- };
+ }
public static final class IndexEntry implements RAFSerializable<Index.IndexEntry> {
public final String token;