use of net.osmand.plus.activities.MapActivity in project Osmand by osmandapp.
the class MapillaryInstallDialogFragment method onCreateDialog.
@NonNull
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
final MapActivity mapActivity = (MapActivity) getActivity();
final AlertDialog.Builder builder = new AlertDialog.Builder(mapActivity);
builder.setCancelable(true);
builder.setNegativeButton(mapActivity.getString(R.string.shared_string_cancel), new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
dialog.dismiss();
}
});
builder.setPositiveButton(mapActivity.getString(R.string.shared_string_install), new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
dialog.dismiss();
MapillaryPlugin.installMapillary(mapActivity, mapActivity.getMyApplication());
}
});
builder.setView(mapActivity.getLayoutInflater().inflate(R.layout.mapillary_install_dialog, null));
return builder.create();
}
use of net.osmand.plus.activities.MapActivity in project Osmand by osmandapp.
the class MapRouteInfoMenuFragment method onCreateView.
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
MapActivity mapActivity = getMapActivity();
menu = mapActivity.getMapLayers().getMapControlsLayer().getMapRouteInfoMenu();
View view = inflater.inflate(R.layout.plan_route_info, container, false);
portrait = AndroidUiHelper.isOrientationPortrait(mapActivity);
if (!portrait) {
AndroidUtils.addStatusBarPadding21v(getActivity(), view);
}
if (menu == null) {
return view;
}
view.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
dismiss();
}
});
mainView = view.findViewById(R.id.main_view);
updateInfo();
return view;
}
use of net.osmand.plus.activities.MapActivity in project Osmand by osmandapp.
the class MapRouteInfoMenuFragment 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.route_info_menu_bg_light, R.drawable.route_info_menu_bg_dark);
} else {
AndroidUtils.setBackground(ctx, mainView, nightMode, R.drawable.route_info_menu_bg_left_light, R.drawable.route_info_menu_bg_left_dark);
}
AndroidUtils.setBackground(ctx, mainView.findViewById(R.id.map_route_prepare_bottom_view), nightMode, R.color.route_info_bottom_view_bg_light, R.color.route_info_bottom_view_bg_dark);
AndroidUtils.setBackground(ctx, mainView.findViewById(R.id.dividerModesLayout), nightMode, R.color.route_info_divider_light, R.color.route_info_divider_dark);
AndroidUtils.setBackground(ctx, mainView.findViewById(R.id.dividerFromDropDown), nightMode, R.color.route_info_divider_light, R.color.route_info_divider_dark);
AndroidUtils.setBackground(ctx, mainView.findViewById(R.id.viaLayoutDivider), nightMode, R.color.route_info_divider_light, R.color.route_info_divider_dark);
AndroidUtils.setBackground(ctx, mainView.findViewById(R.id.dividerToDropDown), nightMode, R.color.route_info_divider_light, R.color.route_info_divider_dark);
AndroidUtils.setBackground(ctx, mainView.findViewById(R.id.dividerButtons), nightMode, R.color.route_info_divider_light, R.color.route_info_divider_dark);
AndroidUtils.setBackground(ctx, mainView.findViewById(R.id.dividerBtn1), nightMode, R.color.route_info_divider_light, R.color.route_info_divider_dark);
AndroidUtils.setBackground(ctx, mainView.findViewById(R.id.dividerBtn2), nightMode, R.color.route_info_divider_light, R.color.route_info_divider_dark);
AndroidUtils.setTextPrimaryColor(ctx, (TextView) mainView.findViewById(R.id.ViaView), nightMode);
AndroidUtils.setTextSecondaryColor(ctx, (TextView) mainView.findViewById(R.id.ViaSubView), nightMode);
AndroidUtils.setTextSecondaryColor(ctx, (TextView) mainView.findViewById(R.id.toTitle), nightMode);
AndroidUtils.setTextSecondaryColor(ctx, (TextView) mainView.findViewById(R.id.fromTitle), nightMode);
AndroidUtils.setTextPrimaryColor(ctx, (TextView) mainView.findViewById(R.id.InfoTextView), nightMode);
AndroidUtils.setTextPrimaryColor(ctx, (TextView) mainView.findViewById(R.id.DistanceText), nightMode);
AndroidUtils.setTextSecondaryColor(ctx, (TextView) mainView.findViewById(R.id.DistanceTitle), nightMode);
AndroidUtils.setTextPrimaryColor(ctx, (TextView) mainView.findViewById(R.id.DurationText), nightMode);
AndroidUtils.setTextSecondaryColor(ctx, (TextView) mainView.findViewById(R.id.DurationTitle), nightMode);
}
use of net.osmand.plus.activities.MapActivity in project Osmand by osmandapp.
the class TrackDetailsMenuFragment method onCreateView.
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
MapActivity mapActivity = getMapActivity();
menu = mapActivity.getMapLayers().getMapControlsLayer().getTrackDetailsMenu();
View view = inflater.inflate(R.layout.track_details, container, false);
if (!AndroidUiHelper.isOrientationPortrait(getActivity())) {
AndroidUtils.addStatusBarPadding21v(getActivity(), view);
}
if (menu == null || menu.getGpxItem() == null) {
return view;
}
mainView = view.findViewById(R.id.main_view);
TextView topBarTitle = (TextView) mainView.findViewById(R.id.top_bar_title);
if (topBarTitle != null) {
if (menu.getGpxItem().group != null) {
topBarTitle.setText(menu.getGpxItem().group.getGpxName());
} else {
topBarTitle.setText(mapActivity.getString(R.string.rendering_category_details));
}
}
ImageButton backButton = (ImageButton) mainView.findViewById(R.id.top_bar_back_button);
ImageButton closeButton = (ImageButton) mainView.findViewById(R.id.top_bar_close_button);
if (backButton != null) {
backButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
getActivity().onBackPressed();
}
});
}
if (closeButton != null) {
closeButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
dismiss();
}
});
}
updateInfo();
ViewTreeObserver vto = mainView.getViewTreeObserver();
vto.addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() {
@Override
public void onGlobalLayout() {
ViewTreeObserver obs = mainView.getViewTreeObserver();
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
obs.removeOnGlobalLayoutListener(this);
} else {
obs.removeGlobalOnLayoutListener(this);
}
if (getMapActivity() != null) {
updateInfo();
}
}
});
return view;
}
use of net.osmand.plus.activities.MapActivity in project Osmand by osmandapp.
the class MapillaryContributeCard method update.
@Override
public void update() {
if (view != null) {
boolean night = getMyApplication().getDaynightHelper().isNightModeForMapControls();
MapActivity ctx = getMapActivity();
AndroidUtils.setBackgroundColor(ctx, view, night, R.color.bg_color_light, R.color.bg_color_dark);
AndroidUtils.setTextPrimaryColor(ctx, (TextView) view.findViewById(R.id.title), night);
AndroidUtils.setBackground(ctx, view.findViewById(R.id.card_background), night, R.drawable.context_menu_card_light, R.drawable.context_menu_card_dark);
view.findViewById(R.id.button).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
MapillaryPlugin.openMapillary(getMapActivity(), null);
}
});
}
}
Aggregations