Attempt to add "Analyze on map" to menu
This commit is contained in:
parent
faf7524327
commit
0288467f57
3 changed files with 29 additions and 0 deletions
|
@ -178,8 +178,16 @@ public class TrackActivity extends TabActivity {
|
|||
}
|
||||
}
|
||||
|
||||
boolean firstTime = true;
|
||||
|
||||
@Override
|
||||
public void onAttachFragment(Fragment fragment) {
|
||||
if(firstTime) {
|
||||
if (getIntent().getBooleanExtra("open_details", false)) {
|
||||
((TrackSegmentFragment) fragment).openDetailsFromMenu = true;
|
||||
firstTime = false;
|
||||
}
|
||||
}
|
||||
fragList.add(new WeakReference<>(fragment));
|
||||
}
|
||||
|
||||
|
|
|
@ -1240,6 +1240,20 @@ public class AvailableGPXFragment extends OsmandExpandableListFragment {
|
|||
}
|
||||
});
|
||||
|
||||
item = optionsMenu.getMenu().add(R.string.analyze_on_map).setIcon(iconsCache.getThemedIcon(R.drawable.ic_map));
|
||||
item.setOnMenuItemClickListener(new MenuItem.OnMenuItemClickListener() {
|
||||
@Override
|
||||
public boolean onMenuItemClick(MenuItem item) {
|
||||
Intent newIntent = new Intent(getActivity(), getMyApplication().getAppCustomization().getTrackActivity());
|
||||
newIntent.putExtra(TrackActivity.TRACK_FILE_NAME, gpxInfo.file.getAbsolutePath());
|
||||
newIntent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
|
||||
newIntent.putExtra("open_details", true);
|
||||
startActivity(newIntent);
|
||||
|
||||
return true;
|
||||
}
|
||||
});
|
||||
|
||||
item = optionsMenu.getMenu().add(R.string.shared_string_move).setIcon(iconsCache.getThemedIcon(R.drawable.ic_action_folder_stroke));
|
||||
item.setOnMenuItemClickListener(new MenuItem.OnMenuItemClickListener() {
|
||||
@Override
|
||||
|
|
|
@ -784,6 +784,8 @@ public class TrackSegmentFragment extends OsmAndListFragment {
|
|||
}
|
||||
}
|
||||
|
||||
public boolean openDetailsFromMenu = false;
|
||||
|
||||
private enum GPXTabItemType {
|
||||
GPX_TAB_ITEM_GENERAL,
|
||||
GPX_TAB_ITEM_ALTITUDE,
|
||||
|
@ -1213,6 +1215,11 @@ public class TrackSegmentFragment extends OsmAndListFragment {
|
|||
|
||||
container.addView(view, 0);
|
||||
views.put(position, view);
|
||||
|
||||
if (openDetailsFromMenu) {
|
||||
openDetails(GPXTabItemType.GPX_TAB_ITEM_GENERAL);
|
||||
openDetailsFromMenu = false;
|
||||
}
|
||||
return view;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue