forked from organicmaps/organicmaps
[new downloader][android] add: Zoom to current location after first start screen.
This commit is contained in:
parent
f80f6e214d
commit
689e7cadd7
4 changed files with 19 additions and 1 deletions
|
@ -273,6 +273,13 @@ void Framework::Scale(::Framework::EScaleMode mode)
|
|||
m_work.Scale(mode, true);
|
||||
}
|
||||
|
||||
void Framework::Scale(m2::PointD const & centerPt, int targetZoom, bool animate)
|
||||
{
|
||||
ref_ptr<df::DrapeEngine> engine = m_work.GetDrapeEngine();
|
||||
if (engine)
|
||||
engine->SetModelViewCenter(centerPt, targetZoom, animate);
|
||||
}
|
||||
|
||||
::Framework * Framework::NativeFramework()
|
||||
{
|
||||
return &m_work;
|
||||
|
@ -958,6 +965,13 @@ extern "C"
|
|||
env->SetBooleanField(result, buildingsField, buildings);
|
||||
}
|
||||
|
||||
// static void nativeZoomToPoint(double lat, double lon, int zoom, boolean animate);
|
||||
JNIEXPORT void JNICALL
|
||||
Java_com_mapswithme_maps_Framework_nativeZoomToPoint(JNIEnv * env, jclass clazz, jdouble lat, jdouble lon, jint zoom, jboolean animate)
|
||||
{
|
||||
g_framework->Scale(m2::PointD(MercatorBounds::FromLatLon(lat, lon)), zoom, animate);
|
||||
}
|
||||
|
||||
extern JNIEXPORT void JNICALL
|
||||
Java_com_mapswithme_maps_bookmarks_data_BookmarkManager_nativeDeleteBookmark(JNIEnv *, jobject, jint, jint);
|
||||
|
||||
|
|
|
@ -112,6 +112,7 @@ namespace android
|
|||
void AddString(string const & name, string const & value);
|
||||
|
||||
void Scale(::Framework::EScaleMode mode);
|
||||
void Scale(m2::PointD const & centerPt, int targetZoom, bool animate);
|
||||
|
||||
void ReplaceBookmark(BookmarkAndCategory const & ind, BookmarkData & bm);
|
||||
size_t ChangeBookmarkCategory(BookmarkAndCategory const & ind, size_t newCat);
|
||||
|
|
|
@ -189,4 +189,6 @@ public class Framework
|
|||
|
||||
@NonNull
|
||||
public static native MapObject nativeDeleteBookmarkFromMapObject();
|
||||
|
||||
public static native void nativeZoomToPoint(double lat, double lon, int zoom, boolean animate);
|
||||
}
|
||||
|
|
|
@ -9,6 +9,7 @@ import android.support.v4.app.FragmentActivity;
|
|||
import android.support.v4.app.FragmentManager;
|
||||
|
||||
import com.mapswithme.maps.BuildConfig;
|
||||
import com.mapswithme.maps.Framework;
|
||||
import com.mapswithme.maps.R;
|
||||
import com.mapswithme.maps.location.LocationHelper;
|
||||
import com.mapswithme.util.Config;
|
||||
|
@ -115,7 +116,7 @@ public class FirstStartFragment extends BaseNewsFragment
|
|||
return;
|
||||
}
|
||||
|
||||
// TODO (trashkalmar): Zoom to location
|
||||
Framework.nativeZoomToPoint(sLocation.getLatitude(), sLocation.getLongitude(), 14, true);
|
||||
|
||||
sLocation = null;
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue