forked from organicmaps/organicmaps
[android] Added the new "Open Subs Screen" Dialog, the new "crown" btn
This commit is contained in:
parent
6c3fcf83bb
commit
e639edacb1
15 changed files with 137 additions and 32 deletions
BIN
android/res/drawable-hdpi/ic_fab_blue.png
Executable file
BIN
android/res/drawable-hdpi/ic_fab_blue.png
Executable file
Binary file not shown.
After Width: | Height: | Size: 2.7 KiB |
BIN
android/res/drawable-mdpi/ic_fab_blue.png
Executable file
BIN
android/res/drawable-mdpi/ic_fab_blue.png
Executable file
Binary file not shown.
After Width: | Height: | Size: 1.6 KiB |
BIN
android/res/drawable-xhdpi/ic_fab_blue.png
Executable file
BIN
android/res/drawable-xhdpi/ic_fab_blue.png
Executable file
Binary file not shown.
After Width: | Height: | Size: 3.6 KiB |
BIN
android/res/drawable-xxhdpi/ic_fab_blue.png
Executable file
BIN
android/res/drawable-xxhdpi/ic_fab_blue.png
Executable file
Binary file not shown.
After Width: | Height: | Size: 6.3 KiB |
BIN
android/res/drawable-xxxhdpi/ic_fab_blue.png
Executable file
BIN
android/res/drawable-xxxhdpi/ic_fab_blue.png
Executable file
Binary file not shown.
After Width: | Height: | Size: 9.2 KiB |
6
android/res/drawable/bg_crown.xml
Normal file
6
android/res/drawable/bg_crown.xml
Normal file
|
@ -0,0 +1,6 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:drawable="@drawable/bg_circle_pressed" android:state_pressed="true"/>
|
||||
<item android:drawable="@drawable/bg_circle" android:state_selected="true"/>
|
||||
<item android:drawable="@drawable/bg_circle"/>
|
||||
</selector>
|
6
android/res/drawable/bg_crown_night.xml
Normal file
6
android/res/drawable/bg_crown_night.xml
Normal file
|
@ -0,0 +1,6 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:drawable="@drawable/bg_circle_pressed_night" android:state_pressed="true"/>
|
||||
<item android:drawable="@drawable/bg_circle_night" android:state_selected="true"/>
|
||||
<item android:drawable="@drawable/bg_circle_night"/>
|
||||
</selector>
|
|
@ -24,23 +24,43 @@
|
|||
android:background="?attr/nav_bg_subway"
|
||||
android:visibility="invisible"/>
|
||||
|
||||
<ImageButton
|
||||
android:id="@+id/nav_zoom_in"
|
||||
style="@style/MwmWidget.MapButton"
|
||||
android:layout_above="@+id/nav_zoom_out"
|
||||
android:layout_alignParentEnd="true"
|
||||
android:layout_alignParentRight="true"
|
||||
android:background="?nav_background"
|
||||
android:src="@drawable/ic_zoom_in"/>
|
||||
<RelativeLayout
|
||||
android:id="@+id/nav_zoom_in_container"
|
||||
android:layout_above="@+id/nav_zoom_out_container"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<ImageButton
|
||||
android:id="@id/nav_zoom_out"
|
||||
style="@style/MwmWidget.MapButton"
|
||||
<ImageButton
|
||||
android:id="@+id/nav_zoom_in"
|
||||
style="@style/MwmWidget.MapButton"
|
||||
android:layout_alignParentEnd="true"
|
||||
android:layout_alignParentRight="true"
|
||||
android:background="?nav_background"
|
||||
android:src="@drawable/ic_zoom_in"/>
|
||||
</RelativeLayout>
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/nav_zoom_out_container"
|
||||
android:layout_above="@+id/my_position"
|
||||
android:layout_alignParentEnd="true"
|
||||
android:layout_alignParentRight="true"
|
||||
android:background="?nav_background"
|
||||
android:src="@drawable/ic_zoom_out"/>
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
<ImageButton
|
||||
android:id="@+id/subs_screen_btn"
|
||||
style="@style/MwmWidget.MapButton.Traffic"
|
||||
android:background="?attr/bg_crown"
|
||||
android:src="@drawable/ic_fab_blue"
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:layout_alignParentStart="true"/>
|
||||
|
||||
<ImageButton
|
||||
android:id="@id/nav_zoom_out"
|
||||
style="@style/MwmWidget.MapButton"
|
||||
android:layout_alignParentEnd="true"
|
||||
android:layout_alignParentRight="true"
|
||||
android:background="?nav_background"
|
||||
android:src="@drawable/ic_zoom_out"/>
|
||||
</RelativeLayout>
|
||||
|
||||
<ImageButton
|
||||
android:id="@id/my_position"
|
||||
|
|
|
@ -36,20 +36,43 @@
|
|||
android:contentDescription="@string/core_my_position"
|
||||
android:tint="@null"/>
|
||||
|
||||
<ImageButton
|
||||
android:id="@+id/nav_zoom_out"
|
||||
style="@style/MwmWidget.MapButton"
|
||||
<RelativeLayout
|
||||
android:id="@+id/nav_zoom_out_container"
|
||||
android:layout_alignParentEnd="true"
|
||||
android:layout_alignParentRight="true"
|
||||
android:layout_below="@+id/nav_zoom_in"
|
||||
android:src="@drawable/ic_zoom_out"/>
|
||||
android:layout_below="@id/nav_zoom_in_container"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content">
|
||||
<ImageButton
|
||||
android:id="@+id/nav_zoom_out"
|
||||
style="@style/MwmWidget.MapButton"
|
||||
android:layout_alignParentEnd="true"
|
||||
android:layout_alignParentRight="true"
|
||||
android:src="@drawable/ic_zoom_out"/>
|
||||
</RelativeLayout>
|
||||
|
||||
<ImageButton
|
||||
android:id="@id/nav_zoom_in"
|
||||
style="@style/MwmWidget.MapButton"
|
||||
android:src="@drawable/ic_zoom_in"
|
||||
<RelativeLayout
|
||||
android:id="@+id/nav_zoom_in_container"
|
||||
android:layout_marginTop="@dimen/nav_zoom_top"
|
||||
android:layout_alignParentTop="true"
|
||||
android:layout_alignParentRight="true"
|
||||
android:layout_alignParentEnd="true"/>
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
<ImageButton
|
||||
android:id="@+id/subs_screen_btn"
|
||||
style="@style/MwmWidget.MapButton.Traffic"
|
||||
android:background="?attr/bg_crown"
|
||||
android:src="@drawable/ic_fab_blue"
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:layout_alignParentStart="true"/>
|
||||
|
||||
<ImageButton
|
||||
android:id="@id/nav_zoom_in"
|
||||
style="@style/MwmWidget.MapButton"
|
||||
android:src="@drawable/ic_zoom_in"
|
||||
android:layout_alignParentTop="true"
|
||||
android:layout_alignParentRight="true"
|
||||
android:layout_alignParentEnd="true"/>
|
||||
</RelativeLayout>
|
||||
|
||||
</RelativeLayout>
|
||||
|
|
|
@ -110,6 +110,7 @@
|
|||
<attr name="tipsBgColor" format="color"/>
|
||||
<attr name="tipsPrimaryTextColor" format="color"/>
|
||||
<attr name="tipsSecondaryTextColor" format="color"/>
|
||||
<attr name="bg_crown" format="reference"/>
|
||||
</declare-styleable>
|
||||
|
||||
<declare-styleable name="ThemeAttrs.NavButtons">
|
||||
|
|
|
@ -158,6 +158,7 @@
|
|||
<item name="bookmarkSubscriptionCardTextColor">@color/subscription_card_color</item>
|
||||
<item name="subscriptionTitleColor">@color/bookmarks_subs_title</item>
|
||||
<item name="subscriptionSubtitleColor">@color/bookmarks_subs_subtitle</item>
|
||||
<item name="bg_crown">@drawable/bg_crown</item>
|
||||
</style>
|
||||
|
||||
<!-- Night theme -->
|
||||
|
@ -315,5 +316,6 @@
|
|||
<item name="bookmarkSubscriptionCardTextColor">@color/subscription_card_color_night</item>
|
||||
<item name="subscriptionTitleColor">@color/bookmarks_subs_title_night</item>
|
||||
<item name="subscriptionSubtitleColor">@color/bookmarks_subs_subtitle_night</item>
|
||||
<item name="bg_crown">@drawable/bg_crown_night</item>
|
||||
</style>
|
||||
</resources>
|
||||
|
|
|
@ -46,6 +46,7 @@ import com.mapswithme.maps.bookmarks.data.CatalogCustomProperty;
|
|||
import com.mapswithme.maps.bookmarks.data.CatalogTagsGroup;
|
||||
import com.mapswithme.maps.bookmarks.data.MapObject;
|
||||
import com.mapswithme.maps.dialog.AlertDialogCallback;
|
||||
import com.mapswithme.maps.dialog.CatalogUnlimitedAccessDialog;
|
||||
import com.mapswithme.maps.dialog.DialogUtils;
|
||||
import com.mapswithme.maps.dialog.DrivingOptionsDialogFactory;
|
||||
import com.mapswithme.maps.discovery.DiscoveryActivity;
|
||||
|
@ -81,10 +82,12 @@ import com.mapswithme.maps.promo.PromoAfterBooking;
|
|||
import com.mapswithme.maps.promo.PromoBookingDialogFragment;
|
||||
import com.mapswithme.maps.purchase.AdsRemovalActivationCallback;
|
||||
import com.mapswithme.maps.purchase.AdsRemovalPurchaseControllerProvider;
|
||||
import com.mapswithme.maps.purchase.BookmarkSubscriptionActivity;
|
||||
import com.mapswithme.maps.purchase.FailedPurchaseChecker;
|
||||
import com.mapswithme.maps.purchase.PurchaseCallback;
|
||||
import com.mapswithme.maps.purchase.PurchaseController;
|
||||
import com.mapswithme.maps.purchase.PurchaseFactory;
|
||||
import com.mapswithme.maps.purchase.PurchaseUtils;
|
||||
import com.mapswithme.maps.routing.NavigationController;
|
||||
import com.mapswithme.maps.routing.RoutePointInfo;
|
||||
import com.mapswithme.maps.routing.RoutingBottomMenuListener;
|
||||
|
@ -189,7 +192,9 @@ public class MwmActivity extends BaseMwmFragmentActivity
|
|||
private static final int REQ_CODE_SHOW_SIMILAR_HOTELS = 3;
|
||||
public static final int REQ_CODE_ERROR_DRIVING_OPTIONS_DIALOG = 5;
|
||||
public static final int REQ_CODE_DRIVING_OPTIONS = 6;
|
||||
public static final int REQ_CODE_CATALOG_UNLIMITED_ACCESS = 7;
|
||||
public static final String ERROR_DRIVING_OPTIONS_DIALOG_TAG = "error_driving_options_dialog_tag";
|
||||
public static final String CATALOG_UNLIMITED_ACCESS_DIALOG_TAG = "catalog_unlimited_access_dialog_tag";
|
||||
|
||||
// Map tasks that we run AFTER rendering initialized
|
||||
private final Stack<MapTask> mTasks = new Stack<>();
|
||||
|
@ -706,16 +711,25 @@ public class MwmActivity extends BaseMwmFragmentActivity
|
|||
if (frame == null)
|
||||
return;
|
||||
|
||||
View zoomIn = frame.findViewById(R.id.nav_zoom_in);
|
||||
zoomIn.setOnClickListener(this);
|
||||
View zoomOut = frame.findViewById(R.id.nav_zoom_out);
|
||||
zoomOut.setOnClickListener(this);
|
||||
View zoomIn = frame.findViewById(R.id.nav_zoom_in_container);
|
||||
zoomIn.findViewById(R.id.nav_zoom_in).setOnClickListener(this);
|
||||
View zoomOut = frame.findViewById(R.id.nav_zoom_out_container);
|
||||
zoomOut.findViewById(R.id.nav_zoom_out).setOnClickListener(this);
|
||||
View myPosition = frame.findViewById(R.id.my_position);
|
||||
mNavMyPosition = new MyPositionButton(myPosition, mOnMyPositionClickListener);
|
||||
|
||||
initToggleMapLayerController(frame);
|
||||
mNavAnimationController = new NavigationButtonsAnimationController(
|
||||
zoomIn, zoomOut, myPosition, getWindow().getDecorView().getRootView(), this);
|
||||
View openSubsScreenBtn = frame.findViewById(R.id.subs_screen_btn);
|
||||
openSubsScreenBtn.setOnClickListener(v -> openSubscriptionsScreen());
|
||||
openSubsScreenBtn.setVisibility(true ? View.VISIBLE : View.GONE);
|
||||
}
|
||||
|
||||
private void openSubscriptionsScreen()
|
||||
{
|
||||
Intent intent = new Intent(MwmActivity.this, BookmarkSubscriptionActivity.class);
|
||||
startActivityForResult(intent, PurchaseUtils.REQ_CODE_PAY_SUBSCRIPTION);
|
||||
}
|
||||
|
||||
private void initToggleMapLayerController(@NonNull View frame)
|
||||
|
@ -933,9 +947,29 @@ public class MwmActivity extends BaseMwmFragmentActivity
|
|||
case REQ_CODE_DRIVING_OPTIONS:
|
||||
rebuildLastRoute();
|
||||
break;
|
||||
case PurchaseUtils.REQ_CODE_PAY_SUBSCRIPTION:
|
||||
showCatalogUnlimitedAccessDialog();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
private void showCatalogUnlimitedAccessDialog()
|
||||
{
|
||||
com.mapswithme.maps.dialog.AlertDialog dialog =
|
||||
new com.mapswithme.maps.dialog.AlertDialog.Builder()
|
||||
.setTitleId(R.string.unable_to_calc_alert_title)
|
||||
.setMessageId(R.string.unable_to_calc_alert_subtitle)
|
||||
.setPositiveBtnId(R.string.settings)
|
||||
.setNegativeBtnId(R.string.cancel)
|
||||
.setDialogViewStrategyType(com.mapswithme.maps.dialog.AlertDialog.DialogViewStrategyType.CONFIRMATION_DIALOG)
|
||||
.setDialogFactory(CatalogUnlimitedAccessDialog::new)
|
||||
.setReqCode(REQ_CODE_CATALOG_UNLIMITED_ACCESS)
|
||||
.setFragManagerStrategyType(com.mapswithme.maps.dialog.AlertDialog
|
||||
.FragManagerStrategyType.ACTIVITY_FRAGMENT_MANAGER)
|
||||
.build();
|
||||
dialog.show(this, CATALOG_UNLIMITED_ACCESS_DIALOG_TAG);
|
||||
}
|
||||
|
||||
private void rebuildLastRoute()
|
||||
{
|
||||
RoutingController.get().attach(this);
|
||||
|
@ -2333,6 +2367,8 @@ public class MwmActivity extends BaseMwmFragmentActivity
|
|||
{
|
||||
if (requestCode == REQ_CODE_ERROR_DRIVING_OPTIONS_DIALOG)
|
||||
DrivingOptionsActivity.start(this);
|
||||
else if (requestCode == REQ_CODE_CATALOG_UNLIMITED_ACCESS)
|
||||
BookmarksCatalogActivity.start(this, BookmarkManager.INSTANCE.getCatalogFrontendUrl(UTM.UTM_NONE));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -76,7 +76,7 @@ public class AlertDialog extends BaseMwmDialogFragment
|
|||
@LayoutRes
|
||||
protected int getLayoutId()
|
||||
{
|
||||
throw new UnsupportedOperationException("By default, you" +
|
||||
throw new UnsupportedOperationException("By default, you " +
|
||||
"shouldn't implement this method." +
|
||||
" AlertDialog.Builder will do everything by itself. " +
|
||||
"But if you want to use this method, " +
|
||||
|
|
|
@ -0,0 +1,12 @@
|
|||
package com.mapswithme.maps.dialog;
|
||||
|
||||
import com.mapswithme.maps.R;
|
||||
|
||||
public class CatalogUnlimitedAccessDialog extends ActivityCallbackAlertDialog
|
||||
{
|
||||
@Override
|
||||
protected int getLayoutId()
|
||||
{
|
||||
return R.layout.fragment_confirmation;
|
||||
}
|
||||
}
|
|
@ -1,6 +1,5 @@
|
|||
package com.mapswithme.maps.purchase;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.support.annotation.NonNull;
|
||||
import android.support.v4.app.Fragment;
|
||||
|
|
Loading…
Add table
Reference in a new issue