Search in sources :

Example 26 with ExportSettingsType

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

the class ImportedSettingsItemsAdapter method onBindViewHolder.

@Override
public void onBindViewHolder(@NonNull ItemViewHolder holder, int position) {
    final ExportSettingsType currentItemType = itemsTypes.get(position);
    boolean isLastItem = itemsTypes.size() - 1 == position;
    int activeColorRes = ColorUtilities.getActiveColorId(nightMode);
    holder.title.setTextColor(app.getResources().getColor(activeColorRes));
    Typeface typeface = FontCache.getFont(app, app.getString(R.string.font_roboto_medium));
    if (typeface != null) {
        holder.title.setTypeface(typeface);
    }
    holder.divider.setVisibility(isLastItem ? View.VISIBLE : View.GONE);
    holder.itemView.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View view) {
            listener.onItemClick(currentItemType);
        }
    });
    holder.subTitle.setText(String.format(app.getString(R.string.ltr_or_rtl_combine_via_colon), app.getString(R.string.items_added), String.valueOf(itemsMap.get(currentItemType).size())));
    switch(currentItemType) {
        case PROFILE:
            holder.icon.setImageDrawable(uiUtils.getIcon(R.drawable.ic_action_settings, activeColorRes));
            holder.title.setText(R.string.shared_string_settings);
            break;
        case QUICK_ACTIONS:
            holder.icon.setImageDrawable(uiUtils.getIcon(R.drawable.ic_quick_action, activeColorRes));
            holder.title.setText(R.string.configure_screen_quick_action);
            break;
        case POI_TYPES:
            holder.icon.setImageDrawable(uiUtils.getIcon(R.drawable.ic_action_info_dark, activeColorRes));
            holder.title.setText(R.string.search_activity);
            break;
        case MAP_SOURCES:
            holder.icon.setImageDrawable(uiUtils.getIcon(R.drawable.ic_action_layers, activeColorRes));
            holder.title.setText(R.string.configure_map);
            break;
        case CUSTOM_RENDER_STYLE:
            holder.icon.setImageDrawable(uiUtils.getIcon(R.drawable.ic_action_map_style, activeColorRes));
            holder.title.setText(R.string.shared_string_rendering_style);
            break;
        case CUSTOM_ROUTING:
            holder.icon.setImageDrawable(uiUtils.getIcon(R.drawable.ic_action_route_distance, activeColorRes));
            holder.title.setText(R.string.shared_string_routing);
            break;
        case AVOID_ROADS:
            holder.icon.setImageDrawable(uiUtils.getIcon(R.drawable.ic_action_alert, activeColorRes));
            holder.title.setText(R.string.avoid_road);
            break;
        case MULTIMEDIA_NOTES:
            holder.icon.setImageDrawable(uiUtils.getIcon(R.drawable.ic_action_photo_dark, activeColorRes));
            holder.title.setText(R.string.notes);
            break;
        case TRACKS:
            holder.icon.setImageDrawable(uiUtils.getIcon(R.drawable.ic_action_route_distance, activeColorRes));
            holder.title.setText(R.string.shared_string_tracks);
            break;
        case OSM_NOTES:
            holder.icon.setImageDrawable(uiUtils.getIcon(R.drawable.ic_action_osm_note_add, activeColorRes));
            holder.title.setText(R.string.osm_notes);
            break;
        case OSM_EDITS:
            holder.icon.setImageDrawable(uiUtils.getIcon(R.drawable.ic_action_openstreetmap_logo, activeColorRes));
            holder.title.setText(R.string.osm_edits);
            break;
        case FAVORITES:
            holder.icon.setImageDrawable(uiUtils.getIcon(R.drawable.ic_action_favorite, activeColorRes));
            holder.title.setText(R.string.shared_string_favorites);
            break;
        case OFFLINE_MAPS:
            holder.icon.setImageDrawable(uiUtils.getIcon(R.drawable.ic_map, activeColorRes));
            holder.title.setText(R.string.shared_string_maps);
            break;
        case TTS_VOICE:
            holder.icon.setImageDrawable(uiUtils.getIcon(R.drawable.ic_action_volume_up, activeColorRes));
            holder.title.setText(R.string.local_indexes_cat_tts);
            break;
        case VOICE:
            holder.icon.setImageDrawable(uiUtils.getIcon(R.drawable.ic_action_volume_up, activeColorRes));
            holder.title.setText(R.string.local_indexes_cat_voice);
            break;
        case GLOBAL:
            holder.icon.setImageDrawable(uiUtils.getIcon(R.drawable.ic_action_settings, activeColorRes));
            holder.title.setText(R.string.osmand_settings);
            break;
        case ACTIVE_MARKERS:
            holder.icon.setImageDrawable(uiUtils.getIcon(R.drawable.ic_action_flag, activeColorRes));
            holder.title.setText(R.string.map_markers);
            break;
        case HISTORY_MARKERS:
            holder.icon.setImageDrawable(uiUtils.getIcon(R.drawable.ic_action_flag, activeColorRes));
            holder.title.setText(R.string.markers_history);
            break;
        case SEARCH_HISTORY:
            holder.icon.setImageDrawable(uiUtils.getIcon(R.drawable.ic_action_history, activeColorRes));
            holder.title.setText(R.string.shared_string_search_history);
            break;
        case ONLINE_ROUTING_ENGINES:
            holder.icon.setImageDrawable(uiUtils.getIcon(R.drawable.ic_world_globe_dark, activeColorRes));
            holder.title.setText(R.string.online_routing_engines);
            break;
        case ITINERARY_GROUPS:
            holder.icon.setImageDrawable(uiUtils.getIcon(R.drawable.ic_action_flag, activeColorRes));
            holder.title.setText(R.string.shared_string_itinerary);
            break;
    }
}
Also used : Typeface(android.graphics.Typeface) ImageView(android.widget.ImageView) TextView(android.widget.TextView) View(android.view.View) RecyclerView(androidx.recyclerview.widget.RecyclerView) ExportSettingsType(net.osmand.plus.settings.backend.ExportSettingsType)

