Added shadow to cancelled subscription dialog button. Make dialog tarnsparent.

This commit is contained in:
Alexey Kulish 2018-05-06 13:50:15 +03:00
parent fee6cb27d1
commit adbb466f34
12 changed files with 178 additions and 101 deletions

View file

@ -4,7 +4,7 @@
<item>
<inset>
<shape android:shape="oval">
<solid android:color="@color/dialog_bg_color_light"/>
<solid android:color="@color/bg_color_light"/>
</shape>
</inset>
</item>

View file

@ -4,7 +4,7 @@
<item>
<inset>
<shape android:shape="oval">
<solid android:color="@color/dialog_bg_color_night"/>
<solid android:color="@color/bg_color_dark"/>
</shape>
</inset>
</item>

View file

@ -0,0 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<nine-patch android:src="@drawable/bg_card_shadow_cr3dp"/>
</item>
<item>
<shape>
<solid android:color="@color/wikivoyage_active_dark"/>
<corners android:radius="3dp"/>
</shape>
</item>
</layer-list>

View file

@ -0,0 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<nine-patch android:src="@drawable/bg_card_shadow_cr3dp"/>
</item>
<item>
<shape>
<solid android:color="@color/wikivoyage_active_light"/>
<corners android:radius="3dp"/>
</shape>
</item>
</layer-list>

View file

@ -9,11 +9,6 @@
android:clickable="true"
android:orientation="vertical">
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fillViewport="true">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
@ -51,18 +46,12 @@
</FrameLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginLeft="@dimen/list_content_padding_large"
android:layout_marginRight="@dimen/list_content_padding_large"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="@dimen/title_padding"
android:orientation="vertical">
<net.osmand.plus.widgets.TextViewEx
android:id="@+id/title"
android:layout_width="wrap_content"
@ -74,25 +63,24 @@
android:textSize="@dimen/dialog_header_text_size"
osmand:typeface="@string/font_roboto_medium"/>
<ScrollView
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_marginTop="@dimen/title_padding"
android:layout_weight="1"
android:fillViewport="true">
<net.osmand.plus.widgets.TextViewEx
android:id="@+id/info_description"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/title_padding"
android:lineSpacingMultiplier="@dimen/text_button_line_spacing_multiplier"
android:textColor="?attr/dialog_text_description_color"
android:textSize="@dimen/default_list_text_size"
android:lineSpacingMultiplier="@dimen/text_button_line_spacing_multiplier"
osmand:typeface="@string/font_roboto_regular"
tools:text="@string/purchase_cancelled_dialog_descr"/>
</LinearLayout>
<LinearLayout
android:id="@+id/cards_container"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"/>
</ScrollView>
<net.osmand.plus.widgets.TextViewEx
android:id="@+id/inapp_descr"
@ -100,7 +88,7 @@
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/list_content_padding_large"
android:layout_marginRight="@dimen/list_content_padding_large"
android:layout_marginTop="@dimen/list_header_padding"
android:layout_marginTop="@dimen/title_padding"
android:gravity="center"
android:text="@string/osm_live_payment_desc"
android:textColor="?attr/card_description_text_color"
@ -113,12 +101,12 @@
android:layout_marginBottom="@dimen/card_padding"
android:layout_marginTop="@dimen/card_padding">
<include layout="@layout/purchase_dialog_card_button"/>
<include layout="@layout/purchase_dialog_card_shadow_button"/>
</FrameLayout>
</LinearLayout>
</LinearLayout>
</ScrollView>
</LinearLayout>
</LinearLayout>

View file

@ -10,7 +10,7 @@
android:id="@+id/card_button"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?attr/selectableItemBackground"
android:background="?attr/selectableItemBackgroundBorderless"
android:minHeight="@dimen/card_button_min_size"
android:orientation="vertical"
android:gravity="center"

View file

@ -0,0 +1,53 @@
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:osmand="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?attr/purchase_dialog_shadow_btn_bg">
<LinearLayout
android:id="@+id/card_button"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?attr/selectableItemBackgroundBorderless"
android:minHeight="@dimen/card_button_min_size"
android:orientation="vertical"
android:gravity="center"
android:paddingBottom="@dimen/list_header_padding"
android:paddingLeft="@dimen/list_content_padding"
android:paddingRight="@dimen/list_content_padding"
android:paddingTop="@dimen/list_header_padding">
<ProgressBar
android:id="@+id/card_button_progress"
android:layout_width="@dimen/card_button_progress_size"
android:layout_height="@dimen/card_button_progress_size"
android:indeterminate="true"
android:visibility="gone"/>
<net.osmand.plus.widgets.TextViewEx
android:id="@+id/card_button_title"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:letterSpacing="@dimen/text_button_letter_spacing"
android:textColor="@color/color_white"
android:textSize="@dimen/text_button_text_size"
osmand:typeface="@string/font_roboto_medium"
tools:text="Buy - 5€"/>
<net.osmand.plus.widgets.TextViewEx
android:id="@+id/card_button_subtitle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:letterSpacing="@dimen/text_button_letter_spacing"
android:textColor="@color/white_50_transparent"
android:textSize="@dimen/text_button_text_size"
osmand:typeface="@string/font_roboto_regular"
tools:text="One time purchase"/>
</LinearLayout>
</FrameLayout>

