fixed KeyNotFound bug, cosmetic changes

This commit is contained in:
Tobias Erthal
2016-09-21 20:09:57 +02:00
parent 5f6bac8017
commit a432d59d2c
5 changed files with 8 additions and 9 deletions

View File

@@ -20,6 +20,8 @@ package org.sufficientlysecure.keychain.ui;
import android.app.Activity; import android.app.Activity;
import android.content.Intent; import android.content.Intent;
import android.support.test.espresso.ViewAction;
import android.support.test.espresso.action.ViewActions;
import android.support.test.espresso.contrib.RecyclerViewActions; import android.support.test.espresso.contrib.RecyclerViewActions;
import android.support.test.espresso.matcher.ViewMatchers; import android.support.test.espresso.matcher.ViewMatchers;
import android.support.test.rule.ActivityTestRule; import android.support.test.rule.ActivityTestRule;

View File

@@ -47,11 +47,6 @@ public class SelectSignKeyAdapter extends KeyCursorAdapter<CursorAdapter.KeyCurs
} }
} }
@Override
public long getIdFromCursor(KeyCursor keyCursor) {
return keyCursor.getKeyId();
}
@Override @Override
public int getItemViewType(int position) { public int getItemViewType(int position) {
return position == getItemCount() -1 ? return position == getItemCount() -1 ?

View File

@@ -52,6 +52,7 @@ public abstract class CursorAdapter<C extends CursorAdapter.AbstractCursor, VH e
* @param context The context * @param context The context
*/ */
public CursorAdapter(Context context, C c) { public CursorAdapter(Context context, C c) {
setHasStableIds(true);
init(context, c, FLAG_REGISTER_CONTENT_OBSERVER); init(context, c, FLAG_REGISTER_CONTENT_OBSERVER);
} }
@@ -64,6 +65,7 @@ public abstract class CursorAdapter<C extends CursorAdapter.AbstractCursor, VH e
* @see #FLAG_REGISTER_CONTENT_OBSERVER * @see #FLAG_REGISTER_CONTENT_OBSERVER
*/ */
public CursorAdapter(Context context, C c, int flags) { public CursorAdapter(Context context, C c, int flags) {
setHasStableIds(true);
init(context, c, flags); init(context, c, flags);
} }

View File

@@ -40,8 +40,6 @@ public abstract class SectionCursorAdapter<C extends CursorAdapter.AbstractCurso
public SectionCursorAdapter(Context context, C cursor, int flags, Comparator<T> comparator) { public SectionCursorAdapter(Context context, C cursor, int flags, Comparator<T> comparator) {
super(context, cursor, flags); super(context, cursor, flags);
setHasStableIds(false); // because we have additional section items
setSectionComparator(comparator); setSectionComparator(comparator);
} }

View File

@@ -352,12 +352,14 @@ public class RecyclerFragment<A extends RecyclerView.Adapter> extends Fragment {
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
private void ensureList() { private void ensureList() {
if (listView != null) if (listView != null) {
return; return;
}
View root = getView(); View root = getView();
if (root == null) if (root == null) {
throw new IllegalStateException("Content view not yet created"); throw new IllegalStateException("Content view not yet created");
}
if (root instanceof RecyclerView) { if (root instanceof RecyclerView) {
listView = (RecyclerView) root; listView = (RecyclerView) root;