Merge by hand.

This commit is contained in:
GaidamakUA 2015-09-23 17:09:43 +03:00
commit a06e1a158f
6 changed files with 44 additions and 18 deletions

View file

@ -2134,4 +2134,7 @@
<string name="address_unknown">Adressen kendes endnu ikke</string> <string name="address_unknown">Adressen kendes endnu ikke</string>
<string name="unsaved_changes_will_be_lost">Eventuelle ikke-gemte ændringer vil gå tabt. Fortsæt?</string> <string name="unsaved_changes_will_be_lost">Eventuelle ikke-gemte ændringer vil gå tabt. Fortsæt?</string>
<string name="are_you_sure">Sikker?</string> <string name="are_you_sure">Sikker?</string>
<string name="simulate_your_location_stop_descr">Stop simulering af position</string>
<string name="simulate_your_location_descr">Simuler ved brug af indspillet GPX eller beregnet rute</string>
<string name="downloads_left_template">%1$s downloads tilbage</string>
</resources> </resources>

View file

@ -2102,7 +2102,7 @@ Si consiglia di aggiungere uno o più punti intermedi per migliorarne le prestaz
<string name="lang_gl">Gallego</string> <string name="lang_gl">Gallego</string>
<string name="lang_et">Estone</string> <string name="lang_et">Estone</string>
<string name="lang_ceb">Cebuano</string> <string name="lang_ceb">Cebuano</string>
<string name="rendering_attr_currentTrackColor_name">Colore GPX</string> <string name="rendering_attr_currentTrackColor_name">Colore traccia GPX</string>
<string name="rendering_attr_currentTrackWidth_name">Spessore traccia GPX</string> <string name="rendering_attr_currentTrackWidth_name">Spessore traccia GPX</string>
<string name="rendering_value_translucent_red_name">Rosso traslucido</string> <string name="rendering_value_translucent_red_name">Rosso traslucido</string>
<string name="rendering_value_translucent_orange_name">Arancione traslucido</string> <string name="rendering_value_translucent_orange_name">Arancione traslucido</string>
@ -2178,4 +2178,7 @@ Si consiglia di aggiungere uno o più punti intermedi per migliorarne le prestaz
<string name="count_of_lines">Conteggio delle linee</string> <string name="count_of_lines">Conteggio delle linee</string>
<string name="are_you_sure">Sei sicuro?</string> <string name="are_you_sure">Sei sicuro?</string>
<string name="unsaved_changes_will_be_lost">Tutte le modifiche non salvate andranno perse. Continuare?</string> <string name="unsaved_changes_will_be_lost">Tutte le modifiche non salvate andranno perse. Continuare?</string>
<string name="simulate_your_location_stop_descr">Arresta la simulazione del percorso</string>
<string name="simulate_your_location_descr">Simula utilizzando un GPX registrato o una percorso calcolato</string>
<string name="downloads_left_template">%1$s download rimanenti</string>
</resources> </resources>

View file

