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

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

View File

@@ -52,6 +52,7 @@ public abstract class CursorAdapter<C extends CursorAdapter.AbstractCursor, VH e
* @param context The context
*/
public CursorAdapter(Context context, C c) {
setHasStableIds(true);
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
*/
public CursorAdapter(Context context, C c, int flags) {
setHasStableIds(true);
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) {
super(context, cursor, flags);
setHasStableIds(false); // because we have additional section items
setSectionComparator(comparator);
}

View File

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