Enabling and disabling 3d mode on Android via search panel.

Conflicts:
	android/jni/com/mapswithme/maps/Framework.cpp
	android/src/com/mapswithme/maps/search/SearchFragment.java
This commit is contained in:
Daria Volvenkova 2015-10-12 17:37:44 +03:00
parent 20e2e31752
commit ed9db0ba8e
4 changed files with 35 additions and 1 deletions

View file

@ -188,6 +188,11 @@ MapStyle Framework::GetMapStyle() const
return m_work.GetMapStyle();
}
void Framework::Enable3dMode(bool enable)
{
m_work.Enable3dMode(enable);
}
Storage & Framework::Storage()
{
return m_work.Storage();
@ -1312,4 +1317,15 @@ extern "C"
{
frm()->DeregisterAllMaps();
}
JNIEXPORT void JNICALL
Java_com_mapswithme_maps_Framework_nativeEnable3dMode(JNIEnv * env, jclass thiz, jboolean enable)
{
bool enable3d = static_cast<bool>(enable);
g_framework->PostDrapeTask([enable3d]()
{
g_framework->Enable3dMode(enable3d);
});
}
} // extern "C"

View file

@ -156,6 +156,8 @@ namespace android
location::EMyPositionMode GetMyPositionMode() const;
void SetMyPositionMode(location::EMyPositionMode mode);
void Enable3dMode(bool enable);
void SetupWidget(gui::EWidget widget, float x, float y, dp::Anchor anchor);
void ApplyWidgets();
void CleanWidgets();

View file

@ -177,4 +177,6 @@ public class Framework
public native static void nativeRegisterMaps();
public native static void nativeDeregisterMaps();
public native static void nativeEnable3dMode(boolean enable);
}

View file

@ -84,7 +84,7 @@ public class SearchFragment extends BaseMwmFragment
}
// TODO: This code only for demonstration purposes and will be removed soon
if (tryChangeMapStyle(query))
if (tryChangeMapStyle(query) || try3dMode(query))
return;
runSearch();
@ -335,6 +335,20 @@ public class SearchFragment extends BaseMwmFragment
return true;
}
private boolean try3dMode(String str)
{
final boolean is3d = str.equals("?3d");
final boolean is2d = str.equals("?2d");
if (!is3d && !is2d)
return false;
hideSearch();
Framework.nativeEnable3dMode(is3d);
return true;
}
// FIXME END
private void processSelected(SearchResult result)