fixes an issue with flag resource access from base library.

This commit is contained in:
rachytski 2012-07-06 14:18:31 -07:00 committed by Alex Zolotarev
parent b263940b2f
commit f4afae7349
2 changed files with 8 additions and 2 deletions

View file

@ -18,11 +18,14 @@ public class ArrowImage extends ImageView
private Paint m_paint;
private boolean m_drawArrow;
private float m_angle;
private String m_packageName;
public ArrowImage(Context context, AttributeSet attrs)
{
super(context, attrs);
m_packageName = context.getApplicationContext().getPackageName();
m_paint = new Paint();
m_paint.setFlags(m_paint.getFlags() | Paint.ANTI_ALIAS_FLAG);
m_paint.setStyle(Style.FILL);
@ -37,7 +40,7 @@ public class ArrowImage extends ImageView
if (flag.equals("do"))
flag = "do_hack";
final int id = res.getIdentifier(flag, "drawable", "com.mapswithme.maps");
final int id = res.getIdentifier(flag, "drawable", m_packageName);
if (id > 0)
setImageDrawable(res.getDrawable(id));
else

View file

@ -45,6 +45,8 @@ public class DownloadUI extends ListActivity implements MapStorage.Listener
private int m_slotID = 0;
private MapStorage m_storage;
private String m_packageName;
private static class CountryItem
{
public String m_name;
@ -133,6 +135,7 @@ public class DownloadUI extends ListActivity implements MapStorage.Listener
public DownloadAdapter(Activity context)
{
m_storage = MapStorage.getInstance();
m_packageName = context.getApplication().getPackageName();
m_context = context;
m_inflater = (LayoutInflater) m_context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
@ -474,7 +477,7 @@ public class DownloadUI extends ListActivity implements MapStorage.Listener
private void setFlag(int position, ImageView v)
{
Resources res = m_context.getResources();
final int id = res.getIdentifier(m_items[position].m_flag, "drawable", "com.mapswithme.maps");
final int id = res.getIdentifier(m_items[position].m_flag, "drawable", m_packageName);
if (id > 0)
v.setImageDrawable(res.getDrawable(id));
else