Example 27 with ExportSettingsType

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

the class ExportSettingsFragment method onCreate.

@Override
public void onCreate(@Nullable Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    if (savedInstanceState != null) {
        appMode = ApplicationMode.valueOfStringKey(savedInstanceState.getString(APP_MODE_KEY), null);
        globalExport = savedInstanceState.getBoolean(GLOBAL_EXPORT_KEY);
        exportingStarted = savedInstanceState.getBoolean(EXPORTING_STARTED_KEY);
        exportStartTime = savedInstanceState.getLong(EXPORT_START_TIME_KEY);
        progressMax = savedInstanceState.getInt(PROGRESS_MAX_KEY);
        progressValue = savedInstanceState.getInt(PROGRESS_VALUE_KEY);
    }
    exportMode = true;
    dataList = app.getFileSettingsHelper().getSettingsByCategory(true);
    if (savedInstanceState == null) {
        if (!globalExport) {
            updateSelectedProfile();
        }
        Bundle args = getArguments();
        if (args != null && args.containsKey(SELECTED_TYPES)) {
            List<String> selectedTypes = args.getStringArrayList(SELECTED_TYPES);
            if (!Algorithms.isEmpty(selectedTypes)) {
                for (String type : selectedTypes) {
                    ExportSettingsType settingsType = ExportSettingsType.valueOf(type);
                    List<Object> items = getItemsForType(settingsType);
                    selectedItemsMap.put(settingsType, items);
                }
            }
        }
    }
}
Also used : Bundle(android.os.Bundle) ExportSettingsType(net.osmand.plus.settings.backend.ExportSettingsType)

Example 28 with ExportSettingsType

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

the class ExportSettingsFragment method showInstance.

public static boolean showInstance(@NonNull FragmentManager fragmentManager, @NonNull ApplicationMode appMode, @Nullable List<ExportSettingsType> selectedTypes, boolean globalExport) {
    if (AndroidUtils.isFragmentCanBeAdded(fragmentManager, TAG)) {
        Bundle args = null;
        if (!Algorithms.isEmpty(selectedTypes)) {
            ArrayList<String> types = new ArrayList<>();
            for (ExportSettingsType type : selectedTypes) {
                types.add(type.name());
            }
            args = new Bundle();
            args.putStringArrayList(SELECTED_TYPES, types);
        }
        ExportSettingsFragment fragment = new ExportSettingsFragment();
        fragment.appMode = appMode;
        fragment.globalExport = globalExport;
        fragment.setArguments(args);
        fragmentManager.beginTransaction().replace(R.id.fragmentContainer, fragment, TAG).addToBackStack(SETTINGS_LIST_TAG).commitAllowingStateLoss();
        return true;
    }
    return false;
}
Also used : Bundle(android.os.Bundle) ArrayList(java.util.ArrayList) ExportSettingsType(net.osmand.plus.settings.backend.ExportSettingsType)

Example 29 with ExportSettingsType

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

the class BaseSettingsListFragment method onCategorySelected.

@Override
public void onCategorySelected(ExportSettingsCategory category, boolean selected) {
    SettingsCategoryItems categoryItems = dataList.get(category);
    for (ExportSettingsType type : categoryItems.getNotEmptyTypes()) {
        List<?> selectedItems = selected ? categoryItems.getItemsForType(type) : new ArrayList<>();
        selectedItemsMap.put(type, selectedItems);
    }
    updateAvailableSpace();
}
Also used : ExportSettingsType(net.osmand.plus.settings.backend.ExportSettingsType)

Example 30 with ExportSettingsType

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

the class ExportSettingsAdapter method getChild.

@Override
public Object getChild(int groupPosition, int childPosition) {
    SettingsCategoryItems categoryItems = itemsMap.get(itemsTypes.get(groupPosition));
    ExportSettingsType type = categoryItems.getTypes().get(groupPosition);
    return categoryItems.getItemsForType(type).get(childPosition);
}
Also used : ExportSettingsType(net.osmand.plus.settings.backend.ExportSettingsType)

Aggregations

ExportSettingsType (net.osmand.plus.settings.backend.ExportSettingsType)36 ArrayList (java.util.ArrayList)18 List (java.util.List)10 SettingsCategoryItems (net.osmand.plus.settings.fragments.SettingsCategoryItems)9 ExportSettingsCategory (net.osmand.plus.settings.backend.ExportSettingsCategory)6 View (android.view.View)5 ImageView (android.widget.ImageView)5 TextView (android.widget.TextView)5 File (java.io.File)5 LinkedHashMap (java.util.LinkedHashMap)5 Nullable (androidx.annotation.Nullable)4 HashMap (java.util.HashMap)4 Map (java.util.Map)4 SettingsItem (net.osmand.plus.settings.backend.backup.items.SettingsItem)4 NonNull (androidx.annotation.NonNull)3 EnumMap (java.util.EnumMap)3 ApplicationMode (net.osmand.plus.settings.backend.ApplicationMode)3 SuppressLint (android.annotation.SuppressLint)2 Typeface (android.graphics.Typeface)2 AsyncTask (android.os.AsyncTask)2