Updated tracks card on dashboard. Added current track for tracks in my places.
This commit is contained in:
parent
5587f506ea
commit
9dda58934c
14 changed files with 316 additions and 189 deletions
|
@ -1,24 +1,34 @@
|
|||
<?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="match_parent">
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical">
|
||||
|
||||
<LinearLayout android:id="@+id/current_track"
|
||||
android:orientation="vertical"
|
||||
<LinearLayout
|
||||
android:id="@+id/current_track"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
android:layout_height="wrap_content"
|
||||
android:background="?attr/card_bg"
|
||||
android:orientation="vertical">
|
||||
|
||||
<include android:layout_height="wrap_content"
|
||||
android:layout_width="match_parent"
|
||||
layout="@layout/dash_gpx_track_item"/>
|
||||
<include
|
||||
layout="@layout/dash_gpx_track_item"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"/>
|
||||
|
||||
<Button android:id="@+id/map_btn"
|
||||
android:text="@string/back_to_map"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"/>
|
||||
<View
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dp"
|
||||
android:background="?attr/dashboard_divider"/>
|
||||
|
||||
</LinearLayout>
|
||||
<Button
|
||||
android:id="@+id/map_btn"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="?attr/expandable_list_item_background"
|
||||
android:text="@string/back_to_map"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
|
||||
<ExpandableListView
|
||||
|
@ -26,11 +36,11 @@
|
|||
style="@style/OsmandListView"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="0dp"
|
||||
android:background="?attr/expandable_list_background"
|
||||
android:layout_marginLeft="0dp"
|
||||
android:layout_marginRight="0dp"
|
||||
android:layout_marginTop="0dp"
|
||||
android:layout_weight="1"
|
||||
android:background="?attr/expandable_list_background"
|
||||
android:groupIndicator="@android:color/transparent"/>
|
||||
|
||||
|
||||
|
|
|
@ -77,7 +77,7 @@
|
|||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_marginLeft="4dp"
|
||||
android:textColor="@color/dashboard_descr_colol"
|
||||
android:textColor="@color/icon_color_light"
|
||||
android:textSize="@dimen/showAllButtonTextSize"/>
|
||||
</LinearLayout>
|
||||
|
||||
|
|
|
@ -1,73 +1,103 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:orientation="vertical"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="@dimen/dashListItemHeight">
|
||||
<View android:layout_width="match_parent"
|
||||
android:background="?attr/dashboard_divider"
|
||||
android:layout_height="1dp"/>
|
||||
<LinearLayout android:orientation="horizontal"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
<LinearLayout android:orientation="vertical"
|
||||
android:layout_width="0dp"
|
||||
android:layout_weight="1"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_marginLeft="@dimen/subHeaderMarginLeft"
|
||||
android:layout_marginRight="@dimen/showAllButtonMarginRight"
|
||||
android:layout_height="wrap_content">
|
||||
<TextView android:id="@+id/name"
|
||||
android:textColor="?android:textColorPrimary"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"/>
|
||||
<LinearLayout android:orientation="horizontal"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
<ImageView android:id="@+id/points_icon"
|
||||
android:src="@drawable/ic_small_point"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"/>
|
||||
<TextView android:id="@+id/points_count"
|
||||
android:textColor="@color/dashboard_descr_colol"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"/>
|
||||
android:layout_height="wrap_content"
|
||||
android:minHeight="@dimen/dashListItemHeight"
|
||||
android:orientation="vertical">
|
||||
|
||||
<ImageView android:id="@+id/distance_icon"
|
||||
android:src="@drawable/ic_small_distance"
|
||||
android:layout_marginLeft="@dimen/dashPluginMargin"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"/>
|
||||
<TextView android:id="@+id/distance"
|
||||
android:textColor="@color/dashboard_descr_colol"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"/>
|
||||
<View
|
||||
android:id="@+id/divider"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dp"
|
||||
android:background="?attr/dashboard_divider"/>
|
||||
|
||||
<ImageView android:id="@+id/time_icon"
|
||||
android:src="@drawable/ic_small_time"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"/>
|
||||
<TextView android:id="@+id/time"
|
||||
android:textColor="@color/dashboard_descr_colol"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"/>
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_marginLeft="@dimen/subHeaderMarginLeft"
|
||||
android:layout_marginRight="@dimen/showAllButtonMarginRight"
|
||||
android:layout_weight="1"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/name"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textColor="?android:textColorPrimary"
|
||||
tools:text="@string/validate_gpx_upload_name_pwd"/>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/points_icon"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:src="@drawable/ic_small_point"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/points_count"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textColor="@color/icon_color_light"/>
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/distance_icon"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_marginLeft="@dimen/dashPluginMargin"
|
||||
android:src="@drawable/ic_small_distance"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/distance"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textColor="@color/icon_color_light"/>
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/time_icon"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:src="@drawable/ic_small_time"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/time"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textColor="@color/icon_color_light"/>
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
|
||||
<ImageButton android:id="@+id/stop"
|
||||
android:visibility="gone"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:background="?attr/dashboard_button"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"/>
|
||||
<ImageButton
|
||||
android:id="@+id/stop"
|
||||
android:layout_width="@dimen/dashListItemHeight"
|
||||
android:layout_height="@dimen/dashListItemHeight"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_marginRight="@dimen/favorites_icon_right_margin"
|
||||
android:background="?attr/options_button_background"
|
||||
android:src="@drawable/ic_action_rec_stop"
|
||||
android:visibility="gone"
|
||||
tools:visibility="visible"/>
|
||||
|
||||
<ImageButton android:id="@+id/show_on_map"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:background="?attr/dashboard_button"
|
||||
android:layout_width="@dimen/dashListItemHeight"
|
||||
android:layout_height="@dimen/dashListItemHeight"/>
|
||||
<ImageButton
|
||||
android:id="@+id/show_on_map"
|
||||
android:layout_width="@dimen/dashListItemHeight"
|
||||
android:layout_height="@dimen/dashListItemHeight"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:background="?attr/options_button_background"
|
||||
android:src="@drawable/ic_action_gsave_dark"/>
|
||||
</LinearLayout>
|
||||
|
||||
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:maxLines="3"
|
||||
android:textColor="@color/dashboard_descr_colol"
|
||||
android:textColor="@color/icon_color_light"
|
||||
android:text="@string/loading_data"
|
||||
android:textSize="@dimen/dashProgressTextSize"/>
|
||||
</LinearLayout>
|
||||
|
|
|
@ -84,7 +84,7 @@
|
|||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_marginLeft="4dp"
|
||||
android:textColor="@color/dashboard_descr_colol"
|
||||
android:textColor="@color/icon_color_light"
|
||||
android:textSize="@dimen/showAllButtonTextSize"/>
|
||||
</LinearLayout>
|
||||
|
||||
|
|
|
@ -5,72 +5,85 @@
|
|||
android:layout_height="wrap_content"
|
||||
android:background="?attr/expandable_list_item_background"
|
||||
android:minHeight="@dimen/list_item_height"
|
||||
android:orientation="horizontal"
|
||||
android:orientation="vertical"
|
||||
android:paddingLeft="@dimen/list_content_padding">
|
||||
|
||||
<CheckBox
|
||||
android:id="@+id/check_local_index"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_marginRight="@dimen/local_index_check_right_margin"
|
||||
android:focusable="false"
|
||||
android:visibility="gone"/>
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/icon"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_marginRight="@dimen/favorites_icon_right_margin"
|
||||
android:focusable="false"
|
||||
android:src="@drawable/ic_sdcard"/>
|
||||
<View
|
||||
android:id="@+id/divider"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dp"
|
||||
android:visibility="gone"
|
||||
android:background="?attr/dashboard_divider"/>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_weight="1"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/name"
|
||||
style="@style/ListText.Small"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
<CheckBox
|
||||
android:id="@+id/check_local_index"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:maxLines="1"
|
||||
android:ellipsize="end"
|
||||
tools:text="@string/app_version"/>
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_marginRight="@dimen/local_index_check_right_margin"
|
||||
android:focusable="false"
|
||||
android:visibility="gone"/>
|
||||
|
||||
|
||||
<TextView
|
||||
android:id="@+id/descr"
|
||||
<ImageView
|
||||
android:id="@+id/icon"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center_vertical"
|
||||
android:textSize="@dimen/download_descr_text_size"
|
||||
android:maxLines="25"
|
||||
tools:text="@string/app_mode_aircraft"/>
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_marginRight="@dimen/favorites_icon_right_margin"
|
||||
android:focusable="false"
|
||||
android:src="@drawable/ic_sdcard"/>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_weight="1"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/name"
|
||||
style="@style/ListText.Small"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:maxLines="1"
|
||||
android:ellipsize="end"
|
||||
tools:text="@string/app_version"/>
|
||||
|
||||
|
||||
</LinearLayout>
|
||||
<TextView
|
||||
android:id="@+id/descr"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center_vertical"
|
||||
android:textSize="@dimen/download_descr_text_size"
|
||||
android:maxLines="25"
|
||||
tools:text="@string/app_mode_aircraft"/>
|
||||
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<ImageButton
|
||||
android:id="@+id/options"
|
||||
android:layout_width="@dimen/list_item_height"
|
||||
android:layout_height="@dimen/list_item_height"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:background="?attr/options_button_background"
|
||||
android:focusable="false"
|
||||
android:src="?attr/list_settings_icon"/>
|
||||
|
||||
<ImageButton
|
||||
android:id="@+id/play"
|
||||
android:layout_width="@dimen/dashListItemHeight"
|
||||
android:layout_height="@dimen/dashListItemHeight"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_marginLeft="@dimen/dashFavIconMargin"
|
||||
android:background="?attr/dashboard_button"
|
||||
android:src="@drawable/ic_play_light"/>
|
||||
</LinearLayout>
|
||||
|
||||
<ImageButton
|
||||
android:id="@+id/options"
|
||||
android:layout_width="@dimen/list_item_height"
|
||||
android:layout_height="@dimen/list_item_height"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:background="?attr/options_button_background"
|
||||
android:focusable="false"
|
||||
android:src="?attr/list_settings_icon"/>
|
||||
|
||||
<ImageButton
|
||||
android:id="@+id/play"
|
||||
android:layout_width="@dimen/dashListItemHeight"
|
||||
android:layout_height="@dimen/dashListItemHeight"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_marginLeft="@dimen/dashFavIconMargin"
|
||||
android:background="?attr/dashboard_button"
|
||||
android:src="@drawable/ic_play_light"/>
|
||||
|
||||
</LinearLayout>
|
|
@ -20,7 +20,9 @@
|
|||
<color name="search_background_dark">#292f33</color>
|
||||
|
||||
|
||||
<color name="dashboard_descr_colol">#727272</color>
|
||||
<color name="icon_color_light">#727272</color>
|
||||
|
||||
<color name="dashboard_gpx_on_map">#448AFF</color>
|
||||
<color name="dashboard_background">#eaeaea</color>
|
||||
<color name="dashboard_divider_light">#F0F0F0</color>
|
||||
<color name="dashboard_divider_dark">#3d474c</color>
|
||||
|
|
|
@ -48,6 +48,7 @@ public abstract class ActionBarPreferenceActivity extends PreferenceActivity {
|
|||
}
|
||||
tb.setClickable(true);
|
||||
Drawable back = getResources().getDrawable(R.drawable.abc_ic_ab_back_mtrl_am_alpha);
|
||||
back.mutate();
|
||||
back.setColorFilter(0xffffffff, PorterDuff.Mode.MULTIPLY);
|
||||
tb.setNavigationIcon(back);
|
||||
tb.setBackgroundColor(getResources().getColor(getResIdFromAttribute(this, R.attr.pstsTabBackground)));
|
||||
|
|
|
@ -37,7 +37,9 @@ import android.content.Context;
|
|||
import android.content.DialogInterface;
|
||||
import android.content.Intent;
|
||||
import android.content.res.TypedArray;
|
||||
import android.graphics.PorterDuff;
|
||||
import android.graphics.Typeface;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.net.Uri;
|
||||
import android.os.AsyncTask;
|
||||
import android.os.Bundle;
|
||||
|
@ -111,27 +113,9 @@ public class AvailableGPXFragment extends OsmandExpandableListFragment {
|
|||
asyncLoader = new LoadGpxTask();
|
||||
asyncLoader.execute(getActivity());
|
||||
}
|
||||
OsmandMonitoringPlugin plugin = OsmandPlugin.getEnabledPlugin(OsmandMonitoringPlugin.class);
|
||||
GpxSelectionHelper.SelectedGpxFile currentTrack = savingTrackHelper.getCurrentTrack();
|
||||
View v = getView();
|
||||
if (v == null){
|
||||
return;
|
||||
}
|
||||
if (plugin != null && savingTrackHelper.getCurrentGpx() != null) {
|
||||
|
||||
updateCurrentTrack(getView());
|
||||
|
||||
v.findViewById(R.id.current_track).setVisibility(View.VISIBLE);
|
||||
((TextView)v.findViewById(R.id.name)).setText(R.string.currently_recording_track);
|
||||
String description = GpxUiHelper.getDescription(getMyApplication(), currentTrack.getGpxFile(), null, true);
|
||||
int startindex = description.indexOf(">");
|
||||
int endindex = description.indexOf("</font>");
|
||||
String distnace = description.substring(startindex + 1, endindex);
|
||||
((TextView)v.findViewById(R.id.distance)).setText(distnace);
|
||||
v.findViewById(R.id.time_icon).setVisibility(View.GONE);
|
||||
} else {
|
||||
v.findViewById(R.id.current_track).setVisibility(View.GONE);
|
||||
}
|
||||
//TODO implement updating view of current track
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -142,6 +126,24 @@ public class AvailableGPXFragment extends OsmandExpandableListFragment {
|
|||
}
|
||||
}
|
||||
|
||||
private void updateCurrentTrack(View v){
|
||||
if (v == null){
|
||||
return;
|
||||
}
|
||||
OsmandMonitoringPlugin plugin = OsmandPlugin.getEnabledPlugin(OsmandMonitoringPlugin.class);
|
||||
|
||||
GpxSelectionHelper.SelectedGpxFile currentTrack = savingTrackHelper.getCurrentTrack();
|
||||
if (plugin != null && savingTrackHelper.getCurrentGpx() != null) {
|
||||
v.findViewById(R.id.current_track).setVisibility(View.VISIBLE);
|
||||
String description = GpxUiHelper.getDescription(getMyApplication(), currentTrack.getGpxFile(), null, true);
|
||||
int startindex = description.indexOf(">");
|
||||
int endindex = description.indexOf("</font>");
|
||||
String distance = description.substring(startindex + 1, endindex);
|
||||
((TextView)v.findViewById(R.id.distance)).setText(distance);
|
||||
} else {
|
||||
v.findViewById(R.id.current_track).setVisibility(View.GONE);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
|
||||
|
@ -150,6 +152,29 @@ public class AvailableGPXFragment extends OsmandExpandableListFragment {
|
|||
if(this.adapter != null) {
|
||||
listView.setAdapter(this.adapter);
|
||||
}
|
||||
|
||||
((TextView)v.findViewById(R.id.name)).setText(R.string.currently_recording_track);
|
||||
v.findViewById(R.id.time_icon).setVisibility(View.GONE);
|
||||
|
||||
Drawable icon = getResources().getDrawable(R.drawable.ic_action_rec_stop);
|
||||
icon.mutate();
|
||||
boolean light = getMyApplication().getSettings().isLightContent();
|
||||
if (light){
|
||||
icon.setColorFilter(0xff727272, PorterDuff.Mode.MULTIPLY);
|
||||
}
|
||||
ImageButton stop = ((ImageButton)v.findViewById(R.id.stop));
|
||||
stop.setImageDrawable(icon);
|
||||
stop.setVisibility(View.VISIBLE);
|
||||
|
||||
icon = getResources().getDrawable(R.drawable.ic_action_gsave_dark);
|
||||
icon.mutate();
|
||||
if (light) {
|
||||
icon.setColorFilter(0xff727272, PorterDuff.Mode.MULTIPLY);
|
||||
}
|
||||
ImageButton save = ((ImageButton)v.findViewById(R.id.show_on_map));
|
||||
v.findViewById(R.id.divider).setVisibility(View.GONE);
|
||||
save.setImageDrawable(icon);
|
||||
updateCurrentTrack(v);
|
||||
return v;
|
||||
}
|
||||
|
||||
|
@ -225,7 +250,7 @@ public class AvailableGPXFragment extends OsmandExpandableListFragment {
|
|||
}
|
||||
};
|
||||
optionsMenuAdapter.item(R.string.show_gpx_route)
|
||||
.icons(R.drawable.ic_action_map_marker_dark, R.drawable.ic_action_map_marker_dark).listen(listener).reg();
|
||||
.icons(R.drawable.ic_show_on_map, R.drawable.ic_show_on_map).listen(listener).reg();
|
||||
optionsMenuAdapter.item(R.string.local_index_mi_delete)
|
||||
.icons(R.drawable.ic_action_delete_dark, R.drawable.ic_action_delete_dark).listen(listener).reg();
|
||||
optionsMenuAdapter.item(R.string.local_index_mi_reload)
|
||||
|
@ -532,26 +557,6 @@ public class AvailableGPXFragment extends OsmandExpandableListFragment {
|
|||
}
|
||||
}
|
||||
|
||||
private void showContextMenu(final GpxInfo info) {
|
||||
Builder builder = new AlertDialog.Builder(getActivity());
|
||||
final ContextMenuAdapter adapter = new ContextMenuAdapter(getActivity());
|
||||
basicFileOperation(info, adapter);
|
||||
|
||||
String[] values = adapter.getItemNames();
|
||||
builder.setItems(values, new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
OnContextMenuClick clk = adapter.getClickAdapter(which);
|
||||
if (clk != null) {
|
||||
clk.onContextMenuClick(null, adapter.getElementId(which), which, false);
|
||||
}
|
||||
}
|
||||
|
||||
});
|
||||
builder.show();
|
||||
}
|
||||
|
||||
|
||||
public class LoadGpxTask extends AsyncTask<Activity, GpxInfo, List<GpxInfo>> {
|
||||
|
||||
private List<GpxInfo> result;
|
||||
|
@ -915,8 +920,13 @@ public class AvailableGPXFragment extends OsmandExpandableListFragment {
|
|||
boolean light = getMyApplication().getSettings().isLightContent();
|
||||
final PopupMenu optionsMenu = new PopupMenu(getActivity(), v);
|
||||
DirectionsDialogs.setupPopUpMenuIcon(optionsMenu);
|
||||
Drawable showIcon = getResources().getDrawable(R.drawable.ic_show_on_map);
|
||||
if (light) {
|
||||
showIcon.mutate();
|
||||
showIcon.setColorFilter(getResources().getColor(R.color.icon_color_light), PorterDuff.Mode.MULTIPLY);
|
||||
}
|
||||
MenuItem item = optionsMenu.getMenu().add(R.string.show_gpx_route)
|
||||
.setIcon(light ? R.drawable.ic_action_map_marker_light : R.drawable.ic_action_map_marker_dark);
|
||||
.setIcon(showIcon);
|
||||
item.setOnMenuItemClickListener(new MenuItem.OnMenuItemClickListener() {
|
||||
@Override
|
||||
public boolean onMenuItemClick(MenuItem item) {
|
||||
|
|
|
@ -38,10 +38,12 @@ public class FavoritesActivity extends TabActivity {
|
|||
// private static final String FAVOURITES_INFO = "FAVOURITES_INFO";
|
||||
private static final String TRACKS = "TRACKS";
|
||||
// private static final String SELECTED_TRACK = "SELECTED_TRACK";
|
||||
// public static int FAVORITES_TAB = 0;
|
||||
// public static int GPX_TAB = 1;
|
||||
// public static int SELECTED_GPX_TAB = 2;
|
||||
// public static String TAB_PARAM = "TAB_PARAM";
|
||||
public static int FAVORITES_TAB = 0;
|
||||
public static int GPX_TAB = 1;
|
||||
public static int SELECTED_GPX_TAB = 2;
|
||||
public static int NOTES_TAB = 3;
|
||||
public static int OSM_EDITS_TAB = 4;
|
||||
public static String TAB_PARAM = "TAB_PARAM";
|
||||
protected List<WeakReference<Fragment>> fragList = new ArrayList<WeakReference<Fragment>>();
|
||||
|
||||
@Override
|
||||
|
@ -78,10 +80,18 @@ public class FavoritesActivity extends TabActivity {
|
|||
OsmandPlugin.addMyPlacesTabPlugins(this, mTabs, getIntent());
|
||||
|
||||
Integer tab = settings.FAVORITES_TAB.get();
|
||||
if (tab == NOTES_TAB) {
|
||||
tab = mTabs.size() -1;
|
||||
} else if (tab == OSM_EDITS_TAB) {
|
||||
//TODO implement method of counting position for other plugins
|
||||
}
|
||||
|
||||
setViewPagerAdapter(mViewPager, mTabs);
|
||||
mSlidingTabLayout.setViewPager(mViewPager);
|
||||
|
||||
if (tab > mTabs.size() - 1){
|
||||
tab = 0;
|
||||
}
|
||||
mViewPager.setCurrentItem(tab);
|
||||
updateSelectedTracks();
|
||||
// setupHomeButton();
|
||||
|
|
|
@ -947,7 +947,7 @@ public class AudioVideoNotesPlugin extends OsmandPlugin {
|
|||
if (getAllRecordings().size() > 0) {
|
||||
mTabs.add(favoritesActivity.getTabIndicator(R.string.notes, NotesFragment.class));
|
||||
if (intent != null && "AUDIO".equals(intent.getStringExtra("TAB"))) {
|
||||
app.getSettings().FAVORITES_TAB.set(mTabs.size() - 1);
|
||||
app.getSettings().FAVORITES_TAB.set(FavoritesActivity.NOTES_TAB);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -49,6 +49,7 @@ public class DashAudioVideoNotesFragment extends DashBaseFragment {
|
|||
final Intent favorites = new Intent(activity, fa);
|
||||
favorites.putExtra("TAB", "AUDIO");
|
||||
favorites.setFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT);
|
||||
getMyApplication().getSettings().FAVORITES_TAB.set(FavoritesActivity.NOTES_TAB);
|
||||
activity.startActivity(favorites);
|
||||
}
|
||||
});
|
||||
|
@ -104,6 +105,7 @@ public class DashAudioVideoNotesFragment extends DashBaseFragment {
|
|||
}
|
||||
});
|
||||
view.findViewById(R.id.options).setVisibility(View.GONE);
|
||||
view.findViewById(R.id.divider).setVisibility(View.VISIBLE);
|
||||
view.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
|
|
|
@ -13,6 +13,7 @@ import net.osmand.plus.FavouritesDbHelper;
|
|||
import net.osmand.plus.OsmAndAppCustomization;
|
||||
import net.osmand.plus.OsmAndFormatter;
|
||||
import net.osmand.plus.R;
|
||||
import net.osmand.plus.activities.FavoritesActivity;
|
||||
import net.osmand.plus.activities.MapActivity;
|
||||
import net.osmand.plus.base.FavoriteImageDrawable;
|
||||
import net.osmand.plus.dialogs.DirectionsDialogs;
|
||||
|
@ -56,6 +57,7 @@ public class DashFavoritesFragment extends DashLocationFragment implements Favou
|
|||
OsmAndAppCustomization appCustomization = getMyApplication().getAppCustomization();
|
||||
final Intent favorites = new Intent(activity, appCustomization.getFavoritesActivity());
|
||||
favorites.setFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT);
|
||||
getMyApplication().getSettings().FAVORITES_TAB.set(FavoritesActivity.FAVORITES_TAB);
|
||||
activity.startActivity(favorites);
|
||||
}
|
||||
});
|
||||
|
|
|
@ -4,15 +4,23 @@ import java.io.File;
|
|||
import java.util.List;
|
||||
|
||||
import net.osmand.IndexConstants;
|
||||
import net.osmand.access.AccessibleToast;
|
||||
import net.osmand.plus.GPXUtilities;
|
||||
import net.osmand.plus.GpxSelectionHelper;
|
||||
import net.osmand.plus.OsmAndAppCustomization;
|
||||
import net.osmand.plus.OsmandSettings;
|
||||
import net.osmand.plus.R;
|
||||
import net.osmand.plus.activities.FavoritesActivity;
|
||||
import net.osmand.plus.activities.MapActivity;
|
||||
import net.osmand.plus.dashboard.DashBaseFragment;
|
||||
import net.osmand.plus.helpers.FontCache;
|
||||
import net.osmand.plus.helpers.GpxUiHelper;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.Intent;
|
||||
import android.graphics.PorterDuff;
|
||||
import android.graphics.Typeface;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.os.Bundle;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
|
@ -21,6 +29,7 @@ import android.widget.Button;
|
|||
import android.widget.ImageButton;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
|
||||
/**
|
||||
* Created by Denis
|
||||
|
@ -43,6 +52,7 @@ public class DashTrackFragment extends DashBaseFragment {
|
|||
Activity activity = getActivity();
|
||||
OsmAndAppCustomization appCustomization = getMyApplication().getAppCustomization();
|
||||
final Intent favorites = new Intent(activity, appCustomization.getFavoritesActivity());
|
||||
getMyApplication().getSettings().FAVORITES_TAB.set(FavoritesActivity.GPX_TAB);
|
||||
favorites.setFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT);
|
||||
activity.startActivity(favorites);
|
||||
}
|
||||
|
@ -62,7 +72,7 @@ public class DashTrackFragment extends DashBaseFragment {
|
|||
final List<String> list = GpxUiHelper.getSortedGPXFilenames(dir);
|
||||
|
||||
|
||||
if (list.size() == 0){
|
||||
if (list.size() == 0) {
|
||||
(mainView.findViewById(R.id.main_fav)).setVisibility(View.GONE);
|
||||
return;
|
||||
} else {
|
||||
|
@ -71,32 +81,69 @@ public class DashTrackFragment extends DashBaseFragment {
|
|||
|
||||
LinearLayout tracks = (LinearLayout) mainView.findViewById(R.id.items);
|
||||
tracks.removeAllViews();
|
||||
if (list.size() > 3){
|
||||
while (list.size() != 3){
|
||||
if (list.size() > 3) {
|
||||
while (list.size() != 3) {
|
||||
list.remove(3);
|
||||
}
|
||||
}
|
||||
|
||||
for (String filename : list){
|
||||
for (String filename : list) {
|
||||
final File f = new File(dir, filename);
|
||||
GPXUtilities.GPXFile res = GPXUtilities.loadGPXFile(getMyApplication(), f);
|
||||
final GPXUtilities.GPXFile res = GPXUtilities.loadGPXFile(getMyApplication(), f);
|
||||
LayoutInflater inflater = getActivity().getLayoutInflater();
|
||||
View view = inflater.inflate(R.layout.dash_gpx_track_item, null, false);
|
||||
((TextView)view.findViewById(R.id.name)).setText(filename);
|
||||
((TextView)view.findViewById(R.id.points_count)).
|
||||
((TextView) view.findViewById(R.id.name)).setText(filename);
|
||||
((TextView) view.findViewById(R.id.points_count)).
|
||||
setText(res.points.size() + " " + getActivity().getString(R.string.points));
|
||||
String description = GpxUiHelper.getDescription(getMyApplication(), res, f, true);
|
||||
int startindex = description.indexOf(">");
|
||||
int endindex = description.indexOf("</font>");
|
||||
String distnace = description.substring(startindex + 1, endindex);
|
||||
((TextView)view.findViewById(R.id.distance)).
|
||||
((TextView) view.findViewById(R.id.distance)).
|
||||
setText(distnace);
|
||||
view.findViewById(R.id.time_icon).setVisibility(View.GONE);
|
||||
|
||||
boolean light = getMyApplication().getSettings().isLightContent();
|
||||
Drawable icon = getResources().getDrawable(R.drawable.ic_show_on_map);
|
||||
GpxSelectionHelper gpxSelectionHelper = getMyApplication().getSelectedGpxHelper();
|
||||
boolean isShowingOnMap = gpxSelectionHelper.getSelectedFileByName(filename) != null;
|
||||
//setting proper icon color
|
||||
if (isShowingOnMap) {
|
||||
icon.mutate();
|
||||
if (light) {
|
||||
icon.setColorFilter(getResources().getColor(R.color.dashboard_gpx_on_map), PorterDuff.Mode.MULTIPLY);
|
||||
} else {
|
||||
icon.setColorFilter(getResources().getColor(R.color.color_distance), PorterDuff.Mode.MULTIPLY);
|
||||
}
|
||||
} else if (light) {
|
||||
icon.mutate();
|
||||
icon.setColorFilter(getResources().getColor(R.color.icon_color_light), PorterDuff.Mode.MULTIPLY);
|
||||
|
||||
}
|
||||
final ImageButton showOnMap = (ImageButton) view.findViewById(R.id.show_on_map);
|
||||
showOnMap.setImageDrawable(icon);
|
||||
showOnMap.setVisibility(View.VISIBLE);
|
||||
//view.findViewById(R.id.distance_icon).setVisibility(View.GONE);
|
||||
view.findViewById(R.id.stop).setVisibility(View.GONE);
|
||||
((ImageButton)view.findViewById(R.id.show_on_map)).
|
||||
setImageDrawable(getResources().getDrawable(R.drawable.ic_action_map));
|
||||
view.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
showOnMap(res);
|
||||
}
|
||||
});
|
||||
tracks.addView(view);
|
||||
}
|
||||
}
|
||||
|
||||
private void showOnMap(GPXUtilities.GPXFile file){
|
||||
if (file.isEmpty()) {
|
||||
AccessibleToast.makeText(getActivity(), R.string.gpx_file_is_empty, Toast.LENGTH_LONG).show();
|
||||
return;
|
||||
}
|
||||
|
||||
OsmandSettings settings = getMyApplication().getSettings();
|
||||
settings.setMapLocationToShow(file.getLastPoint().lat, file.getLastPoint().lon, settings.getLastKnownMapZoom());
|
||||
getMyApplication().getSelectedGpxHelper().setGpxFileToDisplay(file);
|
||||
MapActivity.launchMapActivityMoveToTop(getActivity());
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue