show competitor panel button next to time panel

This commit is contained in:
Peter Siegmund
2017-03-08 09:45:33 +01:00
parent c2240c0e13
commit db6748d413
38 changed files with 338 additions and 200 deletions
Binary file not shown.

After

Width:  |  Height:  |  Size: 126 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 138 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 126 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 138 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 205 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 126 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 205 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 126 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 217 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 141 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 217 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 141 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 141 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 169 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 141 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 169 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 239 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 200 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 239 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 200 B

@@ -1,6 +1,6 @@
<?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:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent">
@@ -11,6 +11,17 @@
android:layout_height="match_parent"
android:background="?attr/sap_gray">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal">
<RelativeLayout
android:id="@+id/time_layer"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="25">
<TextView
android:id="@+id/timer_text"
android:layout_width="match_parent"
@@ -104,7 +115,21 @@
android:visibility="invisible"
tools:text="@string/time"
tools:visibility="visible" />
</RelativeLayout>
</RelativeLayout>
</RelativeLayout>
<com.sap.sailing.racecommittee.app.ui.views.PanelButton
android:id="@+id/button_competitor"
android:layout_width="0dp"
android:layout_weight="10"
android:layout_height="match_parent"
app:buttonCaption="@string/competitor_list"
app:buttonImage="?attr/competitor_list"
app:buttonType="typeImage"
app:captionPosition="bottom"
app:linePosition="left" />
</LinearLayout>
</com.sap.sailing.racecommittee.app.ui.layouts.TimePanelHeaderLayout>
</RelativeLayout>
@@ -1,12 +1,26 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent">
<com.sap.sailing.racecommittee.app.ui.layouts.TimePanelHeaderLayout
android:id="@+id/race_content_header"
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:background="?attr/sap_gray">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal">
<RelativeLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="3">
<TextView
android:id="@+id/timer_text"
android:layout_width="match_parent"
@@ -29,9 +43,8 @@
android:layout_height="wrap_content"
android:layout_above="@id/time_marker"
android:layout_centerHorizontal="true"
android:baselineAligned="false"
android:layout_marginBottom="@dimen/side_padding">
android:layout_marginBottom="@dimen/side_padding"
android:baselineAligned="false">
<RelativeLayout
android:id="@+id/start_time_container"
@@ -44,8 +57,8 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:textAppearance="?attr/textSmall"
android:layout_toRightOf="@+id/linked_locked_area"
android:textAppearance="?attr/textSmall"
tools:text="@string/time_start" />
<LinearLayout
@@ -78,9 +91,9 @@
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_toRightOf="@+id/start_time_container"
android:layout_centerVertical="true"
android:layout_marginLeft="@dimen/side_padding"
android:layout_centerVertical="true">
android:layout_toRightOf="@+id/start_time_container">
<TextView
android:id="@+id/current_time"
@@ -96,6 +109,19 @@
tools:text="@string/time"
tools:visibility="visible" />
</RelativeLayout>
</RelativeLayout>
</RelativeLayout>
<com.sap.sailing.racecommittee.app.ui.views.PanelButton
android:id="@+id/button_competitor"
android:layout_width="0dp"
android:layout_weight="1"
android:layout_height="match_parent"
app:buttonCaption="@string/competitor_list"
app:buttonImage="?attr/competitor_list"
app:buttonType="typeImage"
app:captionPosition="bottom"
app:linePosition="left" />
</LinearLayout>
</com.sap.sailing.racecommittee.app.ui.layouts.TimePanelHeaderLayout>
</RelativeLayout>
@@ -517,5 +517,6 @@
<string name="set_factor_error">Beim Setzen des Faktors ist ein Fehler aufgetreten: %s</string>
<string name="sync_to_minute">Sync zur Minute</string>
<string name="non_public_changed_title">Nicht öffentliche Events</string>
<string name="competitor_list">Teilnehmerliste</string>
</resources>
@@ -4,6 +4,7 @@
<style name="AppTheme.Dark.Custom" parent="Theme.AppCompat.NoActionBar">
<item name="chevron_left">@drawable/ic_chevron_left_white_36dp</item>
<item name="chevron_right">@drawable/ic_chevron_right_white_36dp</item>
<item name="competitor_list">@drawable/ic_competitor_list_white_48dp</item>
<item name="flag_blue_first">@drawable/flag_blue_first_32dp_dark</item>
<item name="flag_blue_last">@drawable/flag_blue_last_32dp_dark</item>
@@ -4,6 +4,7 @@
<style name="AppTheme.Light.Custom" parent="Theme.AppCompat.NoActionBar">
<item name="chevron_left">@drawable/ic_chevron_left_black_36dp</item>
<item name="chevron_right">@drawable/ic_chevron_right_black_36dp</item>
<item name="competitor_list">@drawable/ic_competitor_list_black_48dp</item>
<item name="flag_blue_first">@drawable/flag_blue_first_32dp_light</item>
<item name="flag_blue_last">@drawable/flag_blue_last_32dp_light</item>
@@ -4,6 +4,7 @@
<style name="AppTheme.Dark.Custom" parent="Theme.AppCompat.NoActionBar">
<item name="chevron_left">@drawable/ic_chevron_left_white_36dp</item>
<item name="chevron_right">@drawable/ic_chevron_right_white_36dp</item>
<item name="competitor_list">@drawable/ic_competitor_list_white_48dp</item>
<item name="flag_blue_first">@drawable/flag_blue_first_48dp_dark</item>
<item name="flag_blue_last">@drawable/flag_blue_last_48dp_dark</item>
@@ -4,6 +4,7 @@
<style name="AppTheme.Light.Custom" parent="Theme.AppCompat.NoActionBar">
<item name="chevron_left">@drawable/ic_chevron_left_black_36dp</item>
<item name="chevron_right">@drawable/ic_chevron_right_black_36dp</item>
<item name="competitor_list">@drawable/ic_competitor_list_black_48dp</item>
<item name="flag_blue_first">@drawable/flag_blue_first_48dp_light</item>
<item name="flag_blue_last">@drawable/flag_blue_last_48dp_light</item>
@@ -64,6 +64,7 @@
<attr name="create" format="reference"/>
<attr name="compass_back" format="reference"/>
<attr name="compass_needle" format="reference"/>
<attr name="competitor_list" format="reference"/>
<attr name="course_triangle_48dp" format="reference"/>
<attr name="course_triangle_64dp" format="reference"/>
<attr name="course_updown_48dp" format="reference"/>
@@ -545,5 +545,6 @@
<string name="set_factor_error">There was an error while setting the factor: %s</string>
<string name="sync_to_minute">Sync to minute</string>
<string name="non_public_changed_title">Non-Public Events</string>
<string name="competitor_list">Competitor List</string>
</resources>
@@ -109,6 +109,7 @@
<style name="AppTheme.Dark.Custom" parent="Theme.AppCompat.NoActionBar">
<item name="chevron_left">@drawable/ic_chevron_left_white_24dp</item>
<item name="chevron_right">@drawable/ic_chevron_right_white_24dp</item>
<item name="competitor_list">@drawable/ic_competitor_list_white_32dp</item>
<item name="flag_blue_first">@drawable/flag_blue_first_32dp_dark</item>
<item name="flag_blue_last">@drawable/flag_blue_last_32dp_dark</item>
@@ -118,6 +118,7 @@
<style name="AppTheme.Light.Custom" parent="Theme.AppCompat.NoActionBar">
<item name="chevron_left">@drawable/ic_chevron_left_black_24dp</item>
<item name="chevron_right">@drawable/ic_chevron_right_black_24dp</item>
<item name="competitor_list">@drawable/ic_competitor_list_black_32dp</item>
<item name="flag_blue_first">@drawable/flag_blue_first_32dp_light</item>
<item name="flag_blue_last">@drawable/flag_blue_last_32dp_light</item>
@@ -56,6 +56,7 @@ public class AppConstants {
public final static String INTENT_ACTION_TOGGLE_RECALL = "recall";
public final static String INTENT_ACTION_TOGGLE_BLUE_FIRST = "more";
public final static String INTENT_ACTION_TOGGLE_BLUE_LAST = "blue_last";
public final static String INTENT_ACTION_TOGGLE_COMPETITOR = "competitor";
public final static String INTENT_ACTION_TOGGLE_REPLAY = "replay";
public final static String INTENT_ACTION_TOGGLE_PHOTOS = "photos";
@@ -29,6 +29,7 @@ import com.sap.sailing.racecommittee.app.data.DataManager;
import com.sap.sailing.racecommittee.app.domain.ManagedRace;
import com.sap.sailing.racecommittee.app.ui.fragments.raceinfo.StartTimeFragment;
import com.sap.sailing.racecommittee.app.ui.layouts.TimePanelHeaderLayout;
import com.sap.sailing.racecommittee.app.ui.views.PanelButton;
import com.sap.sailing.racecommittee.app.utils.RaceHelper;
import com.sap.sailing.racecommittee.app.utils.TickSingleton;
import com.sap.sailing.racecommittee.app.utils.TimeUtils;
@@ -45,6 +46,8 @@ public class TimePanelFragment extends BasePanelFragment {
private SimpleDateFormat dateFormat;
private TimePanelHeaderLayout mRaceHeader;
private PanelButton mCompetitorList;
private View mTimeLock;
private TextView mCurrentTime;
private TextView mHeaderTime;
@@ -77,6 +80,9 @@ public class TimePanelFragment extends BasePanelFragment {
}
});
mCompetitorList = ViewHelper.get(layout, R.id.button_competitor);
mCompetitorList.setListener(new CompetitorPanelClick());
mTimeLock = ViewHelper.get(layout, R.id.time_start_lock);
mCurrentTime = ViewHelper.get(layout, R.id.current_time);
mHeaderTime = ViewHelper.get(layout, R.id.timer_text);
@@ -172,10 +178,14 @@ public class TimePanelFragment extends BasePanelFragment {
private void uncheckMarker(View view) {
if (isAdded() && view != null) {
if (!view.equals(mRaceHeader)) {
if (!view.equals(mRaceHeader) && !isNormal(mRaceHeader, R.id.time_marker)) {
resetFragment(mTimeLock, getFrameId(getActivity(), R.id.race_edit, R.id.race_content, false), StartTimeFragment.class);
setMarkerLevel(mRaceHeader, R.id.time_marker, LEVEL_NORMAL);
}
if (!view.equals(mCompetitorList)) {
resetFragment(mCompetitorList.isLocked(), getFrameId(getActivity(), R.id.race_edit, R.id.race_content, false), StartTimeFragment.class);
mCompetitorList.setMarkerLevel(PanelButton.LEVEL_NORMAL);
}
}
}
@@ -215,6 +225,30 @@ public class TimePanelFragment extends BasePanelFragment {
}
}
private class RaceStateChangedListener extends BaseRaceStateChangedListener {
private View mView;
public RaceStateChangedListener() {
mView = new View(getActivity());
}
@Override
public void onStatusChanged(ReadonlyRaceState state) {
super.onStatusChanged(state);
checkStatus();
uncheckMarker(mView);
}
@Override
public void onStartTimeChanged(ReadonlyRaceState state) {
super.onStartTimeChanged(state);
mLinkedRace = null;
}
}
private class RaceHeaderClick implements View.OnClickListener, DialogInterface.OnClickListener {
private final String TAG = RaceHeaderClick.class.getName();
@@ -255,6 +289,35 @@ public class TimePanelFragment extends BasePanelFragment {
}
}
private class CompetitorPanelClick implements PanelButton.PanelButtonClick {
private final String TAG = CompetitorPanelClick.class.getName();
@Override
public void onClick(PanelButton view) {
sendIntent(AppConstants.INTENT_ACTION_TOGGLE, AppConstants.INTENT_ACTION_EXTRA, AppConstants.INTENT_ACTION_TOGGLE_COMPETITOR);
switch (view.toggleMarker()) {
case PanelButton.LEVEL_NORMAL:
sendIntent(AppConstants.INTENT_ACTION_SHOW_MAIN_CONTENT);
break;
case PanelButton.LEVEL_TOGGLED:
replaceFragment(StartTimeFragment.newInstance(StartTimeFragment.MODE_TIME_PANEL));
break;
default:
ExLog.i(getActivity(), TAG, "Unknown return value");
break;
}
view.disableToggle();
}
@Override
public void onChangedSwitch(PanelButton view, boolean isChecked) {
// no-op
}
}
private class IntentReceiver extends BroadcastReceiver {
@Override
@@ -270,6 +333,8 @@ public class TimePanelFragment extends BasePanelFragment {
String data = intent.getExtras().getString(AppConstants.INTENT_ACTION_EXTRA);
if (AppConstants.INTENT_ACTION_TOGGLE_TIME.equals(data)) {
uncheckMarker(mRaceHeader);
} else if (AppConstants.INTENT_ACTION_TOGGLE_COMPETITOR.equals(data)) {
uncheckMarker(mCompetitorList);
} else {
uncheckMarker(view);
}
@@ -289,28 +354,4 @@ public class TimePanelFragment extends BasePanelFragment {
}
}
}
private class RaceStateChangedListener extends BaseRaceStateChangedListener {
private View mView;
public RaceStateChangedListener() {
mView = new View(getActivity());
}
@Override
public void onStatusChanged(ReadonlyRaceState state) {
super.onStatusChanged(state);
checkStatus();
uncheckMarker(mView);
}
@Override
public void onStartTimeChanged(ReadonlyRaceState state) {
super.onStartTimeChanged(state);
mLinkedRace = null;
}
}
}
@@ -3,11 +3,11 @@ package com.sap.sailing.racecommittee.app.ui.layouts;
import android.content.Context;
import android.util.AttributeSet;
import android.view.MotionEvent;
import android.widget.RelativeLayout;
import android.widget.FrameLayout;
import com.sap.sailing.racecommittee.app.ui.utils.TouchEventListener;
public class TimePanelHeaderLayout extends RelativeLayout {
public class TimePanelHeaderLayout extends FrameLayout {
private TouchEventListener mTouchEventListener;
@@ -0,0 +1,9 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="32dp"
android:height="32dp"
android:viewportHeight="24.0"
android:viewportWidth="24.0">
<path
android:fillColor="#FF000000"
android:pathData="M3,13h2v-2L3,11v2zM3,17h2v-2L3,15v2zM3,9h2L5,7L3,7v2zM7,13h14v-2L7,11v2zM7,17h14v-2L7,15v2zM7,7v2h14L21,7L7,7z" />
</vector>
@@ -0,0 +1,9 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="48dp"
android:height="48dp"
android:viewportHeight="24.0"
android:viewportWidth="24.0">
<path
android:fillColor="#FF000000"
android:pathData="M3,13h2v-2L3,11v2zM3,17h2v-2L3,15v2zM3,9h2L5,7L3,7v2zM7,13h14v-2L7,11v2zM7,17h14v-2L7,15v2zM7,7v2h14L21,7L7,7z" />
</vector>
@@ -0,0 +1,9 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="32dp"
android:height="32dp"
android:viewportHeight="24.0"
android:viewportWidth="24.0">
<path
android:fillColor="#FFFFFFFF"
android:pathData="M3,13h2v-2L3,11v2zM3,17h2v-2L3,15v2zM3,9h2L5,7L3,7v2zM7,13h14v-2L7,11v2zM7,17h14v-2L7,15v2zM7,7v2h14L21,7L7,7z" />
</vector>
@@ -0,0 +1,9 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="48dp"
android:height="48dp"
android:viewportHeight="24.0"
android:viewportWidth="24.0">
<path
android:fillColor="#FFFFFFFF"
android:pathData="M3,13h2v-2L3,11v2zM3,17h2v-2L3,15v2zM3,9h2L5,7L3,7v2zM7,13h14v-2L7,11v2zM7,17h14v-2L7,15v2zM7,7v2h14L21,7L7,7z" />
</vector>