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;
}
}
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);
}
}
}
}
}
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;
}
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();
}
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);
}
Aggregations