small fixes

This commit is contained in:
Nazar-Kutz 2020-05-13 10:29:21 +03:00
parent 5a5463d4a9
commit f50d28b235
3 changed files with 8 additions and 11 deletions

View file

@ -162,7 +162,7 @@ public class SelectMapViewQuickActionsBottomSheet extends MenuBottomSheetDialogF
List<String> stylesList = mapStyleAction.getFilteredStyles(); List<String> stylesList = mapStyleAction.getFilteredStyles();
for (String entry : stylesList) { for (String entry : stylesList) {
boolean selected = entry.equals(selectedItem); boolean selected = entry.equals(selectedItem);
createItemRow(selected, counter, null, createItemRow(selected, counter, getContentIcon(action.getIconRes()),
mapStyleAction.getTranslatedItemName(context, entry), entry); mapStyleAction.getTranslatedItemName(context, entry), entry);
counter++; counter++;
} }
@ -187,7 +187,7 @@ public class SelectMapViewQuickActionsBottomSheet extends MenuBottomSheetDialogF
for (Pair<String, String> entry : sources) { for (Pair<String, String> entry : sources) {
String tag = entry.first; String tag = entry.first;
boolean selected = tag.equals(selectedItem); boolean selected = tag.equals(selectedItem);
createItemRow(selected, counter, null, entry.second, tag); createItemRow(selected, counter, getContentIcon(action.getIconRes()), entry.second, tag);
counter++; counter++;
} }
} }
@ -205,9 +205,6 @@ public class SelectMapViewQuickActionsBottomSheet extends MenuBottomSheetDialogF
RadioButton rb = (RadioButton) view.findViewById(R.id.compound_button); RadioButton rb = (RadioButton) view.findViewById(R.id.compound_button);
rb.setChecked(selected); rb.setChecked(selected);
CompoundButtonCompat.setButtonTintList(rb, rbColorList); CompoundButtonCompat.setButtonTintList(rb, rbColorList);
if (icon == null) {
icon = getContentIcon(action.getIconRes());
}
ImageView imageView = (ImageView) view.findViewById(R.id.icon); ImageView imageView = (ImageView) view.findViewById(R.id.icon);
imageView.setImageDrawable(icon); imageView.setImageDrawable(icon);
} }

View file

@ -24,9 +24,9 @@ import net.osmand.plus.settings.bottomsheets.BasePreferenceBottomSheet;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
public class SelectMultipleProfileBottomSheet extends BasePreferenceBottomSheet { public class SelectMultipleProfilesBottomSheet extends BasePreferenceBottomSheet {
public static final String TAG = SelectMultipleProfileBottomSheet.class.getSimpleName(); public static final String TAG = SelectMultipleProfilesBottomSheet.class.getSimpleName();
public static final String SELECTED_KEYS = "selected_keys"; public static final String SELECTED_KEYS = "selected_keys";
public static final String DISABLED_KEYS = "disabled_keys"; public static final String DISABLED_KEYS = "disabled_keys";
@ -146,7 +146,7 @@ public class SelectMultipleProfileBottomSheet extends BasePreferenceBottomSheet
@Nullable List<String> disabledProfiles, @Nullable List<String> disabledProfiles,
boolean usedOnMap, boolean usedOnMap,
CallbackWithObject<List<String>> callback) { CallbackWithObject<List<String>> callback) {
SelectMultipleProfileBottomSheet fragment = new SelectMultipleProfileBottomSheet(); SelectMultipleProfilesBottomSheet fragment = new SelectMultipleProfilesBottomSheet();
Bundle args = new Bundle(); Bundle args = new Bundle();
args.putStringArrayList(SELECTED_KEYS, selectedProfiles != null ? args.putStringArrayList(SELECTED_KEYS, selectedProfiles != null ?
new ArrayList<>(selectedProfiles) : new ArrayList<String>()); new ArrayList<>(selectedProfiles) : new ArrayList<String>());
@ -155,7 +155,7 @@ public class SelectMultipleProfileBottomSheet extends BasePreferenceBottomSheet
fragment.setArguments(args); fragment.setArguments(args);
fragment.setUsedOnMap(usedOnMap); fragment.setUsedOnMap(usedOnMap);
fragment.setCallback(callback); fragment.setCallback(callback);
fragment.show(mapActivity.getSupportFragmentManager(), SelectMultipleProfileBottomSheet.TAG); fragment.show(mapActivity.getSupportFragmentManager(), SelectMultipleProfilesBottomSheet.TAG);
} }
} }

View file

@ -16,7 +16,7 @@ import net.osmand.plus.OsmandApplication;
import net.osmand.plus.OsmandSettings; import net.osmand.plus.OsmandSettings;
import net.osmand.plus.R; import net.osmand.plus.R;
import net.osmand.plus.activities.MapActivity; import net.osmand.plus.activities.MapActivity;
import net.osmand.plus.profiles.SelectMultipleProfileBottomSheet; import net.osmand.plus.profiles.SelectMultipleProfilesBottomSheet;
import net.osmand.plus.quickaction.QuickAction; import net.osmand.plus.quickaction.QuickAction;
import net.osmand.plus.quickaction.QuickActionType; import net.osmand.plus.quickaction.QuickActionType;
import net.osmand.plus.quickaction.SwitchableAction; import net.osmand.plus.quickaction.SwitchableAction;
@ -208,7 +208,7 @@ public class SwitchProfileAction extends SwitchableAction<String> {
@Override @Override
public void onClick(View v) { public void onClick(View v) {
List<String> selectedProfilesKeys = new ArrayList<>(adapter.getItemsList()); List<String> selectedProfilesKeys = new ArrayList<>(adapter.getItemsList());
SelectMultipleProfileBottomSheet.showInstance(activity, selectedProfilesKeys, SelectMultipleProfilesBottomSheet.showInstance(activity, selectedProfilesKeys,
selectedProfilesKeys, false, new CallbackWithObject<List<String>>() { selectedProfilesKeys, false, new CallbackWithObject<List<String>>() {
@Override @Override
public boolean processResult(List<String> result) { public boolean processResult(List<String> result) {