From 83d497f704ad1f8ba85190255d46a3fbe0e3c353 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Reimar=20D=C3=B6ffinger?= Date: Sun, 20 May 2018 11:02:35 +0200 Subject: [PATCH] Run automated code cleanup. --- Util | 2 +- .../hughes/android/dictionary/AboutActivity.java | 2 +- .../android/dictionary/DictionaryActivity.java | 10 +++++----- .../dictionary/DictionaryManagerActivity.java | 14 +++++++------- src/com/hughes/android/dictionary/IsoUtils.java | 2 +- .../android/dictionary/PreferenceActivity.java | 2 +- .../android/dictionary/engine/Dictionary.java | 7 +++---- .../android/dictionary/engine/HtmlEntry.java | 4 ++-- .../hughes/android/dictionary/engine/Index.java | 2 +- 9 files changed, 22 insertions(+), 23 deletions(-) diff --git a/Util b/Util index 1923f0d..ad3bdc6 160000 --- a/Util +++ b/Util @@ -1 +1 @@ -Subproject commit 1923f0d7df985ebcf5a7bc01d8a2f9ceabd21550 +Subproject commit ad3bdc6d114c4714e14985d7526036e50cbadbc6 diff --git a/src/com/hughes/android/dictionary/AboutActivity.java b/src/com/hughes/android/dictionary/AboutActivity.java index d6a5c1d..60234d7 100644 --- a/src/com/hughes/android/dictionary/AboutActivity.java +++ b/src/com/hughes/android/dictionary/AboutActivity.java @@ -41,7 +41,7 @@ public final class AboutActivity extends Activity { } } catch (Exception e) { } - TextView titleView = (TextView)findViewById(R.id.titleText); + TextView titleView = findViewById(R.id.titleText); titleView.setText("QuickDic " + ver); } diff --git a/src/com/hughes/android/dictionary/DictionaryActivity.java b/src/com/hughes/android/dictionary/DictionaryActivity.java index 8ab5627..76915df 100644 --- a/src/com/hughes/android/dictionary/DictionaryActivity.java +++ b/src/com/hughes/android/dictionary/DictionaryActivity.java @@ -820,7 +820,7 @@ public class DictionaryActivity extends ActionBarActivity { final List 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); @@ -995,7 +995,7 @@ public class DictionaryActivity extends ActionBarActivity { 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); @@ -1045,7 +1045,7 @@ public class DictionaryActivity extends ActionBarActivity { }); } - application.onCreateGlobalOptionsMenu(this, menu); + DictionaryApplication.onCreateGlobalOptionsMenu(this, menu); return true; } @@ -1062,7 +1062,7 @@ public class DictionaryActivity extends ActionBarActivity { if (clickOpensContextMenu && (row instanceof HtmlEntry.Row || (row instanceof TokenRow && ((TokenRow)row).getIndexEntry().htmlEntries.size() > 0))) { final List 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) { @@ -1831,7 +1831,7 @@ public class DictionaryActivity extends ActionBarActivity { 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) { diff --git a/src/com/hughes/android/dictionary/DictionaryManagerActivity.java b/src/com/hughes/android/dictionary/DictionaryManagerActivity.java index 69e5645..3ca7a6d 100644 --- a/src/com/hughes/android/dictionary/DictionaryManagerActivity.java +++ b/src/com/hughes/android/dictionary/DictionaryManagerActivity.java @@ -241,7 +241,7 @@ public class DictionaryManagerActivity extends ActionBarActivity { } 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(); @@ -326,7 +326,7 @@ public class DictionaryManagerActivity extends ActionBarActivity { 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 @@ -513,7 +513,7 @@ public class DictionaryManagerActivity extends ActionBarActivity { } }); - application.onCreateGlobalOptionsMenu(this, menu); + DictionaryApplication.onCreateGlobalOptionsMenu(this, menu); return true; } @@ -669,12 +669,12 @@ public class DictionaryManagerActivity extends ActionBarActivity { 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()) { @@ -698,7 +698,7 @@ public class DictionaryManagerActivity extends ActionBarActivity { downloadButton.setVisibility(View.GONE); } - LinearLayout buttons = (LinearLayout) row.findViewById(R.id.dictionaryLauncherButtons); + LinearLayout buttons = row.findViewById(R.id.dictionaryLauncherButtons); final List sortedIndexInfos = application .sortedIndexInfos(dictionaryInfo.indexInfos); diff --git a/src/com/hughes/android/dictionary/IsoUtils.java b/src/com/hughes/android/dictionary/IsoUtils.java index 9b381fb..ad8808e 100644 --- a/src/com/hughes/android/dictionary/IsoUtils.java +++ b/src/com/hughes/android/dictionary/IsoUtils.java @@ -36,7 +36,7 @@ public enum IsoUtils { // Useful: // http://www.loc.gov/standards/iso639-2/php/code_list.php private final Map isoCodeToResources = new HashMap(); - 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, diff --git a/src/com/hughes/android/dictionary/PreferenceActivity.java b/src/com/hughes/android/dictionary/PreferenceActivity.java index 966f21c..add2141 100644 --- a/src/com/hughes/android/dictionary/PreferenceActivity.java +++ b/src/com/hughes/android/dictionary/PreferenceActivity.java @@ -93,7 +93,7 @@ public class PreferenceActivity extends android.preference.PreferenceActivity 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()) diff --git a/src/com/hughes/android/dictionary/engine/Dictionary.java b/src/com/hughes/android/dictionary/engine/Dictionary.java index dfac548..0eb8007 100644 --- a/src/com/hughes/android/dictionary/engine/Dictionary.java +++ b/src/com/hughes/android/dictionary/engine/Dictionary.java @@ -107,8 +107,7 @@ public class Dictionary implements RAFSerializable { 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(); @@ -156,11 +155,11 @@ public class Dictionary implements RAFSerializable { public void write(DataOutput raf, Index t) throws IOException { t.write(raf); } - }; + } final RAFListSerializer htmlEntryIndexSerializer = new RAFListSerializer() { @Override - public void write(DataOutput raf, HtmlEntry t) throws IOException { + public void write(DataOutput raf, HtmlEntry t) { assert false; } diff --git a/src/com/hughes/android/dictionary/engine/HtmlEntry.java b/src/com/hughes/android/dictionary/engine/HtmlEntry.java index c12091b..937c882 100644 --- a/src/com/hughes/android/dictionary/engine/HtmlEntry.java +++ b/src/com/hughes/android/dictionary/engine/HtmlEntry.java @@ -109,7 +109,7 @@ public class HtmlEntry extends AbstractEntry implements Comparable { static final class DataSerializer implements RAFListSerializer { @Override - public HtmlEntry read(DataInput raf, final int index) throws IOException { + public HtmlEntry read(DataInput raf, final int index) { assert false; return null; } @@ -127,7 +127,7 @@ public class HtmlEntry extends AbstractEntry implements Comparable { } @Override - public void write(DataOutput raf, byte[] t) throws IOException { + public void write(DataOutput raf, byte[] t) { assert false; } } diff --git a/src/com/hughes/android/dictionary/engine/Index.java b/src/com/hughes/android/dictionary/engine/Index.java index 285024a..ea0de25 100644 --- a/src/com/hughes/android/dictionary/engine/Index.java +++ b/src/com/hughes/android/dictionary/engine/Index.java @@ -194,7 +194,7 @@ public final class Index implements RAFSerializable { public void write(DataOutput raf, IndexEntry t) throws IOException { t.write(raf); } - }; + } public static final class IndexEntry implements RAFSerializable { public final String token; -- 2.43.0