1 /* 2 * Copyright (C) 2016 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 android.wm.cts.dndsourceapp; 18 19 import android.database.AbstractCursor; 20 21 public class DragSourceCursor extends AbstractCursor { 22 private static final String COLUMN_KEY = "key"; 23 24 private final String mValue; 25 26 public DragSourceCursor(String value) { 27 mValue = value; 28 } 29 30 @Override 31 public int getCount() { 32 return 1; 33 } 34 35 @Override 36 public String[] getColumnNames() { 37 return new String[] {COLUMN_KEY}; 38 } 39 40 @Override 41 public String getString(int column) { 42 if (getPosition() != 0) { 43 throw new IllegalArgumentException("Incorrect position: " + getPosition()); 44 } 45 if (column != 0) { 46 throw new IllegalArgumentException("Incorrect column: " + column); 47 } 48 return mValue; 49 } 50 51 @Override 52 public short getShort(int column) { 53 return 0; 54 } 55 56 @Override 57 public int getInt(int column) { 58 return 0; 59 } 60 61 @Override 62 public long getLong(int column) { 63 return 0; 64 } 65 66 @Override 67 public float getFloat(int column) { 68 return 0; 69 } 70 71 @Override 72 public double getDouble(int column) { 73 return 0; 74 } 75 76 @Override 77 public boolean isNull(int column) { 78 return false; 79 } 80 } 81