project_files/Android-build/SDL-android-project/src/org/hedgewars/hedgeroid/util/UiUtils.java
author unC0Rr
Thu, 19 Dec 2024 14:18:55 +0100
branchtransitional_engine
changeset 16081 6633961698ad
parent 10017 de822cd3df3a
permissions -rw-r--r--
Make wider range of numbers representable with FPNum on the cost of smaller precision
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
7584
7831c84cc644 License change: With the agreement of Xeli, I changed the Hedgeroid license to
Medo <smaxein@googlemail.com>
parents: 7582
diff changeset
     1
/*
7831c84cc644 License change: With the agreement of Xeli, I changed the Hedgeroid license to
Medo <smaxein@googlemail.com>
parents: 7582
diff changeset
     2
 * Hedgewars for Android. An Android port of Hedgewars, a free turn based strategy game
7831c84cc644 License change: With the agreement of Xeli, I changed the Hedgeroid license to
Medo <smaxein@googlemail.com>
parents: 7582
diff changeset
     3
 * Copyright (C) 2012 Simeon Maxein <smaxein@googlemail.com>
7831c84cc644 License change: With the agreement of Xeli, I changed the Hedgeroid license to
Medo <smaxein@googlemail.com>
parents: 7582
diff changeset
     4
 *
7831c84cc644 License change: With the agreement of Xeli, I changed the Hedgeroid license to
Medo <smaxein@googlemail.com>
parents: 7582
diff changeset
     5
 * This program is free software; you can redistribute it and/or
7831c84cc644 License change: With the agreement of Xeli, I changed the Hedgeroid license to
Medo <smaxein@googlemail.com>
parents: 7582
diff changeset
     6
 * modify it under the terms of the GNU General Public License
7831c84cc644 License change: With the agreement of Xeli, I changed the Hedgeroid license to
Medo <smaxein@googlemail.com>
parents: 7582
diff changeset
     7
 * as published by the Free Software Foundation; either version 2
7831c84cc644 License change: With the agreement of Xeli, I changed the Hedgeroid license to
Medo <smaxein@googlemail.com>
parents: 7582
diff changeset
     8
 * of the License, or (at your option) any later version.
7831c84cc644 License change: With the agreement of Xeli, I changed the Hedgeroid license to
Medo <smaxein@googlemail.com>
parents: 7582
diff changeset
     9
 *
7831c84cc644 License change: With the agreement of Xeli, I changed the Hedgeroid license to
Medo <smaxein@googlemail.com>
parents: 7582
diff changeset
    10
 * This program is distributed in the hope that it will be useful,
7831c84cc644 License change: With the agreement of Xeli, I changed the Hedgeroid license to
Medo <smaxein@googlemail.com>
parents: 7582
diff changeset
    11
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
7831c84cc644 License change: With the agreement of Xeli, I changed the Hedgeroid license to
Medo <smaxein@googlemail.com>
parents: 7582
diff changeset
    12
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
7831c84cc644 License change: With the agreement of Xeli, I changed the Hedgeroid license to
Medo <smaxein@googlemail.com>
parents: 7582
diff changeset
    13
 * GNU General Public License for more details.
7831c84cc644 License change: With the agreement of Xeli, I changed the Hedgeroid license to
Medo <smaxein@googlemail.com>
parents: 7582
diff changeset
    14
 *
7831c84cc644 License change: With the agreement of Xeli, I changed the Hedgeroid license to
Medo <smaxein@googlemail.com>
parents: 7582
diff changeset
    15
 * You should have received a copy of the GNU General Public License
7831c84cc644 License change: With the agreement of Xeli, I changed the Hedgeroid license to
Medo <smaxein@googlemail.com>
parents: 7582
diff changeset
    16
 * along with this program; if not, write to the Free Software
7831c84cc644 License change: With the agreement of Xeli, I changed the Hedgeroid license to
Medo <smaxein@googlemail.com>
parents: 7582
diff changeset
    17
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
7831c84cc644 License change: With the agreement of Xeli, I changed the Hedgeroid license to
Medo <smaxein@googlemail.com>
parents: 7582
diff changeset
    18
 */
7831c84cc644 License change: With the agreement of Xeli, I changed the Hedgeroid license to
Medo <smaxein@googlemail.com>
parents: 7582
diff changeset
    19
