Michael Kolb | 9829b43 | 2011-06-04 13:29:00 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2011 The Android Open Source Project |
| 3 | * |
| 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not |
| 5 | * use this file except in compliance with the License. You may obtain a copy of |
| 6 | * 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, WITHOUT |
| 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the |
| 13 | * License for the specific language governing permissions and limitations under |
| 14 | * the License. |
| 15 | */ |
| 16 | |
| 17 | package com.android.browser; |
| 18 | |
| 19 | import android.content.Context; |
| 20 | import android.util.AttributeSet; |
| 21 | import android.view.View; |
| 22 | |
| 23 | import com.android.browser.view.Gallery; |
| 24 | |
| 25 | /** |
| 26 | * custom view for displaying tabs in the nav screen |
| 27 | */ |
| 28 | public class NavTabGallery extends Gallery { |
| 29 | |
| 30 | public NavTabGallery(Context context, AttributeSet attrs, int defStyle) { |
| 31 | super(context, attrs, defStyle); |
| 32 | } |
| 33 | |
| 34 | public NavTabGallery(Context context, AttributeSet attrs) { |
| 35 | super(context, attrs); |
| 36 | } |
| 37 | |
| 38 | public NavTabGallery(Context context) { |
| 39 | super(context); |
| 40 | } |
| 41 | |
| 42 | protected void setSelection(int ix) { |
| 43 | super.setSelectedPositionInt(ix); |
| 44 | } |
| 45 | |
| 46 | protected int getSelectionIndex() { |
| 47 | return getSelectedItemPosition(); |
| 48 | } |
| 49 | |
| 50 | protected Tab getSelectedItem() { |
| 51 | return (Tab) mAdapter.getItem(getSelectedItemPosition()); |
| 52 | } |
| 53 | |
| 54 | View getSelectedTab() { |
| 55 | return getSelectedView(); |
| 56 | } |
| 57 | |
| 58 | } |