retrofit getBlob method of matrixcursor for android 2.3

This commit is contained in:
Vincent Breitmoser 2014-10-27 17:36:39 +01:00
parent 3e601431ea
commit 727783dd00

View File

@ -25,6 +25,8 @@ import android.database.Cursor;
import android.database.MatrixCursor;
import android.graphics.PorterDuff;
import android.net.Uri;
import android.os.Build.VERSION;
import android.os.Build.VERSION_CODES;
import android.os.Bundle;
import android.os.Message;
import android.os.Messenger;
@ -62,6 +64,7 @@ import org.sufficientlysecure.keychain.ui.widget.KeySpinner;
import org.sufficientlysecure.keychain.util.Log;
import org.sufficientlysecure.keychain.util.Preferences;
import java.lang.reflect.Method;
import java.util.ArrayList;
public class CertifyKeyFragment extends LoaderFragment
@ -210,7 +213,23 @@ public class CertifyKeyFragment extends LoaderFragment
MatrixCursor matrix = new MatrixCursor(new String[]{
"_id", "user_data", "grouped"
});
}) {
@Override
public byte[] getBlob(int column) {
// For some reason, getBlob was not implemented before ICS
if (VERSION.SDK_INT < VERSION_CODES.ICE_CREAM_SANDWICH) {
try {
// haha, yes there is int.class
Method m = MatrixCursor.class.getDeclaredMethod("get", new Class[]{int.class});
m.setAccessible(true);
return (byte[]) m.invoke(this, 1);
} catch (Exception e) {
throw new UnsupportedOperationException(e);
}
}
return super.getBlob(column);
}
};
data.moveToFirst();
long lastMasterKeyId = 0;