From b5f5e0e916db82fd73363f1e216c59955ad3ad2e Mon Sep 17 00:00:00 2001 From: veliymolfar Date: Tue, 18 Feb 2020 16:15:24 +0200 Subject: [PATCH] copy of copy base profiles, ui fixes --- OsmAnd/res/layout/fragment_import.xml | 8 +- .../res/layout/fragment_import_duplicates.xml | 7 +- OsmAnd/res/values/strings.xml | 1 + .../src/net/osmand/plus/SettingsHelper.java | 39 +++++++-- .../settings/DuplicatesSettingsAdapter.java | 82 +++++++++++-------- .../settings/ExportImportSettingsAdapter.java | 20 ++++- .../settings/ImportDuplicatesFragment.java | 7 +- .../plus/settings/ImportSettingsFragment.java | 2 +- 8 files changed, 108 insertions(+), 58 deletions(-) diff --git a/OsmAnd/res/layout/fragment_import.xml b/OsmAnd/res/layout/fragment_import.xml index adb5757830..792f7db928 100644 --- a/OsmAnd/res/layout/fragment_import.xml +++ b/OsmAnd/res/layout/fragment_import.xml @@ -49,11 +49,7 @@ android:textSize="@dimen/default_list_text_size" osmand:typeface="@string/font_roboto_medium" /> - + + + + layout="@layout/card_bottom_divider" /> + + + Preparing POI types Nothing selected Quick actions diff --git a/OsmAnd/src/net/osmand/plus/SettingsHelper.java b/OsmAnd/src/net/osmand/plus/SettingsHelper.java index c0b5f1bb58..585077b358 100644 --- a/OsmAnd/src/net/osmand/plus/SettingsHelper.java +++ b/OsmAnd/src/net/osmand/plus/SettingsHelper.java @@ -2,6 +2,7 @@ package net.osmand.plus; import android.annotation.SuppressLint; import android.app.Activity; +import android.app.ProgressDialog; import android.content.Context; import android.content.DialogInterface; import android.os.AsyncTask; @@ -23,6 +24,7 @@ import net.osmand.plus.ApplicationMode.ApplicationModeBuilder; import net.osmand.plus.OsmandSettings.OsmandPreference; import net.osmand.plus.activities.MapActivity; import net.osmand.plus.poi.PoiUIFilter; +import net.osmand.plus.profiles.ProfileIcons; import net.osmand.plus.quickaction.QuickAction; import net.osmand.plus.quickaction.QuickActionFactory; import net.osmand.util.Algorithms; @@ -520,14 +522,29 @@ public class SettingsHelper { @Override public void apply() { - if (appMode.isCustomProfile()) { - if (!shouldReplace && exists()) { - renameProfile(); - builder = ApplicationMode.fromModeBean(app, modeBean); - } - appMode = ApplicationMode.saveProfile(builder, getSettings().getContext()); - ApplicationMode.changeProfileAvailability(appMode, true, app); + if (!appMode.isCustomProfile() && !shouldReplace) { + ApplicationMode parent = ApplicationMode.valueOfStringKey(modeBean.stringKey, null); + renameProfile(); + ApplicationMode.ApplicationModeBuilder builder = ApplicationMode + .createCustomMode(parent, modeBean.stringKey, app) + .setIconResName(modeBean.iconName) + .setUserProfileName(modeBean.userProfileName) + .setRoutingProfile(modeBean.routingProfile) + .setRouteService(modeBean.routeService) + .setIconColor(modeBean.iconColor) + .setLocationIcon(modeBean.locIcon) + .setNavigationIcon(modeBean.navIcon); + app.getSettings().copyPreferencesFromProfile(parent, builder.getApplicationMode()); + appMode = ApplicationMode.saveProfile(builder, app); + } else if (!shouldReplace && exists()) { + renameProfile(); + builder = ApplicationMode.fromModeBean(app, modeBean); + appMode = ApplicationMode.saveProfile(builder, app); + } else { + builder = ApplicationMode.fromModeBean(app, modeBean); + appMode = ApplicationMode.saveProfile(builder, app); } + ApplicationMode.changeProfileAvailability(appMode, true, app); } @Override @@ -1809,6 +1826,7 @@ public class SettingsHelper { private SettingsExporter exporter; private File file; private SettingsExportListener listener; + private ProgressDialog progress; ExportAsyncTask(@NonNull File settingsFile, @Nullable SettingsExportListener listener, @@ -1821,6 +1839,12 @@ public class SettingsHelper { } } + @Override + protected void onPreExecute() { + super.onPreExecute(); + progress = ProgressDialog.show(activity, app.getString(R.string.export_profile), app.getString(R.string.shared_sting_preparing)); + } + @Override protected Boolean doInBackground(Void... voids) { try { @@ -1836,6 +1860,7 @@ public class SettingsHelper { @Override protected void onPostExecute(Boolean success) { + progress.dismiss(); if (listener != null) { listener.onSettingsExportFinished(file, success); } diff --git a/OsmAnd/src/net/osmand/plus/settings/DuplicatesSettingsAdapter.java b/OsmAnd/src/net/osmand/plus/settings/DuplicatesSettingsAdapter.java index 764b3d43f0..210b07a977 100644 --- a/OsmAnd/src/net/osmand/plus/settings/DuplicatesSettingsAdapter.java +++ b/OsmAnd/src/net/osmand/plus/settings/DuplicatesSettingsAdapter.java @@ -1,6 +1,5 @@ package net.osmand.plus.settings; -import android.graphics.drawable.Drawable; import android.support.annotation.NonNull; import android.support.v7.widget.RecyclerView; import android.view.LayoutInflater; @@ -9,13 +8,16 @@ import android.view.ViewGroup; import android.widget.ImageView; import android.widget.TextView; +import net.osmand.AndroidUtils; import net.osmand.map.ITileSource; import net.osmand.plus.ApplicationMode; import net.osmand.plus.OsmandApplication; import net.osmand.plus.R; import net.osmand.plus.poi.PoiUIFilter; +import net.osmand.plus.profiles.ProfileIconColors; import net.osmand.plus.quickaction.QuickAction; import net.osmand.plus.render.RenderingIcons; +import net.osmand.util.Algorithms; import java.io.File; @@ -59,45 +61,53 @@ public class DuplicatesSettingsAdapter extends RecyclerView.Adapter prepareDuplicates() { List duplicates = new ArrayList<>(); - List profiles = new ArrayList<>(); + List profiles = new ArrayList<>(); List actions = new ArrayList<>(); List filters = new ArrayList<>(); List tileSources = new ArrayList<>(); @@ -98,8 +99,8 @@ public class ImportDuplicatesFragment extends BaseOsmAndDialogFragment implement List routingFilesList = new ArrayList<>(); for (Object object : duplicatesList) { - if (object instanceof ApplicationMode) { - profiles.add((ApplicationMode) object); + if (object instanceof ApplicationMode.ApplicationModeBean) { + profiles.add((ApplicationMode.ApplicationModeBean) object); } else if (object instanceof QuickAction) { actions.add((QuickAction) object); } else if (object instanceof PoiUIFilter) { diff --git a/OsmAnd/src/net/osmand/plus/settings/ImportSettingsFragment.java b/OsmAnd/src/net/osmand/plus/settings/ImportSettingsFragment.java index 8653c9cddd..f0e641c59e 100644 --- a/OsmAnd/src/net/osmand/plus/settings/ImportSettingsFragment.java +++ b/OsmAnd/src/net/osmand/plus/settings/ImportSettingsFragment.java @@ -1 +1 @@ -package net.osmand.plus.settings; import android.os.Bundle; import android.support.annotation.NonNull; import android.support.annotation.Nullable; import android.support.v4.app.FragmentManager; import android.support.v7.widget.Toolbar; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.ExpandableListView; import net.osmand.map.ITileSource; import net.osmand.map.TileSourceManager; import net.osmand.plus.ApplicationMode; import net.osmand.plus.OsmandApplication; import net.osmand.plus.R; import net.osmand.plus.SQLiteTileSource; import net.osmand.plus.SettingsHelper; import net.osmand.plus.SettingsHelper.SettingsItem; import net.osmand.plus.UiUtilities; import net.osmand.plus.base.BaseOsmAndDialogFragment; import net.osmand.plus.poi.PoiUIFilter; import net.osmand.plus.profiles.AdditionalDataWrapper; import net.osmand.plus.quickaction.QuickAction; import net.osmand.plus.widgets.TextViewEx; import java.io.File; import java.util.ArrayList; import java.util.List; public class ImportSettingsFragment extends BaseOsmAndDialogFragment implements View.OnClickListener { public static final String TAG = ImportSettingsFragment.class.getSimpleName(); private OsmandApplication app; private ExportImportSettingsAdapter adapter; private ExpandableListView expandableList; private TextViewEx selectBtn; private List settingsItems; private File file; private boolean allSelected; private boolean nightMode; public static void showInstance(@NonNull FragmentManager fm, @NonNull List settingsItems, @NonNull File file) { ImportSettingsFragment fragment = new ImportSettingsFragment(); fragment.setSettingsItems(settingsItems); fragment.setFile(file); fragment.show(fm, TAG); } @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); app = getMyApplication(); nightMode = !getSettings().isLightContent(); if (settingsItems == null) { settingsItems = app.getSettingsHelper().getSettingsItems(); } if (file == null) { file = app.getSettingsHelper().getSettingsFile(); } } @Nullable @Override public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { inflater = UiUtilities.getInflater(app, nightMode); View root = inflater.inflate(R.layout.fragment_import, container, false); setupToolbar((Toolbar) root.findViewById(R.id.toolbar)); TextViewEx continueBtn = root.findViewById(R.id.continue_button); selectBtn = root.findViewById(R.id.select_button); expandableList = root.findViewById(R.id.list); continueBtn.setOnClickListener(this); selectBtn.setOnClickListener(this); return root; } @Override public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) { super.onViewCreated(view, savedInstanceState); adapter = new ExportImportSettingsAdapter(getMyApplication(), getSettingsToOperate(), nightMode, true); expandableList.setAdapter(adapter); } @Override public void onClick(View view) { switch (view.getId()) { case R.id.select_button: { allSelected = !allSelected; selectBtn.setText(allSelected ? R.string.shared_string_deselect_all : R.string.shared_string_select_all); adapter.selectAll(allSelected); break; } case R.id.continue_button: { if (adapter.getDataToOperate().isEmpty()) { app.showShortToastMessage(getString(R.string.shared_sting_nothing_selected)); } else { importItems(); } break; } } } private void importItems() { List settingsItems = getSettingsItemsFromData(adapter.getDataToOperate()); List duplicateItems = getDuplicatesData(settingsItems); if (duplicateItems.isEmpty()) { app.getSettingsHelper().importSettings(file, settingsItems, "", 1, new SettingsHelper.SettingsImportListener() { @Override public void onSettingsImportFinished(boolean succeed, boolean empty, @NonNull List items) { if (succeed) { app.showShortToastMessage(app.getString(R.string.file_imported_successfully, file.getName())); } else if (empty) { app.showShortToastMessage(app.getString(R.string.file_import_error, file.getName(), app.getString(R.string.shared_string_unexpected_error))); } } }); dismiss(); } else { ImportDuplicatesFragment.showInstance(getFragmentManager(), duplicateItems, settingsItems, file); dismiss(); } } private List getDuplicatesData(List items) { List duplicateItems = new ArrayList<>(); for (SettingsItem item : items) { if (item instanceof SettingsHelper.ProfileSettingsItem) { if (item.exists()) { duplicateItems.add(((SettingsHelper.ProfileSettingsItem) item).getAppMode()); } } else if (item instanceof SettingsHelper.QuickActionSettingsItem) { List duplicates = ((SettingsHelper.QuickActionSettingsItem) item).getDuplicates(); if (!duplicates.isEmpty()) { duplicateItems.addAll(duplicates); } } else if (item instanceof SettingsHelper.PoiUiFilterSettingsItem) { List duplicates = ((SettingsHelper.PoiUiFilterSettingsItem) item).getDuplicates(); if (!duplicates.isEmpty()) { duplicateItems.addAll(duplicates); } } else if (item instanceof SettingsHelper.MapSourcesSettingsItem) { List duplicates = ((SettingsHelper.MapSourcesSettingsItem) item).getDuplicates(); if (!duplicates.isEmpty()) { duplicateItems.addAll(duplicates); } } else if (item instanceof SettingsHelper.FileSettingsItem) { if (item.exists()) { duplicateItems.add(((SettingsHelper.FileSettingsItem) item).getFile()); } } } return duplicateItems; } public void setSettingsItems(List settingsItems) { this.settingsItems = settingsItems; } private List getSettingsItemsFromData(List dataToOperate) { List settingsItems = new ArrayList<>(); List quickActions = new ArrayList<>(); List poiUIFilters = new ArrayList<>(); List tileSourceTemplates = new ArrayList<>(); for (Object object : dataToOperate) { if (object instanceof ApplicationMode.ApplicationModeBean) { settingsItems.add(new SettingsHelper.ProfileSettingsItem(app, (ApplicationMode.ApplicationModeBean) object)); } if (object instanceof QuickAction) { quickActions.add((QuickAction) object); } else if (object instanceof PoiUIFilter) { poiUIFilters.add((PoiUIFilter) object); } else if (object instanceof TileSourceManager.TileSourceTemplate || object instanceof SQLiteTileSource) { tileSourceTemplates.add((ITileSource) object); } else if (object instanceof File) { settingsItems.add(new SettingsHelper.FileSettingsItem(getMyApplication(), (File) object)); } } if (!quickActions.isEmpty()) { settingsItems.add(new SettingsHelper.QuickActionSettingsItem(getMyApplication(), quickActions)); } if (!poiUIFilters.isEmpty()) { settingsItems.add(new SettingsHelper.PoiUiFilterSettingsItem(getMyApplication(), poiUIFilters)); } if (!tileSourceTemplates.isEmpty()) { settingsItems.add(new SettingsHelper.MapSourcesSettingsItem(getMyApplication(), tileSourceTemplates)); } return settingsItems; } private List getSettingsToOperate() { List settingsToOperate = new ArrayList<>(); List profiles = new ArrayList<>(); List quickActions = new ArrayList<>(); List poiUIFilters = new ArrayList<>(); List tileSourceTemplates = new ArrayList<>(); List routingFilesList = new ArrayList<>(); List renderFilesList = new ArrayList<>(); for (SettingsHelper.SettingsItem item : settingsItems) { if (item.getType().equals(SettingsHelper.SettingsItemType.PROFILE)) { profiles.add(((SettingsHelper.ProfileSettingsItem) item).getModeBean()); } else if (item.getType().equals(SettingsHelper.SettingsItemType.QUICK_ACTION)) { quickActions.addAll(((SettingsHelper.QuickActionSettingsItem) item).getQuickActions()); } else if (item.getType().equals(SettingsHelper.SettingsItemType.POI_UI_FILTERS)) { poiUIFilters.addAll(((SettingsHelper.PoiUiFilterSettingsItem) item).getPoiUIFilters()); } else if (item.getType().equals(SettingsHelper.SettingsItemType.MAP_SOURCES)) { tileSourceTemplates.addAll(((SettingsHelper.MapSourcesSettingsItem) item).getMapSources()); } else if (item.getType().equals(SettingsHelper.SettingsItemType.FILE)) { if (item.getName().startsWith("/rendering/")) { renderFilesList.add(((SettingsHelper.FileSettingsItem) item).getFile()); } else if (item.getName().startsWith("/routing/")) { routingFilesList.add(((SettingsHelper.FileSettingsItem) item).getFile()); } } } if (!profiles.isEmpty()) { settingsToOperate.add(new AdditionalDataWrapper( AdditionalDataWrapper.Type.PROFILE, profiles)); } if (!quickActions.isEmpty()) { settingsToOperate.add(new AdditionalDataWrapper( AdditionalDataWrapper.Type.QUICK_ACTIONS, quickActions)); } if (!poiUIFilters.isEmpty()) { settingsToOperate.add(new AdditionalDataWrapper( AdditionalDataWrapper.Type.POI_TYPES, poiUIFilters)); } if (!tileSourceTemplates.isEmpty()) { settingsToOperate.add(new AdditionalDataWrapper( AdditionalDataWrapper.Type.MAP_SOURCES, tileSourceTemplates )); } if (!renderFilesList.isEmpty()) { settingsToOperate.add(new AdditionalDataWrapper( AdditionalDataWrapper.Type.CUSTOM_RENDER_STYLE, renderFilesList )); } if (!routingFilesList.isEmpty()) { settingsToOperate.add(new AdditionalDataWrapper( AdditionalDataWrapper.Type.CUSTOM_ROUTING, routingFilesList )); } return settingsToOperate; } private void setupToolbar(Toolbar toolbar) { toolbar.setNavigationIcon(getPaintedContentIcon(R.drawable.headline_close_button, nightMode ? getResources().getColor(R.color.active_buttons_and_links_text_dark) : getResources().getColor(R.color.active_buttons_and_links_text_light))); toolbar.setNavigationContentDescription(R.string.shared_string_close); toolbar.setNavigationOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { dismiss(); } }); } public void setFile(File file) { this.file = file; } } \ No newline at end of file +package net.osmand.plus.settings; import android.os.Bundle; import android.support.annotation.NonNull; import android.support.annotation.Nullable; import android.support.v4.app.FragmentManager; import android.support.v7.widget.Toolbar; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.ExpandableListView; import net.osmand.map.ITileSource; import net.osmand.map.TileSourceManager; import net.osmand.plus.ApplicationMode; import net.osmand.plus.OsmandApplication; import net.osmand.plus.R; import net.osmand.plus.SQLiteTileSource; import net.osmand.plus.SettingsHelper; import net.osmand.plus.SettingsHelper.SettingsItem; import net.osmand.plus.UiUtilities; import net.osmand.plus.base.BaseOsmAndDialogFragment; import net.osmand.plus.poi.PoiUIFilter; import net.osmand.plus.profiles.AdditionalDataWrapper; import net.osmand.plus.quickaction.QuickAction; import net.osmand.plus.widgets.TextViewEx; import java.io.File; import java.util.ArrayList; import java.util.List; public class ImportSettingsFragment extends BaseOsmAndDialogFragment implements View.OnClickListener { public static final String TAG = ImportSettingsFragment.class.getSimpleName(); private OsmandApplication app; private ExportImportSettingsAdapter adapter; private ExpandableListView expandableList; private TextViewEx selectBtn; private List settingsItems; private File file; private boolean allSelected; private boolean nightMode; public static void showInstance(@NonNull FragmentManager fm, @NonNull List settingsItems, @NonNull File file) { ImportSettingsFragment fragment = new ImportSettingsFragment(); fragment.setSettingsItems(settingsItems); fragment.setFile(file); fragment.show(fm, TAG); } @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); app = getMyApplication(); nightMode = !getSettings().isLightContent(); if (settingsItems == null) { settingsItems = app.getSettingsHelper().getSettingsItems(); } if (file == null) { file = app.getSettingsHelper().getSettingsFile(); } } @Nullable @Override public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { inflater = UiUtilities.getInflater(app, nightMode); View root = inflater.inflate(R.layout.fragment_import, container, false); setupToolbar((Toolbar) root.findViewById(R.id.toolbar)); TextViewEx continueBtn = root.findViewById(R.id.continue_button); selectBtn = root.findViewById(R.id.select_button); expandableList = root.findViewById(R.id.list); continueBtn.setOnClickListener(this); selectBtn.setOnClickListener(this); return root; } @Override public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) { super.onViewCreated(view, savedInstanceState); adapter = new ExportImportSettingsAdapter(getMyApplication(), getSettingsToOperate(), nightMode, true); expandableList.setAdapter(adapter); } @Override public void onClick(View view) { switch (view.getId()) { case R.id.select_button: { allSelected = !allSelected; selectBtn.setText(allSelected ? R.string.shared_string_deselect_all : R.string.shared_string_select_all); adapter.selectAll(allSelected); break; } case R.id.continue_button: { if (adapter.getDataToOperate().isEmpty()) { app.showShortToastMessage(getString(R.string.shared_sting_nothing_selected)); } else { importItems(); } break; } } } private void importItems() { List settingsItems = getSettingsItemsFromData(adapter.getDataToOperate()); List duplicateItems = getDuplicatesData(settingsItems); if (duplicateItems.isEmpty()) { app.getSettingsHelper().importSettings(file, settingsItems, "", 1, new SettingsHelper.SettingsImportListener() { @Override public void onSettingsImportFinished(boolean succeed, boolean empty, @NonNull List items) { if (succeed) { app.showShortToastMessage(app.getString(R.string.file_imported_successfully, file.getName())); } else if (empty) { app.showShortToastMessage(app.getString(R.string.file_import_error, file.getName(), app.getString(R.string.shared_string_unexpected_error))); } } }); dismiss(); } else { ImportDuplicatesFragment.showInstance(getFragmentManager(), duplicateItems, settingsItems, file); dismiss(); } } private List getDuplicatesData(List items) { List duplicateItems = new ArrayList<>(); for (SettingsItem item : items) { if (item instanceof SettingsHelper.ProfileSettingsItem) { if (item.exists()) { duplicateItems.add(((SettingsHelper.ProfileSettingsItem) item).getModeBean()); } } else if (item instanceof SettingsHelper.QuickActionSettingsItem) { List duplicates = ((SettingsHelper.QuickActionSettingsItem) item).getDuplicates(); if (!duplicates.isEmpty()) { duplicateItems.addAll(duplicates); } } else if (item instanceof SettingsHelper.PoiUiFilterSettingsItem) { List duplicates = ((SettingsHelper.PoiUiFilterSettingsItem) item).getDuplicates(); if (!duplicates.isEmpty()) { duplicateItems.addAll(duplicates); } } else if (item instanceof SettingsHelper.MapSourcesSettingsItem) { List duplicates = ((SettingsHelper.MapSourcesSettingsItem) item).getDuplicates(); if (!duplicates.isEmpty()) { duplicateItems.addAll(duplicates); } } else if (item instanceof SettingsHelper.FileSettingsItem) { if (item.exists()) { duplicateItems.add(((SettingsHelper.FileSettingsItem) item).getFile()); } } } return duplicateItems; } public void setSettingsItems(List settingsItems) { this.settingsItems = settingsItems; } private List getSettingsItemsFromData(List dataToOperate) { List settingsItems = new ArrayList<>(); List quickActions = new ArrayList<>(); List poiUIFilters = new ArrayList<>(); List tileSourceTemplates = new ArrayList<>(); for (Object object : dataToOperate) { if (object instanceof ApplicationMode.ApplicationModeBean) { settingsItems.add(new SettingsHelper.ProfileSettingsItem(app, (ApplicationMode.ApplicationModeBean) object)); } if (object instanceof QuickAction) { quickActions.add((QuickAction) object); } else if (object instanceof PoiUIFilter) { poiUIFilters.add((PoiUIFilter) object); } else if (object instanceof TileSourceManager.TileSourceTemplate || object instanceof SQLiteTileSource) { tileSourceTemplates.add((ITileSource) object); } else if (object instanceof File) { settingsItems.add(new SettingsHelper.FileSettingsItem(getMyApplication(), (File) object)); } } if (!quickActions.isEmpty()) { settingsItems.add(new SettingsHelper.QuickActionSettingsItem(getMyApplication(), quickActions)); } if (!poiUIFilters.isEmpty()) { settingsItems.add(new SettingsHelper.PoiUiFilterSettingsItem(getMyApplication(), poiUIFilters)); } if (!tileSourceTemplates.isEmpty()) { settingsItems.add(new SettingsHelper.MapSourcesSettingsItem(getMyApplication(), tileSourceTemplates)); } return settingsItems; } private List getSettingsToOperate() { List settingsToOperate = new ArrayList<>(); List profiles = new ArrayList<>(); List quickActions = new ArrayList<>(); List poiUIFilters = new ArrayList<>(); List tileSourceTemplates = new ArrayList<>(); List routingFilesList = new ArrayList<>(); List renderFilesList = new ArrayList<>(); for (SettingsHelper.SettingsItem item : settingsItems) { if (item.getType().equals(SettingsHelper.SettingsItemType.PROFILE)) { profiles.add(((SettingsHelper.ProfileSettingsItem) item).getModeBean()); } else if (item.getType().equals(SettingsHelper.SettingsItemType.QUICK_ACTION)) { quickActions.addAll(((SettingsHelper.QuickActionSettingsItem) item).getQuickActions()); } else if (item.getType().equals(SettingsHelper.SettingsItemType.POI_UI_FILTERS)) { poiUIFilters.addAll(((SettingsHelper.PoiUiFilterSettingsItem) item).getPoiUIFilters()); } else if (item.getType().equals(SettingsHelper.SettingsItemType.MAP_SOURCES)) { tileSourceTemplates.addAll(((SettingsHelper.MapSourcesSettingsItem) item).getMapSources()); } else if (item.getType().equals(SettingsHelper.SettingsItemType.FILE)) { if (item.getName().startsWith("/rendering/")) { renderFilesList.add(((SettingsHelper.FileSettingsItem) item).getFile()); } else if (item.getName().startsWith("/routing/")) { routingFilesList.add(((SettingsHelper.FileSettingsItem) item).getFile()); } } } if (!profiles.isEmpty()) { settingsToOperate.add(new AdditionalDataWrapper( AdditionalDataWrapper.Type.PROFILE, profiles)); } if (!quickActions.isEmpty()) { settingsToOperate.add(new AdditionalDataWrapper( AdditionalDataWrapper.Type.QUICK_ACTIONS, quickActions)); } if (!poiUIFilters.isEmpty()) { settingsToOperate.add(new AdditionalDataWrapper( AdditionalDataWrapper.Type.POI_TYPES, poiUIFilters)); } if (!tileSourceTemplates.isEmpty()) { settingsToOperate.add(new AdditionalDataWrapper( AdditionalDataWrapper.Type.MAP_SOURCES, tileSourceTemplates )); } if (!renderFilesList.isEmpty()) { settingsToOperate.add(new AdditionalDataWrapper( AdditionalDataWrapper.Type.CUSTOM_RENDER_STYLE, renderFilesList )); } if (!routingFilesList.isEmpty()) { settingsToOperate.add(new AdditionalDataWrapper( AdditionalDataWrapper.Type.CUSTOM_ROUTING, routingFilesList )); } return settingsToOperate; } private void setupToolbar(Toolbar toolbar) { toolbar.setNavigationIcon(getPaintedContentIcon(R.drawable.headline_close_button, nightMode ? getResources().getColor(R.color.active_buttons_and_links_text_dark) : getResources().getColor(R.color.active_buttons_and_links_text_light))); toolbar.setNavigationContentDescription(R.string.shared_string_close); toolbar.setNavigationOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { dismiss(); } }); } public void setFile(File file) { this.file = file; } } \ No newline at end of file