Complete data on overview tab

This commit is contained in:
sonora 2017-04-02 14:01:08 +02:00
parent 3f93ecab98
commit b51598afd8
2 changed files with 602 additions and 0 deletions

View file

@ -270,6 +270,550 @@
</LinearLayout>
<LinearLayout
android:id="@+id/list_divider_altitude"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<LinearLayout
android:layout_width="0dp"
android:layout_weight="1"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:paddingLeft="16dp"
android:paddingRight="8dp">
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="?attr/dashboard_divider"/>
</LinearLayout>
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:orientation="horizontal"
android:paddingLeft="8dp"
android:paddingRight="16dp">
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="?attr/dashboard_divider"/>
</LinearLayout>
</LinearLayout>
<LinearLayout
android:id="@+id/average_altitude_range"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:paddingTop="13dp"
android:paddingBottom="11dp">
<LinearLayout
android:layout_width="0dp"
android:layout_weight="1"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:paddingLeft="16dp">
<ImageView
android:id="@+id/average_altitude_icon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:src="@drawable/ic_action_altitude_average"/>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
android:layout_marginLeft="18dp">
<net.osmand.plus.widgets.TextViewEx
android:id="@+id/average_altitude_text"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@null"
tools:text="40 m"
android:textColor="?android:attr/textColorPrimary"
osmand:typeface="@string/font_roboto_medium"
android:textSize="@dimen/default_desc_text_size"/>
<TextView
android:id="@+id/average_altitude_desc"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@null"
android:layout_marginTop="3dp"
android:text="@string/average_altitude"
android:textColor="?android:attr/textColorSecondary"
android:textSize="@dimen/default_sub_text_size"/>
</LinearLayout>
</LinearLayout>
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:orientation="horizontal"
android:paddingLeft="16dp">
<ImageView
android:id="@+id/altitude_range_icon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:src="@drawable/ic_action_altitude_average"/>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
android:layout_marginLeft="18dp">
<net.osmand.plus.widgets.TextViewEx
android:id="@+id/altitude_range_text"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@null"
tools:text="30m - 53m"
android:textColor="?android:attr/textColorPrimary"
osmand:typeface="@string/font_roboto_medium"
android:textSize="@dimen/default_desc_text_size"/>
<TextView
android:id="@+id/altitude_range_desc"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@null"
android:layout_marginTop="3dp"
android:text="@string/altitude_range"
android:textColor="?android:attr/textColorSecondary"
android:textSize="@dimen/default_sub_text_size"/>
</LinearLayout>
</LinearLayout>
</LinearLayout>
<LinearLayout
android:id="@+id/list_divider_altitude"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<LinearLayout
android:layout_width="0dp"
android:layout_weight="1"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:paddingLeft="16dp"
android:paddingRight="8dp">
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="?attr/dashboard_divider"/>
</LinearLayout>
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:orientation="horizontal"
android:paddingLeft="8dp"
android:paddingRight="16dp">
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="?attr/dashboard_divider"/>
</LinearLayout>
</LinearLayout>
<LinearLayout
android:id="@+id/ascent_descent"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:paddingTop="13dp"
android:paddingBottom="11dp">
<LinearLayout
android:layout_width="0dp"
android:layout_weight="1"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:paddingLeft="16dp">
<ImageView
android:id="@+id/ascent_icon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:src="@drawable/ic_action_altitude_ascent"/>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
android:layout_marginLeft="18dp">
<net.osmand.plus.widgets.TextViewEx
android:id="@+id/ascent_text"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@null"
tools:text="174"
android:textColor="?android:attr/textColorPrimary"
osmand:typeface="@string/font_roboto_medium"
android:textSize="@dimen/default_desc_text_size"/>
<TextView
android:id="@+id/ascent_desc"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@null"
android:layout_marginTop="3dp"
android:text="@string/altitude_ascent"
android:textColor="?android:attr/textColorSecondary"
android:textSize="@dimen/default_sub_text_size"/>
</LinearLayout>
</LinearLayout>
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:orientation="horizontal"
android:paddingLeft="16dp">
<ImageView
android:id="@+id/descent_icon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:src="@drawable/ic_action_altitude_descent"/>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
android:layout_marginLeft="18dp">
<net.osmand.plus.widgets.TextViewEx
android:id="@+id/descent_text"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@null"
tools:text="164"
android:textColor="?android:attr/textColorPrimary"
osmand:typeface="@string/font_roboto_medium"
android:textSize="@dimen/default_desc_text_size"/>
<TextView
android:id="@+id/descent_desc"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@null"
android:layout_marginTop="3dp"
android:text="@string/altitude_descent"
android:textColor="?android:attr/textColorSecondary"
android:textSize="@dimen/default_sub_text_size"/>
</LinearLayout>
</LinearLayout>
</LinearLayout>
<LinearLayout
android:id="@+id/list_divider_speed"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<LinearLayout
android:layout_width="0dp"
android:layout_weight="1"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:paddingLeft="16dp"
android:paddingRight="8dp">
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="?attr/dashboard_divider"/>
</LinearLayout>
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:orientation="horizontal"
android:paddingLeft="8dp"
android:paddingRight="16dp">
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="?attr/dashboard_divider"/>
</LinearLayout>
</LinearLayout>
<LinearLayout
android:id="@+id/max_speed"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:paddingTop="13dp"
android:paddingBottom="11dp">
<LinearLayout
android:layout_width="0dp"
android:layout_weight="1"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:paddingLeft="16dp">
<ImageView
android:id="@+id/average_speed_icon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:src="@drawable/ic_action_speed"/>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
android:layout_marginLeft="18dp">
<net.osmand.plus.widgets.TextViewEx
android:id="@+id/average_speed_text"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@null"
tools:text="6.8 km/h"
android:textColor="?android:attr/textColorPrimary"
osmand:typeface="@string/font_roboto_medium"
android:textSize="@dimen/default_desc_text_size"/>
<TextView
android:id="@+id/average_speed_desc"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@null"
android:layout_marginTop="3dp"
android:text="@string/average_speed"
android:textColor="?android:attr/textColorSecondary"
android:textSize="@dimen/default_sub_text_size"/>
</LinearLayout>
</LinearLayout>
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:orientation="horizontal"
android:paddingLeft="16dp">
<ImageView
android:id="@+id/max_speed_icon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:src="@drawable/ic_action_max_speed"/>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
android:layout_marginLeft="18dp">
<net.osmand.plus.widgets.TextViewEx
android:id="@+id/max_speed_text"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@null"
tools:text="31.3 km/h"
android:textColor="?android:attr/textColorPrimary"
osmand:typeface="@string/font_roboto_medium"
android:textSize="@dimen/default_desc_text_size"/>
<TextView
android:id="@+id/max_speed_desc"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@null"
android:layout_marginTop="3dp"
android:text="@string/max_speed"
android:textColor="?android:attr/textColorSecondary"
android:textSize="@dimen/default_sub_text_size"/>
</LinearLayout>
</LinearLayout>
</LinearLayout>
<LinearLayout
android:id="@+id/list_divider_speed"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<LinearLayout
android:layout_width="0dp"
android:layout_weight="1"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:paddingLeft="16dp"
android:paddingRight="8dp">
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="?attr/dashboard_divider"/>
</LinearLayout>
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:orientation="horizontal"
android:paddingLeft="8dp"
android:paddingRight="16dp">
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="?attr/dashboard_divider"/>
</LinearLayout>
</LinearLayout>
<LinearLayout
android:id="@+id/time_distance"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:paddingTop="13dp"
android:paddingBottom="11dp">
<LinearLayout
android:layout_width="0dp"
android:layout_weight="1"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:paddingLeft="16dp">
<ImageView
android:id="@+id/time_moving_icon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:src="@drawable/ic_action_time_span"/>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
android:layout_marginLeft="18dp">
<net.osmand.plus.widgets.TextViewEx
android:id="@+id/time_moving_text"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@null"
tools:text="174"
android:textColor="?android:attr/textColorPrimary"
osmand:typeface="@string/font_roboto_medium"
android:textSize="@dimen/default_desc_text_size"/>
<TextView
android:id="@+id/time_moving_desc"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@null"
android:layout_marginTop="3dp"
android:text="@string/shared_string_time_moving"
android:textColor="?android:attr/textColorSecondary"
android:textSize="@dimen/default_sub_text_size"/>
</LinearLayout>
</LinearLayout>
<!-- LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:orientation="horizontal"
android:paddingLeft="16dp">
<ImageView
android:id="@+id/distance_icon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:src="@drawable/ic_action_polygom_dark"/>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
android:layout_marginLeft="18dp">
<net.osmand.plus.widgets.TextViewEx
android:id="@+id/distance_text"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@null"
tools:text="42 km"
android:textColor="?android:attr/textColorPrimary"
osmand:typeface="@string/font_roboto_medium"
android:textSize="@dimen/default_desc_text_size"/>
<TextView
android:id="@+id/distance_desc"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@null"
android:layout_marginTop="3dp"
android:text="@string/distance"
android:textColor="?android:attr/textColorSecondary"
android:textSize="@dimen/default_sub_text_size"/>
</LinearLayout>
</LinearLayout -->
</LinearLayout>
<View
android:layout_width="match_parent"
android:layout_height="1dp"

