added linked icon in TimePanelFragment next to the start time
|
After Width: | Height: | Size: 377 B |
|
After Width: | Height: | Size: 398 B |
|
After Width: | Height: | Size: 240 B |
|
After Width: | Height: | Size: 250 B |
|
After Width: | Height: | Size: 445 B |
|
After Width: | Height: | Size: 474 B |
|
After Width: | Height: | Size: 641 B |
|
After Width: | Height: | Size: 691 B |
@@ -1,7 +1,8 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
<RelativeLayout
|
||||
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="?sap_gray">
|
||||
@@ -14,14 +15,14 @@
|
||||
android:gravity="center"
|
||||
android:textColor="?white"
|
||||
android:textSize="@dimen/textSize_40"
|
||||
tools:text="@string/time" />
|
||||
tools:text="@string/time"/>
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/time_marker"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="@dimen/thin_line"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:src="?marker" />
|
||||
android:src="?marker"/>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
@@ -43,19 +44,36 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentEnd="true"
|
||||
android:layout_alignParentRight="true"
|
||||
android:layout_centerVertical="true"
|
||||
android:textAppearance="?textSmall"
|
||||
tools:text="@string/time_start" />
|
||||
tools:text="@string/time_start"/>
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/time_start_lock"
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_marginRight="@dimen/default_margin_half"
|
||||
android:layout_toLeftOf="@+id/time_start"
|
||||
android:layout_toStartOf="@+id/time_start"
|
||||
android:src="?lock_outline"
|
||||
android:visibility="gone" />
|
||||
android:orientation="horizontal">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/time_start_lock"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:src="?lock_outline"
|
||||
android:visibility="gone"
|
||||
tools:visibility="visible"/>
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/linked_race"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:src="?link_24dp"
|
||||
android:visibility="gone"
|
||||
tools:visibility="visible"/>
|
||||
</LinearLayout>
|
||||
</RelativeLayout>
|
||||
|
||||
<RelativeLayout
|
||||
@@ -76,7 +94,8 @@
|
||||
android:gravity="center"
|
||||
android:textAppearance="?textSmall"
|
||||
android:visibility="invisible"
|
||||
tools:text="@string/time" />
|
||||
tools:text="@string/time"
|
||||
tools:visibility="visible"/>
|
||||
</RelativeLayout>
|
||||
|
||||
<RelativeLayout
|
||||
@@ -93,7 +112,8 @@
|
||||
android:layout_alignParentStart="true"
|
||||
android:text="@string/time_finish"
|
||||
android:textAppearance="?textSmall"
|
||||
android:visibility="invisible" />
|
||||
android:visibility="invisible"
|
||||
tools:visibility="visible"/>
|
||||
</RelativeLayout>
|
||||
</LinearLayout>
|
||||
</RelativeLayout>
|
||||
@@ -55,6 +55,7 @@
|
||||
<attr name="dns_48dp" format="reference"/>
|
||||
<attr name="hearing_48dp" format="reference"/>
|
||||
<attr name="link_18dp" format="reference"/>
|
||||
<attr name="link_24dp" format="reference"/>
|
||||
<attr name="lock_outline" format="reference"/>
|
||||
<attr name="marker" format="reference"/>
|
||||
<attr name="marker_race" format="reference"/>
|
||||
|
||||
@@ -70,6 +70,7 @@
|
||||
<item name="dns_48dp">@drawable/ic_dns_white_48dp</item>
|
||||
<item name="hearing_48dp">@drawable/ic_hearing_white_48dp</item>
|
||||
<item name="link_18dp">@drawable/ic_link_white_18dp</item>
|
||||
<item name="link_24dp">@drawable/ic_link_white_24dp</item>
|
||||
<item name="lock_outline">@drawable/lock_outline_dark</item>
|
||||
<item name="marker">@drawable/marker_dark</item>
|
||||
<item name="marker_race">@drawable/marker_race_dark</item>
|
||||
|
||||
@@ -73,6 +73,7 @@
|
||||
<item name="dns_48dp">@drawable/ic_dns_black_48dp</item>
|
||||
<item name="hearing_48dp">@drawable/ic_hearing_black_48dp</item>
|
||||
<item name="link_18dp">@drawable/ic_link_black_18dp</item>
|
||||
<item name="link_24dp">@drawable/ic_link_black_24dp</item>
|
||||
<item name="lock_outline">@drawable/lock_outline_light</item>
|
||||
<item name="marker">@drawable/marker_light</item>
|
||||
<item name="marker_race">@drawable/marker_race_light</item>
|
||||
|
||||
@@ -1,28 +1,36 @@
|
||||
package com.sap.sailing.racecommittee.app.ui.fragments.panels;
|
||||
|
||||
import android.content.*;
|
||||
import java.text.SimpleDateFormat;
|
||||
|
||||
import android.content.BroadcastReceiver;
|
||||
import android.content.Context;
|
||||
import android.content.DialogInterface;
|
||||
import android.content.Intent;
|
||||
import android.content.IntentFilter;
|
||||
import android.os.Bundle;
|
||||
import android.support.v4.content.LocalBroadcastManager;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.sap.sailing.android.shared.logging.ExLog;
|
||||
import com.sap.sailing.android.shared.util.ViewHolder;
|
||||
import com.sap.sailing.domain.abstractlog.race.analyzing.impl.StartTimeFinder;
|
||||
import com.sap.sailing.domain.abstractlog.race.analyzing.impl.StartTimeFinderResult;
|
||||
import com.sap.sailing.domain.abstractlog.race.state.ReadonlyRaceState;
|
||||
import com.sap.sailing.domain.abstractlog.race.state.impl.BaseRaceStateChangedListener;
|
||||
import com.sap.sailing.racecommittee.app.AppConstants;
|
||||
import com.sap.sailing.racecommittee.app.R;
|
||||
import com.sap.sailing.racecommittee.app.data.AndroidRaceLogResolver;
|
||||
import com.sap.sailing.racecommittee.app.ui.fragments.raceinfo.StartTimeFragment;
|
||||
import com.sap.sailing.racecommittee.app.utils.TickListener;
|
||||
import com.sap.sailing.racecommittee.app.utils.TickSingleton;
|
||||
import com.sap.sailing.racecommittee.app.utils.TimeUtils;
|
||||
import com.sap.sse.common.TimePoint;
|
||||
import com.sap.sse.common.impl.MillisecondsTimePoint;
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
|
||||
public class TimePanelFragment extends BasePanelFragment implements TickListener {
|
||||
public class TimePanelFragment extends BasePanelFragment {
|
||||
|
||||
public final static String TOGGLED = "toggled";
|
||||
|
||||
@@ -36,6 +44,8 @@ public class TimePanelFragment extends BasePanelFragment implements TickListener
|
||||
private TextView mHeaderTime;
|
||||
private TextView mTimeStart;
|
||||
private TextView mTimeFinish;
|
||||
private ImageView mLinkIcon;
|
||||
private Boolean mLinkedRace = null;
|
||||
|
||||
public TimePanelFragment() {
|
||||
mReceiver = new IntentReceiver();
|
||||
@@ -64,6 +74,8 @@ public class TimePanelFragment extends BasePanelFragment implements TickListener
|
||||
mTimeFinish = ViewHolder.get(layout, R.id.time_finish);
|
||||
mHeaderTime = ViewHolder.get(layout, R.id.timer_text);
|
||||
mTimeStart = ViewHolder.get(layout, R.id.time_start);
|
||||
mLinkIcon = ViewHolder.get(layout, R.id.linked_race);
|
||||
|
||||
if (getArguments().getBoolean(TOGGLED, false)) {
|
||||
toggleMarker(layout, R.id.time_marker);
|
||||
}
|
||||
@@ -75,7 +87,6 @@ public class TimePanelFragment extends BasePanelFragment implements TickListener
|
||||
public void onResume() {
|
||||
super.onResume();
|
||||
|
||||
TickSingleton.INSTANCE.registerListener(this);
|
||||
notifyTick(MillisecondsTimePoint.now());
|
||||
checkStatus();
|
||||
|
||||
@@ -111,8 +122,12 @@ public class TimePanelFragment extends BasePanelFragment implements TickListener
|
||||
if (getRace() != null && getRace().getState() != null) {
|
||||
TimePoint startTime = getRace().getState().getStartTime();
|
||||
|
||||
if (mTimeStart != null && startTime != null) {
|
||||
mTimeStart.setText(getString(R.string.time_start, dateFormat.format(startTime.asDate())));
|
||||
if (mTimeStart != null) {
|
||||
if (startTime != null) {
|
||||
mTimeStart.setText(getString(R.string.time_start, dateFormat.format(startTime.asDate())));
|
||||
} else {
|
||||
mTimeStart.setText(getString(R.string.time_start, "N/A"));
|
||||
}
|
||||
}
|
||||
|
||||
if (mTimeFinish != null) {
|
||||
@@ -132,6 +147,18 @@ public class TimePanelFragment extends BasePanelFragment implements TickListener
|
||||
mHeaderTime.setText(getString(resId, time));
|
||||
}
|
||||
}
|
||||
|
||||
if (mLinkedRace == null) {
|
||||
StartTimeFinder stf = new StartTimeFinder(new AndroidRaceLogResolver(), getRace().getRaceLog());
|
||||
StartTimeFinderResult result = stf.analyze();
|
||||
if (result != null) {
|
||||
mLinkedRace = result.isDependentStartTime();
|
||||
}
|
||||
}
|
||||
|
||||
if (mLinkedRace != null && mLinkIcon != null) {
|
||||
mLinkIcon.setVisibility(mLinkedRace ? View.VISIBLE : View.GONE);
|
||||
}
|
||||
}
|
||||
|
||||
private void uncheckMarker(View view) {
|
||||
@@ -252,5 +279,12 @@ public class TimePanelFragment extends BasePanelFragment implements TickListener
|
||||
checkStatus();
|
||||
uncheckMarker(mView);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStartTimeChanged(ReadonlyRaceState state) {
|
||||
super.onStartTimeChanged(state);
|
||||
|
||||
mLinkedRace = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||