1022554e3da6e496524387a5d3ecc67ef9749b587Jim Miller/* 2022554e3da6e496524387a5d3ecc67ef9749b587Jim Miller * Copyright (C) 2012 The Android Open Source Project 3022554e3da6e496524387a5d3ecc67ef9749b587Jim Miller * 4022554e3da6e496524387a5d3ecc67ef9749b587Jim Miller * Licensed under the Apache License, Version 2.0 (the "License"); 5022554e3da6e496524387a5d3ecc67ef9749b587Jim Miller * you may not use this file except in compliance with the License. 6022554e3da6e496524387a5d3ecc67ef9749b587Jim Miller * You may obtain a copy of the License at 7022554e3da6e496524387a5d3ecc67ef9749b587Jim Miller * 8022554e3da6e496524387a5d3ecc67ef9749b587Jim Miller * http://www.apache.org/licenses/LICENSE-2.0 9022554e3da6e496524387a5d3ecc67ef9749b587Jim Miller * 10022554e3da6e496524387a5d3ecc67ef9749b587Jim Miller * Unless required by applicable law or agreed to in writing, software 11022554e3da6e496524387a5d3ecc67ef9749b587Jim Miller * distributed under the License is distributed on an "AS IS" BASIS, 12022554e3da6e496524387a5d3ecc67ef9749b587Jim Miller * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13022554e3da6e496524387a5d3ecc67ef9749b587Jim Miller * See the License for the specific language governing permissions and 14022554e3da6e496524387a5d3ecc67ef9749b587Jim Miller * limitations under the License. 15022554e3da6e496524387a5d3ecc67ef9749b587Jim Miller */ 165ecd81154fa039961f65bb4e36d18ac555b0d1d6Jim Millerpackage com.android.keyguard; 17022554e3da6e496524387a5d3ecc67ef9749b587Jim Miller 18022554e3da6e496524387a5d3ecc67ef9749b587Jim Millerimport android.content.Context; 19022554e3da6e496524387a5d3ecc67ef9749b587Jim Millerimport android.util.AttributeSet; 20022554e3da6e496524387a5d3ecc67ef9749b587Jim Millerimport android.view.View; 21022554e3da6e496524387a5d3ecc67ef9749b587Jim Millerimport android.widget.LinearLayout; 22022554e3da6e496524387a5d3ecc67ef9749b587Jim Miller 23022554e3da6e496524387a5d3ecc67ef9749b587Jim Miller/** 24022554e3da6e496524387a5d3ecc67ef9749b587Jim Miller * A layout that arranges its children into a special type of grid. 25022554e3da6e496524387a5d3ecc67ef9749b587Jim Miller */ 26022554e3da6e496524387a5d3ecc67ef9749b587Jim Millerpublic class KeyguardLinearLayout extends LinearLayout { 27022554e3da6e496524387a5d3ecc67ef9749b587Jim Miller int mTopChild = 0; 28022554e3da6e496524387a5d3ecc67ef9749b587Jim Miller 29022554e3da6e496524387a5d3ecc67ef9749b587Jim Miller public KeyguardLinearLayout(Context context) { 30022554e3da6e496524387a5d3ecc67ef9749b587Jim Miller this(context, null, 0); 31022554e3da6e496524387a5d3ecc67ef9749b587Jim Miller } 32022554e3da6e496524387a5d3ecc67ef9749b587Jim Miller 33022554e3da6e496524387a5d3ecc67ef9749b587Jim Miller public KeyguardLinearLayout(Context context, AttributeSet attrs) { 34022554e3da6e496524387a5d3ecc67ef9749b587Jim Miller this(context, attrs, 0); 35022554e3da6e496524387a5d3ecc67ef9749b587Jim Miller } 36022554e3da6e496524387a5d3ecc67ef9749b587Jim Miller 37022554e3da6e496524387a5d3ecc67ef9749b587Jim Miller public KeyguardLinearLayout(Context context, AttributeSet attrs, int defStyle) { 38022554e3da6e496524387a5d3ecc67ef9749b587Jim Miller super(context, attrs, defStyle); 39022554e3da6e496524387a5d3ecc67ef9749b587Jim Miller } 40022554e3da6e496524387a5d3ecc67ef9749b587Jim Miller 41022554e3da6e496524387a5d3ecc67ef9749b587Jim Miller public void setTopChild(View child) { 42022554e3da6e496524387a5d3ecc67ef9749b587Jim Miller int top = indexOfChild(child); 43022554e3da6e496524387a5d3ecc67ef9749b587Jim Miller mTopChild = top; 44022554e3da6e496524387a5d3ecc67ef9749b587Jim Miller invalidate(); 45022554e3da6e496524387a5d3ecc67ef9749b587Jim Miller } 46022554e3da6e496524387a5d3ecc67ef9749b587Jim Miller} 47