Fix My places colors

This commit is contained in:
crimean 2019-07-06 14:21:08 +03:00
parent af777a1dc9
commit 907b7667b9
10 changed files with 67 additions and 66 deletions

View file

@ -189,6 +189,4 @@
</LinearLayout>
<include layout="@layout/list_item_divider"/>
</LinearLayout>

View file

@ -120,8 +120,8 @@
<item name="downloadButtonBackground">@drawable/download_light</item>
<item name="pstsTabBackground">@color/app_bar_color_light</item>
<item name="pstsUnderlineColor">@color/app_bar_color_light</item>
<item name="pstsIndicatorColor">@color/color_white</item>
<item name="pstsTextColor">@color/color_white</item>
<item name="pstsIndicatorColor">@color/active_color_primary_light</item>
<item name="pstsTextColor">@color/text_color_tab_active_light</item>
<item name="pstsInactiveTextColor">@color/searchbar_tab_inactive_light</item>
<item name="btn_flat_bg">@drawable/btn_flat</item>
<item name="btn_border_bg">@drawable/btn_border_bg_light</item>
@ -379,8 +379,8 @@
<item name="downloadButtonBackground">@drawable/download_dark</item>
<item name="pstsTabBackground">@color/app_bar_color_dark</item>
<item name="pstsUnderlineColor">@color/app_bar_color_dark</item>
<item name="pstsIndicatorColor">@color/app_bar_color_light</item>
<item name="pstsTextColor">@color/color_white</item>
<item name="pstsIndicatorColor">@color/active_color_primary_light</item>
<item name="pstsTextColor">@color/text_color_tab_active_dark</item>
<item name="pstsInactiveTextColor">@color/searchbar_tab_inactive_dark</item>
<item name="btn_flat_bg">@drawable/btn_flat_night</item>
<item name="btn_border_bg">@drawable/btn_border_bg_dark</item>

View file

