|
1 /* |
|
2 * Hedgewars for Android. An Android port of Hedgewars, a free turn based strategy game |
|
3 * Copyright (C) 2012 Simeon Maxein <smaxein@googlemail.com> |
|
4 * |
|
5 * This program is free software; you can redistribute it and/or |
|
6 * modify it under the terms of the GNU General Public License |
|
7 * as published by the Free Software Foundation; either version 2 |
|
8 * of the License, or (at your option) any later version. |
|
9 * |
|
10 * This program is distributed in the hope that it will be useful, |
|
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
13 * GNU General Public License for more details. |
|
14 * |
|
15 * You should have received a copy of the GNU General Public License |
|
16 * along with this program; if not, write to the Free Software |
|
17 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
|
18 */ |
|
19 |
|
20 package org.hedgewars.hedgeroid.util; |
|
21 |
|
22 import org.hedgewars.hedgeroid.R; |
|
23 |
|
24 import android.content.Context; |
|
25 import android.view.LayoutInflater; |
|
26 import android.view.View; |
|
27 import android.widget.ImageView; |
|
28 import android.widget.TabHost; |
|
29 import android.widget.TextView; |
|
30 |
|
31 public final class UiUtils { |
|
32 private UiUtils() { |
|
33 throw new AssertionError("This class is not meant to be instantiated"); |
|
34 } |
|
35 |
|
36 public static View createVerticalTabIndicator(TabHost tabHost, int label, int icon) { |
|
37 LayoutInflater inflater = (LayoutInflater) tabHost.getContext() |
|
38 .getSystemService(Context.LAYOUT_INFLATER_SERVICE); |
|
39 |
|
40 View view = inflater.inflate(R.layout.tab_indicator_vertical, |
|
41 tabHost.getTabWidget(), false); |
|
42 |
|
43 final TextView tv = (TextView) view.findViewById(R.id.title); |
|
44 tv.setText(label); |
|
45 |
|
46 if (icon != 0) { |
|
47 ImageView iconView = (ImageView) view.findViewById(R.id.icon); |
|
48 iconView.setImageResource(icon); |
|
49 } |
|
50 |
|
51 return view; |
|
52 } |
|
53 } |