[android] Separated tips for isolines and subways layers

This commit is contained in:
Александр Зацепин 2020-01-21 17:52:07 +03:00 committed by Daria Volvenkova
parent 8c71d824d9
commit bf9cb5036f
4 changed files with 42 additions and 5 deletions

View file

@ -29,7 +29,7 @@ public class MapLayerCompositeController implements MapLayerController
public MapLayerCompositeController(@NonNull TrafficButton traffic, @NonNull View subway,
@NonNull View isoLines, @NonNull AppCompatActivity activity)
{
View.OnClickListener listener = new OpenBottomDialogClickListener(activity, Tutorial.MAP_LAYERS);
View.OnClickListener listener = new OpenBottomDialogClickListener(activity, Tutorial.SUBWAY);
mActivity = activity;
mChildrenEntries = createEntries(traffic, subway, isoLines, activity, listener);
mMasterEntry = getCurrentLayer();

View file

@ -17,6 +17,12 @@ class ClickInterceptorFactory
return new ActivateIsolinesLayer();
}
@NonNull
static ClickInterceptor createActivateSubwayLayerListener()
{
return new ActivateSubwayLayer();
}
@NonNull
static ClickInterceptor createOpenDiscoveryScreenListener()
{
@ -56,7 +62,7 @@ class ClickInterceptorFactory
{
ActivateIsolinesLayer()
{
super(Tutorial.MAP_LAYERS);
super(Tutorial.ISOLINES);
}
@Override
@ -67,6 +73,22 @@ class ClickInterceptorFactory
}
}
static class ActivateSubwayLayer extends AbstractClickInterceptor
{
ActivateSubwayLayer()
{
super(Tutorial.SUBWAY);
}
@Override
public void onInterceptClickInternal(@NonNull MwmActivity activity)
{
Mode.SUBWAY.setEnabled(activity, true);
activity.onSubwayLayerSelected();
}
}
static class SearchHotels extends AbstractClickInterceptor
{
SearchHotels()

View file

@ -3,12 +3,12 @@ package com.mapswithme.maps.tips;
import android.app.Activity;
import android.content.Context;
import android.graphics.Typeface;
import android.view.View;
import androidx.annotation.IdRes;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.annotation.StringRes;
import android.view.View;
import com.mapswithme.maps.Framework;
import com.mapswithme.maps.MwmActivity;
import com.mapswithme.maps.MwmApplication;
@ -61,7 +61,19 @@ public enum Tutorial
}
},
MAP_LAYERS(R.string.tips_map_layers_title_countour,
SUBWAY(R.string.tips_map_layers_title,
R.string.tips_map_layers_message,
R.id.subway, null, MwmActivity.class)
{
@NonNull
@Override
public ClickInterceptor createClickInterceptor()
{
return ClickInterceptorFactory.createActivateSubwayLayerListener();
}
},
ISOLINES(R.string.tips_map_layers_title_countour,
R.string.tips_map_layers_message_countour,
R.id.isolines, null, MwmActivity.class)
{

View file

@ -172,6 +172,8 @@ struct Tip
BookingHotels,
DiscoverButton,
PublicTransport,
// TODO: should be supported.
Isolines,
Count
};
@ -322,6 +324,7 @@ inline std::string DebugPrint(Tip::Type const & type)
case Tip::Type::BookingHotels: return "BookingHotels";
case Tip::Type::DiscoverButton: return "DiscoverButton";
case Tip::Type::PublicTransport: return "PublicTransport";
case Tip::Type::Isolines: return "Isolines";
case Tip::Type::Count: return "Count";
}
UNREACHABLE();