fixed code style errors reported by Android Studio
This commit is contained in:
parent
42cf53787a
commit
f65fd29139
21 changed files with 21 additions and 36 deletions
|
|
@ -57,7 +57,7 @@ public class SlowQueryStats {
|
|||
}
|
||||
|
||||
long averageTime = totalQueries == 0 ? 0 : totalQueryTime / totalQueries;
|
||||
long slowAverageTime = slowQueries.size() == 0 ? 0 : slowQueryTotalTime / slowQueries.size();
|
||||
long slowAverageTime = slowQueries.isEmpty() ? 0 : slowQueryTotalTime / slowQueries.size();
|
||||
|
||||
return
|
||||
"Queries: " + totalQueries + ". Average time: " + averageTime + " ms." +
|
||||
|
|
|
|||
|
|
@ -102,11 +102,6 @@ public class WordStore {
|
|||
}
|
||||
|
||||
|
||||
public boolean exists(Language language) {
|
||||
return language != null && checkOrNotify() && readOps.exists(sqlite.getDb(), language.getId());
|
||||
}
|
||||
|
||||
|
||||
public void remove(ArrayList<Integer> languageIds) {
|
||||
if (!checkOrNotify()) {
|
||||
return;
|
||||
|
|
|
|||
|
|
@ -32,11 +32,6 @@ public abstract class AbstractExporter {
|
|||
private String statusMessage = "";
|
||||
|
||||
|
||||
public static AbstractExporter getInstance() {
|
||||
throw new RuntimeException("Not Implemented");
|
||||
}
|
||||
|
||||
|
||||
private void writeAndroid10(Activity activity) throws Exception {
|
||||
final String fileName = generateFileName();
|
||||
outputFile = getOutputDir() + File.pathSeparator + fileName;
|
||||
|
|
|
|||
|
|
@ -12,7 +12,6 @@ import io.github.sspanak.tt9.db.sqlite.SQLiteOpener;
|
|||
public class CustomWordsExporter extends AbstractExporter {
|
||||
private static CustomWordsExporter customWordsExporterSelf;
|
||||
|
||||
public static final String LOG_TAG = "dictionary_export";
|
||||
private static final String BASE_FILE_NAME = "tt9-added-words-export-";
|
||||
|
||||
public static CustomWordsExporter getInstance() {
|
||||
|
|
|
|||
|
|
@ -8,8 +8,8 @@ class Migration {
|
|||
)
|
||||
};
|
||||
|
||||
String query;
|
||||
boolean mayFail;
|
||||
final String query;
|
||||
final boolean mayFail;
|
||||
private Migration(String query, boolean mayFail) {
|
||||
this.query = query;
|
||||
this.mayFail = mayFail;
|
||||
|
|
|
|||
|
|
@ -443,7 +443,7 @@ public class TraditionalT9 extends KeyPadHandler {
|
|||
cancelAutoAccept();
|
||||
|
||||
String filter;
|
||||
if (repeat && !suggestionBar.getSuggestion(1).equals("")) {
|
||||
if (repeat && !suggestionBar.getSuggestion(1).isEmpty()) {
|
||||
filter = suggestionBar.getSuggestion(1);
|
||||
} else {
|
||||
filter = getComposingText();
|
||||
|
|
@ -703,7 +703,7 @@ public class TraditionalT9 extends KeyPadHandler {
|
|||
maxLength = maxLength > 0 ? Math.min(maxLength, mInputMode.getSequenceLength()) : mInputMode.getSequenceLength();
|
||||
|
||||
String text = suggestionBar.getCurrentSuggestion();
|
||||
if (text.length() > 0 && text.length() > maxLength) {
|
||||
if (!text.isEmpty() && text.length() > maxLength) {
|
||||
text = text.substring(0, maxLength);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ public class InputModeValidator {
|
|||
for (Language lang : validLanguages) {
|
||||
validLanguageIds.add(lang.getId());
|
||||
}
|
||||
if (validLanguageIds.size() == 0) {
|
||||
if (validLanguageIds.isEmpty()) {
|
||||
validLanguageIds.add(LanguageCollection.getDefault(context).getId());
|
||||
Logger.e("validateEnabledLanguages", "The language list seems to be corrupted. Resetting to first language only.");
|
||||
}
|
||||
|
|
@ -46,7 +46,7 @@ public class InputModeValidator {
|
|||
newModeId = oldModeId;
|
||||
} else if (allowedModes.contains(InputMode.MODE_ABC)) {
|
||||
newModeId = InputMode.MODE_ABC;
|
||||
} else if (allowedModes.size() > 0) {
|
||||
} else if (!allowedModes.isEmpty()) {
|
||||
newModeId = allowedModes.get(0);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -262,7 +262,7 @@ public class TextField {
|
|||
*/
|
||||
public void setComposingTextWithHighlightedStem(CharSequence word, String stem, boolean highlightMore) {
|
||||
setComposingText(
|
||||
stem.length() > 0 ? highlightText(word, 0, stem.length(), highlightMore) : word
|
||||
stem.isEmpty() ? word : highlightText(word, 0, stem.length(), highlightMore)
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -89,7 +89,7 @@ public class Mode123 extends ModePassthrough {
|
|||
reset();
|
||||
digitSequence = String.valueOf(number);
|
||||
|
||||
if (hold && number < KEY_CHARACTERS.size() && KEY_CHARACTERS.get(number).size() > 0) {
|
||||
if (hold && number < KEY_CHARACTERS.size() && !KEY_CHARACTERS.get(number).isEmpty()) {
|
||||
suggestions.addAll(KEY_CHARACTERS.get(number));
|
||||
} else {
|
||||
autoAcceptTimeout = 0;
|
||||
|
|
|
|||
|
|
@ -2,7 +2,6 @@ package io.github.sspanak.tt9.ime.modes.helpers;
|
|||
|
||||
import io.github.sspanak.tt9.languages.Text;
|
||||
import io.github.sspanak.tt9.ime.modes.InputMode;
|
||||
import io.github.sspanak.tt9.languages.Language;
|
||||
import io.github.sspanak.tt9.preferences.SettingsStore;
|
||||
|
||||
public class AutoTextCase {
|
||||
|
|
|
|||
|
|
@ -99,7 +99,7 @@ public class SettingsStore {
|
|||
validLanguageIds.add(langId);
|
||||
}
|
||||
|
||||
if (validLanguageIds.size() == 0) {
|
||||
if (validLanguageIds.isEmpty()) {
|
||||
Logger.w("saveEnabledLanguageIds", "Refusing to save an empty language list");
|
||||
return;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ public class ItemInputHandlingMode extends ItemDropDown {
|
|||
|
||||
public static final String NAME = "pref_input_handling_mode";
|
||||
|
||||
private SettingsStore settings;
|
||||
private final SettingsStore settings;
|
||||
|
||||
ItemInputHandlingMode(DropDownPreference item, SettingsStore settings) {
|
||||
super(item);
|
||||
|
|
|
|||
|
|
@ -8,7 +8,6 @@ import androidx.annotation.NonNull;
|
|||
import androidx.annotation.Nullable;
|
||||
import androidx.preference.Preference;
|
||||
import androidx.preference.PreferenceCategory;
|
||||
import androidx.preference.PreferenceViewHolder;
|
||||
|
||||
import io.github.sspanak.tt9.R;
|
||||
import io.github.sspanak.tt9.db.WordStoreAsync;
|
||||
|
|
|
|||
|
|
@ -1,7 +1,5 @@
|
|||
package io.github.sspanak.tt9.preferences.screens.hotkeys;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import androidx.preference.DropDownPreference;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
|
|
|||
|
|
@ -58,7 +58,7 @@ class MainLayoutNumpad extends BaseMainLayout {
|
|||
|
||||
@Override
|
||||
protected ArrayList<SoftKey> getKeys() {
|
||||
if (keys != null && keys.size() > 0) {
|
||||
if (keys != null && !keys.isEmpty()) {
|
||||
return keys;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -59,7 +59,7 @@ class MainLayoutSmall extends BaseMainLayout {
|
|||
|
||||
@Override
|
||||
protected ArrayList<SoftKey> getKeys() {
|
||||
if (view != null && (keys == null || keys.size() == 0)) {
|
||||
if (view != null && (keys == null || keys.isEmpty())) {
|
||||
keys = getKeysFromContainer(view.findViewById(R.id.main_soft_keys));
|
||||
}
|
||||
return keys;
|
||||
|
|
|
|||
|
|
@ -91,7 +91,7 @@ public class SuggestionsBar {
|
|||
|
||||
|
||||
public boolean isEmpty() {
|
||||
return suggestions.size() == 0;
|
||||
return suggestions.isEmpty();
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -216,8 +216,8 @@ public class SuggestionsBar {
|
|||
private void ecoSetBackground(List<String> newSuggestions) {
|
||||
int newSuggestionsSize = newSuggestions != null ? newSuggestions.size() : 0;
|
||||
if (
|
||||
(newSuggestionsSize == 0 && suggestions.size() == 0)
|
||||
|| (newSuggestionsSize > 0 && suggestions.size() > 0)
|
||||
(newSuggestionsSize == 0 && suggestions.isEmpty())
|
||||
|| (newSuggestionsSize > 0 && !suggestions.isEmpty())
|
||||
) {
|
||||
return;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@
|
|||
android:text="✕"
|
||||
android:textAppearance="@android:style/TextAppearance.DeviceDefault.Widget.TextView"
|
||||
android:textSize="@dimen/soft_key_icon_size"
|
||||
tools:ignore="HardcodedText" />
|
||||
tools:ignore="HardcodedText,RtlSymmetry" />
|
||||
|
||||
<TextView
|
||||
android:id="@android:id/title"
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
<resources>
|
||||
<string name="app_settings">Configuración de Traditional T9</string>
|
||||
<string name="failed_loading_language_definitions">Falló al cargar todas las definiciones de idiomas.</string>
|
||||
<string name="add_word_add">Agregar palabra</string>
|
||||
<string name="add_word_add">Agregar</string>
|
||||
<string name="add_word_confirm">¿Agregar la palabra \"%1$s\" a %2$s?</string>
|
||||
<string name="add_word_no_selection">Mueve el cursor dentro de una palabra para añadirla.</string>
|
||||
<string name="add_word_blank">Palabra en blanco no agregada.</string>
|
||||
|
|
|
|||
|
|
@ -97,5 +97,5 @@
|
|||
<string name="dictionary_export_finished">הייצוא הושלם</string>
|
||||
<string name="dictionary_export_finished_more_info">המילים יוצאות ל: \"%1$s\".</string>
|
||||
<string name="dictionary_export_generating_csv">מייצא CSV…</string>
|
||||
<string name="dictionary_export_generating_csv_for_language">מייצא CSV (%1$s)...</string>
|
||||
<string name="dictionary_export_generating_csv_for_language">מייצא CSV (%1$s)…</string>
|
||||
</resources>
|
||||
|
|
|
|||
|
|
@ -75,8 +75,8 @@
|
|||
|
||||
<string name="setup_keyboard_status">Būsena</string>
|
||||
<string name="setup_default_keyboard">Pasirinkite numatytąją klaviatūrą</string>
|
||||
<string name="setup_tt9_on">„Traditional T9“ yra įjungtas</string>
|
||||
<string name="setup_tt9_off">„Traditional T9“ yra išjungtas</string>
|
||||
<string name="setup_tt9_on">„%1$s“ yra įjungtas</string>
|
||||
<string name="setup_tt9_off">„%1$s“ yra išjungtas</string>
|
||||
<string name="setup_click_here_to_enable">Spauskite čia norėdami įjungti „TT9“ per „Android“ nustatymus.</string>
|
||||
|
||||
<string name="key_hold_key">(laikyti nusp.)</string>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue