Search in sources :

Example 11 with OsmAndAppCustomization

use of net.osmand.plus.settings.backend.OsmAndAppCustomization in project Osmand by osmandapp.

the class RouteOptionsBottomSheet method createMenuItems.

@Override
public void createMenuItems(Bundle savedInstanceState) {
    items.add(new TitleItem(app.getString(R.string.shared_string_settings), ColorUtilities.getActiveColorId(nightMode)));
    OsmAndAppCustomization customization = app.getAppCustomization();
    List<LocalRoutingParameter> list = getRoutingParameters(applicationMode);
    for (final LocalRoutingParameter optionsItem : list) {
        if (!dialogMode.isAvailableParameter(optionsItem) || !customization.isFeatureEnabled(optionsItem.getKey())) {
            continue;
        }
        if (optionsItem instanceof DividerItem) {
            if (isDividerRequired()) {
                items.add(new DividerStartItem(app));
            }
        } else if (optionsItem instanceof MuteSoundRoutingParameter) {
            items.add(createMuteSoundItem(optionsItem));
        } else if (optionsItem instanceof ShowAlongTheRouteItem) {
            items.add(createShowAlongTheRouteItem(optionsItem));
        } else if (optionsItem instanceof RouteSimulationItem) {
            items.add(createRouteSimulationItem(optionsItem));
        } else if (optionsItem instanceof AvoidPTTypesRoutingParameter) {
            items.add(createAvoidPTTypesItem(optionsItem));
        } else if (optionsItem instanceof AvoidRoadsRoutingParameter) {
            items.add(createAvoidRoadsItem(optionsItem));
        } else if (optionsItem instanceof GpxLocalRoutingParameter) {
            items.add(createGpxRoutingItem(optionsItem));
        } else if (optionsItem instanceof TimeConditionalRoutingItem) {
            items.add(createTimeConditionalRoutingItem(optionsItem));
        } else if (optionsItem instanceof OtherSettingsRoutingParameter) {
            items.add(createOtherSettingsRoutingItem(optionsItem));
        } else if (optionsItem instanceof CustomizeRouteLineRoutingParameter) {
            items.add(createCustomizeRouteLineRoutingItem(optionsItem));
        } else if (USE_HEIGHT_OBSTACLES.equals(optionsItem.getKey()) && hasReliefParameters()) {
            items.add(inflateElevationParameter(optionsItem));
        } else {
            inflateRoutingParameter(optionsItem);
        }
    }
}
Also used : OtherSettingsRoutingParameter(net.osmand.plus.routepreparationmenu.RoutingOptionsHelper.OtherSettingsRoutingParameter) MuteSoundRoutingParameter(net.osmand.plus.routepreparationmenu.RoutingOptionsHelper.MuteSoundRoutingParameter) AvoidPTTypesRoutingParameter(net.osmand.plus.routepreparationmenu.RoutingOptionsHelper.AvoidPTTypesRoutingParameter) TimeConditionalRoutingItem(net.osmand.plus.routepreparationmenu.RoutingOptionsHelper.TimeConditionalRoutingItem) RouteSimulationItem(net.osmand.plus.routepreparationmenu.RoutingOptionsHelper.RouteSimulationItem) TitleItem(net.osmand.plus.base.bottomsheetmenu.simpleitems.TitleItem) GpxLocalRoutingParameter(net.osmand.plus.routepreparationmenu.RoutingOptionsHelper.GpxLocalRoutingParameter) LocalRoutingParameter(net.osmand.plus.routepreparationmenu.RoutingOptionsHelper.LocalRoutingParameter) AvoidRoadsRoutingParameter(net.osmand.plus.routepreparationmenu.RoutingOptionsHelper.AvoidRoadsRoutingParameter) GpxLocalRoutingParameter(net.osmand.plus.routepreparationmenu.RoutingOptionsHelper.GpxLocalRoutingParameter) DividerStartItem(net.osmand.plus.base.bottomsheetmenu.simpleitems.DividerStartItem) CustomizeRouteLineRoutingParameter(net.osmand.plus.routepreparationmenu.RoutingOptionsHelper.CustomizeRouteLineRoutingParameter) OsmAndAppCustomization(net.osmand.plus.settings.backend.OsmAndAppCustomization) ShowAlongTheRouteItem(net.osmand.plus.routepreparationmenu.RoutingOptionsHelper.ShowAlongTheRouteItem) DividerItem(net.osmand.plus.routepreparationmenu.RoutingOptionsHelper.DividerItem)

