Update icons

This commit is contained in:
Victor Shcherb 2015-02-28 16:53:33 +02:00
parent fd5dc0ad89
commit a18ff669c8
4 changed files with 54 additions and 19 deletions

View file

@ -46,6 +46,7 @@
<TextView
android:id="@+id/name"
style="@style/ListText.Small"
android:textColor="?android:textColorPrimary"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:maxLines="1"
@ -57,6 +58,7 @@
android:id="@+id/descr"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="?android:textColorSecondary"
android:gravity="center_vertical"
android:textSize="@dimen/download_descr_text_size"
android:maxLines="25"

View file

@ -22,6 +22,7 @@ import net.osmand.plus.GPXUtilities;
import net.osmand.plus.GPXUtilities.GPXFile;
import net.osmand.plus.GPXUtilities.WptPt;
import net.osmand.plus.GpxSelectionHelper;
import net.osmand.plus.GpxSelectionHelper.SelectedGpxFile;
import net.osmand.plus.OsmAndFormatter;
import net.osmand.plus.OsmandApplication;
import net.osmand.plus.OsmandPlugin;
@ -33,7 +34,6 @@ import net.osmand.plus.helpers.ScreenOrientationHelper;
import net.osmand.plus.monitoring.OsmandMonitoringPlugin;
import net.osmand.plus.osmedit.OsmEditingPlugin;
import net.osmand.util.Algorithms;
import android.app.Activity;
import android.app.AlertDialog;
import android.app.AlertDialog.Builder;
@ -63,7 +63,6 @@ import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.CheckBox;
import android.widget.CompoundButton;
import android.widget.EditText;
import android.widget.ExpandableListView;
import android.widget.Filter;
@ -71,7 +70,6 @@ import android.widget.Filterable;
import android.widget.ImageButton;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.ListView;
import android.widget.TextView;
import android.widget.Toast;
@ -396,7 +394,7 @@ public class AvailableGPXFragment extends OsmandExpandableListFragment {
enableSelectionMode(true);
updateSelectionMode(mode);
MenuItem it = menu.add(R.string.show_gpx_route);
it.setIcon(!isLightActionBar() ? R.drawable.ic_action_map_marker_dark : R.drawable.ic_action_map_marker_dark);
it.setIcon(R.drawable.ic_action_done);
MenuItemCompat.setShowAsAction(it, MenuItemCompat.SHOW_AS_ACTION_IF_ROOM | MenuItemCompat.SHOW_AS_ACTION_WITH_TEXT);
return true;
}
@ -412,7 +410,7 @@ public class AvailableGPXFragment extends OsmandExpandableListFragment {
if (selectedItems.isEmpty()) {
return true;
}
runSelection(true);
runSelection(false);
actionMode.finish();
return true;
}
@ -625,6 +623,7 @@ public class AvailableGPXFragment extends OsmandExpandableListFragment {
private void loadGPXFolder(File mapPath, List<GpxInfo> result, LoadGpxTask loadTask,
List<GpxInfo> progress, String gpxSubfolder) {
GpxSelectionHelper sgpx = app.getSelectedGpxHelper();
for (File gpxFile : listFilesSorted(mapPath)) {
if (gpxFile.isDirectory()) {
String sub = gpxSubfolder.length() == 0 ? gpxFile.getName() : gpxSubfolder + "/" + gpxFile.getName();
@ -633,6 +632,10 @@ public class AvailableGPXFragment extends OsmandExpandableListFragment {
GpxInfo info = new GpxInfo();
info.subfolder = gpxSubfolder;
info.file = gpxFile;
SelectedGpxFile ssgpx = sgpx.getSelectedFileByName(gpxFile.getAbsolutePath());
if(ssgpx != null ) {
info.analysis = ssgpx.getTrackAnalysis();
}
result.add(info);
progress.add(info);
if (progress.size() > 7) {
@ -881,7 +884,8 @@ public class AvailableGPXFragment extends OsmandExpandableListFragment {
DirectionsDialogs.setupPopUpMenuIcon(optionsMenu);
Drawable showIcon = getResources().getDrawable(R.drawable.ic_show_on_map);
if (light) {
showIcon.mutate().setColorFilter(getResources().getColor(R.color.icon_color_light), PorterDuff.Mode.MULTIPLY);
showIcon = showIcon.mutate();
showIcon.setColorFilter(getResources().getColor(R.color.icon_color_light), PorterDuff.Mode.MULTIPLY);
}
MenuItem item = optionsMenu.getMenu().add(R.string.show_gpx_route)
.setIcon(showIcon);
@ -918,8 +922,13 @@ public class AvailableGPXFragment extends OsmandExpandableListFragment {
final OsmEditingPlugin osmEditingPlugin = OsmandPlugin.getEnabledPlugin(OsmEditingPlugin.class);
if (osmEditingPlugin != null && osmEditingPlugin.isActive()) {
Drawable exportIcon = getResources().getDrawable(R.drawable.ic_action_export);
if (light) {
exportIcon = exportIcon.mutate();
exportIcon.setColorFilter(getResources().getColor(R.color.icon_color_light), PorterDuff.Mode.MULTIPLY);
}
item = optionsMenu.getMenu().add(R.string.export)
.setIcon(light ? R.drawable.ic_action_gup_light : R.drawable.ic_action_gup_dark);
.setIcon(exportIcon);
item.setOnMenuItemClickListener(new MenuItem.OnMenuItemClickListener() {
@Override
public boolean onMenuItemClick(MenuItem item) {

View file

@ -4,6 +4,8 @@ import android.app.AlertDialog;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.graphics.PorterDuff.Mode;
import android.graphics.drawable.Drawable;
import android.net.Uri;
import android.os.Bundle;
import android.support.annotation.Nullable;
@ -124,11 +126,15 @@ public class NotesFragment extends ListFragment {
DirectionsDialogs.setupPopUpMenuIcon(optionsMenu);
MenuItem item;
boolean isPhoto = recording.isPhoto();
final int playIcon;
Drawable playIcon;
if (isPhoto) {
playIcon = light ? R.drawable.ic_action_eye_light : R.drawable.ic_action_eye_dark;
playIcon = getResources().getDrawable(R.drawable.ic_action_view);
if(light) {
playIcon = playIcon.mutate();
playIcon.setColorFilter(getResources().getColor(R.color.icon_color_light), Mode.MULTIPLY);
}
} else {
playIcon = light ? R.drawable.ic_play_light : R.drawable.ic_play_dark;
playIcon = getResources().getDrawable(light ? R.drawable.ic_play_light : R.drawable.ic_play_dark);
}
item = optionsMenu.getMenu().add(isPhoto ? R.string.watch : R.string.recording_context_menu_play)
.setIcon(playIcon);
@ -140,8 +146,13 @@ public class NotesFragment extends ListFragment {
}
});
Drawable showOnMap = getResources().getDrawable(R.drawable.ic_show_on_map);
if(light) {
showOnMap = showOnMap.mutate();
showOnMap.setColorFilter(getResources().getColor(R.color.icon_color_light), Mode.MULTIPLY);
}
item = optionsMenu.getMenu().add(R.string.search_shown_on_map)
.setIcon(light ? R.drawable.ic_action_map_marker_light : R.drawable.ic_action_map_marker_dark);
.setIcon(showOnMap);
item.setOnMenuItemClickListener(new MenuItem.OnMenuItemClickListener() {
@Override
public boolean onMenuItemClick(MenuItem item) {

View file

@ -22,9 +22,12 @@ import android.content.res.ColorStateList;
import android.content.res.TypedArray;
import android.database.DataSetObserver;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.graphics.Paint.Style;
import android.graphics.Typeface;
import android.graphics.drawable.ColorDrawable;
import android.graphics.drawable.Drawable;
import android.os.Build;
import android.os.Parcel;
import android.os.Parcelable;
@ -45,9 +48,9 @@ import android.widget.TextView;
import net.osmand.plus.R;
import net.osmand.plus.helpers.FontCache;
import java.util.Locale;
@SuppressLint("NewApi")
public class PagerSlidingTabStrip extends HorizontalScrollView {
private static final float OPAQUE = 1.0f;
@ -68,6 +71,7 @@ public class PagerSlidingTabStrip extends HorizontalScrollView {
android.R.attr.textColor,
android.R.attr.paddingLeft,
android.R.attr.paddingRight,
android.R.attr.colorPrimary,
};
// @formatter:on
@ -79,6 +83,7 @@ public class PagerSlidingTabStrip extends HorizontalScrollView {
private static final int TEXT_COLOR_INDEX = 2;
private static final int PADDING_LEFT_INDEX = 3;
private static final int PADDING_RIGHT_INDEX = 4;
private static final int COLOR_PRIMARY= 5;
private LinearLayout.LayoutParams defaultTabLayoutParams;
private LinearLayout.LayoutParams expandedTabLayoutParams;
@ -99,10 +104,12 @@ public class PagerSlidingTabStrip extends HorizontalScrollView {
private Paint dividerPaint;
private int indicatorColor;
private int indicatorBgColor;
private int indicatorHeight = 2;
private int underlineHeight = 0;
private int underlineColor;
private int dividerWidth = 0;
private int dividerPadding = 0;
@ -165,6 +172,7 @@ public class PagerSlidingTabStrip extends HorizontalScrollView {
underlineColor = textPrimaryColor;
dividerColor = textPrimaryColor;
indicatorColor = textPrimaryColor;
indicatorBgColor = a.getColor(TEXT_COLOR_PRIMARY, Color.TRANSPARENT);
int paddingLeft = a.getDimensionPixelSize(PADDING_LEFT_INDEX, padding);
int paddingRight = a.getDimensionPixelSize(PADDING_RIGHT_INDEX, padding);
a.recycle();
@ -188,13 +196,11 @@ public class PagerSlidingTabStrip extends HorizontalScrollView {
scrollOffset = a.getDimensionPixelSize(R.styleable.PagerSlidingTabStrip_pstsScrollOffset, scrollOffset);
textAllCaps = a.getBoolean(R.styleable.PagerSlidingTabStrip_pstsTextAllCaps, textAllCaps);
isPaddingMiddle = a.getBoolean(R.styleable.PagerSlidingTabStrip_pstsPaddingMiddle, isPaddingMiddle);
tabTypefaceStyle = a.getInt(R.styleable.PagerSlidingTabStrip_pstsTextStyle, Typeface.BOLD);
tabTypefaceSelectedStyle = a.getInt(R.styleable.PagerSlidingTabStrip_pstsTextSelectedStyle, Typeface.BOLD);
tabTypefaceStyle = a.getInt(R.styleable.PagerSlidingTabStrip_pstsTextStyle, Typeface.NORMAL);
tabTypefaceSelectedStyle = a.getInt(R.styleable.PagerSlidingTabStrip_pstsTextSelectedStyle, Typeface.NORMAL);
tabTextAlpha = a.getFloat(R.styleable.PagerSlidingTabStrip_pstsTextAlpha, HALF_TRANSP);
tabTextSelectedAlpha = a.getFloat(R.styleable.PagerSlidingTabStrip_pstsTextSelectedAlpha, OPAQUE);
if (!isInEditMode()) {
tabTypeface = FontCache.getRobotoMedium(context);
}
tabTypeface = FontCache.getRobotoMedium(context);
a.recycle();
setMarginBottomTabContainer();
@ -387,6 +393,7 @@ public class PagerSlidingTabStrip extends HorizontalScrollView {
private OnGlobalLayoutListener firstTabGlobalLayoutListener = new OnGlobalLayoutListener() {
@SuppressLint("NewApi")
@Override
public void onGlobalLayout() {
View view = tabsContainer.getChildAt(0);
@ -414,13 +421,19 @@ public class PagerSlidingTabStrip extends HorizontalScrollView {
}
final int height = getHeight();
// draw underline
if (indicatorBgColor != Color.TRANSPARENT) {
rectPaint.setColor(indicatorBgColor); // underlineColor
canvas.drawRect(padding, height - indicatorHeight, tabsContainer.getWidth() + padding, height, rectPaint);
}
// draw indicator line
rectPaint.setColor(indicatorColor);
Pair<Float, Float> lines = getIndicatorCoordinates();
rectPaint.setColor(indicatorColor); // indicatorColor
canvas.drawRect(lines.first + padding, height - indicatorHeight, lines.second + padding, height, rectPaint);
// draw underline
rectPaint.setColor(underlineColor);
rectPaint.setColor(underlineColor); //underlineColor
canvas.drawRect(padding, height - underlineHeight, tabsContainer.getWidth() + padding, height, rectPaint);
// draw divider
if (dividerWidth != 0) {
dividerPaint.setStrokeWidth(dividerWidth);