[android] Show copyright in proper place.

This commit is contained in:
Dmitry Yunitsky 2015-11-17 16:18:10 +03:00 committed by r.kuznetsov
parent b577a55b1e
commit 24d819e05c
5 changed files with 30 additions and 14 deletions

View file

@ -451,6 +451,11 @@ void Framework::ApplyWidgets()
m_work.SetWidgetLayout(move(layout));
}
void Framework::CleanWidgets()
{
m_guiPositions.clear();
}
void Framework::SetupMeasurementSystem()
{
m_work.SetupMeasurementSystem();

View file

@ -160,6 +160,7 @@ namespace android
void SetupWidget(gui::EWidget widget, float x, float y, dp::Anchor anchor);
void ApplyWidgets();
void CleanWidgets();
// Fills mapobject's metadata from UserMark
void InjectMetadata(JNIEnv * env, jclass clazz, jobject const mapObject, UserMark const * userMark);

View file

@ -200,4 +200,10 @@ extern "C"
{
g_framework->ApplyWidgets();
}
JNIEXPORT void JNICALL
Java_com_mapswithme_maps_MapFragment_nativeCleanWidgets(JNIEnv * env, jclass clazz)
{
g_framework->CleanWidgets();
}
} // extern "C"

View file

@ -17,7 +17,7 @@ public class MapFragment extends BaseMwmFragment
implements View.OnTouchListener,
SurfaceHolder.Callback
{
// Should be equal to values from Framework.cpp MultiTouchAction enum
// Should correspond to android::MultiTouchAction from Framework.cpp
private static final int NATIVE_ACTION_UP = 0x01;
private static final int NATIVE_ACTION_DOWN = 0x02;
private static final int NATIVE_ACTION_MOVE = 0x03;
@ -48,6 +48,7 @@ public class MapFragment extends BaseMwmFragment
private int mWidth;
private boolean mRequireResize;
private boolean mEngineCreated;
private static boolean sWasCopyrightDisplayed;
public interface MapRenderingListener
{
@ -61,16 +62,21 @@ public class MapFragment extends BaseMwmFragment
mHeight = height;
mWidth = width;
nativeCleanWidgets();
if (!sWasCopyrightDisplayed)
{
nativeSetupWidget(WIDGET_COPYRIGHT,
mWidth - UiUtils.dimen(R.dimen.margin_ruler_right),
mHeight - UiUtils.dimen(R.dimen.margin_ruler_bottom),
ANCHOR_RIGHT_BOTTOM);
sWasCopyrightDisplayed = true;
}
nativeSetupWidget(WIDGET_RULER,
mWidth - UiUtils.dimen(R.dimen.margin_ruler_right),
mHeight - UiUtils.dimen(R.dimen.margin_ruler_bottom),
ANCHOR_RIGHT_BOTTOM);
nativeSetupWidget(WIDGET_COPYRIGHT,
mWidth / 2,
UiUtils.dimen(R.dimen.margin_base),
ANCHOR_TOP);
if (BuildConfig.DEBUG)
{
nativeSetupWidget(WIDGET_SCALE_LABEL,
@ -152,10 +158,8 @@ public class MapFragment extends BaseMwmFragment
@Override
public void surfaceChanged(SurfaceHolder surfaceHolder, int format, int width, int height)
{
if (!mEngineCreated)
return;
if (!mRequireResize && surfaceHolder.isCreating())
if (!mEngineCreated ||
(!mRequireResize && surfaceHolder.isCreating()))
return;
nativeSurfaceChanged(width, height);
@ -177,10 +181,9 @@ public class MapFragment extends BaseMwmFragment
// Destroy engine first, then clear the queue that theoretically can be filled by nativeDestroyEngine().
nativeDestroyEngine();
MwmApplication.get().clearFunctorsOnUiThread();
} else
{
nativeDetachSurface();
}
else
nativeDetachSurface();
}
@Override
@ -298,4 +301,5 @@ public class MapFragment extends BaseMwmFragment
private static native void nativeOnTouch(int actionType, int id1, float x1, float y1, int id2, float x2, float y2, int maskedPointer);
private static native void nativeSetupWidget(int widget, float x, float y, int anchor);
private static native void nativeApplyWidgets();
private static native void nativeCleanWidgets();
}

@ -1 +1 @@
Subproject commit 6ed85f2f83daf46e18351257ab7ff0ba31bfd5dc
Subproject commit b8d935731e502c5390ba6764f32ba60be2fca884