use of net.osmand.plus.activities.MapActivity in project Osmand by osmandapp.
the class SelectCategoryDialogFragment method addCategory.
private void addCategory(LinearLayout ll, final String categoryName, final int categoryColor) {
View itemView = getActivity().getLayoutInflater().inflate(R.layout.favorite_category_dialog_item, null);
Button button = (Button) itemView.findViewById(R.id.button);
if (categoryColor != 0) {
button.setCompoundDrawablesWithIntrinsicBounds(getIcon(getActivity(), R.drawable.ic_action_folder, categoryColor), null, null, null);
} else {
button.setCompoundDrawablesWithIntrinsicBounds(getIcon(getActivity(), R.drawable.ic_action_folder, getResources().getColor(R.color.color_favorite)), null, null, null);
}
button.setCompoundDrawablePadding(dpToPx(15f));
String name = categoryName.length() == 0 ? getString(R.string.shared_string_favorites) : categoryName;
button.setText(name);
button.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
PointEditor editor = ((MapActivity) getActivity()).getContextMenu().getPointEditor(editorTag);
if (editor != null) {
editor.setCategory(categoryName);
if (gpxFile != null && editor instanceof WptPtEditor) {
((WptPtEditor) editor).getWptPt().category = categoryName;
}
}
if (selectionListener != null) {
selectionListener.onCategorySelected(categoryName, categoryColor);
}
dismiss();
}
});
ll.addView(itemView);
}
use of net.osmand.plus.activities.MapActivity in project Osmand by osmandapp.
the class TrackDetailsMenuFragment method applyDayNightMode.
public void applyDayNightMode() {
MapActivity ctx = getMapActivity();
boolean portraitMode = AndroidUiHelper.isOrientationPortrait(ctx);
boolean landscapeLayout = !portraitMode;
boolean nightMode = ctx.getMyApplication().getDaynightHelper().isNightModeForMapControls();
if (!landscapeLayout) {
AndroidUtils.setBackground(ctx, mainView, nightMode, R.drawable.bg_bottom_menu_light, R.drawable.bg_bottom_menu_dark);
} else {
AndroidUtils.setBackground(ctx, mainView, nightMode, R.drawable.bg_left_menu_light, R.drawable.bg_left_menu_dark);
}
AndroidUtils.setTextPrimaryColor(ctx, (TextView) mainView.findViewById(R.id.y_axis_title), nightMode);
AndroidUtils.setTextPrimaryColor(ctx, (TextView) mainView.findViewById(R.id.x_axis_title), nightMode);
ImageView yAxisArrow = (ImageView) mainView.findViewById(R.id.y_axis_arrow);
ImageView xAxisArrow = (ImageView) mainView.findViewById(R.id.x_axis_arrow);
yAxisArrow.setImageDrawable(getContentIcon(R.drawable.ic_action_arrow_drop_down));
xAxisArrow.setImageDrawable(getContentIcon(R.drawable.ic_action_arrow_drop_down));
ImageButton backButton = (ImageButton) mainView.findViewById(R.id.top_bar_back_button);
if (backButton != null) {
backButton.setImageDrawable(getIcon(R.drawable.ic_arrow_back, R.color.color_white));
}
}
use of net.osmand.plus.activities.MapActivity in project Osmand by osmandapp.
the class EditCategoryDialogFragment method onStart.
@Override
public void onStart() {
super.onStart();
final AlertDialog d = (AlertDialog) getDialog();
if (d != null) {
Button positiveButton = d.getButton(Dialog.BUTTON_POSITIVE);
positiveButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
name = nameEdit.getText().toString().trim();
if (!helper.groupExists(name)) {
helper.addEmptyCategory(name, color);
PointEditor editor = ((MapActivity) getActivity()).getContextMenu().getPointEditor(editorTag);
if (editor != null) {
editor.setCategory(name);
}
if (selectionListener != null) {
selectionListener.onCategorySelected(name, color);
}
d.dismiss();
} else {
AlertDialog.Builder b = new AlertDialog.Builder(getActivity());
b.setMessage(getString(R.string.favorite_category_dublicate_message));
b.setNegativeButton(R.string.shared_string_ok, null);
b.show();
}
}
});
}
}
use of net.osmand.plus.activities.MapActivity in project Osmand by osmandapp.
the class DashRecentsFragment method initView.
@Override
public View initView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
View view = getActivity().getLayoutInflater().inflate(R.layout.dash_common_fragment, container, false);
((TextView) view.findViewById(R.id.fav_text)).setText(TITLE_ID);
(view.findViewById(R.id.show_all)).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
closeDashboard();
MapActivity activity = (MapActivity) getActivity();
activity.showQuickSearch(MapActivity.ShowQuickSearchMode.NEW, false);
}
});
return view;
}
use of net.osmand.plus.activities.MapActivity in project Osmand by osmandapp.
the class WaypointDialogHelper method createItemForRadiusProximity.
protected View createItemForRadiusProximity(final FragmentActivity ctx, final int type, final int[] running, final int position, final ArrayAdapter<Object> thisAdapter, boolean nightMode) {
View v;
if (type == WaypointHelper.POI) {
v = ctx.getLayoutInflater().inflate(R.layout.drawer_list_radius_ex, null);
AndroidUtils.setTextPrimaryColor(mapActivity, (TextView) v.findViewById(R.id.titleEx), nightMode);
String descEx = app.getPoiFilters().isShowingAnyPoi() ? ctx.getString(R.string.poi) : app.getPoiFilters().getSelectedPoiFiltersName();
((TextView) v.findViewById(R.id.title)).setText(ctx.getString(R.string.search_radius_proximity) + ":");
((TextView) v.findViewById(R.id.titleEx)).setText(ctx.getString(R.string.shared_string_type) + ":");
final TextView radiusEx = (TextView) v.findViewById(R.id.descriptionEx);
radiusEx.setText(descEx);
v.findViewById(R.id.secondCellContainer).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
running[0] = position;
thisAdapter.notifyDataSetInvalidated();
MapActivity map = (MapActivity) ctx;
map.getMapLayers().showSingleChoicePoiFilterDialog(map.getMapView(), new MapActivityLayers.DismissListener() {
@Override
public void dismiss() {
enableType(running, thisAdapter, type, true);
}
});
}
});
AndroidUtils.setTextPrimaryColor(mapActivity, (TextView) v.findViewById(R.id.title), nightMode);
final TextView radius = (TextView) v.findViewById(R.id.description);
radius.setText(OsmAndFormatter.getFormattedDistance(waypointHelper.getSearchDeviationRadius(type), app));
v.findViewById(R.id.firstCellContainer).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
selectDifferentRadius(type, running, position, thisAdapter, mapActivity);
}
});
} else {
v = ctx.getLayoutInflater().inflate(R.layout.drawer_list_radius, null);
((TextView) v.findViewById(R.id.title)).setText(ctx.getString(R.string.search_radius_proximity));
AndroidUtils.setTextPrimaryColor(mapActivity, (TextView) v.findViewById(R.id.title), nightMode);
final TextView radius = (TextView) v.findViewById(R.id.description);
radius.setText(OsmAndFormatter.getFormattedDistance(waypointHelper.getSearchDeviationRadius(type), app));
radius.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
selectDifferentRadius(type, running, position, thisAdapter, mapActivity);
}
});
}
return v;
}
Aggregations