1 /* 2 * Copyright (C) 2010 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.launcher3; 18 19 import android.content.Context; 20 import android.view.View; 21 22 public class AppsCustomizeCellLayout extends CellLayout implements Page { 23 24 final FocusIndicatorView mFocusHandlerView; 25 26 public AppsCustomizeCellLayout(Context context) { 27 super(context); 28 29 mFocusHandlerView = new FocusIndicatorView(context); 30 addView(mFocusHandlerView, 0); 31 mFocusHandlerView.getLayoutParams().width = FocusIndicatorView.DEFAULT_LAYOUT_SIZE; 32 mFocusHandlerView.getLayoutParams().height = FocusIndicatorView.DEFAULT_LAYOUT_SIZE; 33 } 34 35 @Override 36 public void removeAllViewsOnPage() { 37 removeAllViews(); 38 setLayerType(LAYER_TYPE_NONE, null); 39 } 40 41 @Override 42 public void removeViewOnPageAt(int index) { 43 removeViewAt(index); 44 } 45 46 @Override 47 public int getPageChildCount() { 48 return getChildCount(); 49 } 50 51 @Override 52 public View getChildOnPageAt(int i) { 53 return getChildAt(i); 54 } 55 56 @Override 57 public int indexOfChildOnPage(View v) { 58 return indexOfChild(v); 59 } 60 61 /** 62 * Clears all the key listeners for the individual icons. 63 */ 64 public void resetChildrenOnKeyListeners() { 65 ShortcutAndWidgetContainer children = getShortcutsAndWidgets(); 66 int childCount = children.getChildCount(); 67 for (int j = 0; j < childCount; ++j) { 68 children.getChildAt(j).setOnKeyListener(null); 69 } 70 } 71 } 72