Example 12 with OsmAndAppCustomization

use of net.osmand.plus.settings.backend.OsmAndAppCustomization in project Osmand by osmandapp.

the class DashBaseFragment method startFavoritesActivity.

protected void startFavoritesActivity(int tab) {
    Activity activity = getActivity();
    if (activity == null) {
        return;
    }
    OsmandApplication app = getMyApplication();
    OsmAndAppCustomization appCustomization = app.getAppCustomization();
    final Intent favorites = new Intent(activity, appCustomization.getFavoritesActivity());
    favorites.setFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT);
    app.getSettings().FAVORITES_TAB.set(tab);
    activity.startActivity(favorites);
}
Also used : OsmandApplication(net.osmand.plus.OsmandApplication) OsmAndAppCustomization(net.osmand.plus.settings.backend.OsmAndAppCustomization) Activity(android.app.Activity) MapActivity(net.osmand.plus.activities.MapActivity) Intent(android.content.Intent)

Example 13 with OsmAndAppCustomization

use of net.osmand.plus.settings.backend.OsmAndAppCustomization in project Osmand by osmandapp.

the class OsmEditingFragment method onPreferenceClick.

@Override
public boolean onPreferenceClick(Preference preference) {
    String prefId = preference.getKey();
    if (OPEN_OSM_EDITS.equals(prefId)) {
        Bundle bundle = new Bundle();
        bundle.putInt(TAB_ID, OSM_EDIT_TAB);
        OsmAndAppCustomization appCustomization = app.getAppCustomization();
        Intent favorites = new Intent(preference.getContext(), appCustomization.getFavoritesActivity());
        favorites.setFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT);
        favorites.putExtra(MapActivity.INTENT_PARAMS, bundle);
        startActivity(favorites);
        return true;
    } else if (OSM_LOGIN_DATA.equals(prefId)) {
        FragmentManager fragmentManager = getFragmentManager();
        if (fragmentManager != null) {
            LoginBottomSheetFragment.showInstance(fragmentManager, this);
            return true;
        }
    } else if (OSM_LOGOUT.equals(prefId)) {
        osmLogout();
        return true;
    } else if (MAP_UPDATES_FOR_MAPPERS.equals(prefId)) {
        FragmentActivity activity = getActivity();
        if (activity != null) {
            if (!isValidToken() && !isLoginExists()) {
                MappersPromoFragment.showInstance(activity, this);
            } else {
                MappersFragment.showInstance(activity);
            }
            return true;
        }
    }
    return super.onPreferenceClick(preference);
}
Also used : FragmentManager(androidx.fragment.app.FragmentManager) FragmentActivity(androidx.fragment.app.FragmentActivity) OsmAndAppCustomization(net.osmand.plus.settings.backend.OsmAndAppCustomization) Bundle(android.os.Bundle) Intent(android.content.Intent) SpannableString(android.text.SpannableString)

Example 14 with OsmAndAppCustomization

use of net.osmand.plus.settings.backend.OsmAndAppCustomization in project Osmand by osmandapp.

the class MultimediaNotesFragment method onPreferenceClick.

