Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mapsme/omim.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDmitry Kunin <dkunin@mapswith.me>2013-09-18 13:41:42 +0400
committerAlex Zolotarev <alex@maps.me>2015-09-23 02:02:16 +0300
commit69af634fbf1ffe88aff2f022ae79ab4f3b39218c (patch)
tree8c9d3da028f513eec8819ed048a4adb01dee1d87
parent23c591de0ad2a1a302b6fd49b0a8ff52c4e259fd (diff)
[yota] Yopme cleanup + new logic
-rw-r--r--.gitignore3
-rw-r--r--android/YoPme/AndroidManifest.xml37
-rw-r--r--android/YoPme/build.gradle1
-rw-r--r--android/YoPme/project.properties1
-rw-r--r--android/YoPme/res/xml/prefs.xml9
-rw-r--r--android/YoPme/src/com/mapswithme/yopme/BackscreenActivity.java91
-rw-r--r--android/YoPme/src/com/mapswithme/yopme/PoiPoint.java22
-rw-r--r--android/YoPme/src/com/mapswithme/yopme/YopmeFrontActivity.java212
-rw-r--r--android/YoPme/src/com/mapswithme/yopme/YopmePreference.java34
-rw-r--r--android/YoPme/src/com/mapswithme/yopme/map/MapData.java10
-rw-r--r--android/YoPme/src/com/mapswithme/yopme/map/MapDataProvider.java5
-rw-r--r--android/YoPme/src/com/mapswithme/yopme/map/MapRenderer.java21
12 files changed, 165 insertions, 281 deletions
diff --git a/.gitignore b/.gitignore
index b901810b2e..97719a4b68 100644
--- a/.gitignore
+++ b/.gitignore
@@ -173,4 +173,5 @@ tools/twine/.git
syntax: regexp
(.*/)?\#[^/]*\#$
-android/YoPme/.gradletasknamecache \ No newline at end of file
+android/YoPme/.gradletasknamecache
+android/.gradletasknamecache \ No newline at end of file
diff --git a/android/YoPme/AndroidManifest.xml b/android/YoPme/AndroidManifest.xml
index 589da12f22..86fc20d8d0 100644
--- a/android/YoPme/AndroidManifest.xml
+++ b/android/YoPme/AndroidManifest.xml
@@ -25,23 +25,17 @@
android:name="@string/com.yotadevices.BS_ICON"
android:resource="@drawable/inc_icon" />
- <activity
- android:name="com.mapswithme.yopme.YopmeFrontActivity"
- android:configChanges="keyboardHidden|screenSize|orientation"
- android:label="@string/app_name"
- android:launchMode="singleTop"
- android:screenOrientation="sensorPortrait" >
+ <service
+ android:name="com.mapswithme.yopme.BackscreenActivity" >
<intent-filter>
<action
- android:name="android.intent.action.MAIN" />
-
- <category
- android:name="android.intent.category.LAUNCHER" />
+ android:name="com.mapswithme.yopme.location" />
</intent-filter>
- </activity>
-
- <service
- android:name="com.mapswithme.yopme.BackscreenActivity" />
+ <intent-filter>
+ <action
+ android:name="com.mapswithme.yopme.show_rect" />
+ </intent-filter>
+ </service>
<uses-library
android:name="com.yotadevices.platinum" />
@@ -49,20 +43,23 @@
<activity
android:name="com.mapswithme.yopme.ReferenceActivity"
android:label="@string/title_activity_reference"
- android:parentActivityName="com.mapswithme.yopme.YopmeFrontActivity"
+ android:parentActivityName="com.mapswithme.yopme.YopmePreference"
android:screenOrientation="sensorPortrait" >
<meta-data
android:name="android.support.PARENT_ACTIVITY"
- android:value="com.mapswithme.yopme.YopmeFrontActivity" />
+ android:value="com.mapswithme.yopme.YopmePreference" />
</activity>
<activity
android:name="com.mapswithme.yopme.YopmePreference"
android:label="@string/menu_settings"
- android:parentActivityName="com.mapswithme.yopme.YopmeFrontActivity"
android:screenOrientation="sensorPortrait" >
- <meta-data
- android:name="android.support.PARENT_ACTIVITY"
- android:value="com.mapswithme.yopme.YopmeFrontActivity" />
+ <intent-filter>
+ <action
+ android:name="com.mapswithme.yopme.preference" />
+
+ <category
+ android:name="android.intent.category.DEFAULT" />
+ </intent-filter>
</activity>
</application>
diff --git a/android/YoPme/build.gradle b/android/YoPme/build.gradle
index 6cda75c719..30f0bcb5c9 100644
--- a/android/YoPme/build.gradle
+++ b/android/YoPme/build.gradle
@@ -3,7 +3,6 @@ apply plugin: 'android'
dependencies {
compile fileTree(dir: 'libs', include: '*.jar')
compile project(':3rd_party:yota_sdk')
- compile project(':3rd_party:api-android:lib')
}
apply plugin:'base'
diff --git a/android/YoPme/project.properties b/android/YoPme/project.properties
index 72d3249c28..0c93370d1f 100644
--- a/android/YoPme/project.properties
+++ b/android/YoPme/project.properties
@@ -13,4 +13,3 @@
# Project target.
target=Yota Platinum:Platinum Add-On:17
android.library.reference.1=../3rd_party/yota_sdk
-android.library.reference.2=../3rd_party/api-android/lib
diff --git a/android/YoPme/res/xml/prefs.xml b/android/YoPme/res/xml/prefs.xml
index e37e04c24d..b0f6b9cad0 100644
--- a/android/YoPme/res/xml/prefs.xml
+++ b/android/YoPme/res/xml/prefs.xml
@@ -12,4 +12,13 @@
android:title="@string/location_update_frequency" />
</PreferenceCategory>
+ <Preference
+ android:key="@string/menu_help"
+ android:title="@string/menu_help" >
+ </Preference>
+ <Preference
+ android:key="@string/pref_about"
+ android:title="@string/about_title" >
+ </Preference>
+
</PreferenceScreen> \ No newline at end of file
diff --git a/android/YoPme/src/com/mapswithme/yopme/BackscreenActivity.java b/android/YoPme/src/com/mapswithme/yopme/BackscreenActivity.java
index 11b8369776..37e401674d 100644
--- a/android/YoPme/src/com/mapswithme/yopme/BackscreenActivity.java
+++ b/android/YoPme/src/com/mapswithme/yopme/BackscreenActivity.java
@@ -23,7 +23,6 @@ import android.widget.ImageView;
import android.widget.TextView;
import com.mapswithme.location.LocationRequester;
-import com.mapswithme.maps.api.MWMPoint;
import com.mapswithme.yopme.map.MapData;
import com.mapswithme.yopme.map.MapDataProvider;
import com.mapswithme.yopme.map.MapRenderer;
@@ -31,16 +30,26 @@ import com.yotadevices.sdk.BSActivity;
import com.yotadevices.sdk.BSDrawer.Waveform;
import com.yotadevices.sdk.BSMotionEvent;
import com.yotadevices.sdk.Constants.Gestures;
+import com.yotadevices.sdk.utils.RotationAlgorithm;
public class BackscreenActivity extends BSActivity
{
- private final static String AUTHORITY = "com.mapswithme.yopme";
private final static String TAG = "YOPME";
- public final static String EXTRA_MODE = AUTHORITY + ".mode";
- public final static String EXTRA_POINT = AUTHORITY + ".point";
- public final static String EXTRA_ZOOM = AUTHORITY + ".zoom";
- public final static String EXTRA_LOCATION = AUTHORITY + ".location";
+ private final static String YOPME_AUTHORITY = "com.mapswithme.yopme";
+ public final static String ACTION_PREFERENCE = YOPME_AUTHORITY + ".preference";
+ public final static String ACTION_SHOW_RECT = YOPME_AUTHORITY + ".show_rect";
+ public final static String ACTION_LOCATION = YOPME_AUTHORITY + ".location";
+
+ public final static String EXTRA_LAT = YOPME_AUTHORITY + ".lat";
+ public final static String EXTRA_LON = YOPME_AUTHORITY + ".lon";
+ public final static String EXTRA_ZOOM = YOPME_AUTHORITY + ".zoom";
+ public final static String EXTRA_NAME = YOPME_AUTHORITY + ".name";
+ public final static String EXTRA_MODE = YOPME_AUTHORITY + ".mode";
+
+ public final static String EXTRA_HAS_LOCATION = YOPME_AUTHORITY + ".haslocation";
+ public final static String EXTRA_MY_LAT = YOPME_AUTHORITY + ".mylat";
+ public final static String EXTRA_MY_LON = YOPME_AUTHORITY + ".mylon";
public enum Mode
{
@@ -50,7 +59,7 @@ public class BackscreenActivity extends BSActivity
/// @name Save to state.
//@{
- private MWMPoint mPoint = null;
+ private PoiPoint mPoint = null;
private Mode mMode = Mode.LOCATION;
private double mZoomLevel = MapDataProvider.ZOOM_DEFAULT;
private Location mLocation = null;
@@ -79,6 +88,8 @@ public class BackscreenActivity extends BSActivity
private final Handler mHandler = new Handler();
private final static long REDRAW_MIN_INTERVAL = 333;
+ private static final String EXTRA_POINT = "point";
+
@Override
protected void onBSCreate()
{
@@ -132,7 +143,7 @@ public class BackscreenActivity extends BSActivity
// Do not save and restore m_location! It's compared by getElapsedRealtimeNanos().
- mPoint = (MWMPoint) savedInstanceState.getSerializable(EXTRA_POINT);
+ mPoint = (PoiPoint) savedInstanceState.getSerializable(EXTRA_POINT);
mMode = (Mode) savedInstanceState.getSerializable(EXTRA_MODE);
mZoomLevel = savedInstanceState.getDouble(EXTRA_ZOOM);
}
@@ -177,24 +188,41 @@ public class BackscreenActivity extends BSActivity
{
super.onHandleIntent(intent);
+ final String action = intent.getAction();
if (intent.hasExtra(LocationManager.KEY_LOCATION_CHANGED))
{
final Location l = (Location) intent.getParcelableExtra(LocationManager.KEY_LOCATION_CHANGED);
- if (LocationRequester.isFirstOneBetterLocation(l, mLocation) &&
- areLocationsFarEnough(l, mLocation))
- {
+ if (LocationRequester.isFirstOneBetterLocation(l, mLocation) && areLocationsFarEnough(l, mLocation))
mLocation = l;
- }
else
return;
}
- else if (intent.hasExtra(EXTRA_MODE))
+ else if (action != null && (ACTION_LOCATION + ACTION_SHOW_RECT).contains(action))
{
- mMode = (Mode) intent.getSerializableExtra(EXTRA_MODE);
- mPoint = (MWMPoint) intent.getSerializableExtra(EXTRA_POINT);
+ if (intent.getBooleanExtra(EXTRA_HAS_LOCATION, false))
+ {
+ // use location from MWM
+ final double myLat = intent.getDoubleExtra(EXTRA_MY_LAT, 0);
+ final double myLon = intent.getDoubleExtra(EXTRA_MY_LON, 0);
+ mLocation = new Location("MapsWithMe");
+ mLocation.setLatitude(myLat);
+ mLocation.setLongitude(myLon);
+ }
+
+ if (ACTION_LOCATION.equals(intent.getAction()))
+ mMode = Mode.LOCATION;
+ else if (ACTION_SHOW_RECT.equals(intent.getAction()))
+ {
+ mMode = Mode.POI;
+ final double lat = intent.getDoubleExtra(EXTRA_LAT, 0);
+ final double lon = intent.getDoubleExtra(EXTRA_LON, 0);
+ final String name = intent.getStringExtra(EXTRA_NAME);
+ mPoint = new PoiPoint(lat, lon, name);
+ }
mZoomLevel = intent.getDoubleExtra(EXTRA_ZOOM, MapDataProvider.COMFORT_ZOOM);
requestLocationUpdate();
+ RotationAlgorithm.getInstance(this).turnScreenOffIfRotated();
}
// Do always update data.
@@ -334,31 +362,25 @@ public class BackscreenActivity extends BSActivity
if (mMode == Mode.LOCATION)
{
mPoiInfo.setVisibility(View.GONE);
-
if (mLocation == null)
{
showWaitMessage(getString(R.string.wait_msg));
return;
}
-
- data = mMapDataProvider.getMyPositionData(mLocation.getLatitude(), mLocation.getLongitude(), mZoomLevel);
+ data = mMapDataProvider
+ .getMyPositionData(mLocation.getLatitude(), mLocation.getLongitude(), mZoomLevel);
}
else if (mMode == Mode.POI)
{
mPoiInfo.setVisibility(View.VISIBLE);
-
if (mLocation != null)
- data = mMapDataProvider.getPOIData(mPoint, mZoomLevel, true, mLocation.getLatitude(), mLocation.getLongitude());
+ data = mMapDataProvider
+ .getPOIData(mPoint, mZoomLevel, true, mLocation.getLatitude(), mLocation.getLongitude());
else
- data = mMapDataProvider.getPOIData(mPoint, mZoomLevel, false, 0, 0);
+ data = mMapDataProvider
+ .getPOIData(mPoint, mZoomLevel, false, 0, 0);
- if (mLocation != null && mPoint != null)
- {
- final Location poiLoc = new Location("");
- poiLoc.setLatitude(mPoint.getLat());
- poiLoc.setLongitude(mPoint.getLon());
- setDistance(poiLoc.distanceTo(mLocation));
- }
+ calculateDistance();
}
final Bitmap bitmap = data.getBitmap();
@@ -377,7 +399,18 @@ public class BackscreenActivity extends BSActivity
mPoiText.setText(mPoint.getName());
}
- public static void startInMode(Context context, Mode mode, MWMPoint point, double zoom)
+ private void calculateDistance()
+ {
+ if (mLocation != null && mPoint != null)
+ {
+ final Location poiLoc = new Location("");
+ poiLoc.setLatitude(mPoint.getLat());
+ poiLoc.setLongitude(mPoint.getLon());
+ setDistance(poiLoc.distanceTo(mLocation));
+ }
+ }
+
+ public static void startInMode(Context context, Mode mode, PoiPoint point, double zoom)
{
final Intent i = new Intent(context, BackscreenActivity.class)
.putExtra(EXTRA_MODE, mode)
diff --git a/android/YoPme/src/com/mapswithme/yopme/PoiPoint.java b/android/YoPme/src/com/mapswithme/yopme/PoiPoint.java
new file mode 100644
index 0000000000..717ea5af00
--- /dev/null
+++ b/android/YoPme/src/com/mapswithme/yopme/PoiPoint.java
@@ -0,0 +1,22 @@
+package com.mapswithme.yopme;
+
+import java.io.Serializable;
+
+public class PoiPoint implements Serializable
+{
+ private static final long serialVersionUID = 1L;
+ private final double mLon;
+ private final double mLat;
+ private final String mName;
+
+ public PoiPoint(double lat, double lon, String name)
+ {
+ mLat = lat;
+ mLon = lon;
+ mName = name;
+ }
+
+ public String getName() { return mName; }
+ public double getLat() { return mLat; }
+ public double getLon() { return mLon; }
+} \ No newline at end of file
diff --git a/android/YoPme/src/com/mapswithme/yopme/YopmeFrontActivity.java b/android/YoPme/src/com/mapswithme/yopme/YopmeFrontActivity.java
deleted file mode 100644
index 3c473773d8..0000000000
--- a/android/YoPme/src/com/mapswithme/yopme/YopmeFrontActivity.java
+++ /dev/null
@@ -1,212 +0,0 @@
-package com.mapswithme.yopme;
-
-import com.mapswithme.maps.api.MWMPoint;
-import com.mapswithme.maps.api.MWMResponse;
-import com.mapswithme.maps.api.MapsWithMeApi;
-import com.mapswithme.maps.api.MwmRequest;
-import com.mapswithme.yopme.BackscreenActivity.Mode;
-import com.mapswithme.yopme.map.MapDataProvider;
-
-import android.os.Bundle;
-import android.app.ActionBar;
-import android.app.Activity;
-import android.app.AlertDialog;
-import android.app.PendingIntent;
-import android.content.Intent;
-import android.text.SpannableString;
-import android.text.util.Linkify;
-import android.view.MenuItem;
-import android.view.View;
-import android.view.View.OnClickListener;
-import android.view.ViewGroup;
-import android.widget.PopupMenu;
-import android.widget.Toast;
-import android.widget.PopupMenu.OnMenuItemClickListener;
-import android.widget.TextView;
-
-public class YopmeFrontActivity extends Activity
- implements OnClickListener
-{
- private TextView mSelectedLocation;
- private View mMenu;
-
- private Mode mMode;
- private MWMPoint mPoint;
- private final static String KEY_MODE = "key.mode";
- private final static String KEY_POINT = "key.point";
-
- @Override
- protected void onSaveInstanceState(Bundle outState)
- {
- super.onSaveInstanceState(outState);
-
- outState.putSerializable(KEY_MODE, mMode);
- outState.putSerializable(KEY_POINT, mPoint);
- }
-
- @Override
- protected void onCreate(Bundle savedInstanceState)
- {
- super.onCreate(savedInstanceState);
- setContentView(R.layout.activity_yopme_main);
-
- final ActionBar actionBar = getActionBar();
- actionBar.setDisplayShowTitleEnabled(false);
- actionBar.setDisplayShowHomeEnabled(false);
- actionBar.setDisplayUseLogoEnabled(false);
- actionBar.setDisplayShowCustomEnabled(true);
- actionBar.setCustomView(R.layout.action_bar_view);
-
- setUpView();
-
- //restore
- if (savedInstanceState != null)
- {
- mMode = (Mode) savedInstanceState.getSerializable(KEY_MODE);
- mPoint = (MWMPoint) savedInstanceState.getSerializable(KEY_POINT);
-
- if (Mode.LOCATION == mMode)
- setLocationView();
- else if (Mode.POI == mMode)
- mSelectedLocation.setText(mPoint.getName());
- }
-
- setUpListeners();
-
- if (isIntroNeeded())
- showIntro();
- }
-
- @Override
- protected void onNewIntent(Intent intent)
- {
- super.onNewIntent(intent);
-
- if (intent.hasExtra(EXTRA_PICK) && intent.getBooleanExtra(EXTRA_PICK, false))
- {
- final MWMResponse response = MWMResponse.extractFromIntent(this, intent);
- if (response.hasPoint())
- {
- mPoint = response.getPoint();
- mSelectedLocation.setText(mPoint.getName());
- BackscreenActivity.startInMode(this, Mode.POI, mPoint, response.getZoomLevel());
-
- Toast.makeText(this, R.string.toast_poi, Toast.LENGTH_LONG).show();
- }
-
- }
- }
-
- private void setUpView()
- {
- mSelectedLocation = (TextView) findViewById(R.id.selectedLocation);
- mMenu = findViewById(R.id.menu);
- }
-
- private void setUpListeners()
- {
- findViewById(R.id.poi).setOnClickListener(this);
- findViewById(R.id.me).setOnClickListener(this);
- mMenu.setOnClickListener(this);
- }
-
- @Override
- public void onClick(View v)
- {
- if (R.id.me == v.getId())
- {
- BackscreenActivity.startInMode(getApplicationContext(), Mode.LOCATION, null, MapDataProvider.COMFORT_ZOOM);
- Toast.makeText(this, R.string.toast_your_location, Toast.LENGTH_LONG).show();
- setLocationView();
- }
- else if (R.id.poi == v.getId())
- {
- final MwmRequest request = new MwmRequest()
- .setCustomButtonName(getString(R.string.pick_point_button_name))
- .setPendingIntent(getPickPointPendingIntent())
- .setTitle(getString(R.string.app_name))
- .setPickPointMode(true);
- MapsWithMeApi.sendRequest(this, request);
- }
- else if (R.id.menu == v.getId())
- {
- final PopupMenu popupMenu = new PopupMenu(this, mMenu);
- popupMenu.setOnMenuItemClickListener(new OnMenuItemClickListener()
- {
- @Override
- public boolean onMenuItemClick(MenuItem item)
- {
- final int itemId = item.getItemId();
- if (itemId == R.id.menu_help)
- {
- startActivity(new Intent(getApplicationContext(), ReferenceActivity.class));
- return true;
- }
- else if (itemId == R.id.menu_settings)
- {
- startActivity(new Intent(getApplicationContext(), YopmePreference.class));
- return true;
- }
- else if (itemId == R.id.menu_about)
- {
- final SpannableString linkifiedAbout = new SpannableString(getString(R.string.about));
- Linkify.addLinks(linkifiedAbout, Linkify.ALL);
-
- new AlertDialog.Builder(YopmeFrontActivity.this)
- .setTitle(R.string.about_title)
- .setMessage(linkifiedAbout)
- .create()
- .show();
-
- return true;
- }
- return false;
- }
- });
- popupMenu.inflate(R.menu.yopme_main);
- popupMenu.show();
- }
- }
-
- private final static String EXTRA_PICK = ".pick_point";
- private PendingIntent getPickPointPendingIntent()
- {
- final Intent i = new Intent(this, YopmeFrontActivity.class);
- i.putExtra(EXTRA_PICK, true);
- return PendingIntent.getActivity(this, 0, i, PendingIntent.FLAG_UPDATE_CURRENT);
- }
-
- private void setLocationView()
- {
- mSelectedLocation.setText(getString(R.string.poi_label));
- }
-
- private void showIntro()
- {
- final View intro = View.inflate(this, R.layout.help, null);
- intro.setBackgroundColor(0x80000000);
- ((ViewGroup)getWindow().getDecorView()).addView(intro);
- intro.setOnClickListener(new OnClickListener()
- {
- @Override
- public void onClick(View v)
- {
- intro.setVisibility(View.GONE);
- markIntroShown();
- }
- });
- }
-
- private final static String PREFS = "prefs.xml";
- private final static String KEY_INTRO = "intro";
-
- private boolean isIntroNeeded()
- {
- return getSharedPreferences(PREFS, 0).getBoolean(KEY_INTRO, true);
- }
-
- private void markIntroShown()
- {
- getSharedPreferences(PREFS, 0).edit().putBoolean(KEY_INTRO, false).apply();
- }
-}
diff --git a/android/YoPme/src/com/mapswithme/yopme/YopmePreference.java b/android/YoPme/src/com/mapswithme/yopme/YopmePreference.java
index 14b1acfc08..f441319160 100644
--- a/android/YoPme/src/com/mapswithme/yopme/YopmePreference.java
+++ b/android/YoPme/src/com/mapswithme/yopme/YopmePreference.java
@@ -1,11 +1,17 @@
package com.mapswithme.yopme;
+import android.app.AlertDialog;
+import android.content.Intent;
import android.content.SharedPreferences;
import android.content.SharedPreferences.OnSharedPreferenceChangeListener;
import android.os.Bundle;
import android.preference.ListPreference;
+import android.preference.Preference;
+import android.preference.Preference.OnPreferenceClickListener;
import android.preference.PreferenceActivity;
import android.preference.PreferenceManager;
+import android.text.SpannableString;
+import android.text.util.Linkify;
public class YopmePreference extends PreferenceActivity
implements OnSharedPreferenceChangeListener
@@ -22,6 +28,34 @@ public class YopmePreference extends PreferenceActivity
addPreferencesFromResource(R.xml.prefs);
mLocationUpdatePref = (ListPreference) findPreference(getString(R.string.pref_loc_update));
updateSummary();
+
+ findPreference(getString(R.string.pref_about)).setOnPreferenceClickListener(new OnPreferenceClickListener()
+ {
+ @Override
+ public boolean onPreferenceClick(Preference preference)
+ {
+ final SpannableString linkifiedAbout = new SpannableString(getString(R.string.about));
+ Linkify.addLinks(linkifiedAbout, Linkify.ALL);
+
+ new AlertDialog.Builder(YopmePreference.this)
+ .setTitle(R.string.about_title)
+ .setMessage(linkifiedAbout)
+ .create()
+ .show();
+
+ return true;
+ }
+ });
+
+ findPreference(getString(R.string.menu_help)).setOnPreferenceClickListener(new OnPreferenceClickListener()
+ {
+ @Override
+ public boolean onPreferenceClick(Preference preference)
+ {
+ startActivity(new Intent(getApplicationContext(), ReferenceActivity.class));
+ return true;
+ }
+ });
}
private void updateSummary()
diff --git a/android/YoPme/src/com/mapswithme/yopme/map/MapData.java b/android/YoPme/src/com/mapswithme/yopme/map/MapData.java
index a09e7259ea..4609e7d64b 100644
--- a/android/YoPme/src/com/mapswithme/yopme/map/MapData.java
+++ b/android/YoPme/src/com/mapswithme/yopme/map/MapData.java
@@ -2,7 +2,7 @@ package com.mapswithme.yopme.map;
import java.io.Serializable;
-import com.mapswithme.maps.api.MWMPoint;
+import com.mapswithme.yopme.PoiPoint;
import android.graphics.Bitmap;
@@ -11,21 +11,21 @@ public class MapData implements Serializable
private static final long serialVersionUID = 1L;
private final Bitmap mBitmap;
- private final MWMPoint mPoint;
+ private final PoiPoint mPoint;
public MapData()
{
mBitmap = null;
- mPoint = new MWMPoint(0, 0, "Unknown");
+ mPoint = new PoiPoint(0, 0, "Unknown");
}
- public MapData(Bitmap bitmap, MWMPoint point)
+ public MapData(Bitmap bitmap, PoiPoint point)
{
this.mBitmap = bitmap;
this.mPoint = point;
}
- public MWMPoint getPoint()
+ public PoiPoint getPoint()
{
return mPoint;
}
diff --git a/android/YoPme/src/com/mapswithme/yopme/map/MapDataProvider.java b/android/YoPme/src/com/mapswithme/yopme/map/MapDataProvider.java
index 37de936ffc..b527a503fb 100644
--- a/android/YoPme/src/com/mapswithme/yopme/map/MapDataProvider.java
+++ b/android/YoPme/src/com/mapswithme/yopme/map/MapDataProvider.java
@@ -1,6 +1,7 @@
package com.mapswithme.yopme.map;
-import com.mapswithme.maps.api.MWMPoint;
+import com.mapswithme.yopme.PoiPoint;
+
public interface MapDataProvider
{
@@ -10,5 +11,5 @@ public interface MapDataProvider
public final static double COMFORT_ZOOM = 17;
MapData getMyPositionData(double lat, double lon, double zoom);
- MapData getPOIData(MWMPoint poi, double zoom, boolean myLocationDetected, double myLat, double myLon);
+ MapData getPOIData(PoiPoint poi, double zoom, boolean myLocationDetected, double myLat, double myLon);
}
diff --git a/android/YoPme/src/com/mapswithme/yopme/map/MapRenderer.java b/android/YoPme/src/com/mapswithme/yopme/map/MapRenderer.java
index 29ffbf6a23..fce6c2e9e9 100644
--- a/android/YoPme/src/com/mapswithme/yopme/map/MapRenderer.java
+++ b/android/YoPme/src/com/mapswithme/yopme/map/MapRenderer.java
@@ -1,28 +1,29 @@
package com.mapswithme.yopme.map;
import android.graphics.Bitmap;
-import com.mapswithme.maps.api.MWMPoint;
+
+import com.mapswithme.yopme.PoiPoint;
import com.mapswithme.yopme.util.PixelBuffer;
public class MapRenderer implements MapDataProvider
{
private final static String TAG = "MapRenderer";
PixelBuffer mPixelBuffer = null;
-
+
public MapRenderer(int width, int height)
{
mPixelBuffer = new PixelBuffer(width, height);
mPixelBuffer.init();
nativeCreateFramework(width, height);
}
-
+
public void terminate()
{
mPixelBuffer.terminate();
}
-
+
static volatile private MapRenderer mRenderer = null;
-
+
static public MapRenderer GetRenderer()
{
if (mRenderer == null)
@@ -35,20 +36,20 @@ public class MapRenderer implements MapDataProvider
{
synchronized(MapRenderer.class)
{
- final MWMPoint poi = new MWMPoint(lat, lon, "");
+ final PoiPoint poi = new PoiPoint(lat, lon, "");
mPixelBuffer.attachToThread();
if (nativeRenderMyPosition(poi.getLat(), poi.getLon(), zoom) == false)
return new MapData(null, poi);
- Bitmap bmp = mPixelBuffer.readBitmap();
+ final Bitmap bmp = mPixelBuffer.readBitmap();
mPixelBuffer.detachFromThread();
return new MapData(bmp, poi);
}
}
@Override
- public MapData getPOIData(MWMPoint poi, double zoom, boolean myLocationDetected, double myLat, double myLon)
+ public MapData getPOIData(PoiPoint poi, double zoom, boolean myLocationDetected, double myLat, double myLon)
{
synchronized(MapRenderer.class)
{
@@ -56,12 +57,12 @@ public class MapRenderer implements MapDataProvider
if (nativeRenderPoiMap(poi.getLat(), poi.getLon(), myLocationDetected, myLat, myLon, zoom) == false)
return new MapData(null, poi);
- Bitmap bmp = mPixelBuffer.readBitmap();
+ final Bitmap bmp = mPixelBuffer.readBitmap();
mPixelBuffer.detachFromThread();
return new MapData(bmp, poi);
}
}
-
+
private native void nativeCreateFramework(int width, int height);
private native boolean nativeRenderMyPosition(double lat, double lon, double zoom);
private native boolean nativeRenderPoiMap(double lat, double lon,