-Subproject commit 272a7b504cb85b8dc2bba3718725b547750434b1
+Subproject commit 7efaa369d15e363663e1c226c433569acb1050c0
applicationId 'de.reimardoeffinger.quickdic'
targetSdkVersion 29
resConfigs "de", "es", "eu", "fr", "it", "ja", "pt", "pt-rBR", "ru", "zh-rCN"
- minSdkVersion = 10
+ minSdkVersion 10
}
}
<!-- DictionaryActivity -->
<string name="searchText">Bilatu testua</string>
- <string name="selectDictionary">Hautatu hiztegia...</string>
+ <string name="selectDictionary">Hautatu hiztegia…</string>
<string name="addToWordList">Gehitu hitzen zerrendara: %s</string>
<string name="searchForSelection">Bilatu: %s</string>
<string name="failedAddingToWordList">Akatsa hitz zerrendara gehitzean: %s</string>
<resources>
<string name="app_name" translatable="false">QuickDic</string>
- <string name="thanksForUpdatingVersion" translatable="false">5.1.0</string>
<!-- Global. -->
<string name="about">About QuickDic</string>
final LinearLayout result = new LinearLayout(parent.getContext());
- for (int i = 0; dictionaryInfo.indexInfos != null && i < dictionaryInfo.indexInfos.size(); ++i) {
+ for (int i = 0; i < dictionaryInfo.indexInfos.size(); ++i) {
final IndexInfo indexInfo = dictionaryInfo.indexInfos.get(i);
final View button = IsoUtils.INSTANCE.createButton(parent.getContext(),
indexInfo, application.languageButtonPixels);
}
public boolean isValid() {
- return indexInfos != null && !indexInfos.isEmpty();
+ return !indexInfos.isEmpty();
}
public StringBuilder append(final StringBuilder result) {
}
@Override
- public void onRequestPermissionsResult(int requestCode, @NonNull String permissions[], @NonNull int[] grantResults) {
+ public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) {
readableCheckAndError(false);
application.backgroundUpdateDictionaries(dictionaryUpdater);
import java.io.IOException;
import java.io.InputStream;
import java.io.UnsupportedEncodingException;
+import java.nio.charset.StandardCharsets;
public final class HtmlDisplayActivity extends AppCompatActivity {
fontSizeSp = 14;
}
webView.getSettings().setDefaultFontSize(fontSizeSp);
- try {
- // No way to get pure UTF-8 data into WebView
- html = Base64.encodeToString(html.getBytes("UTF-8"), Base64.DEFAULT);
- } catch (UnsupportedEncodingException e) {
- throw new RuntimeException("Missing UTF-8 support?!", e);
- }
+ // No way to get pure UTF-8 data into WebView
+ html = Base64.encodeToString(html.getBytes(StandardCharsets.UTF_8), Base64.DEFAULT);
// Use loadURL to allow specifying a charset
webView.loadUrl("data:text/html;charset=utf-8;base64," + html);
webView.activity = this;
import java.io.RandomAccessFile;
import java.nio.channels.Channels;
import java.nio.channels.FileChannel;
+import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
out.seek(dataPos);
out.writeShort(h.entrySource.index());
out.writeUTF(h.title);
- byte[] data = h.getHtml().getBytes("UTF-8");
+ byte[] data = h.getHtml().getBytes(StandardCharsets.UTF_8);
out.writeInt(data.length);
ByteArrayOutputStream baos = new ByteArrayOutputStream();
GZIPOutputStream gzout = new GZIPOutputStream(baos);
import java.io.UnsupportedEncodingException;
import java.lang.ref.SoftReference;
import java.nio.channels.FileChannel;
+import java.nio.charset.StandardCharsets;
import java.util.List;
import java.util.regex.Pattern;
}
private void writeData(DataOutput raf) throws IOException {
- final byte[] bytes = getHtml().getBytes("UTF-8");
+ final byte[] bytes = getHtml().getBytes(StandardCharsets.UTF_8);
StringUtil.writeVarInt(raf, bytes.length);
raf.write(bytes);
}
return html;
}
if (data != null) {
- try {
- html = new String(data.get(index), "UTF-8");
- } catch (UnsupportedEncodingException e) {
- throw new RuntimeException("Dictionary HTML data corrupted", e);
- }
+ html = new String(data.get(index), StandardCharsets.UTF_8);
htmlRef = new SoftReference<>(html);
return html;
}
}
try {
final byte[] bytes = StringUtil.unzipFully(zipBytes, numBytes);
- html = new String(bytes, "UTF-8");
+ html = new String(bytes, StandardCharsets.UTF_8);
} catch (IOException e) {
throw new RuntimeException("Dictionary HTML data corrupted", e);
}
sortLanguage = Language.lookup(languageCode);
normalizerRules = raf.readUTF();
swapPairEntries = raf.readBoolean();
- if (sortLanguage == null) {
- throw new IOException("Unsupported language: " + languageCode);
- }
if (dict.dictFileVersion >= 2) {
mainTokenCount = raf.readInt();
}
return new Comparator<Object>() {
@Override
public int compare(Object o, Object t1) {
- return String.class.cast(o).compareToIgnoreCase(String.class.cast(t1));
+ return ((String)o).compareToIgnoreCase((String)t1);
}
};
// TODO: consider if this should be cached - but must be thread-safe
private final File dir;
private final Map<String, Object> objects = new HashMap<>();
- class ConstrainedOIS extends ObjectInputStream {
+ static class ConstrainedOIS extends ObjectInputStream {
ConstrainedOIS(InputStream in) throws IOException {
super(in);
}