View file

@ -1105,6 +1105,7 @@ public class TrackSegmentFragment extends OsmAndListFragment {
((TextView) view.findViewById(R.id.end_date_text)).setText(df.format(end));
} else {
view.findViewById(R.id.list_divider).setVisibility(View.GONE);
view.findViewById(R.id.list_divider_altitude).setVisibility(View.GONE);
view.findViewById(R.id.start_end_time).setVisibility(View.GONE);
}
} else {
@ -1112,7 +1113,64 @@ public class TrackSegmentFragment extends OsmAndListFragment {
view.findViewById(R.id.distance_time_span).setVisibility(View.GONE);
view.findViewById(R.id.list_divider).setVisibility(View.GONE);
view.findViewById(R.id.start_end_time).setVisibility(View.GONE);
view.findViewById(R.id.list_divider_altitude).setVisibility(View.GONE);
}
//Altitude Data
if (analysis != null && analysis.hasElevationData) {
((ImageView) view.findViewById(R.id.average_altitude_icon))
.setImageDrawable(ic.getThemedIcon(R.drawable.ic_action_altitude_average));
((ImageView) view.findViewById(R.id.altitude_range_icon))
.setImageDrawable(ic.getThemedIcon(R.drawable.ic_action_altitude_average));
((ImageView) view.findViewById(R.id.ascent_icon))
.setImageDrawable(ic.getThemedIcon(R.drawable.ic_action_altitude_ascent));
((ImageView) view.findViewById(R.id.descent_icon))
.setImageDrawable(ic.getThemedIcon(R.drawable.ic_action_altitude_descent));
String minAltitude = OsmAndFormatter.getFormattedAlt(analysis.minElevation, app);
String maxAltitude = OsmAndFormatter.getFormattedAlt(analysis.maxElevation, app);
String asc = OsmAndFormatter.getFormattedAlt(analysis.diffElevationUp, app);
String desc = OsmAndFormatter.getFormattedAlt(analysis.diffElevationDown, app);
((TextView) view.findViewById(R.id.average_altitude_text))
.setText(OsmAndFormatter.getFormattedAlt(analysis.avgElevation, app));
((TextView) view.findViewById(R.id.altitude_range_text)).setText(minAltitude + " - " + maxAltitude);
((TextView) view.findViewById(R.id.ascent_text)).setText(asc);
((TextView) view.findViewById(R.id.descent_text)).setText(desc);
} else {
view.findViewById(R.id.average_altitude_range).setVisibility(View.GONE);
view.findViewById(R.id.list_divider_altitude).setVisibility(View.GONE);
view.findViewById(R.id.ascent_descent).setVisibility(View.GONE);
}
//Speed data
if (analysis != null && analysis.isSpeedSpecified() && analysis.hasSpeedData) {
((ImageView) view.findViewById(R.id.average_speed_icon))
.setImageDrawable(ic.getThemedIcon(R.drawable.ic_action_speed));
((ImageView) view.findViewById(R.id.max_speed_icon))
.setImageDrawable(ic.getThemedIcon(R.drawable.ic_action_max_speed));
((ImageView) view.findViewById(R.id.time_moving_icon))
.setImageDrawable(ic.getThemedIcon(R.drawable.ic_action_time_span));
// ((ImageView) view.findViewById(R.id.distance_icon))
// .setImageDrawable(ic.getThemedIcon(R.drawable.ic_action_polygom_dark));
String avgSpeed = OsmAndFormatter.getFormattedSpeed(analysis.avgSpeed, app);
String maxSpeed = OsmAndFormatter.getFormattedSpeed(analysis.maxSpeed, app);
((TextView) view.findViewById(R.id.average_speed_text)).setText(avgSpeed);
((TextView) view.findViewById(R.id.max_speed_text)).setText(maxSpeed);
((TextView) view.findViewById(R.id.time_moving_text))
.setText(Algorithms.formatDuration((int) (analysis.timeMoving / 1000), app.accessibilityEnabled()));
// ((TextView) view.findViewById(R.id.distance_text))
// .setText(OsmAndFormatter.getFormattedDistance(analysis.totalDistanceMoving, app));
} else {
view.findViewById(R.id.max_speed).setVisibility(View.GONE);
view.findViewById(R.id.list_divider_speed).setVisibility(View.GONE);
view.findViewById(R.id.time_distance).setVisibility(View.GONE);
}
view.findViewById(R.id.details_view).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {