Search in sources :

Example 26 with MapActivity

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();
}
Also used : AlertDialog(android.support.v7.app.AlertDialog) DialogInterface(android.content.DialogInterface) MapActivity(net.osmand.plus.activities.MapActivity) NonNull(android.support.annotation.NonNull)

Example 27 with MapActivity

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;
}
Also used : TextView(android.widget.TextView) View(android.view.View) MapActivity(net.osmand.plus.activities.MapActivity)

Example 28 with MapActivity

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);
}
Also used : MapActivity(net.osmand.plus.activities.MapActivity)

Example 29 with MapActivity

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;
}
Also used : ImageButton(android.widget.ImageButton) TextView(android.widget.TextView) ImageView(android.widget.ImageView) TextView(android.widget.TextView) View(android.view.View) ViewTreeObserver(android.view.ViewTreeObserver) MapActivity(net.osmand.plus.activities.MapActivity)

Example 30 with MapActivity

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);
            }
        });
    }
}
Also used : TextView(android.widget.TextView) View(android.view.View) MapActivity(net.osmand.plus.activities.MapActivity)

Aggregations

MapActivity (net.osmand.plus.activities.MapActivity)85 View (android.view.View)39 ImageView (android.widget.ImageView)28 TextView (android.widget.TextView)28 RecyclerView (android.support.v7.widget.RecyclerView)15 OsmandMapTileView (net.osmand.plus.views.OsmandMapTileView)14 AlertDialog (android.support.v7.app.AlertDialog)12 Nullable (android.support.annotation.Nullable)11 DialogInterface (android.content.DialogInterface)10 AdapterView (android.widget.AdapterView)9 LatLon (net.osmand.data.LatLon)9 OsmandApplication (net.osmand.plus.OsmandApplication)9 Bundle (android.os.Bundle)7 Button (android.widget.Button)7 EditText (android.widget.EditText)7 ImageButton (android.widget.ImageButton)7 FavouritePoint (net.osmand.data.FavouritePoint)7 Fragment (android.support.v4.app.Fragment)6 LinearLayoutManager (android.support.v7.widget.LinearLayoutManager)6 ViewTreeObserver (android.view.ViewTreeObserver)6