use of net.osmand.plus.OsmAndAppCustomization in project Osmand by osmandapp.
the class TrackActivity method onOptionsItemSelected.
@Override
public boolean onOptionsItemSelected(MenuItem item) {
int itemId = item.getItemId();
switch(itemId) {
case android.R.id.home:
if (getIntent().hasExtra(MapActivity.INTENT_KEY_PARENT_MAP_ACTIVITY) || openTracksList) {
OsmAndAppCustomization appCustomization = getMyApplication().getAppCustomization();
final Intent favorites = new Intent(this, appCustomization.getFavoritesActivity());
getMyApplication().getSettings().FAVORITES_TAB.set(FavoritesActivity.GPX_TAB);
favorites.setFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT);
startActivity(favorites);
}
finish();
return true;
}
return false;
}
use of net.osmand.plus.OsmAndAppCustomization in project Osmand by osmandapp.
the class WptPtMenuBuilder method getCollapsableWaypointsView.
private CollapsableView getCollapsableWaypointsView(final Context context, boolean collapsed, @NonNull final GPXUtilities.GPXFile gpxFile, WptPt selectedPoint) {
LinearLayout view = (LinearLayout) buildCollapsableContentView(context, collapsed, true);
List<WptPt> points = gpxFile.getPoints();
for (int i = 0; i < points.size() && i < 10; i++) {
final WptPt point = points.get(i);
boolean selected = selectedPoint != null && selectedPoint.equals(point);
TextViewEx button = buildButtonInCollapsableView(context, selected, false);
button.setText(point.name);
if (!selected) {
button.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
LatLon latLon = new LatLon(point.getLatitude(), point.getLongitude());
PointDescription pointDescription = new PointDescription(PointDescription.POINT_TYPE_WPT, point.name);
mapActivity.getContextMenu().show(latLon, pointDescription, point);
}
});
}
view.addView(button);
}
if (points.size() > 10) {
TextViewEx button = buildButtonInCollapsableView(context, false, true);
button.setText(context.getString(R.string.shared_string_show_all));
button.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
OsmAndAppCustomization appCustomization = app.getAppCustomization();
final Intent intent = new Intent(context, appCustomization.getTrackActivity());
intent.putExtra(TrackActivity.TRACK_FILE_NAME, gpxFile.path);
intent.putExtra(TrackActivity.OPEN_POINTS_TAB, true);
intent.setFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT);
context.startActivity(intent);
}
});
view.addView(button);
}
return new CollapsableView(view, this, collapsed);
}
use of net.osmand.plus.OsmAndAppCustomization in project Osmand by osmandapp.
the class DashTrackFragment method initView.
@Override
public View initView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View view = getActivity().getLayoutInflater().inflate(R.layout.dash_common_fragment, container, false);
TextView header = (TextView) view.findViewById(R.id.fav_text);
header.setText(TITLE_ID);
(view.findViewById(R.id.show_all)).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
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);
closeDashboard();
}
});
return view;
}
use of net.osmand.plus.OsmAndAppCustomization in project Osmand by osmandapp.
the class FavouritePointMenuBuilder method getCollapsableFavouritesView.
private CollapsableView getCollapsableFavouritesView(final Context context, boolean collapsed, @NonNull final FavoriteGroup group, FavouritePoint selectedPoint) {
LinearLayout view = (LinearLayout) buildCollapsableContentView(context, collapsed, true);
List<FavouritePoint> points = group.points;
for (int i = 0; i < points.size() && i < 10; i++) {
final FavouritePoint point = points.get(i);
boolean selected = selectedPoint != null && selectedPoint.equals(point);
TextViewEx button = buildButtonInCollapsableView(context, selected, false);
String name = point.getName();
button.setText(name);
if (!selected) {
button.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
LatLon latLon = new LatLon(point.getLatitude(), point.getLongitude());
PointDescription pointDescription = new PointDescription(PointDescription.POINT_TYPE_FAVORITE, point.getName());
mapActivity.getContextMenu().show(latLon, pointDescription, point);
}
});
}
view.addView(button);
}
if (points.size() > 10) {
TextViewEx button = buildButtonInCollapsableView(context, false, true);
button.setText(context.getString(R.string.shared_string_show_all));
button.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
OsmAndAppCustomization appCustomization = app.getAppCustomization();
final Intent intent = new Intent(context, appCustomization.getFavoritesActivity());
intent.putExtra(FavoritesActivity.OPEN_FAVOURITES_TAB, true);
intent.putExtra(FavoritesActivity.GROUP_NAME_TO_SHOW, group.name);
intent.setFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT);
context.startActivity(intent);
}
});
view.addView(button);
}
return new CollapsableView(view, this, collapsed);
}
use of net.osmand.plus.OsmAndAppCustomization in project Osmand by osmandapp.
the class DashBaseFragment method startFavoritesActivity.
protected void startFavoritesActivity(int tab) {
Activity activity = getActivity();
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(tab);
activity.startActivity(favorites);
}
Aggregations