Fix size and displaying timespan or distance

This commit is contained in:
PavelRatushny 2017-07-06 11:20:50 +03:00
parent fd86d10067
commit 70fc627f2d
4 changed files with 49 additions and 38 deletions

View file

@ -38,7 +38,7 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:textColor="?android:attr/textColorPrimary" android:textColor="?android:attr/textColorPrimary"
osmand:typeface="@string/font_roboto_medium" osmand:typeface="@string/font_roboto_medium"
android:textSize="@dimen/default_desc_text_size" android:textSize="@dimen/default_split_segments_overview"
tools:text="Overview"/> tools:text="Overview"/>
<TextView <TextView
@ -50,7 +50,7 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:textColor="?android:attr/textColorSecondary" android:textColor="?android:attr/textColorSecondary"
android:textSize="@dimen/default_sub_text_size"/> android:textSize="@dimen/default_split_segments_overview"/>
</LinearLayout> </LinearLayout>
@ -94,7 +94,7 @@
tools:text="40 km" tools:text="40 km"
android:textColor="?android:attr/textColorPrimary" android:textColor="?android:attr/textColorPrimary"
osmand:typeface="@string/font_roboto_medium" osmand:typeface="@string/font_roboto_medium"
android:textSize="@dimen/default_desc_text_size"/> android:textSize="@dimen/default_split_segments_data"/>
<TextView <TextView
android:id="@+id/distance_or_time_span_text" android:id="@+id/distance_or_time_span_text"
@ -104,7 +104,7 @@
android:layout_marginTop="3dp" android:layout_marginTop="3dp"
tools:text="@string/distance" tools:text="@string/distance"
android:textColor="?android:attr/textColorSecondary" android:textColor="?android:attr/textColorSecondary"
android:textSize="@dimen/default_sub_text_size"/> android:textSize="@dimen/default_split_segments_sub"/>
</LinearLayout> </LinearLayout>
@ -137,7 +137,7 @@
tools:text="15:24:58" tools:text="15:24:58"
android:textColor="?android:attr/textColorPrimary" android:textColor="?android:attr/textColorPrimary"
osmand:typeface="@string/font_roboto_medium" osmand:typeface="@string/font_roboto_medium"
android:textSize="@dimen/default_desc_text_size"/> android:textSize="@dimen/default_split_segments_data"/>
<TextView <TextView
android:id="@+id/start_date_value" android:id="@+id/start_date_value"
@ -147,7 +147,7 @@
android:layout_marginTop="3dp" android:layout_marginTop="3dp"
tools:text="Aud 8, 2016" tools:text="Aud 8, 2016"
android:textColor="?android:attr/textColorSecondary" android:textColor="?android:attr/textColorSecondary"
android:textSize="@dimen/default_sub_text_size"/> android:textSize="@dimen/default_split_segments_sub"/>
</LinearLayout> </LinearLayout>
@ -179,7 +179,7 @@
tools:text="15:34:58" tools:text="15:34:58"
android:textColor="?android:attr/textColorPrimary" android:textColor="?android:attr/textColorPrimary"
osmand:typeface="@string/font_roboto_medium" osmand:typeface="@string/font_roboto_medium"
android:textSize="@dimen/default_desc_text_size"/> android:textSize="@dimen/default_split_segments_data"/>
<TextView <TextView
android:id="@+id/end_date_value" android:id="@+id/end_date_value"
@ -189,7 +189,7 @@
android:layout_marginTop="3dp" android:layout_marginTop="3dp"
tools:text="Aug 8, 2016" tools:text="Aug 8, 2016"
android:textColor="?android:attr/textColorSecondary" android:textColor="?android:attr/textColorSecondary"
android:textSize="@dimen/default_sub_text_size"/> android:textSize="@dimen/default_split_segments_sub"/>
</LinearLayout> </LinearLayout>
@ -239,7 +239,7 @@
tools:text="25 000 m" tools:text="25 000 m"
android:textColor="?android:attr/textColorPrimary" android:textColor="?android:attr/textColorPrimary"
osmand:typeface="@string/font_roboto_medium" osmand:typeface="@string/font_roboto_medium"
android:textSize="@dimen/default_desc_text_size"/> android:textSize="@dimen/default_split_segments_data"/>
<TextView <TextView
android:layout_width="match_parent" android:layout_width="match_parent"
@ -248,7 +248,7 @@
android:layout_marginTop="3dp" android:layout_marginTop="3dp"
android:text="@string/average" android:text="@string/average"
android:textColor="?android:attr/textColorSecondary" android:textColor="?android:attr/textColorSecondary"
android:textSize="@dimen/default_sub_text_size"/> android:textSize="@dimen/default_split_segments_sub"/>
</LinearLayout> </LinearLayout>
@ -281,7 +281,7 @@
tools:text="1/2335 m" tools:text="1/2335 m"
android:textColor="?android:attr/textColorPrimary" android:textColor="?android:attr/textColorPrimary"
osmand:typeface="@string/font_roboto_medium" osmand:typeface="@string/font_roboto_medium"
android:textSize="@dimen/default_desc_text_size"/> android:textSize="@dimen/default_split_segments_data"/>
<net.osmand.plus.widgets.TextViewEx <net.osmand.plus.widgets.TextViewEx
android:id="@+id/min_altitude_value" android:id="@+id/min_altitude_value"
@ -291,7 +291,7 @@
tools:text="1 m" tools:text="1 m"
android:textColor="?android:attr/textColorPrimary" android:textColor="?android:attr/textColorPrimary"
osmand:typeface="@string/font_roboto_medium" osmand:typeface="@string/font_roboto_medium"
android:textSize="@dimen/default_desc_text_size"/> android:textSize="@dimen/default_split_segments_data"/>
<net.osmand.plus.widgets.TextViewEx <net.osmand.plus.widgets.TextViewEx
android:id="@+id/max_altitude_value" android:id="@+id/max_altitude_value"
@ -301,7 +301,7 @@
tools:text="2335 m" tools:text="2335 m"
android:textColor="?android:attr/textColorPrimary" android:textColor="?android:attr/textColorPrimary"
osmand:typeface="@string/font_roboto_medium" osmand:typeface="@string/font_roboto_medium"
android:textSize="@dimen/default_desc_text_size"/> android:textSize="@dimen/default_split_segments_data"/>
<TextView <TextView
android:id="@+id/textView4" android:id="@+id/textView4"
@ -311,7 +311,7 @@
android:background="@null" android:background="@null"
android:text="@string/range" android:text="@string/range"
android:textColor="?android:attr/textColorSecondary" android:textColor="?android:attr/textColorSecondary"
android:textSize="@dimen/default_sub_text_size" /> android:textSize="@dimen/default_split_segments_sub" />
</LinearLayout> </LinearLayout>
@ -343,7 +343,7 @@
tools:text="6280/6285 m" tools:text="6280/6285 m"
android:textColor="?android:attr/textColorPrimary" android:textColor="?android:attr/textColorPrimary"
osmand:typeface="@string/font_roboto_medium" osmand:typeface="@string/font_roboto_medium"
android:textSize="@dimen/default_desc_text_size"/> android:textSize="@dimen/default_split_segments_data"/>
<net.osmand.plus.widgets.TextViewEx <net.osmand.plus.widgets.TextViewEx
android:id="@+id/ascent_value" android:id="@+id/ascent_value"
@ -353,7 +353,7 @@
tools:text="6280 m" tools:text="6280 m"
android:textColor="?android:attr/textColorPrimary" android:textColor="?android:attr/textColorPrimary"
osmand:typeface="@string/font_roboto_medium" osmand:typeface="@string/font_roboto_medium"
android:textSize="@dimen/default_desc_text_size"/> android:textSize="@dimen/default_split_segments_data"/>
<net.osmand.plus.widgets.TextViewEx <net.osmand.plus.widgets.TextViewEx
android:id="@+id/descent_value" android:id="@+id/descent_value"
@ -363,7 +363,7 @@
tools:text="6285 m" tools:text="6285 m"
android:textColor="?android:attr/textColorPrimary" android:textColor="?android:attr/textColorPrimary"
osmand:typeface="@string/font_roboto_medium" osmand:typeface="@string/font_roboto_medium"
android:textSize="@dimen/default_desc_text_size"/> android:textSize="@dimen/default_split_segments_data"/>
<TextView <TextView
android:layout_width="match_parent" android:layout_width="match_parent"
@ -372,7 +372,7 @@
android:layout_marginTop="3dp" android:layout_marginTop="3dp"
android:text="@string/ascent_descent" android:text="@string/ascent_descent"
android:textColor="?android:attr/textColorSecondary" android:textColor="?android:attr/textColorSecondary"
android:textSize="@dimen/default_sub_text_size"/> android:textSize="@dimen/default_split_segments_sub"/>
</LinearLayout> </LinearLayout>
@ -422,7 +422,7 @@
tools:text="3:20:12" tools:text="3:20:12"
android:textColor="?android:attr/textColorPrimary" android:textColor="?android:attr/textColorPrimary"
osmand:typeface="@string/font_roboto_medium" osmand:typeface="@string/font_roboto_medium"
android:textSize="@dimen/default_desc_text_size"/> android:textSize="@dimen/default_split_segments_data"/>
<TextView <TextView
android:layout_width="match_parent" android:layout_width="match_parent"
@ -431,7 +431,7 @@
android:layout_marginTop="3dp" android:layout_marginTop="3dp"
android:text="@string/moving_time" android:text="@string/moving_time"
android:textColor="?android:attr/textColorSecondary" android:textColor="?android:attr/textColorSecondary"
android:textSize="@dimen/default_sub_text_size"/> android:textSize="@dimen/default_split_segments_sub"/>
</LinearLayout> </LinearLayout>
@ -464,7 +464,7 @@
tools:text="11.1 km/h" tools:text="11.1 km/h"
android:textColor="?android:attr/textColorPrimary" android:textColor="?android:attr/textColorPrimary"
osmand:typeface="@string/font_roboto_medium" osmand:typeface="@string/font_roboto_medium"
android:textSize="@dimen/default_desc_text_size"/> android:textSize="@dimen/default_split_segments_data"/>
<TextView <TextView
android:layout_width="match_parent" android:layout_width="match_parent"
@ -473,7 +473,7 @@
android:layout_marginTop="3dp" android:layout_marginTop="3dp"
android:text="@string/average" android:text="@string/average"
android:textColor="?android:attr/textColorSecondary" android:textColor="?android:attr/textColorSecondary"
android:textSize="@dimen/default_sub_text_size"/> android:textSize="@dimen/default_split_segments_sub"/>
</LinearLayout> </LinearLayout>
@ -505,7 +505,7 @@
tools:text="93/2 kmg/h" tools:text="93/2 kmg/h"
android:textColor="?android:attr/textColorPrimary" android:textColor="?android:attr/textColorPrimary"
osmand:typeface="@string/font_roboto_medium" osmand:typeface="@string/font_roboto_medium"
android:textSize="@dimen/default_desc_text_size"/> android:textSize="@dimen/default_split_segments_data"/>
<net.osmand.plus.widgets.TextViewEx <net.osmand.plus.widgets.TextViewEx
android:id="@+id/max_speed_value" android:id="@+id/max_speed_value"
@ -515,7 +515,7 @@
tools:text="93 kmg/h" tools:text="93 kmg/h"
android:textColor="?android:attr/textColorPrimary" android:textColor="?android:attr/textColorPrimary"
osmand:typeface="@string/font_roboto_medium" osmand:typeface="@string/font_roboto_medium"
android:textSize="@dimen/default_desc_text_size"/> android:textSize="@dimen/default_split_segments_data"/>
<net.osmand.plus.widgets.TextViewEx <net.osmand.plus.widgets.TextViewEx
android:id="@+id/min_speed_value" android:id="@+id/min_speed_value"
@ -525,7 +525,7 @@
tools:text="2 kmg/h" tools:text="2 kmg/h"
android:textColor="?android:attr/textColorPrimary" android:textColor="?android:attr/textColorPrimary"
osmand:typeface="@string/font_roboto_medium" osmand:typeface="@string/font_roboto_medium"
android:textSize="@dimen/default_desc_text_size"/> android:textSize="@dimen/default_split_segments_data"/>
<TextView <TextView
android:id="@+id/max_min_speed_text" android:id="@+id/max_min_speed_text"
@ -535,7 +535,7 @@
android:layout_marginTop="3dp" android:layout_marginTop="3dp"
android:text="@string/max_min" android:text="@string/max_min"
android:textColor="?android:attr/textColorSecondary" android:textColor="?android:attr/textColorSecondary"
android:textSize="@dimen/default_sub_text_size"/> android:textSize="@dimen/default_split_segments_sub"/>
</LinearLayout> </LinearLayout>

