1 /* 2 * Copyright (C) 2013 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.gallery3d.ingest.ui; 18 19 import android.content.Context; 20 import android.util.AttributeSet; 21 import android.widget.GridView; 22 23 /** 24 * This just extends GridView with the ability to listen for calls 25 * to clearChoices() 26 */ 27 public class IngestGridView extends GridView { 28 29 public interface OnClearChoicesListener { 30 public void onClearChoices(); 31 } 32 33 private OnClearChoicesListener mOnClearChoicesListener = null; 34 35 public IngestGridView(Context context) { 36 super(context); 37 } 38 39 public IngestGridView(Context context, AttributeSet attrs) { 40 super(context, attrs); 41 } 42 43 public IngestGridView(Context context, AttributeSet attrs, int defStyle) { 44 super(context, attrs, defStyle); 45 } 46 47 public void setOnClearChoicesListener(OnClearChoicesListener l) { 48 mOnClearChoicesListener = l; 49 } 50 51 @Override 52 public void clearChoices() { 53 super.clearChoices(); 54 if (mOnClearChoicesListener != null) { 55 mOnClearChoicesListener.onClearChoices(); 56 } 57 } 58 } 59