Merge remote-tracking branch 'origin/master'
This commit is contained in:
commit
048297c4ed
14 changed files with 237 additions and 298 deletions
|
@ -34,6 +34,7 @@
|
|||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="?attr/card_bg"
|
||||
android:visibility="gone"
|
||||
android:orientation="vertical">
|
||||
|
||||
<LinearLayout
|
||||
|
|
|
@ -17,6 +17,27 @@
|
|||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal">
|
||||
|
||||
|
||||
<CheckBox
|
||||
android:id="@+id/check_local_index"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:focusable="false"
|
||||
android:visibility="gone"
|
||||
android:layout_marginLeft="@dimen/local_index_check_right_margin"
|
||||
android:layout_marginTop="@dimen/favorites_icon_top_margin"/>
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/icon"
|
||||
android:src="@drawable/ic_gpx_track"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:visibility="gone"
|
||||
android:layout_marginLeft="@dimen/list_content_padding"
|
||||
android:layout_marginTop="@dimen/favorites_icon_top_margin"
|
||||
android:focusable="false"/>
|
||||
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
|
@ -36,6 +57,8 @@
|
|||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:id="@+id/read_section"
|
||||
android:visibility="visible"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<ImageView
|
||||
|
@ -43,25 +66,28 @@
|
|||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_marginRight="@dimen/gpx_small_icon_margin"
|
||||
android:src="@drawable/ic_small_point"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/points_count"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginRight="@dimen/gpx_small_text_margin"
|
||||
android:textColor="@color/icon_color_light"/>
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/distance_icon"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginRight="@dimen/gpx_small_icon_margin"
|
||||
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_marginRight="@dimen/gpx_small_text_margin"
|
||||
android:layout_height="wrap_content"
|
||||
android:textColor="@color/icon_color_light"/>
|
||||
|
||||
|
@ -70,37 +96,73 @@
|
|||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_marginRight="@dimen/gpx_small_icon_margin"
|
||||
android:src="@drawable/ic_small_time"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/time"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginRight="@dimen/gpx_small_text_margin"
|
||||
android:textColor="@color/icon_color_light"/>
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:id="@+id/unknown_section"
|
||||
android:visibility="gone"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/date_and_size_details"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textColor="@color/icon_color_light"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
|
||||
<TextView
|
||||
android:id="@+id/description"
|
||||
android:visibility="gone"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textColor="?android:textColorPrimary"/>
|
||||
</LinearLayout>
|
||||
|
||||
<ImageButton
|
||||
android:id="@+id/stop"
|
||||
android:visibility="gone"
|
||||
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:visibility="gone"
|
||||
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"/>
|
||||
|
||||
<ImageButton
|
||||
android:id="@+id/options"
|
||||
android:visibility="gone"
|
||||
android:layout_width="@dimen/list_item_height"
|
||||
android:layout_height="@dimen/list_item_height"
|
||||
android:background="?attr/options_button_background"
|
||||
android:focusable="false"
|
||||
android:src="?attr/list_settings_icon"/>
|
||||
|
||||
<!--
|
||||
<include layout="@layout/check_item_rel" />
|
||||
-->
|
||||
</LinearLayout>
|
||||
|
||||
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
|
||||
<ImageView
|
||||
android:id="@+id/icon"
|
||||
android:src="@drawable/ic_sdcard"
|
||||
android:src="@drawable/ic_gpx_track"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginRight="@dimen/favorites_icon_right_margin"
|
||||
|
|
|
@ -20,6 +20,6 @@
|
|||
android:id="@+id/bottomControls"
|
||||
android:background="?attr/bottomToolBarColor"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="@dimen/bottom_tool_bar_size"/>
|
||||
android:layout_height="wrap_content"/>
|
||||
|
||||
</LinearLayout>
|
|
@ -40,6 +40,8 @@
|
|||
<dimen name="dialog_content_bottom_margin">16dp</dimen>
|
||||
<dimen name="local_size_height">34dp</dimen>
|
||||
<dimen name="favorite_icon_size">24dp</dimen>
|
||||
<dimen name="gpx_small_icon_margin">3dp</dimen>
|
||||
<dimen name="gpx_small_text_margin">14dp</dimen>
|
||||
|
||||
<!-- TextSizes -->
|
||||
<dimen name="list_header_text_size">14sp</dimen>
|
||||
|
|
|
@ -207,19 +207,6 @@ public class GPXUtilities {
|
|||
return maxElevation != -100;
|
||||
}
|
||||
|
||||
public int getTimeHours(long time) {
|
||||
return (int) ((time / 1000) / 3600);
|
||||
}
|
||||
|
||||
|
||||
public int getTimeSeconds(long time) {
|
||||
return (int) ((time / 1000) % 60);
|
||||
}
|
||||
|
||||
public int getTimeMinutes(long time) {
|
||||
return (int) (((time / 1000) / 60) % 60);
|
||||
}
|
||||
|
||||
public boolean isSpeedSpecified() {
|
||||
return avgSpeed > 0;
|
||||
}
|
||||
|
|
|
@ -401,6 +401,7 @@ public class GpxSelectionHelper {
|
|||
private boolean showCurrentTrack;
|
||||
private GPXFile gpxFile;
|
||||
private int color;
|
||||
private GPXTrackAnalysis trackAnalysis;
|
||||
private List<List<WptPt>> processedPointsToDisplay = new ArrayList<List<WptPt>>();
|
||||
private List<GpxDisplayGroup> displayGroups = null;
|
||||
private boolean routePoints;
|
||||
|
@ -410,9 +411,14 @@ public class GpxSelectionHelper {
|
|||
if(gpxFile.tracks.size() > 0) {
|
||||
this.color = gpxFile.tracks.get(0).getColor(0);
|
||||
}
|
||||
trackAnalysis = gpxFile.getAnalysis(new File(gpxFile.path).lastModified());
|
||||
processPoints();
|
||||
}
|
||||
|
||||
public GPXTrackAnalysis getTrackAnalysis() {
|
||||
return trackAnalysis;
|
||||
}
|
||||
|
||||
public void processPoints() {
|
||||
this.processedPointsToDisplay = gpxFile.proccessPoints();
|
||||
if(this.processedPointsToDisplay.isEmpty()) {
|
||||
|
|
|
@ -2,9 +2,11 @@ package net.osmand.plus.activities;
|
|||
|
||||
import java.io.File;
|
||||
import java.text.Collator;
|
||||
import java.text.DateFormat;
|
||||
import java.text.MessageFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Date;
|
||||
import java.util.HashSet;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
|
@ -20,6 +22,7 @@ import net.osmand.plus.GPXUtilities;
|
|||
import net.osmand.plus.GPXUtilities.GPXFile;
|
||||
import net.osmand.plus.GPXUtilities.WptPt;
|
||||
import net.osmand.plus.GpxSelectionHelper;
|
||||
import net.osmand.plus.OsmAndFormatter;
|
||||
import net.osmand.plus.OsmandApplication;
|
||||
import net.osmand.plus.OsmandPlugin;
|
||||
import net.osmand.plus.OsmandSettings;
|
||||
|
@ -84,14 +87,15 @@ public class AvailableGPXFragment extends OsmandExpandableListFragment {
|
|||
private ActionMode actionMode;
|
||||
private LoadGpxTask asyncLoader;
|
||||
private GpxIndexesAdapter allGpxAdapter;
|
||||
private ShowedOnMapAdapter showOnMapGpxAdapter;
|
||||
MessageFormat formatMb = new MessageFormat("{0, number,##.#} MB", Locale.US);
|
||||
private static MessageFormat formatMb = new MessageFormat("{0, number,##.#} MB", Locale.US);
|
||||
private LoadLocalIndexDescriptionTask descriptionLoader;
|
||||
private ContextMenuAdapter optionsMenuAdapter;
|
||||
private AsyncTask<GpxInfo, ?, ?> operationTask;
|
||||
private GpxSelectionHelper selectedGpxHelper;
|
||||
private SavingTrackHelper savingTrackHelper;
|
||||
private OsmandApplication app;
|
||||
private Drawable gpxNormal;
|
||||
private Drawable gpxOnMap;
|
||||
|
||||
|
||||
@Override
|
||||
|
@ -122,17 +126,6 @@ public class AvailableGPXFragment extends OsmandExpandableListFragment {
|
|||
updateCurrentTrack(getView());
|
||||
}
|
||||
|
||||
private void createShowedOnMapsView(View v) {
|
||||
ListView onMap = (ListView) v.findViewById(R.id.gpx_on_map);
|
||||
showOnMapGpxAdapter = new ShowedOnMapAdapter(getActivity(), R.layout.dash_gpx_track_item);
|
||||
onMap.setAdapter(showOnMapGpxAdapter);
|
||||
v.findViewById(R.id.turn_off_all).setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
showOnMapGpxAdapter.notifyDataSetChanged();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPause() {
|
||||
|
@ -142,20 +135,6 @@ public class AvailableGPXFragment extends OsmandExpandableListFragment {
|
|||
}
|
||||
}
|
||||
|
||||
private void setShowedOnMapVisibility(boolean visibility) {
|
||||
View v = getView();
|
||||
if (v == null) {
|
||||
return;
|
||||
}
|
||||
//temporary hiding this view
|
||||
v.findViewById(R.id.show_on_map).setVisibility(View.GONE);
|
||||
/* if (visibility) {
|
||||
v.findViewById(R.id.on_map_layout).setVisibility(View.VISIBLE);
|
||||
} else {
|
||||
v.findViewById(R.id.on_map_layout).setVisibility(View.GONE);
|
||||
}*/
|
||||
}
|
||||
|
||||
private void updateCurrentTrack(View v) {
|
||||
if (v == null) {
|
||||
return;
|
||||
|
@ -195,8 +174,13 @@ public class AvailableGPXFragment extends OsmandExpandableListFragment {
|
|||
MapActivity.launchMapActivityMoveToTop(getActivity());
|
||||
}
|
||||
});
|
||||
gpxNormal = getResources().getDrawable(R.drawable.ic_gpx_track).mutate();
|
||||
gpxOnMap = getResources().getDrawable(R.drawable.ic_gpx_track).mutate();
|
||||
gpxOnMap.setColorFilter(getResources().getColor(R.color.color_distance), PorterDuff.Mode.MULTIPLY);
|
||||
if (getMyApplication().getSettings().isLightContent()) {
|
||||
gpxNormal.setColorFilter(getResources().getColor(R.color.icon_color_light), PorterDuff.Mode.MULTIPLY);
|
||||
}
|
||||
|
||||
createShowedOnMapsView(v);
|
||||
return v;
|
||||
}
|
||||
|
||||
|
@ -205,7 +189,7 @@ public class AvailableGPXFragment extends OsmandExpandableListFragment {
|
|||
icon.mutate();
|
||||
boolean light = app.getSettings().isLightContent();
|
||||
if (light) {
|
||||
icon.setColorFilter(0xff727272, PorterDuff.Mode.MULTIPLY);
|
||||
icon.setColorFilter(app.getResources().getColor(R.color.icon_color_light), PorterDuff.Mode.MULTIPLY);
|
||||
}
|
||||
ImageButton stop = ((ImageButton) v.findViewById(R.id.stop));
|
||||
stop.setImageDrawable(icon);
|
||||
|
@ -227,7 +211,7 @@ public class AvailableGPXFragment extends OsmandExpandableListFragment {
|
|||
icon = app.getResources().getDrawable(R.drawable.ic_action_gsave_dark);
|
||||
icon.mutate();
|
||||
if (light) {
|
||||
icon.setColorFilter(0xff727272, PorterDuff.Mode.MULTIPLY);
|
||||
icon.setColorFilter(app.getResources().getColor(R.color.icon_color_light), PorterDuff.Mode.MULTIPLY);
|
||||
}
|
||||
ImageButton save = ((ImageButton) v.findViewById(R.id.show_on_map));
|
||||
save.setOnClickListener(new View.OnClickListener() {
|
||||
|
@ -442,7 +426,6 @@ public class AvailableGPXFragment extends OsmandExpandableListFragment {
|
|||
@Override
|
||||
public void onDestroyActionMode(ActionMode mode) {
|
||||
enableSelectionMode(false);
|
||||
getView().findViewById(R.id.memory_size).setVisibility(View.GONE);
|
||||
runSelection(false);
|
||||
allGpxAdapter.notifyDataSetChanged();
|
||||
}
|
||||
|
@ -504,16 +487,10 @@ public class AvailableGPXFragment extends OsmandExpandableListFragment {
|
|||
@Override
|
||||
public void onDestroyActionMode(ActionMode mode) {
|
||||
enableSelectionMode(false);
|
||||
getView().findViewById(R.id.memory_size).setVisibility(View.GONE);
|
||||
allGpxAdapter.notifyDataSetChanged();
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
if (R.string.local_index_mi_upload_gpx == actionResId) {
|
||||
((TextView) getView().findViewById(R.id.memory_size)).setText(R.string.local_index_upload_gpx_description);
|
||||
((TextView) getView().findViewById(R.id.memory_size)).setVisibility(View.VISIBLE);
|
||||
}
|
||||
allGpxAdapter.notifyDataSetChanged();
|
||||
}
|
||||
|
||||
|
@ -552,68 +529,6 @@ public class AvailableGPXFragment extends OsmandExpandableListFragment {
|
|||
}
|
||||
}
|
||||
|
||||
private void basicFileOperation(final GpxInfo info, ContextMenuAdapter adapter) {
|
||||
OnContextMenuClick listener = new OnContextMenuClick() {
|
||||
@Override
|
||||
public boolean onContextMenuClick(ArrayAdapter<?> adapter, int resId, int pos, boolean isChecked) {
|
||||
if (resId == R.string.local_index_mi_rename) {
|
||||
renameFile(info);
|
||||
} else if (resId == R.string.local_index_unselect_gpx_file ||
|
||||
resId == R.string.local_index_select_gpx_file) {
|
||||
if (info.gpx == null) {
|
||||
loadGpxAsync(info, resId == R.string.local_index_select_gpx_file);
|
||||
} else {
|
||||
getMyApplication().getSelectedGpxHelper().selectGpxFile(info.gpx, resId == R.string.local_index_select_gpx_file, true);
|
||||
showOnMapGpxAdapter.addGpxInfo(info);
|
||||
|
||||
allGpxAdapter.notifyDataSetChanged();
|
||||
selectedGpxHelper.runUiListeners();
|
||||
}
|
||||
} else if (resId == R.string.local_index_mi_delete) {
|
||||
Builder confirm = new AlertDialog.Builder(getActivity());
|
||||
confirm.setPositiveButton(R.string.default_buttons_yes, new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
new DeleteGpxTask().execute(info);
|
||||
}
|
||||
});
|
||||
confirm.setNegativeButton(R.string.default_buttons_no, null);
|
||||
confirm.setMessage(getString(R.string.delete_confirmation_msg, info.file.getName()));
|
||||
confirm.show();
|
||||
} else if (resId == R.string.local_index_mi_export) {
|
||||
final Uri fileUri = Uri.fromFile(info.file);
|
||||
final Intent sendIntent = new Intent(Intent.ACTION_SEND);
|
||||
sendIntent.putExtra(Intent.EXTRA_STREAM, fileUri);
|
||||
sendIntent.setType("application/gpx+xml");
|
||||
startActivity(sendIntent);
|
||||
} else if (resId == R.string.show_gpx_route) {
|
||||
showGpxOnMap(info);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
};
|
||||
if (info.gpx != null && info.file == null) {
|
||||
GpxSelectionHelper.SelectedGpxFile selectedGpxFile = selectedGpxHelper.getSelectedCurrentRecordingTrack();
|
||||
if (selectedGpxFile != null && selectedGpxFile.getGpxFile() == info.gpx) {
|
||||
adapter.item(R.string.local_index_unselect_gpx_file).listen(listener).reg();
|
||||
} else {
|
||||
adapter.item(R.string.local_index_select_gpx_file).listen(listener).reg();
|
||||
}
|
||||
} else if (info.file != null) {
|
||||
if (getMyApplication().getSelectedGpxHelper().getSelectedFileByPath(info.file.getAbsolutePath()) == null) {
|
||||
adapter.item(R.string.local_index_select_gpx_file).listen(listener).reg();
|
||||
} else {
|
||||
adapter.item(R.string.local_index_unselect_gpx_file).listen(listener).reg();
|
||||
}
|
||||
}
|
||||
adapter.item(R.string.show_gpx_route).listen(listener).reg();
|
||||
if (info.file != null) {
|
||||
adapter.item(R.string.local_index_mi_rename).listen(listener).reg();
|
||||
adapter.item(R.string.local_index_mi_delete).listen(listener).reg();
|
||||
adapter.item(R.string.local_index_mi_export).listen(listener).reg();
|
||||
}
|
||||
OsmandPlugin.onContextMenuActivity(getActivity(), this, info, adapter);
|
||||
}
|
||||
|
||||
private void showGpxOnMap(GpxInfo info) {
|
||||
info.updateGpxInfo(getMyApplication());
|
||||
|
@ -626,10 +541,6 @@ public class AvailableGPXFragment extends OsmandExpandableListFragment {
|
|||
e = false;
|
||||
getMyApplication().getSelectedGpxHelper().setGpxFileToDisplay(info.gpx);
|
||||
MapActivity.launchMapActivityMoveToTop(getActivity());
|
||||
if (showOnMapGpxAdapter.getCount() == 0) {
|
||||
setShowedOnMapVisibility(true);
|
||||
}
|
||||
showOnMapGpxAdapter.addGpxInfo(info);
|
||||
}
|
||||
}
|
||||
if (e) {
|
||||
|
@ -660,36 +571,24 @@ public class AvailableGPXFragment extends OsmandExpandableListFragment {
|
|||
protected void onPreExecute() {
|
||||
((ActionBarActivity) getActivity()).setSupportProgressBarIndeterminateVisibility(true);
|
||||
allGpxAdapter.clear();
|
||||
if (showOnMapGpxAdapter != null) {
|
||||
showOnMapGpxAdapter.clear();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onProgressUpdate(GpxInfo... values) {
|
||||
for (GpxInfo v : values) {
|
||||
allGpxAdapter.addLocalIndexInfo(v);
|
||||
if (selectedGpxHelper.getSelectedFileByName(v.getFileName()) != null) {
|
||||
showOnMapGpxAdapter.addGpxInfo(v);
|
||||
}
|
||||
}
|
||||
showOnMapGpxAdapter.notifyDataSetChanged();
|
||||
allGpxAdapter.notifyDataSetChanged();
|
||||
}
|
||||
|
||||
public void setResult(List<GpxInfo> result) {
|
||||
this.result = result;
|
||||
allGpxAdapter.clear();
|
||||
showOnMapGpxAdapter.clear();
|
||||
if (result != null) {
|
||||
for (GpxInfo v : result) {
|
||||
allGpxAdapter.addLocalIndexInfo(v);
|
||||
if (selectedGpxHelper.getSelectedFileByName(v.getFileName()) != null) {
|
||||
showOnMapGpxAdapter.addGpxInfo(v);
|
||||
}
|
||||
}
|
||||
allGpxAdapter.notifyDataSetChanged();
|
||||
showOnMapGpxAdapter.notifyDataSetChanged();
|
||||
onPostExecute(result);
|
||||
}
|
||||
}
|
||||
|
@ -703,12 +602,6 @@ public class AvailableGPXFragment extends OsmandExpandableListFragment {
|
|||
if (allGpxAdapter.getGroupCount() > 0) {
|
||||
getExpandableListView().expandGroup(0);
|
||||
}
|
||||
|
||||
if (showOnMapGpxAdapter.getCount() > 0) {
|
||||
setShowedOnMapVisibility(true);
|
||||
} else {
|
||||
setShowedOnMapVisibility(false);
|
||||
}
|
||||
}
|
||||
|
||||
private File[] listFilesSorted(File dir) {
|
||||
|
@ -763,7 +656,6 @@ public class AvailableGPXFragment extends OsmandExpandableListFragment {
|
|||
Map<String, List<GpxInfo>> data = new LinkedHashMap<>();
|
||||
List<String> category = new ArrayList<>();
|
||||
int warningColor;
|
||||
int okColor;
|
||||
int defaultColor;
|
||||
int corruptedColor;
|
||||
private SearchFilter filter;
|
||||
|
@ -771,7 +663,6 @@ public class AvailableGPXFragment extends OsmandExpandableListFragment {
|
|||
|
||||
public GpxIndexesAdapter(Context ctx) {
|
||||
warningColor = ctx.getResources().getColor(R.color.color_warning);
|
||||
okColor = ctx.getResources().getColor(R.color.color_ok);
|
||||
TypedArray ta = ctx.getTheme().obtainStyledAttributes(new int[]{android.R.attr.textColorPrimary});
|
||||
defaultColor = ta.getColor(0, ctx.getResources().getColor(R.color.color_unknown));
|
||||
ta.recycle();
|
||||
|
@ -849,42 +740,10 @@ public class AvailableGPXFragment extends OsmandExpandableListFragment {
|
|||
final GpxInfo child = getChild(groupPosition, childPosition);
|
||||
if (v == null) {
|
||||
LayoutInflater inflater = getActivity().getLayoutInflater();
|
||||
v = inflater.inflate(net.osmand.plus.R.layout.local_index_list_item, parent, false);
|
||||
}
|
||||
TextView viewName = ((TextView) v.findViewById(R.id.local_index_name));
|
||||
viewName.setText(child.getName());
|
||||
|
||||
if (child.isCorrupted()) {
|
||||
viewName.setTextColor(corruptedColor);
|
||||
viewName.setTypeface(Typeface.DEFAULT, Typeface.NORMAL);
|
||||
} else if (selectedGpxHelper.getSelectedFileByName(child.getFileName()) != null) {
|
||||
viewName.setTextColor(okColor);
|
||||
viewName.setTypeface(Typeface.DEFAULT, Typeface.NORMAL);
|
||||
} else {
|
||||
viewName.setTextColor(defaultColor);
|
||||
viewName.setTypeface(Typeface.DEFAULT, Typeface.NORMAL);
|
||||
}
|
||||
TextView sizeText = (TextView) v.findViewById(R.id.local_index_size);
|
||||
if (child.getSize() >= 0) {
|
||||
String size;
|
||||
if (child.getSize() > 100) {
|
||||
size = formatMb.format(new Object[]{(float) child.getSize() / (1 << 10)});
|
||||
} else {
|
||||
size = child.getSize() + " kB";
|
||||
}
|
||||
sizeText.setText(size);
|
||||
} else {
|
||||
sizeText.setText("");
|
||||
}
|
||||
TextView descr = ((TextView) v.findViewById(R.id.local_index_descr));
|
||||
if (child.isExpanded()) {
|
||||
descr.setVisibility(View.VISIBLE);
|
||||
descr.setText(child.getHtmlDescription());
|
||||
sizeText.setVisibility(View.GONE);
|
||||
} else {
|
||||
descr.setVisibility(View.GONE);
|
||||
sizeText.setVisibility(View.VISIBLE);
|
||||
v = inflater.inflate(R.layout.dash_gpx_track_item, parent, false);
|
||||
}
|
||||
udpateGpxInfoView(v, child, app, gpxNormal, gpxOnMap, false);
|
||||
ImageView icon = (ImageView) v.findViewById(R.id.icon);
|
||||
ImageButton options = (ImageButton) v.findViewById(R.id.options);
|
||||
options.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
|
@ -892,9 +751,10 @@ public class AvailableGPXFragment extends OsmandExpandableListFragment {
|
|||
openPopUpMenu(v, child);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
final CheckBox checkbox = (CheckBox) v.findViewById(R.id.check_local_index);
|
||||
checkbox.setVisibility(selectionMode ? View.VISIBLE : View.GONE);
|
||||
ImageView icon = (ImageView) v.findViewById(R.id.icon);
|
||||
if (selectionMode) {
|
||||
checkbox.setChecked(selectedItems.contains(child));
|
||||
checkbox.setOnClickListener(new View.OnClickListener() {
|
||||
|
@ -926,6 +786,7 @@ public class AvailableGPXFragment extends OsmandExpandableListFragment {
|
|||
return v;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public View getGroupView(int groupPosition, boolean isExpanded, View convertView, ViewGroup parent) {
|
||||
View v = convertView;
|
||||
|
@ -1020,8 +881,7 @@ public class AvailableGPXFragment extends OsmandExpandableListFragment {
|
|||
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);
|
||||
showIcon.mutate().setColorFilter(getResources().getColor(R.color.icon_color_light), PorterDuff.Mode.MULTIPLY);
|
||||
}
|
||||
MenuItem item = optionsMenu.getMenu().add(R.string.show_gpx_route)
|
||||
.setIcon(showIcon);
|
||||
|
@ -1042,6 +902,19 @@ public class AvailableGPXFragment extends OsmandExpandableListFragment {
|
|||
return true;
|
||||
}
|
||||
});
|
||||
item = optionsMenu.getMenu().add(R.string.share_fav)
|
||||
.setIcon(light ? R.drawable.ic_action_gshare_light : R.drawable.ic_action_gshare_dark);
|
||||
item.setOnMenuItemClickListener(new MenuItem.OnMenuItemClickListener() {
|
||||
@Override
|
||||
public boolean onMenuItemClick(MenuItem item) {
|
||||
final Uri fileUri = Uri.fromFile(gpxInfo.file);
|
||||
final Intent sendIntent = new Intent(Intent.ACTION_SEND);
|
||||
sendIntent.putExtra(Intent.EXTRA_STREAM, fileUri);
|
||||
sendIntent.setType("application/gpx+xml");
|
||||
startActivity(sendIntent);
|
||||
return true;
|
||||
}
|
||||
});
|
||||
|
||||
final OsmEditingPlugin osmEditingPlugin = OsmandPlugin.getEnabledPlugin(OsmEditingPlugin.class);
|
||||
if (osmEditingPlugin != null && osmEditingPlugin.isActive()) {
|
||||
|
@ -1271,15 +1144,10 @@ public class AvailableGPXFragment extends OsmandExpandableListFragment {
|
|||
if (results.values != null) {
|
||||
synchronized (allGpxAdapter) {
|
||||
allGpxAdapter.clear();
|
||||
showOnMapGpxAdapter.clear();
|
||||
for (GpxInfo i : ((List<GpxInfo>) results.values)) {
|
||||
allGpxAdapter.addLocalIndexInfo(i);
|
||||
if (selectedGpxHelper.getSelectedFileByName(i.getFileName()) != null) {
|
||||
showOnMapGpxAdapter.addGpxInfo(i);
|
||||
}
|
||||
}
|
||||
}
|
||||
showOnMapGpxAdapter.notifyDataSetChanged();
|
||||
allGpxAdapter.notifyDataSetChanged();
|
||||
if (constraint != null && constraint.length() > 3) {
|
||||
collapseTrees(10);
|
||||
|
@ -1334,6 +1202,7 @@ public class AvailableGPXFragment extends OsmandExpandableListFragment {
|
|||
private boolean corrupted;
|
||||
private boolean expanded;
|
||||
private Spanned htmlDescription;
|
||||
private GPXUtilities.GPXTrackAnalysis analysis;
|
||||
|
||||
public GpxInfo() {
|
||||
}
|
||||
|
@ -1387,6 +1256,10 @@ public class AvailableGPXFragment extends OsmandExpandableListFragment {
|
|||
return description;
|
||||
}
|
||||
|
||||
public long getFileDate() {
|
||||
return file.lastModified();
|
||||
}
|
||||
|
||||
public Spanned getHtmlDescription() {
|
||||
if (htmlDescription != null) {
|
||||
return htmlDescription;
|
||||
|
@ -1395,6 +1268,13 @@ public class AvailableGPXFragment extends OsmandExpandableListFragment {
|
|||
return htmlDescription;
|
||||
}
|
||||
|
||||
public GPXUtilities.GPXTrackAnalysis getAnalysis() {
|
||||
return analysis;
|
||||
}
|
||||
|
||||
public void setAnalysis(GPXUtilities.GPXTrackAnalysis analysis) {
|
||||
this.analysis = analysis;
|
||||
}
|
||||
|
||||
public void setGpx(GPXFile gpx) {
|
||||
this.gpx = gpx;
|
||||
|
@ -1407,9 +1287,11 @@ public class AvailableGPXFragment extends OsmandExpandableListFragment {
|
|||
if (gpx.warning != null) {
|
||||
corrupted = true;
|
||||
description = gpx.warning;
|
||||
analysis = null;
|
||||
} else {
|
||||
// 'Long-press for options' message
|
||||
description = GpxUiHelper.getDescription(app, gpx, file, true);
|
||||
analysis = gpx.getAnalysis(file.lastModified());
|
||||
description = GpxUiHelper.getDescription(app, analysis, true);
|
||||
}
|
||||
htmlDescription = null;
|
||||
getHtmlDescription();
|
||||
|
@ -1436,79 +1318,86 @@ public class AvailableGPXFragment extends OsmandExpandableListFragment {
|
|||
getView().findViewById(R.id.gpx_on_map).setLayoutParams(params);
|
||||
}
|
||||
|
||||
class ShowedOnMapAdapter extends ArrayAdapter<GpxInfo> {
|
||||
|
||||
public void addGpxInfo(GpxInfo info) {
|
||||
boolean contains = false;
|
||||
for (int i = 0; i < getCount(); i++) {
|
||||
if (getItem(i).equals(info)) {
|
||||
contains = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (contains) {
|
||||
return;
|
||||
}
|
||||
|
||||
add(info);
|
||||
notifyDataSetChanged();
|
||||
|
||||
//if there's too many items, we need to set size of listview
|
||||
if (getCount() == 4) {
|
||||
adjustShowOnMapListViewSize();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public ShowedOnMapAdapter(Context context, int resource) {
|
||||
super(context, resource);
|
||||
}
|
||||
|
||||
@Override
|
||||
public View getView(int position, View convertView, ViewGroup parent) {
|
||||
View v = convertView;
|
||||
if (v == null) {
|
||||
LayoutInflater inflater = getActivity().getLayoutInflater();
|
||||
v = inflater.inflate(R.layout.dash_gpx_track_item, parent, false);
|
||||
}
|
||||
|
||||
final GpxInfo gpxInfo = getItem(position);
|
||||
|
||||
TextView viewName = ((TextView) v.findViewById(R.id.name));
|
||||
viewName.setText(gpxInfo.getName());
|
||||
|
||||
v.findViewById(R.id.show_on_map).setVisibility(View.GONE);
|
||||
v.findViewById(R.id.stop).setVisibility(View.GONE);
|
||||
public static void udpateGpxInfoView(View v, GpxInfo child, OsmandApplication app,
|
||||
Drawable gpxNormal, Drawable gpxOnMap,
|
||||
boolean isDashItem) {
|
||||
TextView viewName = ((TextView) v.findViewById(R.id.name));
|
||||
if(!isDashItem) {
|
||||
v.findViewById(R.id.divider).setVisibility(View.GONE);
|
||||
if (gpxInfo.gpx != null) {
|
||||
String description = GpxUiHelper.getDescription(getMyApplication(), gpxInfo.gpx, gpxInfo.file, 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);
|
||||
} else {
|
||||
v.findViewById(R.id.divider).setVisibility(View.VISIBLE);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
final CompoundButton check = (CompoundButton) v.findViewById(R.id.check_item);
|
||||
check.setVisibility(View.VISIBLE);
|
||||
if (selectedGpxHelper.getSelectedFileByName(gpxInfo.getFileName()) != null) {
|
||||
check.setChecked(true);
|
||||
} else {
|
||||
check.setChecked(false);
|
||||
}
|
||||
check.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
if (gpxInfo.gpx == null) {
|
||||
loadGpxAsync(gpxInfo, check.isChecked());
|
||||
} else {
|
||||
selectedGpxHelper.selectGpxFile(gpxInfo.gpx, check.isChecked(), true);
|
||||
}
|
||||
allGpxAdapter.notifyDataSetChanged();
|
||||
viewName.setText(child.getName());
|
||||
GpxSelectionHelper selectedGpxHelper = app.getSelectedGpxHelper();
|
||||
|
||||
//ImageView icon = (ImageView) v.findViewById(!isDashItem? R.id.icon : R.id.show_on_map);
|
||||
ImageView icon = (ImageView) v.findViewById(R.id.icon);
|
||||
icon.setVisibility(View.VISIBLE);
|
||||
icon.setImageDrawable(gpxNormal);
|
||||
if (child.isCorrupted()) {
|
||||
viewName.setTypeface(Typeface.DEFAULT, Typeface.ITALIC);
|
||||
} else {
|
||||
viewName.setTypeface(Typeface.DEFAULT, Typeface.NORMAL);
|
||||
}
|
||||
if (selectedGpxHelper.getSelectedFileByName(child.getFileName()) != null) {
|
||||
icon.setImageDrawable(gpxOnMap);
|
||||
}
|
||||
boolean sectionRead = child.getAnalysis() == null;
|
||||
if(sectionRead) {
|
||||
v.findViewById(R.id.read_section).setVisibility(View.GONE);
|
||||
v.findViewById(R.id.unknown_section).setVisibility(View.VISIBLE);
|
||||
String date = "";
|
||||
String size = "";
|
||||
if (child.getSize() >= 0) {
|
||||
if (child.getSize() > 100) {
|
||||
size = formatMb.format(new Object[]{(float) child.getSize() / (1 << 10)});
|
||||
} else {
|
||||
size = child.getSize() + " kB";
|
||||
}
|
||||
});
|
||||
return v;
|
||||
}
|
||||
DateFormat df = app.getResourceManager().getDateFormat();
|
||||
long fd = child.getFileDate();
|
||||
if(fd > 0) {
|
||||
date = (df.format(new Date(fd)));
|
||||
}
|
||||
TextView sizeText = (TextView) v.findViewById(R.id.date_and_size_details);
|
||||
sizeText.setText(date + " \u2022 " + size);
|
||||
|
||||
} else {
|
||||
v.findViewById(R.id.read_section).setVisibility(View.VISIBLE);
|
||||
v.findViewById(R.id.unknown_section).setVisibility(View.GONE);
|
||||
TextView time = (TextView) v.findViewById(R.id.time);
|
||||
TextView distance = (TextView) v.findViewById(R.id.distance);
|
||||
TextView pointsCount= (TextView) v.findViewById(R.id.points_count);
|
||||
GPXUtilities.GPXTrackAnalysis analysis = child.getAnalysis();
|
||||
pointsCount.setText(analysis.wptPoints +"");
|
||||
if(analysis.totalDistanceMoving != 0) {
|
||||
distance.setText(OsmAndFormatter.getFormattedDistance(analysis.totalDistanceMoving, app));
|
||||
} else {
|
||||
distance.setText(OsmAndFormatter.getFormattedDistance(analysis.totalDistance, app));
|
||||
}
|
||||
|
||||
if(analysis.isTimeSpecified()) {
|
||||
if(analysis.isTimeMoving()) {
|
||||
time.setText(Algorithms.formatDuration((int) (analysis.timeMoving / 1000))+"");
|
||||
} else {
|
||||
time.setText(Algorithms.formatDuration((int) (analysis.timeSpan/ 1000))+"");
|
||||
}
|
||||
} else {
|
||||
time.setText("");
|
||||
}
|
||||
}
|
||||
|
||||
TextView descr = ((TextView) v.findViewById(R.id.description));
|
||||
if (child.isExpanded()) {
|
||||
descr.setVisibility(View.VISIBLE);
|
||||
descr.setText(child.getHtmlDescription());
|
||||
} else {
|
||||
descr.setVisibility(View.GONE);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -18,7 +18,7 @@ public class OsmandActionBarActivity extends ActionBarActivity {
|
|||
//should be called after set content view
|
||||
protected void setupHomeButton(){
|
||||
Drawable back = getResources().getDrawable(R.drawable.abc_ic_ab_back_mtrl_am_alpha);
|
||||
back.setColorFilter(0xffffffff, PorterDuff.Mode.MULTIPLY);
|
||||
back.setColorFilter(getResources().getColor(R.color.color_white), PorterDuff.Mode.MULTIPLY);
|
||||
getSupportActionBar().setHomeButtonEnabled(true);
|
||||
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
||||
getSupportActionBar().setHomeAsUpIndicator(back);
|
||||
|
|
|
@ -151,7 +151,7 @@ public class SettingsActivity extends SettingsBaseActivity {
|
|||
Toolbar tb = new Toolbar(this);
|
||||
tb.setClickable(true);
|
||||
Drawable back = getResources().getDrawable(R.drawable.abc_ic_ab_back_mtrl_am_alpha);
|
||||
back.setColorFilter(0xffffffff, PorterDuff.Mode.MULTIPLY);
|
||||
back.setColorFilter(app.getResources().getColor(R.color.color_white), PorterDuff.Mode.MULTIPLY);
|
||||
tb.setNavigationIcon(back);
|
||||
tb.setTitle(R.string.about_settings);
|
||||
tb.setBackgroundColor(getResources().getColor( getResIdFromAttribute(this, R.attr.pstsTabBackground)));
|
||||
|
|
|
@ -159,7 +159,7 @@ public class SearchAddressFragment extends Fragment {
|
|||
});
|
||||
menuItem = menu.add(0, ONLINE_SEARCH, 0, R.string.search_online_address);
|
||||
MenuItemCompat.setShowAsAction(menuItem, MenuItemCompat.SHOW_AS_ACTION_ALWAYS);
|
||||
menuItem = menuItem.setIcon(R.drawable.ic_action_gnext_dark);
|
||||
menuItem = menuItem.setIcon(R.drawable.ic_world_globe_dark);
|
||||
menuItem.setOnMenuItemClickListener(new OnMenuItemClickListener() {
|
||||
@Override
|
||||
public boolean onMenuItemClick(MenuItem item) {
|
||||
|
|
|
@ -81,7 +81,7 @@ public class SearchAddressOnlineFragment extends Fragment implements SearchActiv
|
|||
if (getActivity() instanceof SearchActivity) {
|
||||
menuItem = menu.add(0, 0, 0, R.string.search_offline_address);
|
||||
MenuItemCompat.setShowAsAction(menuItem, MenuItemCompat.SHOW_AS_ACTION_ALWAYS | MenuItemCompat.SHOW_AS_ACTION_WITH_TEXT);
|
||||
menuItem = menuItem.setIcon(R.drawable.ic_action_gnext_dark);
|
||||
menuItem = menuItem.setIcon(R.drawable.ic_sdcard);
|
||||
menuItem.setOnMenuItemClickListener(new OnMenuItemClickListener() {
|
||||
@Override
|
||||
public boolean onMenuItemClick(MenuItem item) {
|
||||
|
|
|
@ -131,7 +131,7 @@ public class LocalIndexesFragment extends OsmandExpandableListFragment {
|
|||
backup = getActivity().getResources().getDrawable(R.drawable.ic_type_archive);
|
||||
backup.mutate();
|
||||
if (light) {
|
||||
backup.setColorFilter(0xff727272, PorterDuff.Mode.MULTIPLY);
|
||||
backup.setColorFilter(getResources().getColor(R.color.icon_color_light), PorterDuff.Mode.MULTIPLY);
|
||||
}
|
||||
sdcard = getActivity().getResources().getDrawable(R.drawable.ic_sdcard);
|
||||
sdcard.mutate();
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package net.osmand.plus.monitoring;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
import net.osmand.IndexConstants;
|
||||
|
@ -8,6 +9,7 @@ import net.osmand.access.AccessibleToast;
|
|||
import net.osmand.plus.GPXUtilities;
|
||||
import net.osmand.plus.GpxSelectionHelper;
|
||||
import net.osmand.plus.OsmAndAppCustomization;
|
||||
import net.osmand.plus.OsmAndFormatter;
|
||||
import net.osmand.plus.OsmandApplication;
|
||||
import net.osmand.plus.OsmandSettings;
|
||||
import net.osmand.plus.R;
|
||||
|
@ -40,6 +42,10 @@ import android.widget.Toast;
|
|||
*/
|
||||
public class DashTrackFragment extends DashBaseFragment {
|
||||
|
||||
private Drawable gpxOnMap;
|
||||
private Drawable gpxNormal;
|
||||
private java.text.DateFormat format;
|
||||
|
||||
@Override
|
||||
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
|
||||
View view = getActivity().getLayoutInflater().inflate(R.layout.dash_common_fragment, container, false);
|
||||
|
@ -47,7 +53,16 @@ public class DashTrackFragment extends DashBaseFragment {
|
|||
TextView header = (TextView) view.findViewById(R.id.fav_text);
|
||||
header.setTypeface(typeface);
|
||||
header.setText(R.string.tracks);
|
||||
gpxNormal = getResources().getDrawable(R.drawable.ic_gpx_track).mutate();
|
||||
gpxOnMap = getResources().getDrawable(R.drawable.ic_gpx_track).mutate();
|
||||
gpxOnMap.setColorFilter(getResources().getColor(R.color.color_distance), PorterDuff.Mode.MULTIPLY);
|
||||
if (getMyApplication().getSettings().isLightContent()) {
|
||||
gpxNormal.setColorFilter(getResources().getColor(R.color.icon_color_light), PorterDuff.Mode.MULTIPLY);
|
||||
}
|
||||
|
||||
|
||||
((Button) view.findViewById(R.id.show_all)).setTypeface(typeface);
|
||||
format = getMyApplication().getResourceManager().getDateFormat();
|
||||
|
||||
(view.findViewById(R.id.show_all)).setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
|
@ -90,7 +105,7 @@ public class DashTrackFragment extends DashBaseFragment {
|
|||
}
|
||||
}
|
||||
|
||||
OsmandApplication app = getMyApplication();
|
||||
final OsmandApplication app = getMyApplication();
|
||||
SavingTrackHelper savingTrackHelper = app.getSavingTrackHelper();
|
||||
if (app.getSettings().SAVE_GLOBAL_TRACK_TO_GPX.get()) {
|
||||
list.remove(2);
|
||||
|
@ -99,61 +114,38 @@ public class DashTrackFragment extends DashBaseFragment {
|
|||
|
||||
AvailableGPXFragment.createCurrentTrackView(view, app);
|
||||
|
||||
|
||||
GpxSelectionHelper.SelectedGpxFile currentTrack = savingTrackHelper.getCurrentTrack();
|
||||
((TextView)view.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 distance = description.substring(startindex + 1, endindex);
|
||||
String points = String.valueOf(currentTrack.getGpxFile().points.size());
|
||||
|
||||
((TextView) view.findViewById(R.id.points_count)).setText(points);
|
||||
((TextView)view.findViewById(R.id.distance)).setText(distance);
|
||||
((TextView)view.findViewById(R.id.distance)).setText(
|
||||
OsmAndFormatter.getFormattedDistance(savingTrackHelper.getDistance(), app));
|
||||
tracks.addView(view);
|
||||
}
|
||||
|
||||
for (String filename : list) {
|
||||
final File f = new File(dir, filename);
|
||||
final GPXUtilities.GPXFile res = GPXUtilities.loadGPXFile(getMyApplication(), f);
|
||||
boolean haveInfo = false;
|
||||
GpxSelectionHelper.SelectedGpxFile selectedGpxFile =
|
||||
app.getSelectedGpxHelper().getSelectedFileByPath(f.getAbsolutePath());
|
||||
GPXUtilities.GPXTrackAnalysis trackAnalysis = null;
|
||||
if(selectedGpxFile != null) {
|
||||
trackAnalysis = selectedGpxFile.getTrackAnalysis();
|
||||
}
|
||||
AvailableGPXFragment.GpxInfo info = new AvailableGPXFragment.GpxInfo();
|
||||
info.subfolder = "";
|
||||
info.setAnalysis(trackAnalysis);
|
||||
info.file = 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)).
|
||||
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)).
|
||||
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);
|
||||
AvailableGPXFragment.udpateGpxInfoView(view, info, app, gpxNormal, gpxOnMap, true);
|
||||
view.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
showOnMap(res);
|
||||
showOnMap(GPXUtilities.loadGPXFile(app, f));
|
||||
}
|
||||
});
|
||||
tracks.addView(view);
|
||||
|
|
Loading…
Reference in a new issue