• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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  * Extends GridView with the ability to listen for calls to clearChoices()
25  */
26 public class IngestGridView extends GridView {
27 
28   /**
29    * Listener for all checked choices being cleared.
30    */
31   public interface OnClearChoicesListener {
onClearChoices()32     public void onClearChoices();
33   }
34 
35   private OnClearChoicesListener mOnClearChoicesListener = null;
36 
IngestGridView(Context context)37   public IngestGridView(Context context) {
38     super(context);
39   }
40 
IngestGridView(Context context, AttributeSet attrs)41   public IngestGridView(Context context, AttributeSet attrs) {
42     super(context, attrs);
43   }
44 
IngestGridView(Context context, AttributeSet attrs, int defStyle)45   public IngestGridView(Context context, AttributeSet attrs, int defStyle) {
46     super(context, attrs, defStyle);
47   }
48 
setOnClearChoicesListener(OnClearChoicesListener l)49   public void setOnClearChoicesListener(OnClearChoicesListener l) {
50     mOnClearChoicesListener = l;
51   }
52 
53   @Override
clearChoices()54   public void clearChoices() {
55     super.clearChoices();
56     if (mOnClearChoicesListener != null) {
57       mOnClearChoicesListener.onClearChoices();
58     }
59   }
60 }
61