mirror of
https://github.com/eclipse-sailing-analytics/sailing-analytics.git
synced 2026-09-30 01:16:40 +00:00
replaced ToggleButton with TabHost
This commit is contained in:
@@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
|
||||
<item android:drawable="@color/dark_sap_gray_black_30" android:state_selected="true"/>
|
||||
|
||||
<item android:drawable="@color/dark_black"/>
|
||||
|
||||
</selector>
|
||||
@@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
|
||||
<item android:drawable="@color/light_sap_gray_black_30" android:state_selected="true"/>
|
||||
|
||||
<item android:drawable="@color/light_black"/>
|
||||
|
||||
</selector>
|
||||
+173
-170
@@ -43,185 +43,188 @@
|
||||
android:background="?black"/>
|
||||
</RelativeLayout>
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/time_select"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="@dimen/selector_header_height"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:background="?sap_gray_black_30"
|
||||
android:visibility="gone"
|
||||
tools:visibility="visible">
|
||||
|
||||
<ToggleButton
|
||||
android:id="@+id/switch_start_time"
|
||||
style="?buttonSolidSmall"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerInParent="true"
|
||||
android:layout_marginRight="@dimen/default_margin_half"
|
||||
android:textOff="@string/dependent_races_relative"
|
||||
android:textOn="@string/dependent_races_absolute"/>
|
||||
</RelativeLayout>
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/time_absolute"
|
||||
<TabHost
|
||||
android:id="@android:id/tabhost"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_above="@id/time_select"
|
||||
android:layout_below="@+id/header"
|
||||
android:background="?sap_gray_black_30"
|
||||
android:visibility="gone"
|
||||
tools:visibility="visible">
|
||||
android:layout_below="@+id/header">
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/buttonBar"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="@dimen/selector_header_height"
|
||||
android:layout_alignParentTop="true">
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
<TabWidget
|
||||
android:id="@android:id/tabs"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerInParent="true"
|
||||
android:layout_marginTop="@dimen/default_margin_half"
|
||||
android:orientation="horizontal">
|
||||
android:layout_alignParentBottom="true"
|
||||
android:tabStripEnabled="false"/>
|
||||
|
||||
<Button
|
||||
android:id="@+id/minute_inc"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:background="?button_filled_bordered"
|
||||
android:drawableLeft="?chevron_left_36dp"
|
||||
android:paddingRight="@dimen/default_padding_half"
|
||||
android:textAppearance="?textLarge"
|
||||
android:textColor="?white"
|
||||
tools:text="@string/race_start_time_in"/>
|
||||
<FrameLayout
|
||||
android:id="@android:id/tabcontent"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_above="@android:id/tabs"
|
||||
android:layout_alignParentTop="true">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/start_countdown"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_marginLeft="@dimen/default_margin"
|
||||
android:layout_marginRight="@dimen/default_margin"
|
||||
android:textAppearance="?textXLarge"
|
||||
android:visibility="visible"
|
||||
tools:text="@string/race_start_time_in"/>
|
||||
<RelativeLayout
|
||||
android:id="@+id/time_absolute"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="?sap_gray_black_30"
|
||||
android:visibility="gone"
|
||||
tools:visibility="visible">
|
||||
|
||||
<Button
|
||||
android:id="@+id/minute_dec"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:background="?button_filled_bordered"
|
||||
android:drawableRight="?chevron_right_36dp"
|
||||
android:paddingLeft="@dimen/default_padding_half"
|
||||
android:textAppearance="?textLarge"
|
||||
android:textColor="?white"
|
||||
tools:text="@string/race_start_time_in"/>
|
||||
</LinearLayout>
|
||||
<RelativeLayout
|
||||
android:id="@+id/buttonBar"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="@dimen/selector_header_height"
|
||||
android:layout_alignParentTop="true">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerInParent="true"
|
||||
android:layout_marginTop="@dimen/default_margin_half"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<Button
|
||||
android:id="@+id/minute_inc"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:background="?button_filled_bordered"
|
||||
android:drawableLeft="?chevron_left_36dp"
|
||||
android:paddingRight="@dimen/default_padding_half"
|
||||
android:textAppearance="?textLarge"
|
||||
android:textColor="?white"
|
||||
tools:text="@string/race_start_time_in"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/start_countdown"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_marginLeft="@dimen/default_margin"
|
||||
android:layout_marginRight="@dimen/default_margin"
|
||||
android:textAppearance="?textXLarge"
|
||||
android:visibility="visible"
|
||||
tools:text="@string/race_start_time_in"/>
|
||||
|
||||
<Button
|
||||
android:id="@+id/minute_dec"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:background="?button_filled_bordered"
|
||||
android:drawableRight="?chevron_right_36dp"
|
||||
android:paddingLeft="@dimen/default_padding_half"
|
||||
android:textAppearance="?textLarge"
|
||||
android:textColor="?white"
|
||||
tools:text="@string/race_start_time_in"/>
|
||||
</LinearLayout>
|
||||
</RelativeLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/start_picker"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerInParent="true"
|
||||
android:scaleX="@integer/picker_scale"
|
||||
android:scaleY="@integer/picker_scale">
|
||||
|
||||
<NumberPicker
|
||||
android:id="@+id/start_date_picker"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:descendantFocusability="blocksDescendants"/>
|
||||
|
||||
<include
|
||||
android:id="@+id/start_time_picker"
|
||||
layout="@layout/time_picker"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"/>
|
||||
</LinearLayout>
|
||||
|
||||
<Button
|
||||
android:id="@+id/set_start_time_absolute"
|
||||
style="?attr/buttonSolidSmall"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentEnd="true"
|
||||
android:layout_alignParentRight="true"
|
||||
android:layout_centerInParent="true"
|
||||
android:layout_margin="@dimen/default_margin_twice"
|
||||
android:maxWidth="200dp"
|
||||
android:text="@string/race_set_time"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/debug_time"
|
||||
style="?textSmall"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:layout_alignParentStart="true"
|
||||
android:visibility="gone"
|
||||
tools:text="12:12:12"/>
|
||||
</RelativeLayout>
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/time_relative"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="?sap_gray_black_30"
|
||||
android:visibility="gone"
|
||||
tools:visibility="visible">
|
||||
|
||||
<Button
|
||||
android:id="@+id/set_start_time_relative"
|
||||
style="?attr/buttonSolidSmall"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentEnd="true"
|
||||
android:layout_alignParentRight="true"
|
||||
android:layout_centerInParent="true"
|
||||
android:layout_margin="@dimen/default_margin_twice"
|
||||
android:maxWidth="200dp"
|
||||
android:text="@string/race_set_time"/>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerInParent="true">
|
||||
|
||||
<NumberPicker
|
||||
android:id="@+id/time_offset"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="@dimen/default_margin"
|
||||
android:layout_marginTop="@dimen/default_margin"
|
||||
android:scaleX="@integer/picker_scale"
|
||||
android:scaleY="@integer/picker_scale"/>
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:padding="@dimen/default_padding"
|
||||
android:text="@string/minutes_after"
|
||||
android:textAppearance="?textLarge"/>
|
||||
|
||||
<Spinner
|
||||
android:id="@+id/dependent_race"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:dropDownWidth="wrap_content"
|
||||
android:prompt="@string/dependent_races_prompt"
|
||||
android:spinnerMode="dropdown"/>
|
||||
</LinearLayout>
|
||||
</RelativeLayout>
|
||||
</FrameLayout>
|
||||
</RelativeLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/start_picker"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerInParent="true"
|
||||
android:scaleX="@integer/picker_scale"
|
||||
android:scaleY="@integer/picker_scale">
|
||||
|
||||
<NumberPicker
|
||||
android:id="@+id/start_date_picker"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:descendantFocusability="blocksDescendants"/>
|
||||
|
||||
<include
|
||||
android:id="@+id/start_time_picker"
|
||||
layout="@layout/time_picker"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"/>
|
||||
</LinearLayout>
|
||||
|
||||
<Button
|
||||
android:id="@+id/set_start_time_absolute"
|
||||
style="?attr/buttonSolidSmall"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentEnd="true"
|
||||
android:layout_alignParentRight="true"
|
||||
android:layout_centerInParent="true"
|
||||
android:layout_margin="@dimen/default_margin_twice"
|
||||
android:maxWidth="200dp"
|
||||
android:text="@string/race_set_time"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/debug_time"
|
||||
style="?textSmall"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:layout_alignParentStart="true"
|
||||
android:visibility="gone"
|
||||
tools:text="12:12:12"/>
|
||||
</RelativeLayout>
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/time_relative"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_above="@id/time_select"
|
||||
android:layout_below="@+id/header"
|
||||
android:background="?sap_gray_black_30"
|
||||
android:visibility="gone"
|
||||
tools:visibility="visible">
|
||||
|
||||
<Button
|
||||
android:id="@+id/set_start_time_relative"
|
||||
style="?attr/buttonSolidSmall"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentEnd="true"
|
||||
android:layout_alignParentRight="true"
|
||||
android:layout_centerInParent="true"
|
||||
android:layout_margin="@dimen/default_margin_twice"
|
||||
android:maxWidth="200dp"
|
||||
android:text="@string/race_set_time"/>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerInParent="true">
|
||||
|
||||
<NumberPicker
|
||||
android:id="@+id/time_offset"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="@dimen/default_margin"
|
||||
android:layout_marginTop="@dimen/default_margin"
|
||||
android:scaleX="@integer/picker_scale"
|
||||
android:scaleY="@integer/picker_scale"/>
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:padding="@dimen/default_padding"
|
||||
android:text="@string/minutes_after"
|
||||
android:textAppearance="?textLarge"/>
|
||||
|
||||
<Spinner
|
||||
android:id="@+id/dependent_race"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:dropDownWidth="wrap_content"
|
||||
android:prompt="@string/dependent_races_prompt"
|
||||
android:spinnerMode="dropdown"/>
|
||||
</LinearLayout>
|
||||
</RelativeLayout>
|
||||
</TabHost>
|
||||
</RelativeLayout>
|
||||
@@ -19,6 +19,7 @@
|
||||
<attr name="buttonSolidXSmall" format="reference"/>
|
||||
<attr name="buttonSolidSmall" format="reference"/>
|
||||
<attr name="buttonSolidNormal" format="reference"/>
|
||||
<attr name="text" format="reference"/>
|
||||
<attr name="textXXSmall" format="reference"/>
|
||||
<attr name="textXSmall" format="reference"/>
|
||||
<attr name="textSmall" format="reference"/>
|
||||
@@ -64,6 +65,7 @@
|
||||
<attr name="swipe_idle" format="reference"/>
|
||||
<attr name="swipe_left" format="reference"/>
|
||||
<attr name="swipe_right" format="reference"/>
|
||||
<attr name="tab_widget" format="reference"/>
|
||||
<attr name="value_next" format="reference"/>
|
||||
<attr name="value_prev" format="reference"/>
|
||||
<attr name="wind_on" format="reference"/>
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
<style name="AppTheme.Dark.Base" parent="Theme.AppCompat.NoActionBar">
|
||||
<item name="windowActionModeOverlay">true</item>
|
||||
<item name="android:actionOverflowButtonStyle">@style/OverFlow</item>
|
||||
<item name="android:tabWidgetStyle">@style/AppTheme.Dark.TabWidget</item>
|
||||
|
||||
<item name="colorPrimary">@color/dark_colorPrimary</item>
|
||||
<item name="colorPrimaryDark">@color/dark_colorPrimaryDark</item>
|
||||
@@ -34,6 +35,7 @@
|
||||
<item name="buttonSolidXSmall">@style/AppTheme.Dark.Button.XSmall</item>
|
||||
<item name="buttonSolidSmall">@style/AppTheme.Dark.Button.Small</item>
|
||||
<item name="buttonSolidNormal">@style/AppTheme.Dark.Button.Normal</item>
|
||||
<item name="text">@style/AppTheme.Dark.Text</item>
|
||||
<item name="textXXSmall">@style/AppTheme.Dark.Text.XXSmall</item>
|
||||
<item name="textXSmall">@style/AppTheme.Dark.Text.XSmall</item>
|
||||
<item name="textSmall">@style/AppTheme.Dark.Text.Small</item>
|
||||
@@ -78,6 +80,7 @@
|
||||
<item name="swipe_idle">@drawable/swipe_idle_dark</item>
|
||||
<item name="swipe_left">@drawable/swipe_left_dark</item>
|
||||
<item name="swipe_right">@drawable/swipe_right_dark</item>
|
||||
<item name="tab_widget">@drawable/tabwidget_dark</item>
|
||||
<item name="value_next">@drawable/value_next_dark</item>
|
||||
<item name="value_prev">@drawable/value_prev_dark</item>
|
||||
<item name="wind_off">@drawable/wind_off_dark</item>
|
||||
@@ -172,4 +175,13 @@
|
||||
<item name="android:gravity">center_horizontal</item>
|
||||
</style>
|
||||
|
||||
<style name="AppTheme.Dark.TabWidget" parent="@android:style/Widget.TabWidget">
|
||||
<item name="android:textAppearance">@style/AppTheme.Light.TabWidgetText</item>
|
||||
</style>
|
||||
|
||||
<style name="AppTheme.Dark.TabWidgetText" parent="@android:style/TextAppearance.Widget.TabWidget">
|
||||
<item name="android:textSize">@dimen/textSize_32</item>
|
||||
<item name="android:textColor">?white</item>
|
||||
</style>
|
||||
|
||||
</resources>
|
||||
@@ -7,6 +7,7 @@
|
||||
<style name="AppTheme.Light.Base" parent="Theme.AppCompat.NoActionBar">
|
||||
<item name="windowActionModeOverlay">true</item>
|
||||
<item name="android:actionOverflowButtonStyle">@style/OverFlow</item>
|
||||
<item name="android:tabWidgetStyle">@style/AppTheme.Light.TabWidget</item>
|
||||
|
||||
<item name="colorPrimary">@color/light_colorPrimary</item>
|
||||
<item name="colorPrimaryDark">@color/light_colorPrimaryDark</item>
|
||||
@@ -37,6 +38,7 @@
|
||||
<item name="buttonSolidXSmall">@style/AppTheme.Light.Button.XSmall</item>
|
||||
<item name="buttonSolidSmall">@style/AppTheme.Light.Button.Small</item>
|
||||
<item name="buttonSolidNormal">@style/AppTheme.Light.Button.Normal</item>
|
||||
<item name="text">@style/AppTheme.Light.Text</item>
|
||||
<item name="textXXSmall">@style/AppTheme.Light.Text.XXSmall</item>
|
||||
<item name="textXSmall">@style/AppTheme.Light.Text.XSmall</item>
|
||||
<item name="textSmall">@style/AppTheme.Light.Text.Small</item>
|
||||
@@ -81,6 +83,7 @@
|
||||
<item name="swipe_idle">@drawable/swipe_idle_light</item>
|
||||
<item name="swipe_left">@drawable/swipe_left_light</item>
|
||||
<item name="swipe_right">@drawable/swipe_right_light</item>
|
||||
<item name="tab_widget">@drawable/tabwidget_light</item>
|
||||
<item name="value_next">@drawable/value_next_light</item>
|
||||
<item name="value_prev">@drawable/value_prev_light</item>
|
||||
<item name="wind_off">@drawable/wind_off_light</item>
|
||||
@@ -182,4 +185,13 @@
|
||||
<item name="android:windowBackground">@null</item>
|
||||
</style>
|
||||
|
||||
<style name="AppTheme.Light.TabWidget" parent="@android:style/Widget.TabWidget">
|
||||
<item name="android:textAppearance">@style/AppTheme.Light.TabWidgetText</item>
|
||||
</style>
|
||||
|
||||
<style name="AppTheme.Light.TabWidgetText" parent="@android:style/TextAppearance.Widget.TabWidget">
|
||||
<item name="android:textSize">@dimen/textSize_32</item>
|
||||
<item name="android:textColor">?white</item>
|
||||
</style>
|
||||
|
||||
</resources>
|
||||
+34
-30
@@ -15,10 +15,9 @@ import com.sap.sailing.domain.abstractlog.race.state.impl.BaseRaceStateChangedLi
|
||||
import com.sap.sailing.domain.common.racelog.RacingProcedureType;
|
||||
import com.sap.sailing.racecommittee.app.AppConstants;
|
||||
import com.sap.sailing.racecommittee.app.R;
|
||||
import com.sap.sailing.racecommittee.app.data.InMemoryDataStore;
|
||||
import com.sap.sailing.racecommittee.app.data.ReadonlyDataManager;
|
||||
import com.sap.sailing.racecommittee.app.ui.adapters.DependentRaceSpinnerAdapter;
|
||||
import com.sap.sailing.racecommittee.app.ui.fragments.RaceFragment;
|
||||
import com.sap.sailing.racecommittee.app.utils.BitmapHelper;
|
||||
import com.sap.sailing.racecommittee.app.utils.ThemeHelper;
|
||||
import com.sap.sailing.racecommittee.app.utils.TimeUtils;
|
||||
import com.sap.sse.common.Duration;
|
||||
@@ -39,10 +38,10 @@ public class StartTimeFragment extends BaseFragment
|
||||
private static final int FUTURE_DAYS = 25;
|
||||
private static final int PAST_DAYS = -3;
|
||||
private static final int MAX_DIFF_MIN = 60;
|
||||
private static final String ZERO_TIME = "-00:00:00";
|
||||
|
||||
private View mRelative;
|
||||
private View mAbsolute;
|
||||
private ToggleButton mToggle;
|
||||
|
||||
private NumberPicker mDatePicker;
|
||||
private NumberPicker mTimeOffset;
|
||||
@@ -92,9 +91,26 @@ public class StartTimeFragment extends BaseFragment
|
||||
mAbsolute = ViewHolder.get(layout, R.id.time_absolute);
|
||||
|
||||
if (preferences.isDependentRacesAllowed()) {
|
||||
View select = ViewHolder.get(layout, R.id.time_select);
|
||||
if (select != null) {
|
||||
select.setVisibility(View.VISIBLE);
|
||||
final TabHost tabHost = ViewHolder.get(layout, android.R.id.tabhost);
|
||||
if (tabHost != null) {
|
||||
tabHost.setup();
|
||||
|
||||
tabHost.addTab(tabHost.newTabSpec(getString(R.string.dependent_races_absolute))
|
||||
.setIndicator(getString(R.string.dependent_races_absolute)).setContent(R.id.time_absolute));
|
||||
tabHost.addTab(tabHost.newTabSpec(getString(R.string.dependent_races_relative)).setIndicator(getString(R.string.dependent_races_relative)).setContent(R.id.time_relative));
|
||||
|
||||
for (int i = 0; i < tabHost.getTabWidget().getChildCount(); i++) {
|
||||
BitmapHelper.setBackground(tabHost.getTabWidget().getChildAt(i), BitmapHelper.getAttrDrawable(getActivity(), R.attr.tab_widget));
|
||||
}
|
||||
|
||||
tabHost.setOnTabChangedListener(new TabHost.OnTabChangeListener() {
|
||||
@Override
|
||||
public void onTabChanged(String tabId) {
|
||||
setTabTextColor(tabHost);
|
||||
}
|
||||
});
|
||||
setTabTextColor(tabHost);
|
||||
tabHost.setCurrentTab(0);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -114,16 +130,6 @@ public class StartTimeFragment extends BaseFragment
|
||||
setStart.setOnClickListener(this);
|
||||
}
|
||||
|
||||
mToggle = ViewHolder.get(layout, R.id.switch_start_time);
|
||||
if (mToggle != null) {
|
||||
mToggle.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
||||
@Override
|
||||
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
|
||||
showInputView(isChecked);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
mDebugTime = ViewHolder.get(layout, R.id.debug_time);
|
||||
return layout;
|
||||
}
|
||||
@@ -236,8 +242,6 @@ public class StartTimeFragment extends BaseFragment
|
||||
mDependentRace.setAdapter(adapter);
|
||||
}
|
||||
}
|
||||
|
||||
showInputView(mToggle.isChecked());
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -285,16 +289,16 @@ public class StartTimeFragment extends BaseFragment
|
||||
|
||||
if (mMinuteDec != null) {
|
||||
String countdown = getString(resId, timeLeft);
|
||||
if (countdown.equals("-00:00:00")) {
|
||||
countdown = "00:00:00";
|
||||
if (ZERO_TIME.equals(countdown)) {
|
||||
countdown = countdown.substring(1);
|
||||
}
|
||||
mMinuteDec.setText(countdown);
|
||||
}
|
||||
|
||||
if (mMinuteInc != null) {
|
||||
String countdown = getString(resId, timeRight);
|
||||
if (countdown.equals("-00:00:00")) {
|
||||
countdown = "00:00:00";
|
||||
if (ZERO_TIME.equals(countdown)) {
|
||||
countdown = countdown.substring(1);
|
||||
}
|
||||
mMinuteInc.setText(countdown);
|
||||
}
|
||||
@@ -305,13 +309,13 @@ public class StartTimeFragment extends BaseFragment
|
||||
}
|
||||
}
|
||||
|
||||
private void showInputView(boolean isChecked) {
|
||||
if (isChecked) {
|
||||
mAbsolute.setVisibility(View.GONE);
|
||||
mRelative.setVisibility(View.VISIBLE);
|
||||
} else {
|
||||
mAbsolute.setVisibility(View.VISIBLE);
|
||||
mRelative.setVisibility(View.GONE);
|
||||
private void setTabTextColor(TabHost tabHost) {
|
||||
for (int i = 0; i < tabHost.getTabWidget().getTabCount(); i++) {
|
||||
View view = tabHost.getTabWidget().getChildTabViewAt(i);
|
||||
if (view != null) {
|
||||
TextView textView = (TextView) view.findViewById(android.R.id.title);
|
||||
textView.setTextColor(ThemeHelper.getColor(getActivity(), (i == tabHost.getCurrentTab()) ? R.attr.white : R.attr.sap_light_gray));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -370,7 +374,7 @@ public class StartTimeFragment extends BaseFragment
|
||||
break;
|
||||
|
||||
case R.id.set_start_time_relative:
|
||||
|
||||
//TODO
|
||||
break;
|
||||
|
||||
case R.id.header_text:
|
||||
|
||||
Reference in New Issue
Block a user