• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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.support.v7.preference;
18 
19 import static android.support.annotation.RestrictTo.Scope.LIBRARY_GROUP;
20 
21 import android.content.Context;
22 import android.support.annotation.RestrictTo;
23 import android.util.AttributeSet;
24 import android.widget.LinearLayout;
25 
26 /**
27  * Custom LinearLayout that does not propagate the pressed state down to its children.
28  * By default, the pressed state is propagated to all the children that are not clickable
29  * or long-clickable.
30  * @hide
31  */
32 @RestrictTo(LIBRARY_GROUP)
33 public class UnPressableLinearLayout extends LinearLayout {
UnPressableLinearLayout(Context context)34     public UnPressableLinearLayout(Context context) {
35         this(context, null);
36     }
37 
UnPressableLinearLayout(Context context, AttributeSet attrs)38     public UnPressableLinearLayout(Context context, AttributeSet attrs) {
39         super(context, attrs);
40     }
41 
42     @Override
dispatchSetPressed(boolean pressed)43     protected void dispatchSetPressed(boolean pressed) {
44         // Skip dispatching the pressed key state to the children so that they don't trigger any
45         // pressed state animation on their stateful drawables.
46     }
47 }
48