1 /* 2 * Copyright 2018 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 package com.android.documentsui; 18 19 import android.os.Bundle; 20 21 import androidx.recyclerview.selection.MutableSelection; 22 import androidx.recyclerview.selection.Selection; 23 import androidx.recyclerview.selection.SelectionTracker; 24 import androidx.recyclerview.widget.RecyclerView.AdapterDataObserver; 25 26 import java.util.Set; 27 28 /** 29 * A dummy SelectionTracker used by DocsSelectionHelper before a real SelectionTracker has been 30 * initialized by DirectoryFragment. 31 */ 32 public class DummySelectionTracker<K> extends SelectionTracker<K> { 33 34 @Override addObserver(SelectionObserver observer)35 public void addObserver(SelectionObserver observer) { 36 } 37 38 @Override hasSelection()39 public boolean hasSelection() { 40 return false; 41 } 42 43 @Override getSelection()44 public Selection<K> getSelection() { 45 return new MutableSelection<K>(); 46 } 47 48 @Override copySelection(MutableSelection<K> dest)49 public void copySelection(MutableSelection<K> dest) { 50 } 51 52 @Override isSelected(K key)53 public boolean isSelected(K key) { 54 return false; 55 } 56 57 @Override restoreSelection(Selection<K> selection)58 public void restoreSelection(Selection<K> selection) { 59 } 60 61 @Override clearSelection()62 public boolean clearSelection() { 63 return false; 64 } 65 66 @Override setItemsSelected(Iterable<K> keys, boolean selected)67 public boolean setItemsSelected(Iterable<K> keys, boolean selected) { 68 return false; 69 } 70 71 @Override select(K key)72 public boolean select(K key) { 73 return false; 74 } 75 76 @Override deselect(K key)77 public boolean deselect(K key) { 78 return false; 79 } 80 81 @Override getAdapterDataObserver()82 protected AdapterDataObserver getAdapterDataObserver() { 83 return null; 84 } 85 86 @Override startRange(int position)87 public void startRange(int position) { 88 } 89 90 @Override extendRange(int position)91 public void extendRange(int position) { 92 } 93 94 @Override endRange()95 public void endRange() { 96 } 97 98 @Override isRangeActive()99 public boolean isRangeActive() { 100 return false; 101 } 102 103 @Override anchorRange(int position)104 public void anchorRange(int position) { 105 } 106 107 @Override extendProvisionalRange(int position)108 public void extendProvisionalRange(int position) { 109 } 110 111 @Override setProvisionalSelection(Set<K> newSelection)112 public void setProvisionalSelection(Set<K> newSelection) { 113 } 114 115 @Override clearProvisionalSelection()116 public void clearProvisionalSelection() { 117 } 118 119 @Override mergeProvisionalSelection()120 public void mergeProvisionalSelection() { 121 } 122 123 @Override onSaveInstanceState(Bundle state)124 public void onSaveInstanceState(Bundle state) { 125 } 126 127 @Override onRestoreInstanceState(Bundle state)128 public void onRestoreInstanceState(Bundle state) { 129 } 130 131 } 132