@ -2748,7 +2748,7 @@ public class OsmandSettings {
new IntPreference("osmand_theme", OSMAND_LIGHT_THEME).makeGlobal().cache();
public boolean isLightActionBar() {
return true;
return isLightContent();
}

View file

@ -359,8 +359,7 @@ public class FavoritesTreeFragment extends OsmandExpandableListFragment implemen
@Override
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
menu.clear();
MenuItem mi = createMenuItem(menu, SEARCH_ID, R.string.search_poi_filter, R.drawable.ic_action_search_dark,
R.drawable.ic_action_search_dark, MenuItemCompat.SHOW_AS_ACTION_ALWAYS | MenuItemCompat.SHOW_AS_ACTION_COLLAPSE_ACTION_VIEW);
MenuItem mi = createMenuItem(menu, SEARCH_ID, R.string.search_poi_filter, R.drawable.ic_action_search_dark, MenuItemCompat.SHOW_AS_ACTION_ALWAYS | MenuItemCompat.SHOW_AS_ACTION_COLLAPSE_ACTION_VIEW);
mi.setOnMenuItemClickListener(new MenuItem.OnMenuItemClickListener() {
@Override
public boolean onMenuItemClick(MenuItem item) {
@ -378,17 +377,10 @@ public class FavoritesTreeFragment extends OsmandExpandableListFragment implemen
if (!MenuItemCompat.isActionViewExpanded(mi)) {
createMenuItem(menu, IMPORT_FAVOURITES_ID, R.string.shared_string_add_to_favorites, R.drawable.ic_action_plus,
R.drawable.ic_action_plus, MenuItemCompat.SHOW_AS_ACTION_ALWAYS);
createMenuItem(menu, SHARE_ID, R.string.shared_string_share, R.drawable.ic_action_gshare_dark,
R.drawable.ic_action_gshare_dark, MenuItemCompat.SHOW_AS_ACTION_ALWAYS);
createMenuItem(menu, SELECT_MAP_MARKERS_ID, R.string.select_map_markers, R.drawable.ic_action_flag_dark,
R.drawable.ic_action_flag_dark, MenuItemCompat.SHOW_AS_ACTION_ALWAYS);
createMenuItem(menu, DELETE_ID, R.string.shared_string_delete, R.drawable.ic_action_delete_dark,
R.drawable.ic_action_delete_dark, MenuItemCompat.SHOW_AS_ACTION_ALWAYS);
// createMenuItem(menu, EXPORT_ID, R.string.shared_string_export, R.drawable.ic_action_gsave_light,
// R.drawable.ic_action_gsave_dark, MenuItem.SHOW_AS_ACTION_IF_ROOM);
createMenuItem(menu, IMPORT_FAVOURITES_ID, R.string.shared_string_add_to_favorites, R.drawable.ic_action_plus, MenuItemCompat.SHOW_AS_ACTION_ALWAYS);
createMenuItem(menu, SHARE_ID, R.string.shared_string_share, R.drawable.ic_action_gshare_dark, MenuItemCompat.SHOW_AS_ACTION_ALWAYS);
createMenuItem(menu, SELECT_MAP_MARKERS_ID, R.string.select_map_markers, R.drawable.ic_action_flag_dark, MenuItemCompat.SHOW_AS_ACTION_ALWAYS);
createMenuItem(menu, DELETE_ID, R.string.shared_string_delete, R.drawable.ic_action_delete_dark, MenuItemCompat.SHOW_AS_ACTION_ALWAYS);
}
}
@ -414,7 +406,7 @@ public class FavoritesTreeFragment extends OsmandExpandableListFragment implemen
public boolean onCreateActionMode(ActionMode mode, Menu menu) {
enableSelectionMode(true);
createMenuItem(menu, SELECT_MAP_MARKERS_ACTION_MODE_ID, R.string.select_map_markers,
R.drawable.ic_action_flag_dark, R.drawable.ic_action_flag_dark,
R.drawable.ic_action_flag_dark,
MenuItemCompat.SHOW_AS_ACTION_IF_ROOM);
favoritesSelected.clear();
groupsToDelete.clear();
@ -477,7 +469,7 @@ public class FavoritesTreeFragment extends OsmandExpandableListFragment implemen
public boolean onCreateActionMode(ActionMode mode, Menu menu) {
enableSelectionMode(true);
createMenuItem(menu, DELETE_ACTION_ID, R.string.shared_string_delete,
R.drawable.ic_action_delete_dark, R.drawable.ic_action_delete_dark,
R.drawable.ic_action_delete_dark,
MenuItemCompat.SHOW_AS_ACTION_IF_ROOM);
favoritesSelected.clear();
groupsToDelete.clear();

View file

@ -18,8 +18,10 @@ public class OsmandActionBarActivity extends OsmandInAppPurchaseActivity {
protected boolean haveHomeButton = true;
//should be called after set content view
protected void setupHomeButton(){
Drawable back = ((OsmandApplication)getApplication()).getUIUtilities().getIcon(R.drawable.ic_arrow_back, R.color.color_white);
protected void setupHomeButton() {
boolean lightTheme = getMyApplication().getSettings().isLightContent();
Drawable back = ((OsmandApplication)getApplication()).getUIUtilities().getIcon(R.drawable.ic_arrow_back,
lightTheme ? R.color.active_buttons_and_links_text_light : R.color.active_buttons_and_links_text_dark);
final ActionBar supportActionBar = getSupportActionBar();
if (supportActionBar != null) {
supportActionBar.setHomeButtonEnabled(true);

View file

@ -81,11 +81,12 @@ public abstract class OsmandExpandableListFragment extends BaseOsmAndFragment
listView.setOnChildClickListener(this);
}
public MenuItem createMenuItem(Menu m, int id, int titleRes, int iconLight, int iconDark, int menuItemType) {
int r = isLightActionBar() ? iconLight : iconDark;
public MenuItem createMenuItem(Menu m, int id, int titleRes, int iconId, int menuItemType) {
Drawable d = iconId == 0 ? null : requireMyApplication().getUIUtilities().getIcon(iconId,
isLightActionBar() ? R.color.active_buttons_and_links_text_light : R.color.active_buttons_and_links_text_dark);
MenuItem menuItem = m.add(0, id, 0, titleRes);
if (r != 0) {
menuItem.setIcon(r);
if (d != null) {
menuItem.setIcon(d);
}
menuItem.setOnMenuItemClickListener(new MenuItem.OnMenuItemClickListener() {
@Override

View file

@ -338,9 +338,6 @@ public class AvailableGPXFragment extends OsmandExpandableListFragment implement
}
});
*/
} else {
View headerView = inflater.inflate(R.layout.list_shadow_header, null, false);
listView.addHeaderView(headerView);
}
footerView = inflater.inflate(R.layout.list_shadow_footer, null, false);
listView.addFooterView(footerView);
@ -421,8 +418,7 @@ public class AvailableGPXFragment extends OsmandExpandableListFragment implement
@Override
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
menu.clear();
MenuItem mi = createMenuItem(menu, SEARCH_ID, R.string.search_poi_filter, R.drawable.ic_action_search_dark,
R.drawable.ic_action_search_dark, MenuItemCompat.SHOW_AS_ACTION_ALWAYS
MenuItem mi = createMenuItem(menu, SEARCH_ID, R.string.search_poi_filter, R.drawable.ic_action_search_dark, MenuItemCompat.SHOW_AS_ACTION_ALWAYS
| MenuItemCompat.SHOW_AS_ACTION_COLLAPSE_ACTION_VIEW);
SearchView searchView = new SearchView(getActivity());
FavoritesActivity.updateSearchView(getActivity(), searchView);

View file

@ -347,7 +347,7 @@ public class TrackPointFragment extends OsmandExpandableListFragment implements
}
MenuItem mi = createMenuItem(menu, SEARCH_ID, R.string.search_poi_filter, R.drawable.ic_action_search_dark,
R.drawable.ic_action_search_dark, MenuItem.SHOW_AS_ACTION_ALWAYS | MenuItem.SHOW_AS_ACTION_COLLAPSE_ACTION_VIEW);
MenuItem.SHOW_AS_ACTION_ALWAYS | MenuItem.SHOW_AS_ACTION_COLLAPSE_ACTION_VIEW);
SearchView searchView = new SearchView(activity);
FavoritesActivity.updateSearchView(activity, searchView);
mi.setActionView(searchView);
@ -390,22 +390,17 @@ public class TrackPointFragment extends OsmandExpandableListFragment implements
if (!mi.isActionViewExpanded()) {
createMenuItem(menu, SHARE_ID, R.string.shared_string_share, R.drawable.ic_action_gshare_dark,
R.drawable.ic_action_gshare_dark, MenuItem.SHOW_AS_ACTION_NEVER);
createMenuItem(menu, SHARE_ID, R.string.shared_string_share, R.drawable.ic_action_gshare_dark, MenuItem.SHOW_AS_ACTION_NEVER);
GPXFile gpxFile = getGpx();
if (gpxFile != null && gpxFile.path != null) {
final MapMarkersHelper markersHelper = app.getMapMarkersHelper();
final boolean synced = markersHelper.getMarkersGroup(getGpx()) != null;
createMenuItem(menu, SELECT_MAP_MARKERS_ID, synced ? R.string.remove_from_map_markers
: R.string.shared_string_add_to_map_markers, R.drawable.ic_action_flag_dark,
R.drawable.ic_action_flag_dark, MenuItem.SHOW_AS_ACTION_NEVER);
: R.string.shared_string_add_to_map_markers, R.drawable.ic_action_flag_dark, MenuItem.SHOW_AS_ACTION_NEVER);
}
createMenuItem(menu, SELECT_FAVORITES_ID, R.string.shared_string_add_to_favorites, R.drawable.ic_action_fav_dark,
R.drawable.ic_action_fav_dark, MenuItem.SHOW_AS_ACTION_NEVER);
createMenuItem(menu, DELETE_ID, R.string.shared_string_delete, R.drawable.ic_action_delete_dark,
R.drawable.ic_action_delete_dark, MenuItem.SHOW_AS_ACTION_NEVER);
createMenuItem(menu, COORDINATE_INPUT_ID, R.string.coordinate_input, R.drawable.ic_action_coordinates_longitude,
R.drawable.ic_action_coordinates_longitude, MenuItem.SHOW_AS_ACTION_NEVER);
createMenuItem(menu, SELECT_FAVORITES_ID, R.string.shared_string_add_to_favorites, R.drawable.ic_action_fav_dark, MenuItem.SHOW_AS_ACTION_NEVER);
createMenuItem(menu, DELETE_ID, R.string.shared_string_delete, R.drawable.ic_action_delete_dark, MenuItem.SHOW_AS_ACTION_NEVER);
createMenuItem(menu, COORDINATE_INPUT_ID, R.string.coordinate_input, R.drawable.ic_action_coordinates_longitude, MenuItem.SHOW_AS_ACTION_NEVER);
}
this.optionsMenu = menu;
}
@ -436,7 +431,7 @@ public class TrackPointFragment extends OsmandExpandableListFragment implements
public boolean onCreateActionMode(ActionMode mode, Menu menu) {
setSelectionMode(true);
createMenuItem(menu, DELETE_ACTION_ID, R.string.shared_string_delete,
R.drawable.ic_action_delete_dark, R.drawable.ic_action_delete_dark,
R.drawable.ic_action_delete_dark,
MenuItemCompat.SHOW_AS_ACTION_IF_ROOM);
selectedItems.clear();
selectedGroups.clear();
@ -567,7 +562,7 @@ public class TrackPointFragment extends OsmandExpandableListFragment implements
public boolean onCreateActionMode(ActionMode mode, Menu menu) {
setSelectionMode(true);
createMenuItem(menu, SELECT_FAVORITES_ACTION_MODE_ID, R.string.shared_string_add_to_favorites,
R.drawable.ic_action_fav_dark, R.drawable.ic_action_fav_dark,
R.drawable.ic_action_fav_dark,
MenuItem.SHOW_AS_ACTION_IF_ROOM);
selectedItems.clear();
selectedGroups.clear();

View file

@ -11,6 +11,7 @@ import android.os.AsyncTask;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.v4.content.ContextCompat;
import android.support.v4.view.MenuItemCompat;
import android.support.v4.view.PagerAdapter;
import android.support.v4.view.ViewCompat;
@ -67,6 +68,7 @@ import net.osmand.plus.measurementtool.NewGpxData;
import net.osmand.plus.myplaces.TrackBitmapDrawer.TrackBitmapDrawerListener;
import net.osmand.plus.views.controls.PagerSlidingTabStrip;
import net.osmand.plus.views.controls.PagerSlidingTabStrip.CustomTabProvider;
import net.osmand.plus.views.controls.PagerSlidingTabStrip.TabSelectionType;
import net.osmand.plus.views.controls.WrapContentHeightViewPager;
import net.osmand.plus.views.controls.WrapContentHeightViewPager.ViewAtPositionInterface;
import net.osmand.plus.widgets.IconPopupMenu;
@ -335,10 +337,12 @@ public class TrackSegmentFragment extends OsmAndListFragment implements TrackBit
tabLayout.setIndicatorColorResource(light ? R.color.active_color_primary_light : R.color.active_color_primary_dark);
tabLayout.setIndicatorBgColorResource(light ? R.color.divider_color_light : R.color.divider_color_dark);
tabLayout.setIndicatorHeight(AndroidUtils.dpToPx(app, 1f));
tabLayout.setTextColor(tabLayout.getIndicatorColor());
if (light) {
tabLayout.setTextColor(tabLayout.getIndicatorColor());
tabLayout.setTabInactiveTextColor(ContextCompat.getColor(row.getContext(), R.color.text_color_secondary_light));
}
tabLayout.setTextSize(AndroidUtils.spToPx(app, 12f));
tabLayout.setShouldExpand(true);
tabLayout.setTabSelectionType(PagerSlidingTabStrip.TabSelectionType.SOLID_COLOR);
pager = (WrapContentHeightViewPager) row.findViewById(R.id.pager);
pager.setSwipeable(false);
pager.setOffscreenPageLimit(2);

View file

@ -29,6 +29,9 @@ import android.graphics.Typeface;
import android.os.Build;
import android.os.Parcel;
import android.os.Parcelable;
import android.support.annotation.ColorInt;
import android.support.annotation.ColorRes;
import android.support.annotation.DrawableRes;
import android.support.annotation.NonNull;
import android.support.v4.util.Pair;
import android.support.v4.view.ViewCompat;
@ -108,24 +111,30 @@ public class PagerSlidingTabStrip extends HorizontalScrollView {
private Paint rectPaint;
private Paint dividerPaint;
@ColorInt
private int indicatorColor;
@ColorInt
private int indicatorBgColor;
private int indicatorHeight = 2;
private int underlineHeight = 0;
@ColorInt
private int underlineColor;
private int dividerWidth = 0;
private int dividerPadding = 0;
@ColorInt
private int dividerColor;
private int tabPadding = 12;
private int tabTextSize = 14;
private int tabTextColor = 0;
@ColorInt
private int tabTextColor;
private TabSelectionType tabSelectionType = TabSelectionType.ALPHA;
private int tabInactiveTextColor = 0;
private TabSelectionType tabSelectionType = TabSelectionType.SOLID_COLOR;
@ColorInt
private int tabInactiveTextColor;
private float tabTextAlpha = HALF_TRANSP;
private float tabTextSelectedAlpha = OPAQUE;
@ -142,6 +151,7 @@ public class PagerSlidingTabStrip extends HorizontalScrollView {
private int scrollOffset;
private int lastScrollX = 0;
@DrawableRes
private int tabBackgroundResId = R.drawable.background_tab;
private Locale locale;
@ -175,7 +185,7 @@ public class PagerSlidingTabStrip extends HorizontalScrollView {
// get system attrs (android:textSize and android:textColor)
TypedArray a = context.obtainStyledAttributes(attrs, ATTRS);
tabTextSize = a.getDimensionPixelSize(TEXT_SIZE_INDEX, tabTextSize);
int textPrimaryColor = a.getColor(TEXT_COLOR_PRIMARY, android.R.color.white);
int textPrimaryColor = a.getColor(TEXT_COLOR_PRIMARY, Color.WHITE);
underlineColor = textPrimaryColor;
dividerColor = textPrimaryColor;
@ -729,10 +739,12 @@ public class PagerSlidingTabStrip extends HorizontalScrollView {
return tabSelectionType;
}
@ColorInt
public int getTextColor() {
return tabTextColor;
}
@ColorInt
public int getTabInactiveTextColor() {
return tabInactiveTextColor;
}
@ -745,6 +757,7 @@ public class PagerSlidingTabStrip extends HorizontalScrollView {
return tabTextSelectedAlpha;
}
@DrawableRes
public int getTabBackground() {
return tabBackgroundResId;
}
@ -753,22 +766,22 @@ public class PagerSlidingTabStrip extends HorizontalScrollView {
return tabPadding;
}
public void setIndicatorColor(int indicatorColor) {
public void setIndicatorColor(@ColorInt int indicatorColor) {
this.indicatorColor = indicatorColor;
invalidate();
}
public void setIndicatorColorResource(int resId) {
public void setIndicatorColorResource(@ColorRes int resId) {
this.indicatorColor = getResources().getColor(resId);
invalidate();
}
public void setIndicatorBgColor(int indicatorBgColor) {
public void setIndicatorBgColor(@ColorInt int indicatorBgColor) {
this.indicatorBgColor = indicatorBgColor;
invalidate();
}
public void setIndicatorBgColorResource(int resId) {
public void setIndicatorBgColorResource(@ColorRes int resId) {
this.indicatorBgColor = getResources().getColor(resId);
invalidate();
}
@ -778,22 +791,22 @@ public class PagerSlidingTabStrip extends HorizontalScrollView {
invalidate();
}
public void setUnderlineColor(int underlineColor) {
public void setUnderlineColor(@ColorInt int underlineColor) {
this.underlineColor = underlineColor;
invalidate();
}
public void setUnderlineColorResource(int resId) {
public void setUnderlineColorResource(@ColorRes int resId) {
this.underlineColor = getResources().getColor(resId);
invalidate();
}
public void setDividerColor(int dividerColor) {
public void setDividerColor(@ColorInt int dividerColor) {
this.dividerColor = dividerColor;
invalidate();
}
public void setDividerColorResource(int resId) {
public void setDividerColorResource(@ColorRes int resId) {
this.dividerColor = getResources().getColor(resId);
invalidate();
}
@ -838,24 +851,24 @@ public class PagerSlidingTabStrip extends HorizontalScrollView {
this.tabSelectionType = tabSelectionType;
}
public void setTextColor(int textColor) {
public void setTextColor(@ColorInt int textColor) {
tabTextColor = textColor;
}
public void setTabInactiveTextColor(int tabInactiveTextColor) {
public void setTabInactiveTextColor(@ColorInt int tabInactiveTextColor) {
this.tabInactiveTextColor = tabInactiveTextColor;
}
private ColorStateList getColorStateList(int textColor) {
private ColorStateList getColorStateList(@ColorInt int textColor) {
return new ColorStateList(new int[][]{new int[]{}}, new int[]{textColor});
}
public void setTextColorResource(int resId) {
public void setTextColorResource(@ColorRes int resId) {
setTextColor(getResources().getColor(resId));
}
public void setTextColorStateListResource(int resId) {
public void setTextColorStateListResource(@ColorRes int resId) {
setTextColor(getResources().getColor(resId));
}
@ -865,7 +878,7 @@ public class PagerSlidingTabStrip extends HorizontalScrollView {
updateTabStyles();
}
public void setTabBackground(int resId) {
public void setTabBackground(@DrawableRes int resId) {
this.tabBackgroundResId = resId;
}