Udate ui
This commit is contained in:
parent
5043d5b76c
commit
fe7b44afd2
4 changed files with 5 additions and 43 deletions
|
@ -11,6 +11,7 @@
|
|||
android:layout_width="match_parent"
|
||||
android:layout_height="1dp"
|
||||
android:id="@+id/divider"
|
||||
android:visibility="gone"
|
||||
android:background="?attr/dashboard_divider" />
|
||||
|
||||
<LinearLayout
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
android:layout_height="wrap_content"
|
||||
android:background="?attr/expandable_list_item_background"
|
||||
android:minHeight="@dimen/list_item_height"
|
||||
android:descendantFocusability="blocksDescendants"
|
||||
android:orientation="horizontal"
|
||||
android:paddingLeft="@dimen/list_content_padding">
|
||||
|
||||
|
@ -79,6 +80,7 @@
|
|||
android:layout_height="@dimen/list_item_height"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:visibility="gone"
|
||||
android:focusable="false"
|
||||
android:background="?attr/options_button_background"
|
||||
android:src="?attr/list_settings_icon"/>
|
||||
|
||||
|
|
|
@ -449,7 +449,6 @@ public class AvailableGPXFragment extends OsmandExpandableListFragment {
|
|||
@Override
|
||||
public boolean onActionItemClicked(ActionMode mode, MenuItem item) {
|
||||
runSelection(false);
|
||||
updateCurrentTrack();
|
||||
actionMode.finish();
|
||||
allGpxAdapter.refreshSelected();
|
||||
allGpxAdapter.notifyDataSetChanged();
|
||||
|
@ -464,9 +463,9 @@ public class AvailableGPXFragment extends OsmandExpandableListFragment {
|
|||
|
||||
@Override
|
||||
public void onDestroyActionMode(ActionMode mode) {
|
||||
updateCurrentTrack();
|
||||
showOnMapMode = false;
|
||||
enableSelectionMode(false);
|
||||
updateCurrentTrack();
|
||||
allGpxAdapter.notifyDataSetChanged();
|
||||
}
|
||||
|
||||
|
|
|
@ -13,7 +13,6 @@ import net.osmand.data.FavouritePoint;
|
|||
import net.osmand.data.LatLon;
|
||||
import net.osmand.data.PointDescription;
|
||||
import net.osmand.plus.ContextMenuAdapter;
|
||||
import net.osmand.plus.ContextMenuAdapter.OnContextMenuClick;
|
||||
import net.osmand.plus.FavouritesDbHelper;
|
||||
import net.osmand.plus.GPXUtilities.GPXFile;
|
||||
import net.osmand.plus.GpxSelectionHelper;
|
||||
|
@ -23,10 +22,8 @@ import net.osmand.plus.GpxSelectionHelper.GpxDisplayItemType;
|
|||
import net.osmand.plus.GpxSelectionHelper.SelectedGpxFile;
|
||||
import net.osmand.plus.OsmAndFormatter;
|
||||
import net.osmand.plus.OsmandApplication;
|
||||
import net.osmand.plus.OsmandPlugin;
|
||||
import net.osmand.plus.OsmandSettings;
|
||||
import net.osmand.plus.R;
|
||||
import net.osmand.plus.activities.MapActivity;
|
||||
import net.osmand.plus.activities.TrackActivity;
|
||||
import net.osmand.plus.base.FavoriteImageDrawable;
|
||||
import net.osmand.plus.dialogs.DirectionsDialogs;
|
||||
|
@ -190,44 +187,7 @@ public class SelectedGPXFragment extends ListFragment {
|
|||
return view;
|
||||
}
|
||||
|
||||
protected void showContextMenu(final GpxDisplayItem gpxDisplayItem) {
|
||||
Builder builder = new AlertDialog.Builder(getMyActivity());
|
||||
final ContextMenuAdapter adapter = new ContextMenuAdapter(getMyActivity());
|
||||
basicFileOperation(gpxDisplayItem, 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();
|
||||
}
|
||||
|
||||
private void basicFileOperation(final GpxDisplayItem gpxDisplayItem, ContextMenuAdapter adapter) {
|
||||
OnContextMenuClick listener = new OnContextMenuClick() {
|
||||
@Override
|
||||
public boolean onContextMenuClick(ArrayAdapter<?> adapter, int resId, int pos, boolean isChecked) {
|
||||
if (resId == R.string.show_gpx_route) {
|
||||
OsmandSettings settings = app.getSettings();
|
||||
settings.setMapLocationToShow(gpxDisplayItem.locationStart.lat, gpxDisplayItem.locationStart.lon,
|
||||
settings.getLastKnownMapZoom(), new PointDescription(PointDescription.POINT_TYPE_WPT, Html.fromHtml(gpxDisplayItem.name).toString()));
|
||||
MapActivity.launchMapActivityMoveToTop(getMyActivity());
|
||||
}
|
||||
return true;
|
||||
}
|
||||
};
|
||||
if (gpxDisplayItem.locationStart != null) {
|
||||
adapter.item(R.string.show_gpx_route).listen(listener).reg();
|
||||
}
|
||||
OsmandPlugin.onContextMenuActivity(getActivity(), this, gpxDisplayItem, adapter);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean onOptionsItemSelected(MenuItem item) {
|
||||
|
@ -483,7 +443,7 @@ public class SelectedGPXFragment extends ListFragment {
|
|||
// child.group.getType() == GpxDisplayItemType.TRACK_ROUTE_POINTS) {
|
||||
ContextMenuAdapter qa = new ContextMenuAdapter(v.getContext());
|
||||
qa.setAnchor(v);
|
||||
PointDescription name = new PointDescription(PointDescription.POINT_TYPE_FAVORITE, child.name);
|
||||
PointDescription name = new PointDescription(PointDescription.POINT_TYPE_FAVORITE, Html.fromHtml(child.name).toString());
|
||||
LatLon location = new LatLon(child.locationStart.lat, child.locationStart.lon);
|
||||
OsmandSettings settings = app.getSettings();
|
||||
final PopupMenu optionsMenu = new PopupMenu(getActivity(), v);
|
||||
|
|
Loading…
Reference in a new issue