This commit is contained in:
madwasp79 2019-06-19 22:36:43 +03:00
parent 21fe632078
commit 426a5296fa
2 changed files with 5 additions and 27 deletions

View file

@ -21,13 +21,14 @@ public class AppProfileArrayAdapter extends ArrayAdapter<ProfileDataObject> {
private Activity context; private Activity context;
private List<ProfileDataObject> modes; private List<ProfileDataObject> modes;
private int layout; private int layout;
private int colorRes; private OsmandApplication app;
public AppProfileArrayAdapter(@NonNull Activity context, int resource, @NonNull List<ProfileDataObject> objects) { public AppProfileArrayAdapter(@NonNull Activity context, int resource, @NonNull List<ProfileDataObject> objects) {
super(context, resource, objects); super(context, resource, objects);
this.context = context; this.context = context;
this.modes = objects; this.modes = objects;
this.layout = resource; this.layout = resource;
app = (OsmandApplication) context.getApplication();
} }
public long getItemId(int position) { public long getItemId(int position) {
@ -61,17 +62,10 @@ public class AppProfileArrayAdapter extends ArrayAdapter<ProfileDataObject> {
ProfileDataObject mode = modes.get(position); ProfileDataObject mode = modes.get(position);
Drawable iconDrawable; Drawable iconDrawable;
if (getMyApp(context) != null) {
if (mode.isSelected()) { if (mode.isSelected()) {
iconDrawable = getMyApp(context).getUIUtilities().getIcon(mode.getIconRes(), iconDrawable = app.getUIUtilities().getIcon(mode.getIconRes(), mode.getIconColor(!app.getSettings().isLightContent()));
mode.getIconColor(!getMyApp(context).getSettings().isLightContent())
);
} else { } else {
iconDrawable = getMyApp(context).getUIUtilities() iconDrawable = app.getUIUtilities().getIcon(mode.getIconRes(), R.color.profile_icon_color_inactive);
.getIcon(mode.getIconRes(), R.color.profile_icon_color_inactive);
}
} else {
iconDrawable = context.getDrawable(mode.getIconRes());
} }
viewHolder.title.setText(mode.getName()); viewHolder.title.setText(mode.getName());
@ -81,13 +75,4 @@ public class AppProfileArrayAdapter extends ArrayAdapter<ProfileDataObject> {
return rowView; return rowView;
} }
private OsmandApplication getMyApp(Activity context) {
Application app = context.getApplication();
if (app instanceof OsmandApplication) {
return (OsmandApplication) app;
} else {
return null;
}
}
} }

View file

@ -246,13 +246,6 @@ public class EditProfileFragment extends BaseOsmAndFragment {
} }
int iconColor = profile.iconColor.getColor(nightMode); int iconColor = profile.iconColor.getColor(nightMode);
// if (isNew) {
// iconColor = profile.iconColor.getColor(nightMode);
// } else if (isUserProfile) {
// iconColor = profile.iconColor.getColor(nightMode);
// } else {
// iconColor = R.color.icon_color;
// }
profileIcon.setImageDrawable(app.getUIUtilities().getIcon(startIconId, iconColor)); profileIcon.setImageDrawable(app.getUIUtilities().getIcon(startIconId, iconColor));
colorSample.setImageDrawable(app.getUIUtilities().getIcon(R.drawable.ic_action_circle, iconColor)); colorSample.setImageDrawable(app.getUIUtilities().getIcon(R.drawable.ic_action_circle, iconColor));