style issues fixed

This commit is contained in:
simon 2020-08-17 11:03:52 +03:00
parent 674995734b
commit 58bf6d35f6
3 changed files with 7 additions and 18 deletions

View file

@ -130,15 +130,15 @@ public class FavouritesDbHelper {
}
}
public Drawable setColoredIconForGroup(String groupName) {
FavouritesDbHelper.FavoriteGroup favoriteGroup = this.getGroup(
public Drawable getColoredIconForGroup(String groupName) {
FavouritesDbHelper.FavoriteGroup favoriteGroup = getGroup(
FavouritesDbHelper.FavoriteGroup.
convertDisplayNameToGroupIdName(
this.context, groupName));
context, groupName));
if (favoriteGroup != null) {
int color = favoriteGroup.getColor() == 0 ?
this.context.getResources().getColor(R.color.color_favorite) : favoriteGroup.getColor();
return this.context.getUIUtilities().getPaintedIcon(R.drawable.ic_action_folder, color);
context.getResources().getColor(R.color.color_favorite) : favoriteGroup.getColor();
return context.getUIUtilities().getPaintedIcon(R.drawable.ic_action_folder, color);
}
return null;
}

View file

@ -5,12 +5,7 @@ import android.animation.AnimatorListenerAdapter;
import android.annotation.TargetApi;
import android.content.Context;
import android.content.res.Resources;
import android.graphics.Canvas;
import android.graphics.ColorFilter;
import android.graphics.PorterDuff;
import android.graphics.PorterDuffColorFilter;
import android.graphics.Typeface;
import android.graphics.drawable.BitmapDrawable;
import android.graphics.drawable.Drawable;
import android.graphics.drawable.GradientDrawable;
import android.os.Build;
@ -47,7 +42,6 @@ import androidx.annotation.Nullable;
import androidx.appcompat.content.res.AppCompatResources;
import androidx.appcompat.view.ContextThemeWrapper;
import androidx.core.content.ContextCompat;
import androidx.core.graphics.drawable.DrawableCompat;
import androidx.fragment.app.FragmentActivity;
import androidx.fragment.app.FragmentManager;
@ -1837,7 +1831,7 @@ public class MapContextMenuFragment extends BaseOsmAndFragment implements Downlo
if (menu.getMyApplication() != null){
FavouritesDbHelper helper = menu.getMyApplication().getFavorites();
if (helper != null && helper.getGroup(groupName) != null){
Drawable line2icon = helper.setColoredIconForGroup(groupName);
Drawable line2icon = helper.getColoredIconForGroup(groupName);
GravityDrawable line2GravityDrawable =
new GravityDrawable(line2icon);
line2.setCompoundDrawablesWithIntrinsicBounds(

View file

@ -1,8 +1,5 @@
package net.osmand.plus.mapcontextmenu.other;
import android.graphics.ColorFilter;
import android.graphics.PorterDuff;
import android.graphics.PorterDuffColorFilter;
import android.graphics.drawable.Drawable;
import android.view.View;
import android.view.ViewGroup;
@ -17,8 +14,6 @@ import androidx.core.content.ContextCompat;
import net.osmand.AndroidUtils;
import net.osmand.data.FavouritePoint;
import net.osmand.plus.FavouritesDbHelper;
import net.osmand.plus.OsmAndConstants;
import net.osmand.plus.OsmandApplication;
import net.osmand.plus.R;
import net.osmand.plus.UiUtilities;
import net.osmand.util.Algorithms;
@ -118,7 +113,7 @@ public class MultiSelectionArrayAdapter extends ArrayAdapter<MapMultiSelectionMe
if (item.getMyApplication() != null){
FavouritesDbHelper helper = item.getMyApplication().getFavorites();
if (helper != null && helper.getGroup(groupName) != null){
Drawable line2icon = helper.setColoredIconForGroup(groupName);
Drawable line2icon = helper.getColoredIconForGroup(groupName);
GravityDrawable line2GravityIcon = new GravityDrawable(line2icon);
line2GravityIcon.setBoundsFrom(line2icon);
line2.setCompoundDrawablesWithIntrinsicBounds(line2GravityIcon, null, null, null);