forked from organicmaps/organicmaps
[android] CreateDrapeEngine with m_isLaunchByDeepLink flag.
This commit is contained in:
parent
45eb41dde2
commit
97d9bb8a1f
6 changed files with 28 additions and 9 deletions
|
@ -132,7 +132,8 @@ void Framework::TrafficStateChanged(TrafficManager::TrafficState state)
|
|||
m_onTrafficStateChangedFn(state);
|
||||
}
|
||||
|
||||
bool Framework::CreateDrapeEngine(JNIEnv * env, jobject jSurface, int densityDpi, bool firstLaunch)
|
||||
bool Framework::CreateDrapeEngine(JNIEnv * env, jobject jSurface, int densityDpi, bool firstLaunch,
|
||||
bool launchByDeepLink)
|
||||
{
|
||||
m_contextFactory = make_unique_dp<dp::ThreadSafeFactory>(new AndroidOGLContextFactory(env, jSurface));
|
||||
AndroidOGLContextFactory const * factory = m_contextFactory->CastFactory<AndroidOGLContextFactory>();
|
||||
|
@ -152,8 +153,7 @@ bool Framework::CreateDrapeEngine(JNIEnv * env, jobject jSurface, int densityDpi
|
|||
p.m_initialMyPositionState = m_currentMode;
|
||||
p.m_isChoosePositionMode = m_isChoosePositionMode;
|
||||
p.m_hints.m_isFirstLaunch = firstLaunch;
|
||||
// TODO: Add initialization.
|
||||
// p.m_hints.m_isLaunchByDeepLink = ...;
|
||||
p.m_hints.m_isLaunchByDeepLink = launchByDeepLink;
|
||||
ASSERT(!m_guiPositions.empty(), ("GUI elements must be set-up before engine is created"));
|
||||
p.m_widgetsInitInfo = m_guiPositions;
|
||||
|
||||
|
|
|
@ -78,7 +78,8 @@ namespace android
|
|||
|
||||
void Invalidate();
|
||||
|
||||
bool CreateDrapeEngine(JNIEnv * env, jobject jSurface, int densityDpi, bool firstLaunch);
|
||||
bool CreateDrapeEngine(JNIEnv * env, jobject jSurface, int densityDpi, bool firstLaunch,
|
||||
bool launchByDeepLink);
|
||||
bool IsDrapeEngineCreated();
|
||||
|
||||
void DetachSurface(bool destroyContext);
|
||||
|
|
|
@ -58,9 +58,12 @@ Java_com_mapswithme_maps_MapFragment_nativeShowMapForUrl(JNIEnv * env, jclass cl
|
|||
}
|
||||
|
||||
JNIEXPORT jboolean JNICALL
|
||||
Java_com_mapswithme_maps_MapFragment_nativeCreateEngine(JNIEnv * env, jclass clazz, jobject surface, jint density, jboolean firstLaunch)
|
||||
Java_com_mapswithme_maps_MapFragment_nativeCreateEngine(JNIEnv * env, jclass clazz,
|
||||
jobject surface, jint density,
|
||||
jboolean firstLaunch,
|
||||
jboolean isLaunchByDeepLink)
|
||||
{
|
||||
return g_framework->CreateDrapeEngine(env, surface, density, firstLaunch);
|
||||
return g_framework->CreateDrapeEngine(env, surface, density, firstLaunch, isLaunchByDeepLink);
|
||||
}
|
||||
|
||||
JNIEXPORT jboolean JNICALL
|
||||
|
|
|
@ -444,6 +444,8 @@ public class DownloadResourcesActivity extends BaseMwmFragmentActivity
|
|||
if (mMapTaskToForward != null)
|
||||
{
|
||||
intent.putExtra(MwmActivity.EXTRA_TASK, mMapTaskToForward);
|
||||
intent.putExtra(MwmActivity.EXTRA_LAUNCH_BY_DEEP_LINK,
|
||||
mMapTaskToForward instanceof OpenUrlTask);
|
||||
mMapTaskToForward = null;
|
||||
}
|
||||
|
||||
|
|
|
@ -24,6 +24,8 @@ public class MapFragment extends BaseMwmFragment
|
|||
implements View.OnTouchListener,
|
||||
SurfaceHolder.Callback
|
||||
{
|
||||
public static final String ARG_LAUNCH_BY_DEEP_LINK = "launch_by_deep_link";
|
||||
|
||||
// Should correspond to android::MultiTouchAction from Framework.cpp
|
||||
private static final int NATIVE_ACTION_UP = 0x01;
|
||||
private static final int NATIVE_ACTION_DOWN = 0x02;
|
||||
|
@ -55,6 +57,7 @@ public class MapFragment extends BaseMwmFragment
|
|||
private int mWidth;
|
||||
private boolean mRequireResize;
|
||||
private boolean mContextCreated;
|
||||
private boolean mLaunchByDeepLink;
|
||||
private static boolean sWasCopyrightDisplayed;
|
||||
|
||||
interface MapRenderingListener
|
||||
|
@ -171,7 +174,7 @@ public class MapFragment extends BaseMwmFragment
|
|||
final float exactDensityDpi = metrics.densityDpi;
|
||||
|
||||
final boolean firstStart = SplashActivity.isFirstStart();
|
||||
if (!nativeCreateEngine(surface, (int) exactDensityDpi, firstStart))
|
||||
if (!nativeCreateEngine(surface, (int) exactDensityDpi, firstStart, mLaunchByDeepLink))
|
||||
{
|
||||
reportUnsupported();
|
||||
return;
|
||||
|
@ -234,6 +237,9 @@ public class MapFragment extends BaseMwmFragment
|
|||
{
|
||||
super.onCreate(b);
|
||||
setRetainInstance(true);
|
||||
Bundle args = getArguments();
|
||||
if (args != null)
|
||||
mLaunchByDeepLink = args.getBoolean(ARG_LAUNCH_BY_DEEP_LINK);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -308,7 +314,9 @@ public class MapFragment extends BaseMwmFragment
|
|||
static native void nativeScaleMinus();
|
||||
static native boolean nativeShowMapForUrl(String url);
|
||||
static native boolean nativeIsEngineCreated();
|
||||
private static native boolean nativeCreateEngine(Surface surface, int density, boolean firstLaunch);
|
||||
private static native boolean nativeCreateEngine(Surface surface, int density,
|
||||
boolean firstLaunch,
|
||||
boolean isLaunchByDeepLink);
|
||||
private static native boolean nativeAttachSurface(Surface surface);
|
||||
private static native void nativeDetachSurface(boolean destroyContext);
|
||||
private static native void nativeSurfaceChanged(int w, int h);
|
||||
|
|
|
@ -120,6 +120,7 @@ public class MwmActivity extends BaseMwmFragmentActivity
|
|||
RoutingPlanInplaceController.RoutingPlanListener
|
||||
{
|
||||
public static final String EXTRA_TASK = "map_task";
|
||||
public static final String EXTRA_LAUNCH_BY_DEEP_LINK = "launch_by_deep_link";
|
||||
private static final String EXTRA_CONSUMED = "mwm.extra.intent.processed";
|
||||
private static final String EXTRA_UPDATE_COUNTRIES = ".extra.update.countries";
|
||||
|
||||
|
@ -176,6 +177,7 @@ public class MwmActivity extends BaseMwmFragmentActivity
|
|||
private boolean mIsFullscreen;
|
||||
private boolean mIsFullscreenAnimating;
|
||||
private boolean mIsAppearMenuLater;
|
||||
private boolean mIsLaunchByDeepLink;
|
||||
|
||||
private FloatingSearchToolbarController mSearchController;
|
||||
|
||||
|
@ -485,6 +487,7 @@ public class MwmActivity extends BaseMwmFragmentActivity
|
|||
getWindow().addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
|
||||
|
||||
setContentView(R.layout.activity_map);
|
||||
mIsLaunchByDeepLink = getIntent().getBooleanExtra(EXTRA_LAUNCH_BY_DEEP_LINK, false);
|
||||
initViews();
|
||||
|
||||
Statistics.INSTANCE.trackConnectionState();
|
||||
|
@ -635,7 +638,9 @@ public class MwmActivity extends BaseMwmFragmentActivity
|
|||
mMapFragment = (MapFragment) getSupportFragmentManager().findFragmentByTag(MapFragment.class.getName());
|
||||
if (mMapFragment == null)
|
||||
{
|
||||
mMapFragment = (MapFragment) MapFragment.instantiate(this, MapFragment.class.getName(), null);
|
||||
Bundle args = new Bundle();
|
||||
args.putBoolean(MapFragment.ARG_LAUNCH_BY_DEEP_LINK, mIsLaunchByDeepLink);
|
||||
mMapFragment = (MapFragment) MapFragment.instantiate(this, MapFragment.class.getName(), args);
|
||||
getSupportFragmentManager()
|
||||
.beginTransaction()
|
||||
.replace(R.id.map_fragment_container, mMapFragment, MapFragment.class.getName())
|
||||
|
|
Loading…
Add table
Reference in a new issue