View file

@ -74,5 +74,9 @@
<dimen name="default_desc_text_size">16sp</dimen> <dimen name="default_desc_text_size">16sp</dimen>
<dimen name="default_sub_text_size">14sp</dimen> <dimen name="default_sub_text_size">14sp</dimen>
<dimen name="welcome_header_text_size">27sp</dimen> <dimen name="welcome_header_text_size">27sp</dimen>
<dimen name="default_split_segments_overview">14sp</dimen>
<dimen name="default_split_segments_data">14sp</dimen>
<dimen name="default_split_segments_sub">11sp</dimen>
</resources> </resources>

View file

@ -134,5 +134,9 @@
<dimen name="default_sub_text_size">12sp</dimen> <dimen name="default_sub_text_size">12sp</dimen>
<dimen name="welcome_header_text_size">23sp</dimen> <dimen name="welcome_header_text_size">23sp</dimen>
<dimen name="default_split_segments_overview">12sp</dimen>
<dimen name="default_split_segments_data">12sp</dimen>
<dimen name="default_split_segments_sub">9sp</dimen>
<dimen name="dialog_header_text_size">20sp</dimen> <dimen name="dialog_header_text_size">20sp</dimen>
</resources> </resources>

View file

@ -91,7 +91,7 @@ public class SplitSegmentFragment extends OsmAndListFragment {
adapter = new SplitSegmentsAdapter(new ArrayList<GpxDisplayItem>()); adapter = new SplitSegmentsAdapter(new ArrayList<GpxDisplayItem>());
headerView = getActivity().getLayoutInflater().inflate(R.layout.gpx_split_segments_header, null, false); headerView = getActivity().getLayoutInflater().inflate(R.layout.gpx_split_segments_header, null, false);
((ImageView) headerView.findViewById(R.id.header_split_image)).setImageDrawable(ic.getIcon(R.drawable.ic_action_split_interval, app.getSettings().isLightContent() ? R.color.gpx_split_segment_icon_color : 0)); ((ImageView) headerView.findViewById(R.id.header_split_image)).setImageDrawable(ic.getIcon(R.drawable.ic_action_split_interval, app.getSettings().isLightContent() ? R.color.icon_color : 0));
listView.addHeaderView(headerView); listView.addHeaderView(headerView);
listView.addFooterView(getActivity().getLayoutInflater().inflate(R.layout.list_shadow_footer, null, false)); listView.addFooterView(getActivity().getLayoutInflater().inflate(R.layout.list_shadow_footer, null, false));
@ -379,12 +379,6 @@ public class SplitSegmentFragment extends OsmAndListFragment {
} }
} }
ImageView distanceOrTimeSpanImageView = ((ImageView) convertView.findViewById(R.id.distance_or_timespan_image));
if (position == 0) {
distanceOrTimeSpanImageView.setImageDrawable(ic.getIcon(R.drawable.ic_action_track_16, app.getSettings().isLightContent() ? R.color.gpx_split_segment_icon_color : 0));
} else {
distanceOrTimeSpanImageView.setImageDrawable(ic.getIcon(R.drawable.ic_action_time_span_16, app.getSettings().isLightContent() ? R.color.gpx_split_segment_icon_color : 0));
}
((ImageView) convertView.findViewById(R.id.start_time_image)) ((ImageView) convertView.findViewById(R.id.start_time_image))
.setImageDrawable(ic.getIcon(R.drawable.ic_action_time_start_16, app.getSettings().isLightContent() ? R.color.gpx_split_segment_icon_color : 0)); .setImageDrawable(ic.getIcon(R.drawable.ic_action_time_start_16, app.getSettings().isLightContent() ? R.color.gpx_split_segment_icon_color : 0));
((ImageView) convertView.findViewById(R.id.end_time_image)) ((ImageView) convertView.findViewById(R.id.end_time_image))
@ -405,18 +399,27 @@ public class SplitSegmentFragment extends OsmAndListFragment {
if (currentGpxDisplayItem != null) { if (currentGpxDisplayItem != null) {
GPXTrackAnalysis analysis = currentGpxDisplayItem.analysis; GPXTrackAnalysis analysis = currentGpxDisplayItem.analysis;
if (analysis != null) { if (analysis != null) {
ImageView distanceOrTimeSpanImageView = ((ImageView) convertView.findViewById(R.id.distance_or_timespan_image));
TextView distanceOrTimeSpanValue = (TextView) convertView.findViewById(R.id.distance_or_time_span_value); TextView distanceOrTimeSpanValue = (TextView) convertView.findViewById(R.id.distance_or_time_span_value);
TextView distanceOrTimeSpanText = (TextView) convertView.findViewById(R.id.distance_or_time_span_text); TextView distanceOrTimeSpanText = (TextView) convertView.findViewById(R.id.distance_or_time_span_text);
if (position == 0) { if (position == 0) {
distanceOrTimeSpanImageView.setImageDrawable(ic.getIcon(R.drawable.ic_action_track_16, app.getSettings().isLightContent() ? R.color.gpx_split_segment_icon_color : 0));
distanceOrTimeSpanValue.setText(OsmAndFormatter.getFormattedDistance(analysis.totalDistance, app)); distanceOrTimeSpanValue.setText(OsmAndFormatter.getFormattedDistance(analysis.totalDistance, app));
distanceOrTimeSpanText.setText(app.getString(R.string.distance)); distanceOrTimeSpanText.setText(app.getString(R.string.distance));
} else { } else {
if (analysis.timeSpan > 0) { if (currentGpxDisplayItem.group.isSplitDistance()) {
distanceOrTimeSpanValue.setText(OsmAndFormatter.getFormattedDuration((int) (analysis.timeSpan / 1000), app)); distanceOrTimeSpanImageView.setImageDrawable(ic.getIcon(R.drawable.ic_action_time_span_16, app.getSettings().isLightContent() ? R.color.gpx_split_segment_icon_color : 0));
} else { if (analysis.timeSpan > 0) {
distanceOrTimeSpanValue.setText("-"); distanceOrTimeSpanValue.setText(Algorithms.formatDuration((int) (analysis.timeSpan / 1000), app.accessibilityEnabled()));
} else {
distanceOrTimeSpanValue.setText("-");
}
distanceOrTimeSpanText.setText(app.getString(R.string.shared_string_time_span));
} else if (currentGpxDisplayItem.group.isSplitTime()) {
distanceOrTimeSpanImageView.setImageDrawable(ic.getIcon(R.drawable.ic_action_track_16, app.getSettings().isLightContent() ? R.color.gpx_split_segment_icon_color : 0));
distanceOrTimeSpanValue.setText(OsmAndFormatter.getFormattedDistance(analysis.totalDistance, app));
distanceOrTimeSpanText.setText(app.getString(R.string.distance));
} }
distanceOrTimeSpanText.setText(app.getString(R.string.shared_string_time_span));
} }
TextView startTimeValue = (TextView) convertView.findViewById(R.id.start_time_value); TextView startTimeValue = (TextView) convertView.findViewById(R.id.start_time_value);