Search in sources :

Example 71 with MapActivity

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

Example 72 with MapActivity

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

Example 73 with MapActivity

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();
                }
            }
        });
    }
}
Also used : AlertDialog(android.support.v7.app.AlertDialog) Button(android.widget.Button) View(android.view.View) AdapterView(android.widget.AdapterView) MapActivity(net.osmand.plus.activities.MapActivity)

Example 74 with MapActivity

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

Example 75 with MapActivity

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;
}
Also used : TextView(android.widget.TextView) ImageView(android.widget.ImageView) View(android.view.View) AdapterView(android.widget.AdapterView) TextView(android.widget.TextView) 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