mirror of
https://github.com/eclipse-sailing-analytics/sailing-analytics.git
synced 2026-09-19 04:05:36 +00:00
header on phone can be swiped
This commit is contained in:
+1
-1
@@ -31,7 +31,7 @@ ext {
|
||||
minSdk = 14
|
||||
targetSdk = 22
|
||||
|
||||
support = "22.1.1"
|
||||
support = "22.2.1"
|
||||
play_services = "7.3.0"
|
||||
|
||||
license_dialog = "1.7.0"
|
||||
|
||||
@@ -77,6 +77,7 @@ dependencies {
|
||||
/* support libraries */
|
||||
compile "com.android.support:appcompat-v7:${rootProject.ext.support}"
|
||||
compile "com.android.support:recyclerview-v7:${rootProject.ext.support}"
|
||||
compile "com.android.support:support-v13:${rootProject.ext.support}"
|
||||
|
||||
/* Google Play Services */
|
||||
compile "com.google.android.gms:play-services-location:${rootProject.ext.play_services}"
|
||||
|
||||
@@ -26,6 +26,12 @@
|
||||
<artifactId>android</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.android.support</groupId>
|
||||
<artifactId>support-v13</artifactId>
|
||||
<type>aar</type>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.h6ah4i.android.widget.advrecyclerview</groupId>
|
||||
<artifactId>advrecyclerview</artifactId>
|
||||
|
||||
@@ -110,14 +110,14 @@
|
||||
android:orientation="horizontal">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/panel_1"
|
||||
android:id="@+id/dot_1"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginRight="5dp"
|
||||
tools:src="@drawable/ic_dot"/>
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/panel_2"
|
||||
android:id="@+id/dot_2"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
tools:src="@drawable/ic_dot"/>
|
||||
|
||||
@@ -1,57 +1,46 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<RelativeLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<android.support.v4.view.ViewPager
|
||||
android:id="@+id/panels_pager"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="@dimen/side_button_height"
|
||||
android:layout_alignParentTop="true"
|
||||
android:background="@color/colorPrimary" />
|
||||
|
||||
<FrameLayout
|
||||
android:id="@+id/panels_top"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="@dimen/side_button_height"
|
||||
android:layout_alignParentTop="true">
|
||||
android:layout_alignParentTop="true"
|
||||
android:visibility="gone">
|
||||
|
||||
<FrameLayout
|
||||
android:id="@+id/race_panel_setup"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"/>
|
||||
android:layout_height="match_parent" />
|
||||
|
||||
<FrameLayout
|
||||
android:id="@+id/race_panel_time"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"/>
|
||||
android:layout_height="match_parent" />
|
||||
|
||||
<FrameLayout
|
||||
android:id="@+id/race_panel_extra"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
</FrameLayout>
|
||||
android:layout_height="match_parent" />
|
||||
</FrameLayout>
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/panel_switcher"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="40dp"
|
||||
android:layout_below="@id/panels_top"
|
||||
android:layout_below="@id/panels_pager"
|
||||
android:background="?attr/sap_gray">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/nav_prev"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:layout_centerVertical="true"
|
||||
android:src="?attr/button_prev"/>
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/nav_next"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentRight="true"
|
||||
android:layout_centerVertical="true"
|
||||
android:src="?attr/button_next"/>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
@@ -59,55 +48,53 @@
|
||||
android:orientation="horizontal">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/panel_1"
|
||||
android:id="@+id/dot_1"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginRight="5dp"
|
||||
tools:src="@drawable/ic_dot"/>
|
||||
tools:src="@drawable/ic_dot" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/panel_2"
|
||||
android:id="@+id/dot_2"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
tools:src="@drawable/ic_dot"/>
|
||||
tools:src="@drawable/ic_dot" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/panel_3"
|
||||
android:id="@+id/dot_3"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="5dp"
|
||||
android:visibility="gone"
|
||||
tools:src="@drawable/ic_dot"
|
||||
tools:visibility="visible"/>
|
||||
tools:src="@drawable/ic_dot" />
|
||||
</LinearLayout>
|
||||
|
||||
<View
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="@dimen/thin_line"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:background="?attr/black"/>
|
||||
android:background="?attr/black" />
|
||||
</RelativeLayout>
|
||||
|
||||
<FrameLayout
|
||||
android:id="@+id/race_panel_flags"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="@dimen/side_button_height"
|
||||
android:layout_alignParentBottom="true"/>
|
||||
android:layout_alignParentBottom="true" />
|
||||
|
||||
<FrameLayout
|
||||
android:id="@+id/race_content"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_above="@id/race_panel_flags"
|
||||
android:layout_below="@id/panel_switcher"/>
|
||||
android:layout_below="@id/panel_switcher" />
|
||||
|
||||
<FrameLayout
|
||||
android:id="@+id/race_edit"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"/>
|
||||
android:layout_height="match_parent" />
|
||||
|
||||
<FrameLayout
|
||||
android:id="@+id/protest_time_fragment"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"/>
|
||||
android:layout_height="match_parent" />
|
||||
</RelativeLayout>
|
||||
@@ -36,7 +36,7 @@
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:layout_marginTop="@dimen/side_padding"
|
||||
android:layout_marginTop="@dimen/header_margin_top"
|
||||
android:text="@string/start_mode"
|
||||
android:textAppearance="?attr/textPanelHeader" />
|
||||
|
||||
@@ -105,7 +105,7 @@
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:layout_marginTop="@dimen/side_padding"
|
||||
android:layout_marginTop="@dimen/header_margin_top"
|
||||
android:text="@string/gate_start_pathfinder"
|
||||
android:textAppearance="?attr/textPanelHeader" />
|
||||
|
||||
@@ -174,7 +174,7 @@
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:layout_marginTop="@dimen/side_padding"
|
||||
android:layout_marginTop="@dimen/header_margin_top"
|
||||
android:text="@string/gate_start_timing"
|
||||
android:textAppearance="?attr/textPanelHeader" />
|
||||
|
||||
|
||||
@@ -35,7 +35,7 @@
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:layout_marginTop="@dimen/side_padding"
|
||||
android:layout_marginTop="@dimen/header_margin_top"
|
||||
android:text="@string/start_procedure"
|
||||
android:textAppearance="?attr/textPanelHeader" />
|
||||
|
||||
@@ -106,7 +106,7 @@
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:layout_marginTop="@dimen/side_padding"
|
||||
android:layout_marginTop="@dimen/header_margin_top"
|
||||
android:text="@string/course"
|
||||
android:textAppearance="?attr/textPanelHeader" />
|
||||
|
||||
@@ -176,7 +176,7 @@
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:layout_marginTop="@dimen/side_padding"
|
||||
android:layout_marginTop="@dimen/header_margin_top"
|
||||
android:text="@string/wind"
|
||||
android:textAppearance="?attr/textPanelHeader" />
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
android:id="@+id/timer_text"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="@dimen/side_padding"
|
||||
android:layout_marginTop="@dimen/header_margin_top"
|
||||
android:gravity="center"
|
||||
android:singleLine="true"
|
||||
android:textColor="?attr/white"
|
||||
|
||||
@@ -110,14 +110,14 @@
|
||||
android:orientation="horizontal">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/panel_1"
|
||||
android:id="@+id/dot_1"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginRight="5dp"
|
||||
tools:src="@drawable/ic_dot"/>
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/panel_2"
|
||||
android:id="@+id/dot_2"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
tools:src="@drawable/ic_dot"/>
|
||||
|
||||
@@ -58,6 +58,8 @@
|
||||
<dimen name="management_text_normal">@dimen/textSize_26</dimen>
|
||||
<dimen name="management_text_small">@dimen/textSize_22</dimen>
|
||||
|
||||
<dimen name="header_margin_top">@dimen/side_padding</dimen>
|
||||
|
||||
<!-- race state dependent -->
|
||||
<!-- unscheduled -->
|
||||
<dimen name="unscheduled_header_line">@dimen/thick_line</dimen>
|
||||
|
||||
@@ -85,6 +85,8 @@
|
||||
<dimen name="management_text_normal">@dimen/textSize_20</dimen>
|
||||
<dimen name="management_text_small">@dimen/textSize_18</dimen>
|
||||
|
||||
<dimen name="header_margin_top">13dp</dimen>
|
||||
|
||||
<!-- race state dependent -->
|
||||
<!-- login -->
|
||||
<dimen name="login_text_size_small">@dimen/textSize_18</dimen>
|
||||
|
||||
+47
@@ -0,0 +1,47 @@
|
||||
package com.sap.sailing.racecommittee.app.ui.adapters;
|
||||
|
||||
import android.app.Fragment;
|
||||
import android.app.FragmentManager;
|
||||
import android.os.Bundle;
|
||||
import android.support.v13.app.FragmentPagerAdapter;
|
||||
import android.view.View;
|
||||
|
||||
import com.sap.sailing.racecommittee.app.ui.fragments.panels.BasePanelFragment;
|
||||
import com.sap.sailing.racecommittee.app.ui.fragments.panels.MorePanelFragment;
|
||||
import com.sap.sailing.racecommittee.app.ui.fragments.panels.SetupPanelFragment;
|
||||
import com.sap.sailing.racecommittee.app.ui.fragments.panels.TimePanelFragment;
|
||||
|
||||
public class PanelsAdapter extends FragmentPagerAdapter {
|
||||
|
||||
private Bundle mArguments;
|
||||
|
||||
public PanelsAdapter(FragmentManager fragmentManager, Bundle args) {
|
||||
super(fragmentManager);
|
||||
mArguments = args;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Fragment getItem(int position) {
|
||||
Fragment fragment = new Fragment();
|
||||
switch (position) {
|
||||
case 0:
|
||||
fragment = TimePanelFragment.newInstance(mArguments);
|
||||
break;
|
||||
|
||||
case 1:
|
||||
fragment = SetupPanelFragment.newInstance(mArguments);
|
||||
break;
|
||||
|
||||
case 2:
|
||||
fragment = MorePanelFragment.newInstance(mArguments);
|
||||
break;
|
||||
}
|
||||
|
||||
return fragment;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getCount() {
|
||||
return 3;
|
||||
}
|
||||
}
|
||||
+1
-1
@@ -166,7 +166,7 @@ public abstract class RaceFragment extends LoggableFragment implements TickListe
|
||||
}
|
||||
|
||||
protected void viewPanel(@MOVE_VALUES int direction) {
|
||||
if (mDots.size() == 0) {
|
||||
if (mDots.size() == 0 || mPanels.size() == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
+2
-6
@@ -96,15 +96,11 @@ public class ProtestTimeDialogFragment extends AttachedDialogFragment implements
|
||||
mPanels = new ArrayList<>();
|
||||
|
||||
ImageView dot;
|
||||
dot = ViewHelper.get(layout, R.id.panel_1);
|
||||
dot = ViewHelper.get(layout, R.id.dot_1);
|
||||
if (dot != null) {
|
||||
mDots.add(dot);
|
||||
}
|
||||
dot = ViewHelper.get(layout, R.id.panel_2);
|
||||
if (dot != null) {
|
||||
mDots.add(dot);
|
||||
}
|
||||
dot = ViewHelper.get(layout, R.id.panel_3);
|
||||
dot = ViewHelper.get(layout, R.id.dot_2);
|
||||
if (dot != null) {
|
||||
mDots.add(dot);
|
||||
}
|
||||
|
||||
+27
-25
@@ -410,35 +410,37 @@ public class SetupPanelFragment extends BasePanelFragment {
|
||||
|
||||
private void toggleFragment() {
|
||||
sendIntent(AppConstants.INTENT_ACTION_TOGGLE, AppConstants.INTENT_ACTION_EXTRA, AppConstants.INTENT_ACTION_TOGGLE_PROCEDURE_MORE);
|
||||
FragmentTransaction transaction = getFragmentManager().beginTransaction();
|
||||
if (mExtraLayout != null) {
|
||||
switch (toggleMarker(container, markerId)) {
|
||||
case LEVEL_NORMAL:
|
||||
mExtraLayout.setVisibility(View.GONE);
|
||||
transaction.remove(getFragmentManager().findFragmentById(R.id.race_panel_extra));
|
||||
break;
|
||||
if (getView() != null && getView().findViewById(R.id.race_panel_extra) != null) {
|
||||
FragmentTransaction transaction = getFragmentManager().beginTransaction();
|
||||
if (mExtraLayout != null) {
|
||||
switch (toggleMarker(container, markerId)) {
|
||||
case LEVEL_NORMAL:
|
||||
mExtraLayout.setVisibility(View.GONE);
|
||||
transaction.remove(getFragmentManager().findFragmentById(R.id.race_panel_extra));
|
||||
break;
|
||||
|
||||
case LEVEL_TOGGLED:
|
||||
int multiplier = 1;
|
||||
if (getRaceState().getRacingProcedure() instanceof GateStartRacingProcedure) {
|
||||
multiplier = 2;
|
||||
}
|
||||
int height = container.getMeasuredHeight() + getResources().getDimensionPixelSize(R.dimen.thin_line);
|
||||
int width = container.getMeasuredWidth() * multiplier;
|
||||
RelativeLayout.LayoutParams params = new RelativeLayout.LayoutParams(width, height);
|
||||
params.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM);
|
||||
params.addRule(RelativeLayout.RIGHT_OF, R.id.race_panel_setup);
|
||||
mExtraLayout.setLayoutParams(params);
|
||||
mExtraLayout.setVisibility(View.VISIBLE);
|
||||
transaction.replace(R.id.race_panel_extra, MorePanelFragment.newInstance(getArguments()));
|
||||
break;
|
||||
case LEVEL_TOGGLED:
|
||||
int multiplier = 1;
|
||||
if (getRaceState().getRacingProcedure() instanceof GateStartRacingProcedure) {
|
||||
multiplier = 2;
|
||||
}
|
||||
int height = container.getMeasuredHeight() + getResources().getDimensionPixelSize(R.dimen.thin_line);
|
||||
int width = container.getMeasuredWidth() * multiplier;
|
||||
RelativeLayout.LayoutParams params = new RelativeLayout.LayoutParams(width, height);
|
||||
params.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM);
|
||||
params.addRule(RelativeLayout.RIGHT_OF, R.id.race_panel_setup);
|
||||
mExtraLayout.setLayoutParams(params);
|
||||
mExtraLayout.setVisibility(View.VISIBLE);
|
||||
transaction.replace(R.id.race_panel_extra, MorePanelFragment.newInstance(getArguments()));
|
||||
break;
|
||||
|
||||
default:
|
||||
ExLog.i(getActivity(), TAG, "Unknown return value");
|
||||
break;
|
||||
default:
|
||||
ExLog.i(getActivity(), TAG, "Unknown return value");
|
||||
break;
|
||||
}
|
||||
}
|
||||
transaction.commit();
|
||||
}
|
||||
transaction.commit();
|
||||
disableToggle(container, markerId);
|
||||
}
|
||||
}
|
||||
|
||||
+5
-3
@@ -5,6 +5,7 @@ import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.support.annotation.IdRes;
|
||||
|
||||
import com.sap.sailing.android.shared.util.AppUtils;
|
||||
import com.sap.sailing.android.shared.util.BroadcastManager;
|
||||
import com.sap.sailing.domain.abstractlog.race.state.ReadonlyRaceState;
|
||||
import com.sap.sailing.domain.abstractlog.race.state.impl.BaseRaceStateChangedListener;
|
||||
@@ -28,16 +29,17 @@ public abstract class BaseRaceInfoRaceFragment<ProcedureType extends RacingProce
|
||||
public BaseRaceInfoRaceFragment() {
|
||||
mRaceStateChangedListener = new RaceStateChangedListener();
|
||||
mProcedureListener = new ProcedureChangedListener();
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onActivityCreated(Bundle savedInstanceState) {
|
||||
super.onActivityCreated(savedInstanceState);
|
||||
|
||||
replaceFragment(SetupPanelFragment.newInstance(getArguments()), R.id.race_panel_setup);
|
||||
replaceFragment(FlagPanelFragment.newInstance(getArguments()), R.id.race_panel_flags);
|
||||
replaceFragment(TimePanelFragment.newInstance(getArguments()), R.id.race_panel_time);
|
||||
if (AppUtils.with(getActivity()).is10inch() && AppUtils.with(getActivity()).isLand()) {
|
||||
replaceFragment(SetupPanelFragment.newInstance(getArguments()), R.id.race_panel_setup);
|
||||
replaceFragment(TimePanelFragment.newInstance(getArguments()), R.id.race_panel_time);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
+2
-6
@@ -80,15 +80,11 @@ public class TrackingListFragment extends BaseFragment
|
||||
mPanels = new ArrayList<>();
|
||||
|
||||
ImageView dot;
|
||||
dot = ViewHelper.get(layout, R.id.panel_1);
|
||||
dot = ViewHelper.get(layout, R.id.dot_1);
|
||||
if (dot != null) {
|
||||
mDots.add(dot);
|
||||
}
|
||||
dot = ViewHelper.get(layout, R.id.panel_2);
|
||||
if (dot != null) {
|
||||
mDots.add(dot);
|
||||
}
|
||||
dot = ViewHelper.get(layout, R.id.panel_3);
|
||||
dot = ViewHelper.get(layout, R.id.dot_2);
|
||||
if (dot != null) {
|
||||
mDots.add(dot);
|
||||
}
|
||||
|
||||
+46
-97
@@ -1,140 +1,89 @@
|
||||
package com.sap.sailing.racecommittee.app.ui.fragments.raceinfo.startphase;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import android.app.Fragment;
|
||||
import android.app.FragmentTransaction;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.os.Bundle;
|
||||
import android.support.v4.view.ViewPager;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.ImageView;
|
||||
|
||||
import com.sap.sailing.android.shared.util.ViewHelper;
|
||||
import com.sap.sailing.domain.abstractlog.race.state.ReadonlyRaceState;
|
||||
import com.sap.sailing.domain.abstractlog.race.state.impl.BaseRaceStateChangedListener;
|
||||
import com.sap.sailing.domain.abstractlog.race.state.racingprocedure.RacingProcedure;
|
||||
import com.sap.sailing.domain.abstractlog.race.state.racingprocedure.gate.GateStartRacingProcedure;
|
||||
import com.sap.sailing.domain.abstractlog.race.state.racingprocedure.rrs26.RRS26RacingProcedure;
|
||||
import com.sap.sailing.racecommittee.app.R;
|
||||
import com.sap.sailing.racecommittee.app.ui.fragments.panels.MorePanelFragment;
|
||||
import com.sap.sailing.racecommittee.app.ui.adapters.PanelsAdapter;
|
||||
import com.sap.sailing.racecommittee.app.ui.fragments.raceinfo.BaseRaceInfoRaceFragment;
|
||||
import com.sap.sailing.racecommittee.app.utils.BitmapHelper;
|
||||
import com.sap.sailing.racecommittee.app.utils.ThemeHelper;
|
||||
|
||||
public abstract class BaseStartphaseRaceFragment<ProcedureType extends RacingProcedure> extends BaseRaceInfoRaceFragment<ProcedureType>
|
||||
implements View.OnClickListener {
|
||||
import java.util.ArrayList;
|
||||
|
||||
private RaceStateListener mStateListener;
|
||||
public abstract class BaseStartphaseRaceFragment<ProcedureType extends RacingProcedure> extends BaseRaceInfoRaceFragment<ProcedureType> {
|
||||
|
||||
@Override
|
||||
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
|
||||
View layout = inflater.inflate(R.layout.race_main, container, false);
|
||||
|
||||
mDots = new ArrayList<>();
|
||||
mPanels = new ArrayList<>();
|
||||
|
||||
mStateListener = new RaceStateListener();
|
||||
|
||||
View panel;
|
||||
panel = ViewHelper.get(layout, R.id.race_panel_time);
|
||||
if (panel != null) {
|
||||
mPanels.add(panel);
|
||||
}
|
||||
panel = ViewHelper.get(layout, R.id.race_panel_setup);
|
||||
if (panel != null) {
|
||||
mPanels.add(panel);
|
||||
}
|
||||
panel = ViewHelper.get(layout, R.id.race_panel_extra);
|
||||
if (panel != null) {
|
||||
mPanels.add(panel);
|
||||
}
|
||||
|
||||
ImageView dot;
|
||||
dot = ViewHelper.get(layout, R.id.panel_1);
|
||||
dot = ViewHelper.get(layout, R.id.dot_1);
|
||||
if (dot != null) {
|
||||
mDots.add(dot);
|
||||
}
|
||||
dot = ViewHelper.get(layout, R.id.panel_2);
|
||||
dot = ViewHelper.get(layout, R.id.dot_2);
|
||||
if (dot != null) {
|
||||
mDots.add(dot);
|
||||
}
|
||||
dot = ViewHelper.get(layout, R.id.panel_3);
|
||||
dot = ViewHelper.get(layout, R.id.dot_3);
|
||||
if (dot != null) {
|
||||
mDots.add(dot);
|
||||
}
|
||||
|
||||
ImageView btnPrev = ViewHelper.get(layout, R.id.nav_prev);
|
||||
if (btnPrev != null) {
|
||||
btnPrev.setOnClickListener(this);
|
||||
}
|
||||
|
||||
ImageView btnNext = ViewHelper.get(layout, R.id.nav_next);
|
||||
if (btnNext != null) {
|
||||
btnNext.setOnClickListener(this);
|
||||
}
|
||||
|
||||
return layout;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onActivityCreated(Bundle savedInstanceState) {
|
||||
super.onActivityCreated(savedInstanceState);
|
||||
|
||||
ViewPager pager = ViewHelper.get(getView(), R.id.panels_pager);
|
||||
if (pager != null) {
|
||||
pager.setAdapter(new PanelsAdapter(getFragmentManager(), getArguments()));
|
||||
pager.addOnPageChangeListener(new ViewPager.OnPageChangeListener() {
|
||||
@Override
|
||||
public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPageSelected(int position) {
|
||||
markDot(position);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPageScrollStateChanged(int state) {
|
||||
|
||||
}
|
||||
});
|
||||
markDot(0);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void setupUi() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onResume() {
|
||||
super.onResume();
|
||||
|
||||
getRaceState().addChangedListener(mStateListener);
|
||||
initMoreButtons();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPause() {
|
||||
super.onPause();
|
||||
|
||||
getRaceState().removeChangedListener(mStateListener);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
switch (v.getId()) {
|
||||
case R.id.nav_prev:
|
||||
viewPanel(MOVE_DOWN);
|
||||
break;
|
||||
|
||||
case R.id.nav_next:
|
||||
viewPanel(MOVE_UP);
|
||||
break;
|
||||
private void markDot(int position) {
|
||||
// tint all dots gray
|
||||
for (ImageView mDot : mDots) {
|
||||
int tint = ThemeHelper.getColor(getActivity(), R.attr.sap_light_gray);
|
||||
Drawable drawable = BitmapHelper.getTintedDrawable(getActivity(), R.drawable.ic_dot, tint);
|
||||
mDot.setImageDrawable(drawable);
|
||||
}
|
||||
}
|
||||
|
||||
private void initMoreButtons() {
|
||||
if (mDots != null && mDots.size() > 0) {
|
||||
if (getRaceState() != null && getRaceState().getRacingProcedure() != null) {
|
||||
RacingProcedure procedure = getRaceState().getRacingProcedure();
|
||||
FragmentTransaction transaction = getFragmentManager().beginTransaction();
|
||||
if (procedure instanceof RRS26RacingProcedure || procedure instanceof GateStartRacingProcedure) {
|
||||
mDots.get(mDots.size() - 1).setVisibility(View.VISIBLE);
|
||||
transaction.replace(R.id.race_panel_extra, MorePanelFragment.newInstance(getArguments()));
|
||||
} else {
|
||||
mDots.get(mDots.size() - 1).setVisibility(View.GONE);
|
||||
Fragment fragment = getFragmentManager().findFragmentById(R.id.race_panel_extra);
|
||||
if (fragment != null) {
|
||||
transaction.remove(fragment);
|
||||
}
|
||||
}
|
||||
transaction.commit();
|
||||
viewPanel(MOVE_NONE);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private class RaceStateListener extends BaseRaceStateChangedListener {
|
||||
|
||||
@Override
|
||||
public void onRacingProcedureChanged(ReadonlyRaceState state) {
|
||||
super.onRacingProcedureChanged(state);
|
||||
|
||||
initMoreButtons();
|
||||
}
|
||||
int tint = ThemeHelper.getColor(getActivity(), R.attr.black);
|
||||
Drawable drawable = BitmapHelper.getTintedDrawable(getActivity(), R.drawable.ic_dot, tint);
|
||||
mDots.get(position).setImageDrawable(drawable);
|
||||
}
|
||||
}
|
||||
|
||||
+7
-1
@@ -26,7 +26,7 @@
|
||||
<!-- redefine in child poms -->
|
||||
<additional-deployment-version-file></additional-deployment-version-file>
|
||||
<app-version></app-version>
|
||||
<android.support.version>22.1.1</android.support.version>
|
||||
<android.support.version>22.2.1</android.support.version>
|
||||
<play.services.version>7.5.0</play.services.version>
|
||||
|
||||
<sign.keystore>../android-keystore/STG-debug.jks</sign.keystore>
|
||||
@@ -55,6 +55,12 @@
|
||||
<version>${android.support.version}</version>
|
||||
<type>aar</type>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.android.support</groupId>
|
||||
<artifactId>support-v13</artifactId>
|
||||
<version>${android.support.version}</version>
|
||||
<type>aar</type>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.android.support</groupId>
|
||||
<artifactId>recyclerview-v7</artifactId>
|
||||
|
||||
Reference in New Issue
Block a user