mirror of
https://github.com/Kunzisoft/KeePassDX.git
synced 2025-12-04 15:49:33 +01:00
Fix quick search with magikeyboard
This commit is contained in:
@@ -35,7 +35,6 @@ import com.kunzisoft.keepass.database.Database;
|
|||||||
import com.kunzisoft.keepass.database.PwEntry;
|
import com.kunzisoft.keepass.database.PwEntry;
|
||||||
import com.kunzisoft.keepass.database.PwIcon;
|
import com.kunzisoft.keepass.database.PwIcon;
|
||||||
import com.kunzisoft.keepass.database.PwIconFactory;
|
import com.kunzisoft.keepass.database.PwIconFactory;
|
||||||
import com.kunzisoft.keepass.database.PwIconStandard;
|
|
||||||
import com.kunzisoft.keepass.database.cursor.EntryCursor;
|
import com.kunzisoft.keepass.database.cursor.EntryCursor;
|
||||||
import com.kunzisoft.keepass.icons.IconPackChooser;
|
import com.kunzisoft.keepass.icons.IconPackChooser;
|
||||||
|
|
||||||
@@ -119,7 +118,6 @@ public class SearchEntryCursorAdapter extends CursorAdapter {
|
|||||||
|
|
||||||
pwEntry = database.createEntry();
|
pwEntry = database.createEntry();
|
||||||
database.populateEntry(pwEntry, cursor);
|
database.populateEntry(pwEntry, cursor);
|
||||||
|
|
||||||
}
|
}
|
||||||
return pwEntry;
|
return pwEntry;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -210,9 +210,9 @@ public class Database {
|
|||||||
try {
|
try {
|
||||||
switch (getPwDatabase().getVersion()) {
|
switch (getPwDatabase().getVersion()) {
|
||||||
case V3:
|
case V3:
|
||||||
EntryCursor.addEntry(cursor, (PwEntryV3) entry, i);
|
EntryCursor.addEntry(cursor, i, (PwEntryV3) entry);
|
||||||
case V4:
|
case V4:
|
||||||
EntryCursor.addEntry(cursor, (PwEntryV4) entry, i);
|
EntryCursor.addEntry(cursor, i, (PwEntryV4) entry);
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
Log.e(TAG, "This version of PwGroup can't be populated", e);
|
Log.e(TAG, "This version of PwGroup can't be populated", e);
|
||||||
|
|||||||
@@ -3,7 +3,6 @@ package com.kunzisoft.keepass.database.cursor;
|
|||||||
import android.database.Cursor;
|
import android.database.Cursor;
|
||||||
import android.database.MatrixCursor;
|
import android.database.MatrixCursor;
|
||||||
import android.provider.BaseColumns;
|
import android.provider.BaseColumns;
|
||||||
import android.util.Log;
|
|
||||||
|
|
||||||
import com.kunzisoft.keepass.database.PwDatabase;
|
import com.kunzisoft.keepass.database.PwDatabase;
|
||||||
import com.kunzisoft.keepass.database.PwEntry;
|
import com.kunzisoft.keepass.database.PwEntry;
|
||||||
@@ -24,6 +23,11 @@ public class EntryCursor extends MatrixCursor {
|
|||||||
public static final String COLUMN_INDEX_ICON_STANDARD = "iconStandard";
|
public static final String COLUMN_INDEX_ICON_STANDARD = "iconStandard";
|
||||||
public static final String COLUMN_INDEX_ICON_CUSTOM_UUID_MOST_SIGNIFICANT_BITS = "iconCustomUUIDMostSignificantBits";
|
public static final String COLUMN_INDEX_ICON_CUSTOM_UUID_MOST_SIGNIFICANT_BITS = "iconCustomUUIDMostSignificantBits";
|
||||||
public static final String COLUMN_INDEX_ICON_CUSTOM_UUID_LEAST_SIGNIFICANT_BITS = "iconCustomUUIDLeastSignificantBits";
|
public static final String COLUMN_INDEX_ICON_CUSTOM_UUID_LEAST_SIGNIFICANT_BITS = "iconCustomUUIDLeastSignificantBits";
|
||||||
|
public static final String COLUMN_INDEX_USERNAME = "username";
|
||||||
|
public static final String COLUMN_INDEX_PASSWORD = "password";
|
||||||
|
public static final String COLUMN_INDEX_URL = "URL";
|
||||||
|
public static final String COLUMN_INDEX_NOTES = "notes";
|
||||||
|
// TODO custom elements
|
||||||
|
|
||||||
public EntryCursor() {
|
public EntryCursor() {
|
||||||
super(new String[]{ _ID,
|
super(new String[]{ _ID,
|
||||||
@@ -32,27 +36,40 @@ public class EntryCursor extends MatrixCursor {
|
|||||||
COLUMN_INDEX_TITLE,
|
COLUMN_INDEX_TITLE,
|
||||||
COLUMN_INDEX_ICON_STANDARD,
|
COLUMN_INDEX_ICON_STANDARD,
|
||||||
COLUMN_INDEX_ICON_CUSTOM_UUID_MOST_SIGNIFICANT_BITS,
|
COLUMN_INDEX_ICON_CUSTOM_UUID_MOST_SIGNIFICANT_BITS,
|
||||||
COLUMN_INDEX_ICON_CUSTOM_UUID_LEAST_SIGNIFICANT_BITS});
|
COLUMN_INDEX_ICON_CUSTOM_UUID_LEAST_SIGNIFICANT_BITS,
|
||||||
|
COLUMN_INDEX_USERNAME,
|
||||||
|
COLUMN_INDEX_PASSWORD,
|
||||||
|
COLUMN_INDEX_URL,
|
||||||
|
COLUMN_INDEX_NOTES});
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void addEntry(MatrixCursor cursor, PwEntryV3 entry, int id) {
|
public static void addEntry(MatrixCursor cursor, int id, PwEntryV3 entry) {
|
||||||
cursor.addRow(new Object[] {id,
|
cursor.addRow(new Object[] {id,
|
||||||
entry.getUUID().getMostSignificantBits(),
|
entry.getUUID().getMostSignificantBits(),
|
||||||
entry.getUUID().getLeastSignificantBits(),
|
entry.getUUID().getLeastSignificantBits(),
|
||||||
entry.getTitle(),
|
entry.getTitle(),
|
||||||
entry.getIconStandard().getIconId(),
|
entry.getIconStandard().getIconId(),
|
||||||
PwDatabase.UUID_ZERO.getMostSignificantBits(),
|
PwDatabase.UUID_ZERO.getMostSignificantBits(),
|
||||||
PwDatabase.UUID_ZERO.getLeastSignificantBits()});
|
PwDatabase.UUID_ZERO.getLeastSignificantBits(),
|
||||||
|
entry.getUsername(),
|
||||||
|
entry.getPassword(),
|
||||||
|
entry.getUrl(),
|
||||||
|
entry.getNotes(),
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void addEntry(MatrixCursor cursor, PwEntryV4 entry, int id) {
|
public static void addEntry(MatrixCursor cursor, int id, PwEntryV4 entry) {
|
||||||
cursor.addRow(new Object[] {id,
|
cursor.addRow(new Object[] {id,
|
||||||
entry.getUUID().getMostSignificantBits(),
|
entry.getUUID().getMostSignificantBits(),
|
||||||
entry.getUUID().getLeastSignificantBits(),
|
entry.getUUID().getLeastSignificantBits(),
|
||||||
entry.getTitle(),
|
entry.getTitle(),
|
||||||
entry.getIconStandard().getIconId(),
|
entry.getIconStandard().getIconId(),
|
||||||
entry.getCustomIcon().getUUID().getMostSignificantBits(),
|
entry.getCustomIcon().getUUID().getMostSignificantBits(),
|
||||||
entry.getCustomIcon().getUUID().getLeastSignificantBits()});
|
entry.getCustomIcon().getUUID().getLeastSignificantBits(),
|
||||||
|
entry.getUsername(),
|
||||||
|
entry.getPassword(),
|
||||||
|
entry.getUrl(),
|
||||||
|
entry.getNotes()});
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void populateEntryBaseVersion(Cursor cursor, PwEntry pwEntry, PwIconFactory iconFactory) {
|
private static void populateEntryBaseVersion(Cursor cursor, PwEntry pwEntry, PwIconFactory iconFactory) {
|
||||||
@@ -63,6 +80,11 @@ public class EntryCursor extends MatrixCursor {
|
|||||||
|
|
||||||
PwIconStandard iconStandard = iconFactory.getIcon(cursor.getInt(cursor.getColumnIndex(EntryCursor.COLUMN_INDEX_ICON_STANDARD)));
|
PwIconStandard iconStandard = iconFactory.getIcon(cursor.getInt(cursor.getColumnIndex(EntryCursor.COLUMN_INDEX_ICON_STANDARD)));
|
||||||
pwEntry.setIcon(iconStandard);
|
pwEntry.setIcon(iconStandard);
|
||||||
|
|
||||||
|
pwEntry.setUsername(cursor.getString(cursor.getColumnIndex(EntryCursor.COLUMN_INDEX_USERNAME)));
|
||||||
|
pwEntry.setPassword(cursor.getString(cursor.getColumnIndex(EntryCursor.COLUMN_INDEX_PASSWORD)));
|
||||||
|
pwEntry.setUrl(cursor.getString(cursor.getColumnIndex(EntryCursor.COLUMN_INDEX_URL)));
|
||||||
|
pwEntry.setNotes(cursor.getString(cursor.getColumnIndex(EntryCursor.COLUMN_INDEX_NOTES)));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void populateEntry(Cursor cursor, PwEntryV3 pwEntry, PwIconFactory iconFactory) {
|
public static void populateEntry(Cursor cursor, PwEntryV3 pwEntry, PwIconFactory iconFactory) {
|
||||||
|
|||||||
Reference in New Issue
Block a user