0
0
mirror of https://github.com/ankidroid/Anki-Android.git synced 2024-09-20 20:03:05 +02:00

NF: remove useless casts, and related warning

This commit is contained in:
Arthur Milchior 2020-12-13 08:23:28 +01:00 committed by Mike Hardy
parent dfbd491b3d
commit 34c87ba75f
6 changed files with 14 additions and 13 deletions

View File

@ -1160,7 +1160,7 @@ public class Reviewer extends AbstractFlashcardViewer {
// This is how all other whiteboard settings are // This is how all other whiteboard settings are
Integer whiteboardPenColor = MetaDB.getWhiteboardPenColor(this, getParentDid()).fromPreferences(sharedPrefs); Integer whiteboardPenColor = MetaDB.getWhiteboardPenColor(this, getParentDid()).fromPreferences(sharedPrefs);
if (whiteboardPenColor != null) { if (whiteboardPenColor != null) {
mWhiteboard.setPenColor((int) whiteboardPenColor); mWhiteboard.setPenColor(whiteboardPenColor);
} }
mWhiteboard.setOnPaintColorChangeListener(color -> MetaDB.storeWhiteboardPenColor(this, getParentDid(), !CardAppearance.isInNightMode(sharedPrefs), color)); mWhiteboard.setOnPaintColorChangeListener(color -> MetaDB.storeWhiteboardPenColor(this, getParentDid(), !CardAppearance.isInNightMode(sharedPrefs), color));

View File

@ -240,7 +240,7 @@ public class CardContentProvider extends ContentProvider {
/* Search for notes using direct SQL query */ /* Search for notes using direct SQL query */
String[] proj = sanitizeNoteProjection(projection); String[] proj = sanitizeNoteProjection(projection);
String sql = SQLiteQueryBuilder.buildQueryString(false, "notes", proj, selection, null, null, order, null); String sql = SQLiteQueryBuilder.buildQueryString(false, "notes", proj, selection, null, null, order, null);
return col.getDb().query(sql, (Object[])selectionArgs); return col.getDb().query(sql, selectionArgs);
} }
case NOTES: { case NOTES: {
/* Search for notes using the libanki browser syntax */ /* Search for notes using the libanki browser syntax */

View File

@ -82,7 +82,7 @@ public class PeripheralCommand {
} }
private static PeripheralCommand unicode(char unicodeChar, @ViewerCommandDef int command, CardSide side, ModifierKeys modifierKeys) { private static PeripheralCommand unicode(char unicodeChar, @ViewerCommandDef int command, CardSide side, ModifierKeys modifierKeys) {
return new PeripheralCommand((Character) unicodeChar, command, side, modifierKeys); return new PeripheralCommand(unicodeChar, command, side, modifierKeys);
} }
public static PeripheralCommand keyCode(int keyCode, @ViewerCommandDef int command, CardSide side) { public static PeripheralCommand keyCode(int keyCode, @ViewerCommandDef int command, CardSide side) {

View File

@ -104,14 +104,14 @@ public class DeckAdapter<T extends AbstractDeckTreeNode<T>> extends RecyclerView
public ViewHolder(View v) { public ViewHolder(View v) {
super(v); super(v);
deckLayout = (RelativeLayout) v.findViewById(R.id.DeckPickerHoriz); deckLayout = v.findViewById(R.id.DeckPickerHoriz);
countsLayout = (LinearLayout) v.findViewById(R.id.counts_layout); countsLayout = v.findViewById(R.id.counts_layout);
deckExpander = (ImageButton) v.findViewById(R.id.deckpicker_expander); deckExpander = v.findViewById(R.id.deckpicker_expander);
indentView = (ImageButton) v.findViewById(R.id.deckpicker_indent); indentView = v.findViewById(R.id.deckpicker_indent);
deckName = (TextView) v.findViewById(R.id.deckpicker_name); deckName = v.findViewById(R.id.deckpicker_name);
deckNew = (TextView) v.findViewById(R.id.deckpicker_new); deckNew = v.findViewById(R.id.deckpicker_new);
deckLearn = (TextView) v.findViewById(R.id.deckpicker_lrn); deckLearn = v.findViewById(R.id.deckpicker_lrn);
deckRev = (TextView) v.findViewById(R.id.deckpicker_rev); deckRev = v.findViewById(R.id.deckpicker_rev);
} }
} }

View File

@ -2661,7 +2661,8 @@ public class SchedV2 extends AbstractSched {
"select id from cards where id in " + Utils.ids2str(ids) + " and (queue != " + Consts.QUEUE_TYPE_NEW + " or type != " + Consts.CARD_TYPE_NEW + ")"); "select id from cards where id in " + Utils.ids2str(ids) + " and (queue != " + Consts.QUEUE_TYPE_NEW + " or type != " + Consts.CARD_TYPE_NEW + ")");
mCol.getDb().execute("update cards set reps=0, lapses=0 where id in " + Utils.ids2str(nonNew)); mCol.getDb().execute("update cards set reps=0, lapses=0 where id in " + Utils.ids2str(nonNew));
forgetCards(nonNew); forgetCards(nonNew);
mCol.log((Object[]) ids); //noinspection RedundantCast
mCol.log((Object[]) ids); // Cast useful to indicate to indicate how to interpret varargs
} }

View File

@ -42,7 +42,7 @@ public class UtilsTest {
ZipFile zipFile = new ZipFile(file); ZipFile zipFile = new ZipFile(file);
Enumeration<ZipArchiveEntry> zipEntries = zipFile.getEntries(); Enumeration<ZipArchiveEntry> zipEntries = zipFile.getEntries();
while (zipEntries.hasMoreElements()) { while (zipEntries.hasMoreElements()) {
ZipArchiveEntry ze2 = (ZipArchiveEntry) zipEntries.nextElement(); ZipArchiveEntry ze2 = zipEntries.nextElement();
Utils.unzipFiles(zipFile, "/tmp", new String[]{ze2.getName()}, null); Utils.unzipFiles(zipFile, "/tmp", new String[]{ze2.getName()}, null);
} }
Assert.fail("Expected an IOException"); Assert.fail("Expected an IOException");