Winson Chung | c58497e | 2013-09-03 17:48:37 -0700 | [diff] [blame] | 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; |
Winson Chung | c58497e | 2013-09-03 17:48:37 -0700 | [diff] [blame] | 20 | import android.view.View; |
Winson Chung | c58497e | 2013-09-03 17:48:37 -0700 | [diff] [blame] | 21 | |
| 22 | public class AppsCustomizeCellLayout extends CellLayout implements Page { |
Sunny Goyal | dcbcc86 | 2014-08-12 15:58:36 -0700 | [diff] [blame] | 23 | |
| 24 | final FocusIndicatorView mFocusHandlerView; |
| 25 | |
Winson Chung | c58497e | 2013-09-03 17:48:37 -0700 | [diff] [blame] | 26 | public AppsCustomizeCellLayout(Context context) { |
| 27 | super(context); |
Sunny Goyal | dcbcc86 | 2014-08-12 15:58:36 -0700 | [diff] [blame] | 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; |
Winson Chung | c58497e | 2013-09-03 17:48:37 -0700 | [diff] [blame] | 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 | } |