7582
714310efad8f Hedgeroid: Final sprint to the deadline
Medo <smaxein@googlemail.com>
parents:
diff changeset
    20
package org.hedgewars.hedgeroid.util;
714310efad8f Hedgeroid: Final sprint to the deadline
Medo <smaxein@googlemail.com>
parents:
diff changeset
    21
714310efad8f Hedgeroid: Final sprint to the deadline
Medo <smaxein@googlemail.com>
parents:
diff changeset
    22
import org.hedgewars.hedgeroid.R;
714310efad8f Hedgeroid: Final sprint to the deadline
Medo <smaxein@googlemail.com>
parents:
diff changeset
    23
714310efad8f Hedgeroid: Final sprint to the deadline
Medo <smaxein@googlemail.com>
parents:
diff changeset
    24
import android.content.Context;
714310efad8f Hedgeroid: Final sprint to the deadline
Medo <smaxein@googlemail.com>
parents:
diff changeset
    25
import android.view.LayoutInflater;
714310efad8f Hedgeroid: Final sprint to the deadline
Medo <smaxein@googlemail.com>
parents:
diff changeset
    26
import android.view.View;
714310efad8f Hedgeroid: Final sprint to the deadline
Medo <smaxein@googlemail.com>
parents:
diff changeset
    27
import android.widget.ImageView;
714310efad8f Hedgeroid: Final sprint to the deadline
Medo <smaxein@googlemail.com>
parents:
diff changeset
    28
import android.widget.TabHost;
714310efad8f Hedgeroid: Final sprint to the deadline
Medo <smaxein@googlemail.com>
parents:
diff changeset
    29
import android.widget.TextView;
714310efad8f Hedgeroid: Final sprint to the deadline
Medo <smaxein@googlemail.com>
parents:
diff changeset
    30
714310efad8f Hedgeroid: Final sprint to the deadline
Medo <smaxein@googlemail.com>
parents:
diff changeset
    31
public final class UiUtils {
10017
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 7586
diff changeset
    32
    private UiUtils() {
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 7586
diff changeset
    33
        throw new AssertionError("This class is not meant to be instantiated");
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 7586
diff changeset
    34
    }
7582
714310efad8f Hedgeroid: Final sprint to the deadline
Medo <smaxein@googlemail.com>
parents:
diff changeset
    35
10017
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 7586
diff changeset
    36
    public static View createVerticalTabIndicator(TabHost tabHost, int label, int icon) {
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 7586
diff changeset
    37
        LayoutInflater inflater = (LayoutInflater) tabHost.getContext()
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 7586
diff changeset
    38
                .getSystemService(Context.LAYOUT_INFLATER_SERVICE);
7582
714310efad8f Hedgeroid: Final sprint to the deadline
Medo <smaxein@googlemail.com>
parents:
diff changeset
    39
10017
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 7586
diff changeset
    40
        View view = inflater.inflate(R.layout.tab_indicator_vertical,
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 7586
diff changeset
    41
                tabHost.getTabWidget(), false);
7582
714310efad8f Hedgeroid: Final sprint to the deadline
Medo <smaxein@googlemail.com>
parents:
diff changeset
    42
10017
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 7586
diff changeset
    43
        final TextView tv = (TextView) view.findViewById(R.id.title);
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 7586
diff changeset
    44
        tv.setText(label);
7582
714310efad8f Hedgeroid: Final sprint to the deadline
Medo <smaxein@googlemail.com>
parents:
diff changeset
    45
10017
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 7586
diff changeset
    46
        if (icon != 0) {
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 7586
diff changeset
    47
            ImageView iconView = (ImageView) view.findViewById(R.id.icon);
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 7586
diff changeset
    48
            iconView.setImageResource(icon);
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 7586
diff changeset
    49
        }
7582
714310efad8f Hedgeroid: Final sprint to the deadline
Medo <smaxein@googlemail.com>
parents:
diff changeset
    50
10017
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 7586
diff changeset
    51
        return view;
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 7586
diff changeset
    52
    }
7582
714310efad8f Hedgeroid: Final sprint to the deadline
Medo <smaxein@googlemail.com>
parents:
diff changeset
    53
}