[android] Fixed review notes

This commit is contained in:
Dmitry Donskoy 2020-05-27 16:53:25 +03:00 committed by Aleksandr Zatsepin
parent bf39704b98
commit 7c4a6259a6
3 changed files with 12 additions and 6 deletions

View file

@ -35,9 +35,13 @@ Java_com_mapswithme_maps_maplayer_isolines_IsolinesManager_nativeRemoveListener(
}
JNIEXPORT jboolean JNICALL
Java_com_mapswithme_maps_maplayer_isolines_IsolinesManager_nativeIsVisible(JNIEnv *env, jclass clazz)
Java_com_mapswithme_maps_maplayer_isolines_IsolinesManager_nativeShouldShowNotification(JNIEnv *env,
jclass clazz)
{
CHECK(g_framework, ("Framework isn't created yet!"));
return static_cast<jboolean>(g_framework->NativeFramework()->GetIsolinesManager().IsVisible());
auto const &manager = g_framework->NativeFramework()->GetIsolinesManager();
auto const visible = manager.IsVisible();
auto const enabled = manager.GetState() == IsolinesManager::IsolinesState::Enabled;
return static_cast<jboolean>(!visible && enabled);
}
}

View file

@ -3,6 +3,7 @@ package com.mapswithme.maps.maplayer;
import android.view.View;
import android.widget.Toast;
import androidx.annotation.CallSuper;
import androidx.annotation.NonNull;
import com.mapswithme.maps.R;
import com.mapswithme.maps.maplayer.isolines.IsolinesManager;
@ -18,10 +19,11 @@ public abstract class AbstractIsoLinesClickListener extends DefaultClickListener
super(adapter);
}
@CallSuper
@Override
public void onItemClickInternal(@NonNull View v, @NonNull BottomSheetItem item)
{
if (IsolinesManager.from(v.getContext()).isVisible())
if (IsolinesManager.from(v.getContext()).shouldShowNotification())
{
Toast.makeText(v.getContext(), R.string.isolines_toast_zooms_1_10, Toast.LENGTH_SHORT).show();
Statistics.INSTANCE.trackEvent(Statistics.EventName.MAP_TOAST_SHOW,

View file

@ -64,7 +64,7 @@ public class IsolinesManager implements Initializable<Void>, Detachable<Isolines
private static native void nativeAddListener(@NonNull OnIsolinesChangedListener listener);
private static native void nativeRemoveListener(@NonNull OnIsolinesChangedListener listener);
private static native boolean nativeIsVisible();
private static native boolean nativeShouldShowNotification();
@Override
public void attach(@NonNull IsolinesErrorDialogListener listener)
@ -78,8 +78,8 @@ public class IsolinesManager implements Initializable<Void>, Detachable<Isolines
mListener.detach();
}
public boolean isVisible()
public boolean shouldShowNotification()
{
return nativeIsVisible();
return nativeShouldShowNotification();
}
}