+ public void sendFocusedNotification() {
+ focusedItem.setValue(focusedItem.getValue());
+ }
+ public void updateFocusedItem(int position) {
+ focusedItem.setValue(position);
+ }
+ public void noteFocusChanged(int position, FocusedElement element) {
+ getItem(position).setFocusedElement(element);
+ }
+ public void swapItems(int one, int two) {
+ Collections.swap(items, one - 1, two - 1);
+ }
+ public void toggleComment(int position) {
+ final MutableLiveData<Boolean> commentVisible = getItem(position).commentVisible;
+ commentVisible.postValue(!commentVisible.getValue());
+ }
+ public void moveItemLast(int index) {
+ /* 0
+ 1 <-- index
+ 2
+ 3 <-- desired position
+ */
+ int itemCount = items.size();
+
+ if (index < itemCount - 1) {
+ Item acc = items.remove(index);
+ items.add(itemCount - 1, acc);
+ }
+ }