@Override
public boolean onPreferenceClick(Preference preference) {
    String prefId = preference.getKey();
    if (OPEN_NOTES.equals(prefId)) {
        Bundle bundle = new Bundle();
        bundle.putInt(TAB_ID, NOTES_TAB);
        OsmAndAppCustomization appCustomization = app.getAppCustomization();
        Intent favorites = new Intent(preference.getContext(), appCustomization.getFavoritesActivity());
        favorites.setFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT);
        favorites.putExtra(MapActivity.INTENT_PARAMS, bundle);
        startActivity(favorites);
        return true;
    } else if (COPY_PLUGIN_SETTINGS.equals(prefId)) {
        FragmentManager fragmentManager = getFragmentManager();
        if (fragmentManager != null) {
            SelectCopyAppModeBottomSheet.showInstance(fragmentManager, this, false, getSelectedAppMode());
        }
    } else if (RESET_TO_DEFAULT.equals(prefId)) {
        FragmentManager fragmentManager = getFragmentManager();
        if (fragmentManager != null) {
            ResetProfilePrefsBottomSheet.showInstance(fragmentManager, prefId, this, false, getSelectedAppMode());
        }
    } else if (CAMERA_PERMISSION.equals(prefId)) {
        requestPermissions(new String[] { Manifest.permission.CAMERA }, CAMERA_FOR_PHOTO_PARAMS_REQUEST_CODE);
    }
    return super.onPreferenceClick(preference);
}
Also used : FragmentManager(androidx.fragment.app.FragmentManager) OsmAndAppCustomization(net.osmand.plus.settings.backend.OsmAndAppCustomization) Bundle(android.os.Bundle) Intent(android.content.Intent) SpannableString(android.text.SpannableString)

Example 15 with OsmAndAppCustomization

use of net.osmand.plus.settings.backend.OsmAndAppCustomization in project Osmand by osmandapp.

the class MonitoringSettingsFragment method onPreferenceClick.

@Override
public boolean onPreferenceClick(Preference preference) {
    String prefId = preference.getKey();
    if (OPEN_TRACKS.equals(prefId)) {
        Bundle bundle = new Bundle();
        bundle.putInt(TAB_ID, FavoritesActivity.GPX_TAB);
        OsmAndAppCustomization appCustomization = app.getAppCustomization();
        Intent favorites = new Intent(preference.getContext(), appCustomization.getFavoritesActivity());
        favorites.setFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT);
        favorites.putExtra(MapActivity.INTENT_PARAMS, bundle);
        startActivity(favorites);
        return true;
    } else if (COPY_PLUGIN_SETTINGS.equals(prefId)) {
        FragmentManager fragmentManager = getFragmentManager();
        if (fragmentManager != null) {
            SelectCopyAppModeBottomSheet.showInstance(fragmentManager, this, false, getSelectedAppMode());
        }
    } else if (RESET_TO_DEFAULT.equals(prefId)) {
        FragmentManager fragmentManager = getFragmentManager();
        if (fragmentManager != null) {
            ResetProfilePrefsBottomSheet.showInstance(fragmentManager, prefId, this, false, getSelectedAppMode());
        }
    }
    return super.onPreferenceClick(preference);
}
Also used : FragmentManager(androidx.fragment.app.FragmentManager) OsmAndAppCustomization(net.osmand.plus.settings.backend.OsmAndAppCustomization) Bundle(android.os.Bundle) Intent(android.content.Intent) SpannableString(android.text.SpannableString)

Aggregations

OsmAndAppCustomization (net.osmand.plus.settings.backend.OsmAndAppCustomization)15 Intent (android.content.Intent)9 Bundle (android.os.Bundle)5 View (android.view.View)4 ImageView (android.widget.ImageView)4 FragmentManager (androidx.fragment.app.FragmentManager)4 OsmandApplication (net.osmand.plus.OsmandApplication)4 MapActivity (net.osmand.plus.activities.MapActivity)4 OsmandMapTileView (net.osmand.plus.views.OsmandMapTileView)4 SpannableString (android.text.SpannableString)3 TextView (android.widget.TextView)3 AppCompatImageView (androidx.appcompat.widget.AppCompatImageView)3 RoutingHelper (net.osmand.plus.routing.RoutingHelper)3 Activity (android.app.Activity)2 HorizontalScrollView (android.widget.HorizontalScrollView)2 FragmentActivity (androidx.fragment.app.FragmentActivity)2 File (java.io.File)2 TransportRoutingHelper (net.osmand.plus.routing.TransportRoutingHelper)2 ApplicationMode (net.osmand.plus.settings.backend.ApplicationMode)2 NameNotFoundException (android.content.pm.PackageManager.NameNotFoundException)1