@ -1,6 +1,8 @@
package net.osmand.plus; package net.osmand.plus;
import android.graphics.Bitmap;
import android.graphics.PorterDuff; import android.graphics.PorterDuff;
import android.graphics.drawable.BitmapDrawable;
import android.graphics.drawable.Drawable; import android.graphics.drawable.Drawable;
import gnu.trove.map.hash.TLongObjectHashMap; import gnu.trove.map.hash.TLongObjectHashMap;
@ -14,12 +16,32 @@ public class IconsCache {
this.app = app; this.app = app;
} }
public Drawable scaleImage(Drawable image, float scaleFactor) {
if ((image == null) || !(image instanceof BitmapDrawable)) {
return image;
}
Bitmap b = ((BitmapDrawable)image).getBitmap();
int sizeX = Math.round(image.getIntrinsicWidth() * scaleFactor);
int sizeY = Math.round(image.getIntrinsicHeight() * scaleFactor);
Bitmap bitmapResized = Bitmap.createScaledBitmap(b, sizeX, sizeY, false);
return new BitmapDrawable(app.getResources(), bitmapResized);
}
private Drawable getDrawable(int resId, int clrId) { private Drawable getDrawable(int resId, int clrId) {
long hash = ((long)resId << 31l) + clrId; return getDrawable(resId, clrId, 0);
}
private Drawable getDrawable(int resId, int clrId, float scale) {
long hash = ((long)resId << 31l) + clrId + (int)(scale * 10000f);
Drawable d = drawable.get(hash); Drawable d = drawable.get(hash);
if(d == null) { if(d == null) {
if (scale > 0) {
d = scaleImage(app.getResources().getDrawable(resId).mutate(), scale);
} else {
d = app.getResources().getDrawable(resId).mutate(); d = app.getResources().getDrawable(resId).mutate();
}
d.clearColorFilter(); d.clearColorFilter();
if (clrId != 0) { if (clrId != 0) {
d.setColorFilter(app.getResources().getColor(clrId), PorterDuff.Mode.SRC_IN); d.setColorFilter(app.getResources().getColor(clrId), PorterDuff.Mode.SRC_IN);
@ -49,12 +71,14 @@ public class IconsCache {
return getDrawable(id, colorId); return getDrawable(id, colorId);
} }
public Drawable getIcon(int id, int colorId, float scale) {
return getDrawable(id, colorId, scale);
}
public Drawable getContentIcon(int id) { public Drawable getContentIcon(int id) {
return getDrawable(id, app.getSettings().isLightContent() ? R.color.icon_color : 0); return getDrawable(id, app.getSettings().isLightContent() ? R.color.icon_color : 0);
} }
public Drawable getIcon(int id) { public Drawable getIcon(int id) {
return getDrawable(id, 0); return getDrawable(id, 0);
} }

View file

@ -69,7 +69,6 @@ public class SettingsDevelopmentActivity extends SettingsBaseActivity {
pref.setTitle(R.string.simulate_your_location); pref.setTitle(R.string.simulate_your_location);
updateTitle.run(); updateTitle.run();
pref.setKey("simulate_your_location"); pref.setKey("simulate_your_location");
sim.isRouteAnimating();
pref.setOnPreferenceClickListener(new OnPreferenceClickListener() { pref.setOnPreferenceClickListener(new OnPreferenceClickListener() {
@Override @Override
public boolean onPreferenceClick(Preference preference) { public boolean onPreferenceClick(Preference preference) {

View file

@ -80,7 +80,7 @@ public class MapContextMenu {
typeStr = null; typeStr = null;
streetStr = null; streetStr = null;
acquireLeftIconId(); acquireLeftIcon();
acquireNameAndType(); acquireNameAndType();
acquireStreetName(new LatLon(pointDescription.getLat(), pointDescription.getLon())); acquireStreetName(new LatLon(pointDescription.getLat(), pointDescription.getLon()));
@ -123,7 +123,7 @@ public class MapContextMenu {
return streetStr; return streetStr;
} }
private void acquireLeftIconId() { private void acquireLeftIcon() {
leftIconId = 0; leftIconId = 0;
if (object != null) { if (object != null) {
if (object instanceof Amenity) { if (object instanceof Amenity) {
@ -131,17 +131,14 @@ public class MapContextMenu {
Amenity o = (Amenity) object; Amenity o = (Amenity) object;
PoiType st = o.getType().getPoiTypeByKeyName(o.getSubType()); PoiType st = o.getType().getPoiTypeByKeyName(o.getSubType());
if (st != null) { if (st != null) {
if (RenderingIcons.containsSmallIcon(st.getIconKeyName())) { if (RenderingIcons.containsBigIcon(st.getIconKeyName())) {
id = st.getIconKeyName(); id = st.getIconKeyName();
} else if (RenderingIcons.containsSmallIcon(st.getOsmTag() + "_" + st.getOsmValue())) { } else if (RenderingIcons.containsBigIcon(st.getOsmTag() + "_" + st.getOsmValue())) {
id = st.getOsmTag() + "_" + st.getOsmValue(); id = st.getOsmTag() + "_" + st.getOsmValue();
} }
} }
if (id != null) { if (id != null) {
Integer resId = RenderingIcons.getResId(id); leftIconId = RenderingIcons.getBigIconResourceId(id);
if (resId != null) {
leftIconId = resId;
}
} }
} }
} }
@ -292,5 +289,6 @@ public class MapContextMenu {
if (streetStrObj != null) { if (streetStrObj != null) {
streetStr = streetStrObj.toString(); streetStr = streetStrObj.toString();
} }
acquireLeftIcon();
} }
} }

View file

@ -34,7 +34,6 @@ import net.osmand.plus.R;
import net.osmand.plus.activities.MapActivity; import net.osmand.plus.activities.MapActivity;
import net.osmand.plus.mapcontextmenu.sections.MenuController; import net.osmand.plus.mapcontextmenu.sections.MenuController;
import net.osmand.plus.views.AnimateDraggingMapThread; import net.osmand.plus.views.AnimateDraggingMapThread;
import net.osmand.plus.views.OsmandMapTileView;
import org.apache.commons.logging.Log; import org.apache.commons.logging.Log;
@ -327,7 +326,7 @@ public class MapContextMenuFragment extends Fragment {
iconLayout.setVisibility(View.GONE); iconLayout.setVisibility(View.GONE);
} else { } else {
iconView.setImageDrawable(iconsCache.getIcon(iconId, iconView.setImageDrawable(iconsCache.getIcon(iconId,
light ? R.color.osmand_orange : R.color.osmand_orange_dark)); light ? R.color.osmand_orange : R.color.osmand_orange_dark, 0.75f));
} }
setAddressLocation(); setAddressLocation();