Merge remote-tracking branch 'origin/master'
This commit is contained in:
commit
0a92fc9497
14 changed files with 1044 additions and 369 deletions
|
@ -2,8 +2,6 @@
|
|||
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:shape="rectangle">
|
||||
<corners android:radius="4dp" />
|
||||
<solid android:color="?attr/bg_color"/>
|
||||
<stroke
|
||||
android:width="1dp"
|
||||
android:color="#808080" />
|
||||
<solid android:color="@color/bg_color_dark"/>
|
||||
<stroke android:width="1dp" android:color="#808080" />
|
||||
</shape>
|
7
OsmAnd/res/drawable/chart_marker_background_light.xml
Normal file
7
OsmAnd/res/drawable/chart_marker_background_light.xml
Normal file
|
@ -0,0 +1,7 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:shape="rectangle">
|
||||
<corners android:radius="4dp" />
|
||||
<solid android:color="@color/bg_color_light"/>
|
||||
<stroke android:width="1dp" android:color="#808080" />
|
||||
</shape>
|
|
@ -8,7 +8,7 @@
|
|||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
android:background="@drawable/chart_marker_background">
|
||||
android:background="?attr/chart_marker_background">
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/text_alt_container"
|
||||
|
|
|
@ -58,6 +58,7 @@
|
|||
</LinearLayout>
|
||||
|
||||
<View
|
||||
android:id="@+id/divider"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dp"
|
||||
android:layout_marginLeft="16dp"
|
||||
|
@ -65,6 +66,7 @@
|
|||
android:background="?attr/dashboard_divider"/>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/split_color_view"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
|
|
|
@ -1,69 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="?attr/expandable_list_item_background"
|
||||
android:minHeight="@dimen/list_item_height"
|
||||
android:orientation="vertical"
|
||||
android:paddingTop="10dp">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingLeft="@dimen/list_content_padding"
|
||||
android:paddingRight="@dimen/list_content_padding">
|
||||
|
||||
<FrameLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_marginRight="@dimen/favorites_icon_right_margin" >
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/icon"
|
||||
android:layout_width="@dimen/standard_icon_size"
|
||||
android:layout_height="@dimen/standard_icon_size"
|
||||
android:layout_gravity="center_vertical" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/additional"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:maxLines="2"
|
||||
android:textColor="?android:textColorPrimary"
|
||||
android:textSize="@dimen/default_desc_text_size"
|
||||
tools:text="Additional" />
|
||||
</FrameLayout>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/name"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_weight="1"
|
||||
android:textColor="?android:textColorPrimary"
|
||||
android:textSize="@dimen/default_list_text_size"
|
||||
tools:text="Name" />
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/description"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center_vertical"
|
||||
android:layout_marginTop="5dp"
|
||||
android:textColor="?android:textColorSecondary"
|
||||
android:textSize="@dimen/default_desc_text_size"
|
||||
android:paddingLeft="@dimen/list_content_padding"
|
||||
android:paddingRight="@dimen/list_content_padding"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
91
OsmAnd/res/layout/wpt_list_item.xml
Normal file
91
OsmAnd/res/layout/wpt_list_item.xml
Normal file
|
@ -0,0 +1,91 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="?attr/expandable_list_item_background"
|
||||
android:minHeight="@dimen/list_item_height"
|
||||
android:orientation="vertical">
|
||||
|
||||
<View
|
||||
android:id="@+id/divider"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dp"
|
||||
android:background="?attr/dashboard_divider"
|
||||
android:visibility="gone"/>
|
||||
|
||||
<View
|
||||
android:id="@+id/list_divider"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dp"
|
||||
android:background="?attr/dashboard_divider"
|
||||
android:layout_marginLeft="54dp"
|
||||
android:visibility="gone"/>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:orientation="horizontal"
|
||||
android:paddingLeft="@dimen/list_content_padding">
|
||||
|
||||
<CheckBox
|
||||
android:id="@+id/toggle_item"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_marginRight="@dimen/list_content_padding"
|
||||
android:focusable="false"
|
||||
android:visibility="gone"
|
||||
tools:visibility="visible"/>
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/icon"
|
||||
android:layout_width="@dimen/standard_icon_size"
|
||||
android:layout_height="@dimen/standard_icon_size"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_marginRight="@dimen/list_content_padding"/>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_weight="1"
|
||||
android:orientation="vertical"
|
||||
android:paddingRight="@dimen/list_content_padding"
|
||||
android:paddingTop="8dp"
|
||||
android:paddingBottom="8dp">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/label"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textColor="?android:textColorPrimary"
|
||||
android:textSize="@dimen/default_list_text_size"
|
||||
tools:text="Point title"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/description"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textColor="?android:textColorSecondary"
|
||||
android:textSize="@dimen/default_sub_text_size"
|
||||
android:maxLines="2"
|
||||
tools:text="Point description"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<ImageButton
|
||||
android:id="@+id/options"
|
||||
android:contentDescription="@string/shared_string_more"
|
||||
android:layout_width="@dimen/list_item_height"
|
||||
android:layout_height="@dimen/list_item_height"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:background="?attr/dashboard_button"
|
||||
android:src="@drawable/ic_overflow_menu_white"
|
||||
android:visibility="visible"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
100
OsmAnd/res/layout/wpt_list_item_category.xml
Normal file
100
OsmAnd/res/layout/wpt_list_item_category.xml
Normal file
|
@ -0,0 +1,100 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
xmlns:osmand="http://schemas.android.com/apk/res-auto"
|
||||
android:orientation="vertical">
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/group_divider"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<include layout="@layout/list_item_divider"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingLeft="@dimen/list_content_padding"
|
||||
android:minHeight="@dimen/list_item_height"
|
||||
android:background="?attr/bg_color"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<CheckBox
|
||||
android:id="@+id/toggle_item"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:background="?attr/dashboard_button"
|
||||
android:focusable="false"
|
||||
android:layout_marginRight="@dimen/list_content_padding"
|
||||
android:visibility="gone"
|
||||
tools:visiblity="visible"/>
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/category_icon"
|
||||
android:layout_width="24dp"
|
||||
android:layout_height="24dp"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_marginRight="@dimen/list_content_padding"
|
||||
android:visibility="gone"/>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
android:layout_weight="1"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:paddingTop="8dp"
|
||||
android:paddingBottom="8dp">
|
||||
|
||||
<net.osmand.plus.widgets.TextViewEx
|
||||
android:id="@+id/category_name"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:textColor="?android:textColorPrimary"
|
||||
android:textSize="@dimen/default_sub_text_size"
|
||||
osmand:typeface="@string/font_roboto_medium"
|
||||
tools:text="Category name"/>
|
||||
|
||||
<net.osmand.plus.widgets.TextViewEx
|
||||
android:id="@+id/category_desc"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:textColor="?android:textColorSecondary"
|
||||
android:textSize="@dimen/default_sub_text_size"
|
||||
tools:text="Important points in this route"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/options"
|
||||
android:contentDescription="@string/shared_string_more"
|
||||
android:layout_width="46dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_marginRight="4dp"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:background="?attr/dashboard_button"
|
||||
android:focusable="false"
|
||||
android:scaleType="center"
|
||||
android:src="@drawable/ic_overflow_menu_white"
|
||||
android:visibility="gone"
|
||||
tools:visiblity="visible"/>
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/explist_indicator"
|
||||
android:layout_width="24dp"
|
||||
android:layout_height="match_parent"
|
||||
android:scaleType="center"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_marginRight="@dimen/list_content_padding"
|
||||
android:visibility="gone"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
|
@ -5,6 +5,7 @@
|
|||
</declare-styleable>
|
||||
<declare-styleable name="OsmAndTheme">
|
||||
<attr name="routeParameterTitleColor" format="color"/>
|
||||
<attr name="chart_marker_background" format="reference" />
|
||||
<!-- list colors -->
|
||||
<attr name="ctx_menu_info_divider" format="color"/>
|
||||
<attr name="searchbar_text" format="color"/>
|
||||
|
|
|
@ -9,6 +9,10 @@
|
|||
3. All your modified/created strings are in the top of the file (to make easier find what\'s translated).
|
||||
PLEASE: Have a look at http://code.google.com/p/osmand/wiki/UIConsistency, it may really improve your and our work :-) Thx - Hardy
|
||||
-->
|
||||
<string name="points_delete_multiple_succesful">Point(s) deleted successfully.</string>
|
||||
<string name="points_delete_multiple">You are going to delete %1$d point(s). Are you sure?</string>
|
||||
<string name="route_points_category_name">Points on the route to pass</string>
|
||||
<string name="track_points_category_name">Important points in this route</string>
|
||||
<string name="gpx_track">Track</string>
|
||||
<string name="max_speed">Max speed</string>
|
||||
<string name="average_speed">Average speed</string>
|
||||
|
@ -18,7 +22,7 @@
|
|||
<string name="shared_string_start_time">Start time</string>
|
||||
<string name="shared_string_end_time">End time</string>
|
||||
<string name="shared_string_color">Color</string>
|
||||
<string name="select_gpx_folder">Select GPX folder</string>
|
||||
<string name="select_gpx_folder">Select track folder</string>
|
||||
<string name="file_can_not_be_moved">File can not be moved.</string>
|
||||
<string name="shared_string_move">Move</string>
|
||||
<string name="shared_string_tracks">Tracks</string>
|
||||
|
|
|
@ -76,6 +76,7 @@
|
|||
|
||||
<!-- Osmand themes styles -->
|
||||
<style name="OsmandLightTheme" parent="Theme.AppCompat.Light">
|
||||
<item name="chart_marker_background">@drawable/chart_marker_background_light</item>
|
||||
<item name="routeParameterTitleColor">@color/color_myloc_distance</item>
|
||||
<item name="ctx_menu_info_divider">@color/ctx_menu_info_divider_light</item>
|
||||
<item name="searchbar_text">@color/searchbar_text_light</item>
|
||||
|
@ -139,6 +140,7 @@
|
|||
<item name="android:actionModeCloseDrawable">@drawable/ic_action_mode_back</item>
|
||||
<item name="android:actionModeStyle">@style/WhiteActionMode</item>
|
||||
<item name="android:actionMenuTextColor">@color/color_white</item>
|
||||
<item name="actionOverflowButtonStyle">@style/OverflowMenuButton</item>
|
||||
|
||||
<item name="dialog_inactive_text_color">@color/icon_color_light</item>
|
||||
<item name="secondary_icon_color">@color/icon_color_light</item>
|
||||
|
@ -155,6 +157,10 @@
|
|||
<item name="popupMenuStyle">@style/PopupMenuLight</item>
|
||||
</style>
|
||||
|
||||
<style name="OverflowMenuButton" parent="@style/Widget.AppCompat.ActionButton.Overflow">
|
||||
<item name="android:src">@drawable/ic_overflow_menu_white</item>
|
||||
</style>
|
||||
|
||||
<style name="PopupMenuLight" parent="@style/Widget.AppCompat.Light.PopupMenu">
|
||||
<item name="overlapAnchor">true</item>'
|
||||
<item name="android:dropDownVerticalOffset">8dip</item>
|
||||
|
@ -241,6 +247,7 @@
|
|||
</style>
|
||||
|
||||
<style name="OsmandDarkTheme" parent="Theme.AppCompat">
|
||||
<item name="chart_marker_background">@drawable/chart_marker_background_dark</item>
|
||||
<item name="routeParameterTitleColor">@color/osmand_orange</item>
|
||||
<item name="ctx_menu_info_divider">@color/ctx_menu_info_divider_dark</item>
|
||||
<item name="searchbar_text">@color/searchbar_text_dark</item>
|
||||
|
@ -291,6 +298,7 @@
|
|||
|
||||
<item name="android:actionModeBackground">@color/actionbar_dark_color</item>
|
||||
<item name="android:actionBarStyle">@style/Widget.Styled.ActionBarDark</item>
|
||||
<item name="actionOverflowButtonStyle">@style/OverflowMenuButton</item>
|
||||
|
||||
<item name="dialog_inactive_text_color">@color/dialog_inactive_text_color_dark</item>
|
||||
<item name="secondary_icon_color">@color/dialog_inactive_text_color_dark</item>
|
||||
|
|
|
@ -138,11 +138,11 @@ public class FavoritesTreeFragment extends OsmandExpandableListFragment {
|
|||
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
|
||||
View view = inflater.inflate(R.layout.favorites_tree, container, false);
|
||||
ExpandableListView listView = (ExpandableListView) view.findViewById(android.R.id.list);
|
||||
View headerView = inflater.inflate(R.layout.list_shadow_header, null, false);
|
||||
listView.addHeaderView(headerView);
|
||||
View footerView = inflater.inflate(R.layout.list_shadow_footer, null, false);
|
||||
listView.addFooterView(footerView);
|
||||
favouritesAdapter.synchronizeGroups();
|
||||
if (!favouritesAdapter.isEmpty()) {
|
||||
listView.addHeaderView(inflater.inflate(R.layout.list_shadow_header, null, false));
|
||||
listView.addFooterView(inflater.inflate(R.layout.list_shadow_footer, null, false));
|
||||
}
|
||||
listView.setAdapter(favouritesAdapter);
|
||||
setListView(listView);
|
||||
setHasOptionsMenu(true);
|
||||
|
|
|
@ -76,6 +76,7 @@ import java.util.Comparator;
|
|||
import java.util.Date;
|
||||
import java.util.HashSet;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.LinkedHashSet;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
|
@ -88,6 +89,7 @@ public class AvailableGPXFragment extends OsmandExpandableListFragment {
|
|||
// protected static final int DELETE_ACTION_ID = 1;
|
||||
private boolean selectionMode = false;
|
||||
private List<GpxInfo> selectedItems = new ArrayList<>();
|
||||
private Set<Integer> selectedGroups = new LinkedHashSet<>();
|
||||
private ActionMode actionMode;
|
||||
private LoadGpxTask asyncLoader;
|
||||
private ProcessGpxTask asyncProcessor;
|
||||
|
@ -271,6 +273,9 @@ public class AvailableGPXFragment extends OsmandExpandableListFragment {
|
|||
}
|
||||
});
|
||||
*/
|
||||
} else {
|
||||
View headerView = inflater.inflate(R.layout.list_shadow_header, null, false);
|
||||
listView.addHeaderView(headerView);
|
||||
}
|
||||
View footerView = inflater.inflate(R.layout.list_shadow_footer, null, false);
|
||||
listView.addFooterView(footerView);
|
||||
|
@ -467,6 +472,7 @@ public class AvailableGPXFragment extends OsmandExpandableListFragment {
|
|||
enableSelectionMode(true);
|
||||
showOnMapMode = true;
|
||||
selectedItems.clear();
|
||||
selectedGroups.clear();
|
||||
final Set<GpxInfo> originalSelectedItems = allGpxAdapter.getSelectedGpx();
|
||||
selectedItems.addAll(originalSelectedItems);
|
||||
actionMode = getActionBarActivity().startSupportActionMode(new ActionMode.Callback() {
|
||||
|
@ -533,6 +539,7 @@ public class AvailableGPXFragment extends OsmandExpandableListFragment {
|
|||
|
||||
enableSelectionMode(true);
|
||||
selectedItems.clear();
|
||||
selectedGroups.clear();
|
||||
actionMode = getActionBarActivity().startSupportActionMode(new ActionMode.Callback() {
|
||||
|
||||
@Override
|
||||
|
@ -776,6 +783,12 @@ public class AvailableGPXFragment extends OsmandExpandableListFragment {
|
|||
public void refreshSelected() {
|
||||
selected.clear();
|
||||
selected.addAll(getSelectedGpx());
|
||||
Collections.sort(selected, new Comparator<GpxInfo>() {
|
||||
@Override
|
||||
public int compare(GpxInfo i1, GpxInfo i2) {
|
||||
return i1.getName().toLowerCase().compareTo(i2.getName().toLowerCase());
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public Set<GpxInfo> getSelectedGpx() {
|
||||
|
@ -958,15 +971,17 @@ public class AvailableGPXFragment extends OsmandExpandableListFragment {
|
|||
if (selectionMode) {
|
||||
final CheckBox ch = (CheckBox) v.findViewById(R.id.toggle_item);
|
||||
ch.setVisibility(View.VISIBLE);
|
||||
//ch.setChecked(selectedItems.contains(model));
|
||||
ch.setChecked(selectedGroups.contains(groupPosition));
|
||||
|
||||
ch.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
if (ch.isChecked()) {
|
||||
selectedItems.addAll(data.get(category.get(getGroupPosition(groupPosition))));
|
||||
selectedGroups.add(groupPosition);
|
||||
} else {
|
||||
selectedItems.removeAll(data.get(category.get(getGroupPosition(groupPosition))));
|
||||
selectedGroups.remove(groupPosition);
|
||||
}
|
||||
allGpxAdapter.notifyDataSetInvalidated();
|
||||
updateSelectionMode(actionMode);
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -199,95 +199,97 @@ public class TrackSegmentFragment extends OsmAndListFragment {
|
|||
}
|
||||
|
||||
private void setupListView(ListView listView) {
|
||||
if (adapter.getCount() > 0) {
|
||||
View view = getActivity().getLayoutInflater().inflate(R.layout.gpx_item_list_header, null, false);
|
||||
listView.addHeaderView(view);
|
||||
listView.addFooterView(getActivity().getLayoutInflater().inflate(R.layout.list_shadow_footer, null, false));
|
||||
final ImageView imageView = (ImageView) view.findViewById(R.id.imageView);
|
||||
final View splitIntervalView = view.findViewById(R.id.split_interval_view);
|
||||
final View colorView = view.findViewById(R.id.color_view);
|
||||
final SwitchCompat vis = (SwitchCompat) view.findViewById(R.id.showOnMapToggle);
|
||||
vis.setChecked(app.getSelectedGpxHelper().getSelectedFileByPath(getGpx().path) != null);
|
||||
vis.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
||||
@Override
|
||||
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
|
||||
SelectedGpxFile sf = app.getSelectedGpxHelper().selectGpxFile(getGpx(), vis.isChecked(), false);
|
||||
if (vis.isChecked() && sf.getModifiableGpxFile() != null) {
|
||||
sf.processPoints();
|
||||
updateColorView(colorView);
|
||||
View view = getActivity().getLayoutInflater().inflate(R.layout.gpx_item_list_header, null, false);
|
||||
listView.addHeaderView(view);
|
||||
listView.addFooterView(getActivity().getLayoutInflater().inflate(R.layout.list_shadow_footer, null, false));
|
||||
final ImageView imageView = (ImageView) view.findViewById(R.id.imageView);
|
||||
final View splitColorView = view.findViewById(R.id.split_color_view);
|
||||
final View divider = view.findViewById(R.id.divider);
|
||||
final View splitIntervalView = view.findViewById(R.id.split_interval_view);
|
||||
final View colorView = view.findViewById(R.id.color_view);
|
||||
final SwitchCompat vis = (SwitchCompat) view.findViewById(R.id.showOnMapToggle);
|
||||
vis.setChecked(app.getSelectedGpxHelper().getSelectedFileByPath(getGpx().path) != null);
|
||||
vis.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
||||
@Override
|
||||
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
|
||||
SelectedGpxFile sf = app.getSelectedGpxHelper().selectGpxFile(getGpx(), vis.isChecked(), false);
|
||||
if (vis.isChecked() && sf.getModifiableGpxFile() != null) {
|
||||
sf.processPoints();
|
||||
updateColorView(colorView);
|
||||
} else {
|
||||
updateColorView(colorView);
|
||||
}
|
||||
}
|
||||
});
|
||||
imageView.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
SelectedGpxFile sf = app.getSelectedGpxHelper().selectGpxFile(getGpx(), vis.isChecked(), false);
|
||||
if (vis.isChecked() && sf.getGpxFile() != null) {
|
||||
final List<GpxDisplayGroup> groups = getOriginalGroups();
|
||||
if (groups.size() > 0 && groups.get(0).getModifiableList().size() > 0) {
|
||||
GpxDisplayItem item = groups.get(0).getModifiableList().get(0);
|
||||
app.getSettings().setMapLocationToShow(item.locationStart.lat, item.locationStart.lon,
|
||||
15,
|
||||
new PointDescription(PointDescription.POINT_TYPE_GPX_ITEM, item.group.getGpxName()),
|
||||
false,
|
||||
item);
|
||||
} else {
|
||||
updateColorView(colorView);
|
||||
}
|
||||
}
|
||||
});
|
||||
imageView.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
SelectedGpxFile sf = app.getSelectedGpxHelper().selectGpxFile(getGpx(), vis.isChecked(), false);
|
||||
if (vis.isChecked() && sf.getGpxFile() != null) {
|
||||
final List<GpxDisplayGroup> groups = getOriginalGroups();
|
||||
if (groups.size() > 0 && groups.get(0).getModifiableList().size() > 0) {
|
||||
GpxDisplayItem item = groups.get(0).getModifiableList().get(0);
|
||||
app.getSettings().setMapLocationToShow(item.locationStart.lat, item.locationStart.lon,
|
||||
GPXUtilities.WptPt wpt = sf.getGpxFile().findPointToShow();
|
||||
if (wpt != null) {
|
||||
app.getSettings().setMapLocationToShow(wpt.getLatitude(), wpt.getLongitude(),
|
||||
15,
|
||||
new PointDescription(PointDescription.POINT_TYPE_GPX_ITEM, item.group.getGpxName()),
|
||||
new PointDescription(PointDescription.POINT_TYPE_WPT, wpt.name),
|
||||
false,
|
||||
item);
|
||||
} else {
|
||||
GPXUtilities.WptPt wpt = sf.getGpxFile().findPointToShow();
|
||||
if (wpt != null) {
|
||||
app.getSettings().setMapLocationToShow(wpt.getLatitude(), wpt.getLongitude(),
|
||||
15,
|
||||
new PointDescription(PointDescription.POINT_TYPE_WPT, wpt.name),
|
||||
false,
|
||||
wpt);
|
||||
}
|
||||
wpt);
|
||||
}
|
||||
MapActivity.launchMapActivityMoveToTop(getMyActivity());
|
||||
}
|
||||
MapActivity.launchMapActivityMoveToTop(getMyActivity());
|
||||
}
|
||||
});
|
||||
updateColorView(colorView);
|
||||
colorView.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
final ListPopupWindow popup = new ListPopupWindow(getActivity());
|
||||
popup.setAnchorView(colorView);
|
||||
popup.setContentWidth(AndroidUtils.dpToPx(app, 200f));
|
||||
popup.setModal(true);
|
||||
popup.setDropDownGravity(Gravity.RIGHT | Gravity.TOP);
|
||||
popup.setVerticalOffset(AndroidUtils.dpToPx(app, -48f));
|
||||
popup.setHorizontalOffset(AndroidUtils.dpToPx(app, -6f));
|
||||
final GpxAppearanceAdapter gpxApprAdapter = new GpxAppearanceAdapter(getActivity(),
|
||||
getGpx().getColor(0), GpxAppearanceAdapterType.TRACK_COLOR);
|
||||
popup.setAdapter(gpxApprAdapter);
|
||||
popup.setOnItemClickListener(new AdapterView.OnItemClickListener() {
|
||||
}
|
||||
});
|
||||
updateColorView(colorView);
|
||||
colorView.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
final ListPopupWindow popup = new ListPopupWindow(getActivity());
|
||||
popup.setAnchorView(colorView);
|
||||
popup.setContentWidth(AndroidUtils.dpToPx(app, 200f));
|
||||
popup.setModal(true);
|
||||
popup.setDropDownGravity(Gravity.RIGHT | Gravity.TOP);
|
||||
popup.setVerticalOffset(AndroidUtils.dpToPx(app, -48f));
|
||||
popup.setHorizontalOffset(AndroidUtils.dpToPx(app, -6f));
|
||||
final GpxAppearanceAdapter gpxApprAdapter = new GpxAppearanceAdapter(getActivity(),
|
||||
getGpx().getColor(0), GpxAppearanceAdapterType.TRACK_COLOR);
|
||||
popup.setAdapter(gpxApprAdapter);
|
||||
popup.setOnItemClickListener(new AdapterView.OnItemClickListener() {
|
||||
|
||||
@Override
|
||||
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
|
||||
AppearanceListItem item = gpxApprAdapter.getItem(position);
|
||||
if (item != null) {
|
||||
if (item.getAttrName() == CURRENT_TRACK_COLOR_ATTR) {
|
||||
int clr = item.getColor();
|
||||
if (vis.isChecked()) {
|
||||
SelectedGpxFile sf = app.getSelectedGpxHelper().selectGpxFile(getGpx(), vis.isChecked(), false);
|
||||
if (clr != 0 && sf.getModifiableGpxFile() != null) {
|
||||
sf.getModifiableGpxFile().setColor(clr);
|
||||
app.getGpxDatabase().updateColor(getGpxDataItem(), clr);
|
||||
}
|
||||
} else {
|
||||
@Override
|
||||
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
|
||||
AppearanceListItem item = gpxApprAdapter.getItem(position);
|
||||
if (item != null) {
|
||||
if (item.getAttrName() == CURRENT_TRACK_COLOR_ATTR) {
|
||||
int clr = item.getColor();
|
||||
if (vis.isChecked()) {
|
||||
SelectedGpxFile sf = app.getSelectedGpxHelper().selectGpxFile(getGpx(), vis.isChecked(), false);
|
||||
if (clr != 0 && sf.getModifiableGpxFile() != null) {
|
||||
sf.getModifiableGpxFile().setColor(clr);
|
||||
app.getGpxDatabase().updateColor(getGpxDataItem(), clr);
|
||||
}
|
||||
} else {
|
||||
app.getGpxDatabase().updateColor(getGpxDataItem(), clr);
|
||||
}
|
||||
}
|
||||
popup.dismiss();
|
||||
updateColorView(colorView);
|
||||
}
|
||||
});
|
||||
popup.show();
|
||||
}
|
||||
});
|
||||
popup.dismiss();
|
||||
updateColorView(colorView);
|
||||
}
|
||||
});
|
||||
popup.show();
|
||||
}
|
||||
});
|
||||
|
||||
if (adapter.getCount() > 0) {
|
||||
prepareSplitIntervalAdapterData();
|
||||
setupSplitIntervalView(splitIntervalView);
|
||||
updateSplitIntervalView(splitIntervalView);
|
||||
|
@ -320,6 +322,9 @@ public class TrackSegmentFragment extends OsmAndListFragment {
|
|||
popup.show();
|
||||
}
|
||||
});
|
||||
} else {
|
||||
splitColorView.setVisibility(View.GONE);
|
||||
divider.setVisibility(View.GONE);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -518,14 +523,12 @@ public class TrackSegmentFragment extends OsmAndListFragment {
|
|||
|
||||
final OsmandSettings settings = app.getSettings();
|
||||
LatLon location = new LatLon(child.locationStart.lat, child.locationStart.lon);
|
||||
|
||||
if (child.group.getType() == GpxDisplayItemType.TRACK_POINTS) {
|
||||
settings.setMapLocationToShow(location.getLatitude(), location.getLongitude(),
|
||||
settings.setMapLocationToShow(location.getLatitude(), location.getLongitude(),
|
||||
settings.getLastKnownMapZoom(),
|
||||
new PointDescription(PointDescription.POINT_TYPE_WPT, child.locationStart.name),
|
||||
new PointDescription(PointDescription.POINT_TYPE_GPX_ITEM, child.group.getGpxName()),
|
||||
false,
|
||||
child.locationStart);
|
||||
}
|
||||
child);
|
||||
|
||||
MapActivity.launchMapActivityMoveToTop(getActivity());
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue