Merge remote-tracking branch 'origin/master'
This commit is contained in:
commit
5c4710e22a
9 changed files with 200 additions and 120 deletions
|
@ -38,7 +38,7 @@
|
|||
android:layout_height="wrap_content"
|
||||
android:textColor="?android:attr/textColorPrimary"
|
||||
osmand:typeface="@string/font_roboto_medium"
|
||||
android:textSize="@dimen/default_desc_text_size"
|
||||
android:textSize="@dimen/default_split_segments_overview"
|
||||
tools:text="Overview"/>
|
||||
|
||||
<TextView
|
||||
|
@ -50,7 +50,7 @@
|
|||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:textColor="?android:attr/textColorSecondary"
|
||||
android:textSize="@dimen/default_sub_text_size"/>
|
||||
android:textSize="@dimen/default_split_segments_overview"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
|
@ -64,8 +64,8 @@
|
|||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
android:layout_marginTop="10dp"
|
||||
android:layout_marginBottom="10dp">
|
||||
android:layout_marginTop="8dp"
|
||||
android:layout_marginBottom="8dp">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_marginRight="3dp"
|
||||
|
@ -94,7 +94,7 @@
|
|||
tools:text="40 km"
|
||||
android:textColor="?android:attr/textColorPrimary"
|
||||
osmand:typeface="@string/font_roboto_medium"
|
||||
android:textSize="@dimen/default_desc_text_size"/>
|
||||
android:textSize="@dimen/default_split_segments_data"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/distance_or_time_span_text"
|
||||
|
@ -104,7 +104,7 @@
|
|||
android:layout_marginTop="3dp"
|
||||
tools:text="@string/distance"
|
||||
android:textColor="?android:attr/textColorSecondary"
|
||||
android:textSize="@dimen/default_sub_text_size"/>
|
||||
android:textSize="@dimen/default_split_segments_sub"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
|
@ -137,7 +137,7 @@
|
|||
tools:text="15:24:58"
|
||||
android:textColor="?android:attr/textColorPrimary"
|
||||
osmand:typeface="@string/font_roboto_medium"
|
||||
android:textSize="@dimen/default_desc_text_size"/>
|
||||
android:textSize="@dimen/default_split_segments_data"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/start_date_value"
|
||||
|
@ -147,7 +147,7 @@
|
|||
android:layout_marginTop="3dp"
|
||||
tools:text="Aud 8, 2016"
|
||||
android:textColor="?android:attr/textColorSecondary"
|
||||
android:textSize="@dimen/default_sub_text_size"/>
|
||||
android:textSize="@dimen/default_split_segments_sub"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
|
@ -179,7 +179,7 @@
|
|||
tools:text="15:34:58"
|
||||
android:textColor="?android:attr/textColorPrimary"
|
||||
osmand:typeface="@string/font_roboto_medium"
|
||||
android:textSize="@dimen/default_desc_text_size"/>
|
||||
android:textSize="@dimen/default_split_segments_data"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/end_date_value"
|
||||
|
@ -189,7 +189,7 @@
|
|||
android:layout_marginTop="3dp"
|
||||
tools:text="Aug 8, 2016"
|
||||
android:textColor="?android:attr/textColorSecondary"
|
||||
android:textSize="@dimen/default_sub_text_size"/>
|
||||
android:textSize="@dimen/default_split_segments_sub"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
|
@ -209,8 +209,8 @@
|
|||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
android:layout_marginTop="10dp"
|
||||
android:layout_marginBottom="10dp">
|
||||
android:layout_marginTop="8dp"
|
||||
android:layout_marginBottom="8dp">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_marginRight="3dp"
|
||||
|
@ -239,7 +239,7 @@
|
|||
tools:text="25 000 m"
|
||||
android:textColor="?android:attr/textColorPrimary"
|
||||
osmand:typeface="@string/font_roboto_medium"
|
||||
android:textSize="@dimen/default_desc_text_size"/>
|
||||
android:textSize="@dimen/default_split_segments_data"/>
|
||||
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
|
@ -248,7 +248,7 @@
|
|||
android:layout_marginTop="3dp"
|
||||
android:text="@string/average"
|
||||
android:textColor="?android:attr/textColorSecondary"
|
||||
android:textSize="@dimen/default_sub_text_size"/>
|
||||
android:textSize="@dimen/default_split_segments_sub"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
|
@ -281,7 +281,7 @@
|
|||
tools:text="1/2335 m"
|
||||
android:textColor="?android:attr/textColorPrimary"
|
||||
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
|
||||
android:id="@+id/min_altitude_value"
|
||||
|
@ -291,7 +291,7 @@
|
|||
tools:text="1 m"
|
||||
android:textColor="?android:attr/textColorPrimary"
|
||||
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
|
||||
android:id="@+id/max_altitude_value"
|
||||
|
@ -301,7 +301,7 @@
|
|||
tools:text="2335 m"
|
||||
android:textColor="?android:attr/textColorPrimary"
|
||||
osmand:typeface="@string/font_roboto_medium"
|
||||
android:textSize="@dimen/default_desc_text_size"/>
|
||||
android:textSize="@dimen/default_split_segments_data"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView4"
|
||||
|
@ -311,7 +311,7 @@
|
|||
android:background="@null"
|
||||
android:text="@string/range"
|
||||
android:textColor="?android:attr/textColorSecondary"
|
||||
android:textSize="@dimen/default_sub_text_size" />
|
||||
android:textSize="@dimen/default_split_segments_sub" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
|
@ -343,7 +343,7 @@
|
|||
tools:text="6280/6285 m"
|
||||
android:textColor="?android:attr/textColorPrimary"
|
||||
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
|
||||
android:id="@+id/ascent_value"
|
||||
|
@ -353,7 +353,7 @@
|
|||
tools:text="6280 m"
|
||||
android:textColor="?android:attr/textColorPrimary"
|
||||
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
|
||||
android:id="@+id/descent_value"
|
||||
|
@ -363,7 +363,7 @@
|
|||
tools:text="6285 m"
|
||||
android:textColor="?android:attr/textColorPrimary"
|
||||
osmand:typeface="@string/font_roboto_medium"
|
||||
android:textSize="@dimen/default_desc_text_size"/>
|
||||
android:textSize="@dimen/default_split_segments_data"/>
|
||||
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
|
@ -372,7 +372,7 @@
|
|||
android:layout_marginTop="3dp"
|
||||
android:text="@string/ascent_descent"
|
||||
android:textColor="?android:attr/textColorSecondary"
|
||||
android:textSize="@dimen/default_sub_text_size"/>
|
||||
android:textSize="@dimen/default_split_segments_sub"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
|
@ -392,8 +392,8 @@
|
|||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
android:layout_marginTop="10dp"
|
||||
android:layout_marginBottom="10dp">
|
||||
android:layout_marginTop="8dp"
|
||||
android:layout_marginBottom="8dp">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_marginRight="3dp"
|
||||
|
@ -422,7 +422,7 @@
|
|||
tools:text="3:20:12"
|
||||
android:textColor="?android:attr/textColorPrimary"
|
||||
osmand:typeface="@string/font_roboto_medium"
|
||||
android:textSize="@dimen/default_desc_text_size"/>
|
||||
android:textSize="@dimen/default_split_segments_data"/>
|
||||
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
|
@ -431,7 +431,7 @@
|
|||
android:layout_marginTop="3dp"
|
||||
android:text="@string/moving_time"
|
||||
android:textColor="?android:attr/textColorSecondary"
|
||||
android:textSize="@dimen/default_sub_text_size"/>
|
||||
android:textSize="@dimen/default_split_segments_sub"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
|
@ -464,7 +464,7 @@
|
|||
tools:text="11.1 km/h"
|
||||
android:textColor="?android:attr/textColorPrimary"
|
||||
osmand:typeface="@string/font_roboto_medium"
|
||||
android:textSize="@dimen/default_desc_text_size"/>
|
||||
android:textSize="@dimen/default_split_segments_data"/>
|
||||
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
|
@ -473,7 +473,7 @@
|
|||
android:layout_marginTop="3dp"
|
||||
android:text="@string/average"
|
||||
android:textColor="?android:attr/textColorSecondary"
|
||||
android:textSize="@dimen/default_sub_text_size"/>
|
||||
android:textSize="@dimen/default_split_segments_sub"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
|
@ -505,7 +505,7 @@
|
|||
tools:text="93/2 kmg/h"
|
||||
android:textColor="?android:attr/textColorPrimary"
|
||||
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
|
||||
android:id="@+id/max_speed_value"
|
||||
|
@ -515,7 +515,7 @@
|
|||
tools:text="93 kmg/h"
|
||||
android:textColor="?android:attr/textColorPrimary"
|
||||
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
|
||||
android:id="@+id/min_speed_value"
|
||||
|
@ -525,7 +525,7 @@
|
|||
tools:text="2 kmg/h"
|
||||
android:textColor="?android:attr/textColorPrimary"
|
||||
osmand:typeface="@string/font_roboto_medium"
|
||||
android:textSize="@dimen/default_desc_text_size"/>
|
||||
android:textSize="@dimen/default_split_segments_data"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/max_min_speed_text"
|
||||
|
@ -535,7 +535,7 @@
|
|||
android:layout_marginTop="3dp"
|
||||
android:text="@string/max_min"
|
||||
android:textColor="?android:attr/textColorSecondary"
|
||||
android:textSize="@dimen/default_sub_text_size"/>
|
||||
android:textSize="@dimen/default_split_segments_sub"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
|
|
11
OsmAnd/res/layout/gpx_split_segments_empty_header.xml
Normal file
11
OsmAnd/res/layout/gpx_split_segments_empty_header.xml
Normal file
|
@ -0,0 +1,11 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:orientation="vertical"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<View
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="48dp"/>
|
||||
|
||||
</LinearLayout>
|
|
@ -1,61 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:osmand="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:orientation="horizontal"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="48dp"
|
||||
android:background="?attr/bg_color"
|
||||
android:paddingLeft="16dp"
|
||||
android:paddingRight="16dp">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/header_split_image"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
tools:src="@drawable/ic_action_split_interval"
|
||||
android:layout_marginBottom="12dp"
|
||||
android:layout_marginTop="12dp"
|
||||
android:layout_marginRight="16dp"/>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/split_interval_view"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="?attr/selectableItemBackground">
|
||||
|
||||
<net.osmand.plus.widgets.TextViewEx
|
||||
android:id="@+id/split_interval_title"
|
||||
android:background="@null"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textColor="?android:attr/textColorPrimary"
|
||||
osmand:typeface="@string/font_roboto_medium"
|
||||
android:textSize="@dimen/default_desc_text_size"
|
||||
android:text="Split interval:"/>
|
||||
|
||||
<net.osmand.plus.widgets.TextViewEx
|
||||
android:id="@+id/split_interval_text"
|
||||
android:background="@null"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:gravity="right"
|
||||
android:layout_width="0dp"
|
||||
android:layout_weight="1"
|
||||
android:layout_height="wrap_content"
|
||||
android:textColor="?android:attr/textColorPrimary"
|
||||
osmand:typeface="@string/font_roboto_medium"
|
||||
android:textSize="@dimen/default_desc_text_size"
|
||||
tools:text="10 km"/>
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/split_interval_arrow"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:src="@drawable/ic_action_arrow_drop_down"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
86
OsmAnd/res/layout/split_segments_layout.xml
Normal file
86
OsmAnd/res/layout/split_segments_layout.xml
Normal file
|
@ -0,0 +1,86 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
xmlns:osmand="http://schemas.android.com/apk/res-auto"
|
||||
android:orientation="vertical">
|
||||
|
||||
<ListView
|
||||
android:id="@android:id/list"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_marginLeft="0dp"
|
||||
android:layout_marginRight="0dp"
|
||||
android:layout_marginTop="0dp"/>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/header_layout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical">
|
||||
|
||||
<LinearLayout
|
||||
android:orientation="horizontal"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="48dp"
|
||||
android:background="?attr/bg_color"
|
||||
android:paddingLeft="16dp"
|
||||
android:paddingRight="16dp">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/header_split_image"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
tools:src="@drawable/ic_action_split_interval"
|
||||
android:layout_marginBottom="12dp"
|
||||
android:layout_marginTop="12dp"
|
||||
android:layout_marginRight="16dp"/>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/split_interval_view"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="?attr/selectableItemBackground">
|
||||
|
||||
<net.osmand.plus.widgets.TextViewEx
|
||||
android:id="@+id/split_interval_title"
|
||||
android:background="@null"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textColor="?android:attr/textColorPrimary"
|
||||
osmand:typeface="@string/font_roboto_medium"
|
||||
android:textSize="@dimen/default_desc_text_size"
|
||||
android:text="Split interval:"/>
|
||||
|
||||
<net.osmand.plus.widgets.TextViewEx
|
||||
android:id="@+id/split_interval_text"
|
||||
android:background="@null"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:gravity="right"
|
||||
android:layout_width="0dp"
|
||||
android:layout_weight="1"
|
||||
android:layout_height="wrap_content"
|
||||
android:textColor="?android:attr/textColorPrimary"
|
||||
osmand:typeface="@string/font_roboto_medium"
|
||||
android:textSize="@dimen/default_desc_text_size"
|
||||
tools:text="10 km"/>
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/split_interval_arrow"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:src="@drawable/ic_action_arrow_drop_down"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<include layout="@layout/card_bottom_divider"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</FrameLayout>
|
|
@ -75,4 +75,8 @@
|
|||
<dimen name="default_sub_text_size">14sp</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>
|
|
@ -134,5 +134,9 @@
|
|||
<dimen name="default_sub_text_size">12sp</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>
|
||||
</resources>
|
|
@ -1014,7 +1014,7 @@
|
|||
<string name="ascent_descent">Ascent/Descent</string>
|
||||
<string name="moving_time">Moving time</string>
|
||||
<string name="max_min">Max/Min</string>
|
||||
<string name="range">Range</string>
|
||||
<string name="range_min_max">Range = Min/Max</string>
|
||||
<string name="index_tours">Tours</string>
|
||||
<string name="shared_string_all">All</string>
|
||||
<string name="waypoints">Waypoints</string>
|
||||
|
|
|
@ -275,7 +275,7 @@ public class GPXUtilities {
|
|||
public double minElevation = 99999;
|
||||
public double maxElevation = -100;
|
||||
|
||||
public float minSpeed;
|
||||
public float minSpeed = 0;
|
||||
public float maxSpeed = 0;
|
||||
public float avgSpeed;
|
||||
|
||||
|
@ -521,7 +521,11 @@ public class GPXUtilities {
|
|||
|
||||
if (speed > 0) {
|
||||
totalSpeedSum += speed;
|
||||
minSpeed = Math.min(speed, minSpeed);
|
||||
if (minSpeed == 0) {
|
||||
minSpeed = speed;
|
||||
} else {
|
||||
minSpeed = Math.min(speed, minSpeed);
|
||||
}
|
||||
maxSpeed = Math.max(speed, maxSpeed);
|
||||
speedCount++;
|
||||
}
|
||||
|
|
|
@ -10,10 +10,10 @@ import android.view.Gravity;
|
|||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.AbsListView;
|
||||
import android.widget.AdapterView;
|
||||
import android.widget.ArrayAdapter;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.ListView;
|
||||
import android.widget.TextView;
|
||||
|
||||
|
@ -82,22 +82,56 @@ public class SplitSegmentFragment extends OsmAndListFragment {
|
|||
@Override
|
||||
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
|
||||
setHasOptionsMenu(true);
|
||||
View view = getActivity().getLayoutInflater().inflate(R.layout.update_index, container, false);
|
||||
view.findViewById(R.id.header_layout).setVisibility(View.GONE);
|
||||
final View view = getActivity().getLayoutInflater().inflate(R.layout.split_segments_layout, container, false);
|
||||
|
||||
ListView listView = (ListView) view.findViewById(android.R.id.list);
|
||||
final ListView listView = (ListView) view.findViewById(android.R.id.list);
|
||||
listView.setDivider(null);
|
||||
listView.setDividerHeight(0);
|
||||
|
||||
adapter = new SplitSegmentsAdapter(new ArrayList<GpxDisplayItem>());
|
||||
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));
|
||||
headerView = view.findViewById(R.id.header_layout);
|
||||
((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(getActivity().getLayoutInflater().inflate(R.layout.gpx_split_segments_empty_header, null, false));
|
||||
listView.addFooterView(getActivity().getLayoutInflater().inflate(R.layout.list_shadow_footer, null, false));
|
||||
updateContent();
|
||||
updateHeader();
|
||||
|
||||
setListAdapter(adapter);
|
||||
|
||||
listView.setOnScrollListener(new AbsListView.OnScrollListener() {
|
||||
int previousYPos = -1;
|
||||
|
||||
@Override
|
||||
public void onScrollStateChanged(AbsListView absListView, int i) {
|
||||
if (i == SCROLL_STATE_IDLE) {
|
||||
previousYPos = -1;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onScroll(AbsListView absListView, int i, int i1, int i2) {
|
||||
View c = absListView.getChildAt(1);
|
||||
if (c != null) {
|
||||
int currentYPos = -c.getTop() + absListView.getFirstVisiblePosition() * c.getHeight();
|
||||
if (previousYPos == -1) {
|
||||
previousYPos = currentYPos;
|
||||
}
|
||||
|
||||
float yTranslationToSet = headerView.getTranslationY() + (previousYPos - currentYPos);
|
||||
if (yTranslationToSet < 0 && yTranslationToSet > -headerView.getHeight()) {
|
||||
headerView.setTranslationY(yTranslationToSet);
|
||||
} else if (yTranslationToSet < -headerView.getHeight()) {
|
||||
headerView.setTranslationY(-headerView.getHeight());
|
||||
} else if (yTranslationToSet > 0) {
|
||||
headerView.setTranslationY(0);
|
||||
}
|
||||
|
||||
previousYPos = currentYPos;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
return view;
|
||||
}
|
||||
|
||||
|
@ -145,12 +179,6 @@ public class SplitSegmentFragment extends OsmAndListFragment {
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onResume() {
|
||||
super.onResume();
|
||||
updateContent();
|
||||
}
|
||||
|
||||
public void updateContent() {
|
||||
adapter.clear();
|
||||
adapter.setNotifyOnChange(false);
|
||||
|
@ -346,6 +374,7 @@ public class SplitSegmentFragment extends OsmAndListFragment {
|
|||
if (convertView == null) {
|
||||
convertView = getMyActivity().getLayoutInflater().inflate(R.layout.gpx_split_segment_fragment, parent, false);
|
||||
}
|
||||
convertView.setOnClickListener(null);
|
||||
TextView overviewTextView = (TextView) convertView.findViewById(R.id.overview_text);
|
||||
ImageView overviewImageView = (ImageView) convertView.findViewById(R.id.overview_image);
|
||||
if (position == 0) {
|
||||
|
@ -378,12 +407,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))
|
||||
.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))
|
||||
|
@ -404,18 +427,27 @@ public class SplitSegmentFragment extends OsmAndListFragment {
|
|||
if (currentGpxDisplayItem != null) {
|
||||
GPXTrackAnalysis analysis = currentGpxDisplayItem.analysis;
|
||||
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 distanceOrTimeSpanText = (TextView) convertView.findViewById(R.id.distance_or_time_span_text);
|
||||
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));
|
||||
distanceOrTimeSpanText.setText(app.getString(R.string.distance));
|
||||
} else {
|
||||
if (analysis.timeSpan > 0) {
|
||||
distanceOrTimeSpanValue.setText(OsmAndFormatter.getFormattedDuration((int) (analysis.timeSpan / 1000), app));
|
||||
} else {
|
||||
distanceOrTimeSpanValue.setText("-");
|
||||
if (currentGpxDisplayItem.group.isSplitDistance()) {
|
||||
distanceOrTimeSpanImageView.setImageDrawable(ic.getIcon(R.drawable.ic_action_time_span_16, app.getSettings().isLightContent() ? R.color.gpx_split_segment_icon_color : 0));
|
||||
if (analysis.timeSpan > 0) {
|
||||
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);
|
||||
|
|
Loading…
Reference in a new issue