View file

@ -93,7 +93,7 @@
android:id="@+id/button_later"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?attr/selectableItemBackground"
android:background="?attr/selectableItemBackgroundBorderless"
android:gravity="center"
android:letterSpacing="@dimen/text_button_letter_spacing"
android:minHeight="@dimen/dialog_button_height"

View file

@ -90,6 +90,8 @@
<attr name="wikivoyage_travel_card_stroke_bg" format="reference"/>
<attr name="wikivoyage_secondary_btn_bg" format="reference"/>
<attr name="wikivoyage_primary_btn_bg" format="reference"/>
<attr name="purchase_dialog_shadow_btn_bg" format="reference"/>
<attr name="purchase_dialog_active_card_bg" format="reference"/>
</declare-styleable>

View file

@ -5,8 +5,8 @@
<color name="dialog_bg_color_light">#f0f0f0</color>
<color name="dialog_bg_color_night">#17191a</color>
<color name="dialog_transparent_bg_color_light">#14f0f0f0</color>
<color name="dialog_transparent_bg_color_night">#1417191a</color>
<color name="dialog_transparent_bg_color_light">#eaf0f0f0</color>
<color name="dialog_transparent_bg_color_night">#ea17191a</color>
<color name="dialog_title_color_light">#212121</color>
<color name="dialog_title_color_dark">#cccccc</color>

View file

@ -223,6 +223,7 @@
<item name="wikivoyage_secondary_btn_bg">@drawable/wikivoyage_secondary_btn_bg_light</item>
<item name="wikivoyage_primary_btn_bg">@drawable/wikivoyage_primary_btn_bg_light</item>
<item name="purchase_dialog_active_card_bg">@drawable/dialog_active_card_bg_light</item>
<item name="purchase_dialog_shadow_btn_bg">@drawable/purchase_dialog_shadow_btn_bg_light</item>
</style>
@ -435,6 +436,7 @@
<item name="wikivoyage_secondary_btn_bg">@drawable/wikivoyage_secondary_btn_bg_dark</item>
<item name="wikivoyage_primary_btn_bg">@drawable/wikivoyage_primary_btn_bg_dark</item>
<item name="purchase_dialog_active_card_bg">@drawable/dialog_active_card_bg_dark</item>
<item name="purchase_dialog_shadow_btn_bg">@drawable/purchase_dialog_shadow_btn_bg_dark</item>
</style>

View file

@ -3,6 +3,8 @@ package net.osmand.plus.chooseplan;
import android.app.Activity;
import android.app.Dialog;
import android.content.Context;
import android.graphics.Color;
import android.graphics.drawable.ColorDrawable;
import android.os.Build;
import android.os.Bundle;
import android.support.annotation.ColorRes;
@ -73,6 +75,7 @@ public class OsmLiveCancelledDialog extends BaseOsmAndDialogFragment implements
Dialog dialog = new Dialog(ctx, themeId);
Window window = dialog.getWindow();
if (window != null) {
window.setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
if (!getSettings().DO_NOT_USE_ANIMATIONS.get()) {
window.getAttributes().windowAnimations = R.style.Animations_Alpha;
}
@ -240,16 +243,21 @@ public class OsmLiveCancelledDialog extends BaseOsmAndDialogFragment implements
long cancelledTime = settings.LIVE_UPDATES_PURCHASE_CANCELLED_TIME.get();
boolean firstTimeShown = settings.LIVE_UPDATES_PURCHASE_CANCELLED_FIRST_DLG_SHOWN.get();
boolean secondTimeShown = settings.LIVE_UPDATES_PURCHASE_CANCELLED_SECOND_DLG_SHOWN.get();
return true;
/*
return cancelledTime > 0
&& (!firstTimeShown
|| (System.currentTimeMillis() - cancelledTime > SUBSCRIPTION_HOLDING_TIME_MSEC
&& !secondTimeShown));
*/
}
public static void showInstance(@NonNull FragmentManager fm) {
try {
if (fm.findFragmentByTag(OsmLiveCancelledDialog.TAG) == null) {
OsmLiveCancelledDialog fragment = new OsmLiveCancelledDialog();
fragment.show(fm, OsmLiveCancelledDialog.TAG);
}
} catch (RuntimeException e) {
LOG.error("showInstance", e);
}