Small refactoring of icon receiving and setup shareIcon to white color in all themes

This commit is contained in:
nazar-kutz 2020-11-16 17:25:02 +02:00
parent 64c5f1fef5
commit 02da17f726

View file

@ -259,6 +259,7 @@ public class QuickSearchDialogFragment extends DialogFragment implements OsmAndC
public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) { Bundle savedInstanceState) {
final MapActivity mapActivity = getMapActivity(); final MapActivity mapActivity = getMapActivity();
final UiUtilities iconsCache = app.getUIUtilities();
final View view = inflater.inflate(R.layout.search_dialog_fragment, container, false); final View view = inflater.inflate(R.layout.search_dialog_fragment, container, false);
toolbarController = new QuickSearchToolbarController(); toolbarController = new QuickSearchToolbarController();
@ -325,9 +326,9 @@ public class QuickSearchDialogFragment extends DialogFragment implements OsmAndC
buttonToolbarView = view.findViewById(R.id.button_toolbar_layout); buttonToolbarView = view.findViewById(R.id.button_toolbar_layout);
buttonToolbarImage = (ImageView) view.findViewById(R.id.buttonToolbarImage); buttonToolbarImage = (ImageView) view.findViewById(R.id.buttonToolbarImage);
buttonToolbarImage.setImageDrawable(app.getUIUtilities().getThemedIcon(R.drawable.ic_action_marker_dark)); buttonToolbarImage.setImageDrawable(iconsCache.getThemedIcon(R.drawable.ic_action_marker_dark));
buttonToolbarFilter = (ImageButton) view.findViewById(R.id.filterButton); buttonToolbarFilter = (ImageButton) view.findViewById(R.id.filterButton);
buttonToolbarFilter.setImageDrawable(app.getUIUtilities().getThemedIcon(R.drawable.ic_action_filter)); buttonToolbarFilter.setImageDrawable(iconsCache.getThemedIcon(R.drawable.ic_action_filter));
buttonToolbarFilter.setOnClickListener(new OnClickListener() { buttonToolbarFilter.setOnClickListener(new OnClickListener() {
@Override @Override
public void onClick(View v) { public void onClick(View v) {
@ -474,7 +475,7 @@ public class QuickSearchDialogFragment extends DialogFragment implements OsmAndC
if (!app.getSettings().isLightContent()) { if (!app.getSettings().isLightContent()) {
toolbar.setBackgroundColor(ContextCompat.getColor(mapActivity, R.color.app_bar_color_dark)); toolbar.setBackgroundColor(ContextCompat.getColor(mapActivity, R.color.app_bar_color_dark));
} }
Drawable icBack = app.getUIUtilities().getThemedIcon(AndroidUtils.getNavigationIconResId(app)); Drawable icBack = iconsCache.getThemedIcon(AndroidUtils.getNavigationIconResId(app));
toolbar.setNavigationIcon(icBack); toolbar.setNavigationIcon(icBack);
toolbar.setNavigationContentDescription(R.string.access_shared_string_navigate_up); toolbar.setNavigationContentDescription(R.string.access_shared_string_navigate_up);
toolbar.setNavigationOnClickListener( toolbar.setNavigationOnClickListener(
@ -489,7 +490,7 @@ public class QuickSearchDialogFragment extends DialogFragment implements OsmAndC
); );
toolbarEdit = (Toolbar) view.findViewById(R.id.toolbar_edit); toolbarEdit = (Toolbar) view.findViewById(R.id.toolbar_edit);
toolbarEdit.setNavigationIcon(app.getUIUtilities().getIcon(R.drawable.ic_action_remove_dark)); toolbarEdit.setNavigationIcon(iconsCache.getIcon(R.drawable.ic_action_remove_dark));
toolbarEdit.setNavigationContentDescription(R.string.shared_string_cancel); toolbarEdit.setNavigationContentDescription(R.string.shared_string_cancel);
toolbarEdit.setNavigationOnClickListener( toolbarEdit.setNavigationOnClickListener(
new OnClickListener() { new OnClickListener() {
@ -501,8 +502,7 @@ public class QuickSearchDialogFragment extends DialogFragment implements OsmAndC
); );
titleEdit = (TextView) view.findViewById(R.id.titleEdit); titleEdit = (TextView) view.findViewById(R.id.titleEdit);
Drawable shareIcon = app.getUIUtilities().getIcon(R.drawable.ic_action_gshare_dark, Drawable shareIcon = iconsCache.getIcon(R.drawable.ic_action_gshare_dark, R.color.color_white);
nightMode ? R.color.text_color_secondary_dark : R.color.text_color_secondary_light);
shareIcon = AndroidUtils.getDrawableForDirection(app, shareIcon); shareIcon = AndroidUtils.getDrawableForDirection(app, shareIcon);
ImageView shareButton = (ImageView) view.findViewById(R.id.shareButton); ImageView shareButton = (ImageView) view.findViewById(R.id.shareButton);
shareButton.setImageDrawable(shareIcon); shareButton.setImageDrawable(shareIcon);
@ -644,7 +644,7 @@ public class QuickSearchDialogFragment extends DialogFragment implements OsmAndC
progressBar = (ProgressBar) view.findViewById(R.id.searchProgressBar); progressBar = (ProgressBar) view.findViewById(R.id.searchProgressBar);
clearButton = (ImageButton) view.findViewById(R.id.clearButton); clearButton = (ImageButton) view.findViewById(R.id.clearButton);
clearButton.setImageDrawable(app.getUIUtilities().getThemedIcon(R.drawable.ic_action_remove_dark)); clearButton.setImageDrawable(iconsCache.getThemedIcon(R.drawable.ic_action_remove_dark));
clearButton.setOnClickListener( clearButton.setOnClickListener(
new OnClickListener() { new OnClickListener() {
@Override @Override