Split layout to cards
This commit is contained in:
parent
67449365b4
commit
d22edfd9ae
14 changed files with 975 additions and 923 deletions
73
OsmAnd/res/layout/contact_support.xml
Normal file
73
OsmAnd/res/layout/contact_support.xml
Normal file
|
@ -0,0 +1,73 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:osmand="http://schemas.android.com/apk/res-auto"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical">
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/support_link_container"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="?android:attr/selectableItemBackground"
|
||||
android:minHeight="@dimen/list_item_height"
|
||||
android:paddingStart="@dimen/list_content_padding"
|
||||
android:paddingLeft="@dimen/list_content_padding"
|
||||
android:paddingEnd="@dimen/list_content_padding"
|
||||
android:paddingRight="@dimen/list_content_padding">
|
||||
|
||||
<androidx.appcompat.widget.AppCompatImageView
|
||||
android:id="@+id/support_link_icon"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_marginEnd="@dimen/map_widget_height"
|
||||
android:layout_marginRight="@dimen/map_widget_height"
|
||||
app:srcCompat="@drawable/ic_action_at_mail"
|
||||
app:tint="?attr/active_color_basic" />
|
||||
|
||||
<net.osmand.plus.widgets.TextViewEx
|
||||
android:id="@+id/support_link_title"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_marginEnd="@dimen/title_padding"
|
||||
android:layout_marginRight="@dimen/title_padding"
|
||||
android:paddingTop="@dimen/contex_menu_top_shadow_height"
|
||||
android:letterSpacing="@dimen/text_button_letter_spacing"
|
||||
android:text="@string/contact_support_description"
|
||||
android:textColor="?android:textColorPrimary"
|
||||
android:textSize="@dimen/default_list_text_size"
|
||||
osmand:typeface="@string/font_roboto_regular"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/contact_support_container"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="?android:attr/selectableItemBackground"
|
||||
android:paddingStart="@dimen/action_bar_image_side_margin"
|
||||
android:paddingLeft="@dimen/action_bar_image_side_margin"
|
||||
android:paddingTop="@dimen/card_padding"
|
||||
android:paddingEnd="@dimen/action_bar_image_side_margin"
|
||||
android:paddingRight="@dimen/action_bar_image_side_margin"
|
||||
android:paddingBottom="@dimen/card_padding"
|
||||
android:clickable="true"
|
||||
android:focusable="true">
|
||||
|
||||
<net.osmand.plus.widgets.TextViewEx
|
||||
android:id="@+id/contact_support_title"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_weight="1"
|
||||
android:text="@string/contact_support"
|
||||
android:textColor="?attr/active_color_basic"
|
||||
android:textSize="@dimen/default_list_text_size"
|
||||
osmand:typeface="@string/font_roboto_medium" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
|
@ -1,220 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:osmand="http://schemas.android.com/apk/res-auto"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="?attr/bg_color"
|
||||
android:orientation="vertical">
|
||||
|
||||
<com.google.android.material.appbar.AppBarLayout
|
||||
android:id="@+id/appbar"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
</com.google.android.material.appbar.AppBarLayout>
|
||||
|
||||
<androidx.appcompat.widget.AppCompatImageView
|
||||
android:layout_width="@dimen/map_widget_height"
|
||||
android:layout_height="@dimen/context_menu_controller_height"
|
||||
android:layout_gravity="center"
|
||||
android:layout_marginTop="@dimen/favorites_my_places_icon_size"
|
||||
android:layout_marginBottom="@dimen/favorites_my_places_icon_size"
|
||||
app:srcCompat="@drawable/ic_action_purchases"
|
||||
app:tint="?attr/default_icon_color" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="@dimen/list_header_height"
|
||||
android:layout_marginLeft="@dimen/list_header_height"
|
||||
android:layout_marginEnd="@dimen/list_header_height"
|
||||
android:layout_marginRight="@dimen/list_header_height"
|
||||
android:layout_marginBottom="@dimen/default_title_line_height"
|
||||
android:orientation="vertical">
|
||||
|
||||
<net.osmand.plus.widgets.TextViewEx
|
||||
android:id="@+id/any_purchases_title"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:gravity="center"
|
||||
android:paddingBottom="@dimen/slider_thumb_size"
|
||||
android:text="@string/no_purchases"
|
||||
android:textColor="?attr/dialog_title_color"
|
||||
android:textSize="@dimen/empty_state_text_desc_size"
|
||||
osmand:typeface="@string/font_roboto_medium" />
|
||||
|
||||
<net.osmand.plus.widgets.TextViewEx
|
||||
android:id="@+id/info_description"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center"
|
||||
android:letterSpacing="@dimen/description_letter_spacing"
|
||||
android:lineSpacingMultiplier="@dimen/text_button_line_spacing_multiplier"
|
||||
android:minHeight="@dimen/dialog_button_ex_height"
|
||||
android:text="@string/empty_purchases_description"
|
||||
android:textColor="?attr/dialog_text_description_color"
|
||||
android:textSize="@dimen/default_desc_text_size"
|
||||
osmand:typeface="@string/font_roboto_regular" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<View
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dp"
|
||||
android:background="?attr/dashboard_divider" />
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/restore_purchases"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="?android:attr/selectableItemBackground"
|
||||
android:minHeight="@dimen/list_item_height"
|
||||
android:paddingStart="@dimen/list_content_padding"
|
||||
android:paddingLeft="@dimen/list_content_padding"
|
||||
android:paddingEnd="@dimen/list_content_padding"
|
||||
android:paddingRight="@dimen/list_content_padding">
|
||||
|
||||
<androidx.appcompat.widget.AppCompatImageView
|
||||
android:id="@+id/icon"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_marginEnd="@dimen/map_widget_height"
|
||||
android:layout_marginRight="@dimen/map_widget_height"
|
||||
app:srcCompat="@drawable/ic_action_reset_to_default_dark"
|
||||
app:tint="?attr/active_color_basic" />
|
||||
|
||||
<net.osmand.plus.widgets.TextViewEx
|
||||
android:id="@+id/title"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_weight="1"
|
||||
android:text="@string/restore_purchases"
|
||||
android:textColor="?attr/active_color_basic"
|
||||
android:textSize="@dimen/default_list_text_size"
|
||||
app:typeface="@string/font_roboto_medium" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<include
|
||||
android:id="@+id/dismiss_button"
|
||||
layout="@layout/divider_half_item" />
|
||||
|
||||
<include
|
||||
android:id="@+id/osmand_live"
|
||||
layout="@layout/osm_live_banner_list_item" />
|
||||
|
||||
<include
|
||||
android:id="@+id/dismiss_button"
|
||||
layout="@layout/divider_half_item" />
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/new_device_account_container"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="?android:attr/selectableItemBackground"
|
||||
android:minHeight="@dimen/list_item_height"
|
||||
android:paddingStart="@dimen/list_content_padding"
|
||||
android:paddingLeft="@dimen/list_content_padding"
|
||||
android:paddingEnd="@dimen/list_content_padding"
|
||||
android:paddingRight="@dimen/list_content_padding">
|
||||
|
||||
<androidx.appcompat.widget.AppCompatImageView
|
||||
android:id="@+id/icon_new_device_account"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_marginEnd="@dimen/map_widget_height"
|
||||
android:layout_marginRight="@dimen/map_widget_height"
|
||||
app:srcCompat="@drawable/ic_action_help_online"
|
||||
app:tint="?attr/active_color_basic" />
|
||||
|
||||
<net.osmand.plus.widgets.TextViewEx
|
||||
android:id="@+id/new_device_account_title"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_weight="1"
|
||||
android:text="@string/new_device_account"
|
||||
android:textColor="?attr/active_color_basic"
|
||||
android:textSize="@dimen/default_list_text_size"
|
||||
app:typeface="@string/font_roboto_medium" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<include
|
||||
android:id="@+id/dismiss_button"
|
||||
layout="@layout/divider_half_item" />
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/support_link_container"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="?android:attr/selectableItemBackground"
|
||||
android:minHeight="@dimen/list_item_height"
|
||||
android:paddingStart="@dimen/list_content_padding"
|
||||
android:paddingLeft="@dimen/list_content_padding"
|
||||
android:paddingEnd="@dimen/list_content_padding"
|
||||
android:paddingRight="@dimen/list_content_padding">
|
||||
|
||||
<androidx.appcompat.widget.AppCompatImageView
|
||||
android:id="@+id/support_link_icon"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_marginEnd="@dimen/map_widget_height"
|
||||
android:layout_marginRight="@dimen/map_widget_height"
|
||||
app:srcCompat="@drawable/ic_action_at_mail"
|
||||
app:tint="?attr/active_color_basic" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/support_link_title"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_marginEnd="@dimen/card_button_progress_size_small"
|
||||
android:layout_marginRight="@dimen/card_button_progress_size_small"
|
||||
android:layout_weight="1"
|
||||
android:letterSpacing="@dimen/text_button_letter_spacing"
|
||||
android:text="@string/contact_support_description"
|
||||
android:textColor="?android:textColorPrimary"
|
||||
android:textSize="@dimen/default_list_text_size" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/contact_support_container"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="?android:attr/selectableItemBackground"
|
||||
android:paddingStart="@dimen/action_bar_image_side_margin"
|
||||
android:paddingLeft="@dimen/action_bar_image_side_margin"
|
||||
android:paddingTop="@dimen/card_padding"
|
||||
android:paddingEnd="@dimen/action_bar_image_side_margin"
|
||||
android:paddingRight="@dimen/action_bar_image_side_margin"
|
||||
android:paddingBottom="@dimen/card_padding">
|
||||
|
||||
<net.osmand.plus.widgets.TextViewEx
|
||||
android:id="@+id/contact_support_title"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_weight="1"
|
||||
android:text="@string/contact_support"
|
||||
android:textColor="?attr/active_color_basic"
|
||||
android:textSize="@dimen/default_list_text_size"
|
||||
app:typeface="@string/font_roboto_medium" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<include layout="@layout/card_bottom_divider"/>
|
||||
|
||||
<View
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="?attr/activity_background_color" />
|
||||
|
||||
</LinearLayout>
|
34
OsmAnd/res/layout/new_device_or_account_button.xml
Normal file
34
OsmAnd/res/layout/new_device_or_account_button.xml
Normal file
|
@ -0,0 +1,34 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="?android:attr/selectableItemBackground"
|
||||
android:minHeight="@dimen/list_item_height"
|
||||
android:paddingStart="@dimen/list_content_padding"
|
||||
android:paddingLeft="@dimen/list_content_padding"
|
||||
android:paddingEnd="@dimen/list_content_padding"
|
||||
android:paddingRight="@dimen/list_content_padding">
|
||||
|
||||
<androidx.appcompat.widget.AppCompatImageView
|
||||
android:id="@+id/icon_new_device_account"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_marginEnd="@dimen/map_widget_height"
|
||||
android:layout_marginRight="@dimen/map_widget_height"
|
||||
app:srcCompat="@drawable/ic_action_help_online"
|
||||
app:tint="?attr/active_color_basic" />
|
||||
|
||||
<net.osmand.plus.widgets.TextViewEx
|
||||
android:id="@+id/new_device_account_title"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_weight="1"
|
||||
android:text="@string/new_device_account"
|
||||
android:textColor="?attr/active_color_basic"
|
||||
android:textSize="@dimen/default_list_text_size"
|
||||
app:typeface="@string/font_roboto_medium" />
|
||||
|
||||
</LinearLayout>
|
92
OsmAnd/res/layout/no_purchases_card.xml
Normal file
92
OsmAnd/res/layout/no_purchases_card.xml
Normal file
|
@ -0,0 +1,92 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:osmand="http://schemas.android.com/apk/res-auto"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="?attr/bg_color"
|
||||
android:orientation="vertical">
|
||||
|
||||
<androidx.appcompat.widget.AppCompatImageView
|
||||
android:layout_width="@dimen/map_widget_height"
|
||||
android:layout_height="@dimen/context_menu_controller_height"
|
||||
android:layout_gravity="center"
|
||||
android:layout_marginTop="@dimen/favorites_my_places_icon_size"
|
||||
android:layout_marginBottom="@dimen/favorites_my_places_icon_size"
|
||||
app:srcCompat="@drawable/ic_action_purchases"
|
||||
app:tint="?attr/default_icon_color" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="@dimen/list_header_height"
|
||||
android:layout_marginLeft="@dimen/list_header_height"
|
||||
android:layout_marginEnd="@dimen/list_header_height"
|
||||
android:layout_marginRight="@dimen/list_header_height"
|
||||
android:layout_marginBottom="@dimen/default_title_line_height"
|
||||
android:orientation="vertical">
|
||||
|
||||
<net.osmand.plus.widgets.TextViewEx
|
||||
android:id="@+id/any_purchases_title"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:gravity="center"
|
||||
android:paddingBottom="@dimen/slider_thumb_size"
|
||||
android:text="@string/no_purchases"
|
||||
android:textColor="?attr/dialog_title_color"
|
||||
android:textSize="@dimen/empty_state_text_desc_size"
|
||||
osmand:typeface="@string/font_roboto_medium" />
|
||||
|
||||
<net.osmand.plus.widgets.TextViewEx
|
||||
android:id="@+id/info_description"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center"
|
||||
android:letterSpacing="@dimen/description_letter_spacing"
|
||||
android:lineSpacingMultiplier="@dimen/text_button_line_spacing_multiplier"
|
||||
android:minHeight="@dimen/dialog_button_ex_height"
|
||||
android:text="@string/empty_purchases_description"
|
||||
android:textColor="?attr/dialog_text_description_color"
|
||||
android:textSize="@dimen/default_desc_text_size"
|
||||
osmand:typeface="@string/font_roboto_regular" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<include
|
||||
layout="@layout/simple_divider_item" />
|
||||
|
||||
<include
|
||||
android:id="@+id/restore_purchases"
|
||||
layout="@layout/restore_purchases_button" />
|
||||
|
||||
<include
|
||||
layout="@layout/divider_half_item" />
|
||||
|
||||
<include
|
||||
android:id="@+id/osmand_live"
|
||||
layout="@layout/osm_live_banner_list_item" />
|
||||
|
||||
<include
|
||||
layout="@layout/divider_half_item" />
|
||||
|
||||
<include
|
||||
android:id="@+id/new_device_account_container"
|
||||
layout="@layout/new_device_or_account_button" />
|
||||
|
||||
<include
|
||||
layout="@layout/divider_half_item" />
|
||||
|
||||
<include
|
||||
android:id="@+id/contact_support_container"
|
||||
layout="@layout/contact_support" />
|
||||
|
||||
<include
|
||||
layout="@layout/card_bottom_divider"/>
|
||||
|
||||
<View
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="@dimen/dialog_button_ex_min_width"
|
||||
android:background="?attr/activity_background_color" />
|
||||
|
||||
</LinearLayout>
|
|
@ -1,12 +1,10 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:osmand="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="?attr/bg_color"
|
||||
android:orientation="vertical">
|
||||
android:background="?attr/activity_background_color"
|
||||
android:orientation="vertical"
|
||||
android:focusableInTouchMode="false">
|
||||
|
||||
<com.google.android.material.appbar.AppBarLayout
|
||||
android:id="@+id/appbar"
|
||||
|
@ -20,405 +18,10 @@
|
|||
android:layout_height="match_parent">
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/cards_container"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical">
|
||||
|
||||
<View
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="@dimen/list_content_padding"
|
||||
android:background="?attr/activity_background_color" />
|
||||
|
||||
<FrameLayout
|
||||
android:id="@+id/subscriptions_card_container"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content" />
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/support_region_container"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
android:background="?android:attr/selectableItemBackground"
|
||||
android:paddingStart="@dimen/content_padding"
|
||||
android:paddingLeft="@dimen/content_padding"
|
||||
android:paddingRight="@dimen/content_padding"
|
||||
android:paddingEnd="@dimen/content_padding">
|
||||
|
||||
<androidx.appcompat.widget.AppCompatImageView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:minHeight="@dimen/setting_list_item_group_height"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_marginEnd="@dimen/map_widget_height"
|
||||
android:layout_marginRight="@dimen/map_widget_height"
|
||||
app:srcCompat="@drawable/ic_world_globe_dark"
|
||||
app:tint="?attr/default_icon_color" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:layout_marginTop="@dimen/content_padding_small"
|
||||
android:layout_marginBottom="@dimen/content_padding_small"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:orientation="vertical">
|
||||
|
||||
<net.osmand.plus.widgets.TextViewEx
|
||||
android:id="@+id/support_region_header"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textColor="?android:attr/textColorPrimary"
|
||||
android:textSize="@dimen/default_list_text_size"
|
||||
osmand:typeface="@string/font_roboto_regular"
|
||||
tools:text="@string/osm_live_support_region"/>
|
||||
|
||||
<net.osmand.plus.widgets.TextViewEx
|
||||
android:id="@+id/support_region"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginEnd="@dimen/content_padding"
|
||||
android:layout_marginRight="@dimen/content_padding"
|
||||
android:text="@string/osm_live_support_region"
|
||||
android:textColor="?android:attr/textColorSecondary"
|
||||
android:textSize="@dimen/default_desc_text_size"
|
||||
osmand:typeface="@string/font_roboto_regular"
|
||||
tools:text="@string/clear_updates_proposition_message"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<androidx.appcompat.widget.AppCompatImageView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
app:srcCompat="@drawable/ic_action_settings"
|
||||
app:tint="?attr/default_icon_color" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<include layout="@layout/simple_divider_item" />
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/report_container"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="?android:attr/selectableItemBackground"
|
||||
android:minHeight="@dimen/list_item_height"
|
||||
android:paddingStart="@dimen/list_content_padding"
|
||||
android:paddingLeft="@dimen/list_content_padding"
|
||||
android:paddingEnd="@dimen/list_content_padding"
|
||||
android:paddingRight="@dimen/list_content_padding">
|
||||
|
||||
<androidx.appcompat.widget.AppCompatImageView
|
||||
android:id="@+id/report_icon"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_marginEnd="@dimen/map_widget_height"
|
||||
android:layout_marginRight="@dimen/map_widget_height"
|
||||
app:srcCompat="@drawable/ic_action_file_report"
|
||||
app:tint="?attr/active_color_basic" />
|
||||
|
||||
<net.osmand.plus.widgets.TextViewEx
|
||||
android:id="@+id/report_title"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_weight="1"
|
||||
android:text="@string/report"
|
||||
android:textColor="?attr/active_color_basic"
|
||||
android:textSize="@dimen/default_list_text_size"
|
||||
app:typeface="@string/font_roboto_medium" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<include
|
||||
android:id="@+id/dismiss_button"
|
||||
layout="@layout/divider_half_item" />
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/live_updates_container"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="?android:attr/selectableItemBackground"
|
||||
android:minHeight="@dimen/list_item_height"
|
||||
android:paddingStart="@dimen/list_content_padding"
|
||||
android:paddingLeft="@dimen/list_content_padding"
|
||||
android:paddingEnd="@dimen/list_content_padding"
|
||||
android:paddingRight="@dimen/list_content_padding">
|
||||
|
||||
<androidx.appcompat.widget.AppCompatImageView
|
||||
android:id="@+id/live_updates_icon"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_marginEnd="@dimen/map_widget_height"
|
||||
android:layout_marginRight="@dimen/map_widget_height"
|
||||
app:srcCompat="@drawable/ic_action_at_mail"
|
||||
app:tint="?attr/active_color_basic" />
|
||||
|
||||
<net.osmand.plus.widgets.TextViewEx
|
||||
android:id="@+id/live_updates_title"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_marginEnd="@dimen/card_button_progress_size_small"
|
||||
android:layout_marginRight="@dimen/card_button_progress_size_small"
|
||||
android:layout_weight="1"
|
||||
android:letterSpacing="@dimen/text_button_letter_spacing"
|
||||
android:text="@string/live_updates"
|
||||
android:textColor="?attr/active_color_basic"
|
||||
android:textSize="@dimen/default_list_text_size"
|
||||
app:typeface="@string/font_roboto_medium" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<include
|
||||
android:id="@+id/dismiss_button"
|
||||
layout="@layout/divider_half_item" />
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/manage_subscription_container"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="?android:attr/selectableItemBackground"
|
||||
android:minHeight="@dimen/list_item_height"
|
||||
android:paddingStart="@dimen/list_content_padding"
|
||||
android:paddingLeft="@dimen/list_content_padding"
|
||||
android:paddingEnd="@dimen/list_content_padding"
|
||||
android:paddingRight="@dimen/list_content_padding">
|
||||
|
||||
<androidx.appcompat.widget.AppCompatImageView
|
||||
android:id="@+id/manage_subscription_icon"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_marginEnd="@dimen/map_widget_height"
|
||||
android:layout_marginRight="@dimen/map_widget_height"
|
||||
app:srcCompat="@drawable/ic_action_purchases"
|
||||
app:tint="?attr/active_color_basic" />
|
||||
|
||||
<net.osmand.plus.widgets.TextViewEx
|
||||
android:id="@+id/manage_subscription_title"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_marginEnd="@dimen/card_button_progress_size_small"
|
||||
android:layout_marginRight="@dimen/card_button_progress_size_small"
|
||||
android:layout_weight="1"
|
||||
android:letterSpacing="@dimen/text_button_letter_spacing"
|
||||
android:text="@string/manage_subscription"
|
||||
android:textColor="?attr/active_color_basic"
|
||||
android:textSize="@dimen/default_list_text_size"
|
||||
app:typeface="@string/font_roboto_medium" />
|
||||
|
||||
</LinearLayout>
|
||||
<include layout="@layout/card_bottom_divider"/>
|
||||
|
||||
<View
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="@dimen/list_content_padding"
|
||||
android:background="?attr/activity_background_color" />
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/troubleshooting_container"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="?android:attr/selectableItemBackground"
|
||||
android:minHeight="@dimen/list_item_height"
|
||||
android:orientation="vertical"
|
||||
android:paddingStart="@dimen/list_content_padding"
|
||||
android:paddingLeft="@dimen/list_content_padding"
|
||||
android:paddingTop="14dp"
|
||||
android:paddingEnd="@dimen/list_content_padding"
|
||||
android:paddingRight="@dimen/list_content_padding"
|
||||
android:paddingBottom="6dp">
|
||||
|
||||
<androidx.appcompat.widget.AppCompatImageView
|
||||
android:id="@+id/troubleshooting_icon"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_marginEnd="@dimen/map_widget_height"
|
||||
android:layout_marginRight="@dimen/map_widget_height"
|
||||
android:paddingBottom="@dimen/dialog_content_bottom_margin"
|
||||
app:srcCompat="@drawable/ic_action_help"
|
||||
app:tint="?attr/profile_icon_color_green" />
|
||||
|
||||
<net.osmand.plus.widgets.TextViewEx
|
||||
android:id="@+id/troubleshooting_title"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginEnd="@dimen/card_button_progress_size_small"
|
||||
android:layout_marginRight="@dimen/card_button_progress_size_small"
|
||||
android:letterSpacing="@dimen/text_button_letter_spacing"
|
||||
android:text="@string/troubleshooting"
|
||||
android:textColor="?android:textColorPrimary"
|
||||
android:textSize="@dimen/default_list_text_size"
|
||||
app:typeface="@string/font_roboto_medium" />
|
||||
|
||||
<net.osmand.plus.widgets.TextViewEx
|
||||
android:id="@+id/troubleshooting_description"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginEnd="@dimen/card_button_progress_size_small"
|
||||
android:layout_marginRight="@dimen/card_button_progress_size_small"
|
||||
android:letterSpacing="@dimen/description_letter_spacing"
|
||||
android:text="@string/troubleshooting_description"
|
||||
android:textColor="?android:textColorSecondary"
|
||||
android:textSize="@dimen/default_desc_text_size"
|
||||
app:typeface="@string/font_roboto_regular" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/restore_purchases"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="?android:attr/selectableItemBackground"
|
||||
android:minHeight="@dimen/list_item_height"
|
||||
android:paddingStart="@dimen/list_content_padding"
|
||||
android:paddingLeft="@dimen/list_content_padding"
|
||||
android:paddingEnd="@dimen/list_content_padding"
|
||||
android:paddingRight="@dimen/list_content_padding">
|
||||
|
||||
<androidx.appcompat.widget.AppCompatImageView
|
||||
android:id="@+id/icon"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_marginEnd="@dimen/map_widget_height"
|
||||
android:layout_marginRight="@dimen/map_widget_height"
|
||||
app:srcCompat="@drawable/ic_action_reset_to_default_dark"
|
||||
app:tint="?attr/active_color_basic" />
|
||||
|
||||
<net.osmand.plus.widgets.TextViewEx
|
||||
android:id="@+id/title"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_weight="1"
|
||||
android:text="@string/restore_purchases"
|
||||
android:textColor="?attr/active_color_basic"
|
||||
android:textSize="@dimen/default_list_text_size"
|
||||
app:typeface="@string/font_roboto_medium" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<include
|
||||
android:id="@+id/dismiss_button"
|
||||
layout="@layout/divider_half_item" />
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/new_device_account_container"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="?android:attr/selectableItemBackground"
|
||||
android:minHeight="@dimen/list_item_height"
|
||||
android:paddingStart="@dimen/list_content_padding"
|
||||
android:paddingLeft="@dimen/list_content_padding"
|
||||
android:paddingEnd="@dimen/list_content_padding"
|
||||
android:paddingRight="@dimen/list_content_padding">
|
||||
|
||||
<androidx.appcompat.widget.AppCompatImageView
|
||||
android:id="@+id/icon_new_device_account"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_marginEnd="@dimen/map_widget_height"
|
||||
android:layout_marginRight="@dimen/map_widget_height"
|
||||
app:srcCompat="@drawable/ic_action_help_online"
|
||||
app:tint="?attr/active_color_basic" />
|
||||
|
||||
<net.osmand.plus.widgets.TextViewEx
|
||||
android:id="@+id/new_device_account_title"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_weight="1"
|
||||
android:text="@string/new_device_account"
|
||||
android:textColor="?attr/active_color_basic"
|
||||
android:textSize="@dimen/default_list_text_size"
|
||||
app:typeface="@string/font_roboto_medium" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<include
|
||||
android:id="@+id/dismiss_button"
|
||||
layout="@layout/divider" />
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/support_link_container"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="?android:attr/selectableItemBackground"
|
||||
android:minHeight="@dimen/list_item_height"
|
||||
android:paddingStart="@dimen/list_content_padding"
|
||||
android:paddingLeft="@dimen/list_content_padding"
|
||||
android:paddingEnd="@dimen/list_content_padding"
|
||||
android:paddingRight="@dimen/list_content_padding">
|
||||
|
||||
<androidx.appcompat.widget.AppCompatImageView
|
||||
android:id="@+id/support_link_icon"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_marginEnd="@dimen/map_widget_height"
|
||||
android:layout_marginRight="@dimen/map_widget_height"
|
||||
app:srcCompat="@drawable/ic_action_at_mail"
|
||||
app:tint="?attr/active_color_basic" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/support_link_title"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_marginEnd="@dimen/card_button_progress_size_small"
|
||||
android:layout_marginRight="@dimen/card_button_progress_size_small"
|
||||
android:paddingTop="@dimen/contex_menu_top_shadow_height"
|
||||
android:layout_weight="1"
|
||||
android:letterSpacing="@dimen/text_button_letter_spacing"
|
||||
android:text="@string/contact_support_description"
|
||||
android:textColor="?android:textColorPrimary"
|
||||
android:textSize="@dimen/default_list_text_size" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/contact_support_container"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="?android:attr/selectableItemBackground"
|
||||
android:paddingStart="@dimen/action_bar_image_side_margin"
|
||||
android:paddingLeft="@dimen/action_bar_image_side_margin"
|
||||
android:paddingTop="@dimen/card_padding"
|
||||
android:paddingEnd="@dimen/action_bar_image_side_margin"
|
||||
android:paddingRight="@dimen/action_bar_image_side_margin"
|
||||
android:paddingBottom="@dimen/card_padding"
|
||||
android:clickable="true"
|
||||
android:focusable="true">
|
||||
|
||||
<net.osmand.plus.widgets.TextViewEx
|
||||
android:id="@+id/contact_support_title"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_weight="1"
|
||||
android:text="@string/contact_support"
|
||||
android:textColor="?attr/active_color_basic"
|
||||
android:textSize="@dimen/default_list_text_size"
|
||||
app:typeface="@string/font_roboto_medium" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<include layout="@layout/card_bottom_divider"/>
|
||||
|
||||
<View
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="@dimen/card_row_min_height"
|
||||
android:background="?attr/activity_background_color" />
|
||||
|
||||
</LinearLayout>
|
||||
android:orientation="vertical"/>
|
||||
|
||||
</ScrollView>
|
||||
|
||||
|
|
34
OsmAnd/res/layout/restore_purchases_button.xml
Normal file
34
OsmAnd/res/layout/restore_purchases_button.xml
Normal file
|
@ -0,0 +1,34 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="?android:attr/selectableItemBackground"
|
||||
android:minHeight="@dimen/list_item_height"
|
||||
android:paddingStart="@dimen/list_content_padding"
|
||||
android:paddingLeft="@dimen/list_content_padding"
|
||||
android:paddingEnd="@dimen/list_content_padding"
|
||||
android:paddingRight="@dimen/list_content_padding">
|
||||
|
||||
<androidx.appcompat.widget.AppCompatImageView
|
||||
android:id="@+id/icon"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_marginEnd="@dimen/map_widget_height"
|
||||
android:layout_marginRight="@dimen/map_widget_height"
|
||||
app:srcCompat="@drawable/ic_action_reset_to_default_dark"
|
||||
app:tint="?attr/active_color_basic" />
|
||||
|
||||
<net.osmand.plus.widgets.TextViewEx
|
||||
android:id="@+id/title"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_weight="1"
|
||||
android:text="@string/restore_purchases"
|
||||
android:textColor="?attr/active_color_basic"
|
||||
android:textSize="@dimen/default_list_text_size"
|
||||
app:typeface="@string/font_roboto_medium" />
|
||||
|
||||
</LinearLayout>
|
|
@ -1,5 +1,207 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
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:orientation="vertical" />
|
||||
android:background="?attr/bg_color"
|
||||
android:orientation="vertical">
|
||||
|
||||
<View
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="@dimen/list_content_padding"
|
||||
android:background="?attr/activity_background_color" />
|
||||
|
||||
<include
|
||||
layout="@layout/divider" />
|
||||
|
||||
<FrameLayout
|
||||
android:id="@+id/subscriptions_list_container"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content" />
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/support_region_container"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
android:background="?android:attr/selectableItemBackground"
|
||||
android:paddingStart="@dimen/content_padding"
|
||||
android:paddingLeft="@dimen/content_padding"
|
||||
android:paddingRight="@dimen/content_padding"
|
||||
android:paddingEnd="@dimen/content_padding">
|
||||
|
||||
<androidx.appcompat.widget.AppCompatImageView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:minHeight="@dimen/setting_list_item_group_height"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_marginEnd="@dimen/map_widget_height"
|
||||
android:layout_marginRight="@dimen/map_widget_height"
|
||||
app:srcCompat="@drawable/ic_world_globe_dark"
|
||||
app:tint="?attr/default_icon_color" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:layout_marginTop="@dimen/content_padding_small"
|
||||
android:layout_marginBottom="@dimen/content_padding_small"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:orientation="vertical">
|
||||
|
||||
<net.osmand.plus.widgets.TextViewEx
|
||||
android:id="@+id/support_region_header"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textColor="?android:attr/textColorPrimary"
|
||||
android:textSize="@dimen/default_list_text_size"
|
||||
osmand:typeface="@string/font_roboto_regular"
|
||||
tools:text="@string/osm_live_support_region"/>
|
||||
|
||||
<net.osmand.plus.widgets.TextViewEx
|
||||
android:id="@+id/support_region"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginEnd="@dimen/content_padding"
|
||||
android:layout_marginRight="@dimen/content_padding"
|
||||
android:text="@string/osm_live_support_region"
|
||||
android:textColor="?android:attr/textColorSecondary"
|
||||
android:textSize="@dimen/default_desc_text_size"
|
||||
osmand:typeface="@string/font_roboto_regular"
|
||||
tools:text="@string/clear_updates_proposition_message"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<androidx.appcompat.widget.AppCompatImageView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
app:srcCompat="@drawable/ic_action_settings"
|
||||
app:tint="?attr/default_icon_color" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<include layout="@layout/simple_divider_item" />
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/report_container"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="?android:attr/selectableItemBackground"
|
||||
android:minHeight="@dimen/list_item_height"
|
||||
android:paddingStart="@dimen/list_content_padding"
|
||||
android:paddingLeft="@dimen/list_content_padding"
|
||||
android:paddingEnd="@dimen/list_content_padding"
|
||||
android:paddingRight="@dimen/list_content_padding">
|
||||
|
||||
<androidx.appcompat.widget.AppCompatImageView
|
||||
android:id="@+id/report_icon"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_marginEnd="@dimen/map_widget_height"
|
||||
android:layout_marginRight="@dimen/map_widget_height"
|
||||
app:srcCompat="@drawable/ic_action_file_report"
|
||||
app:tint="?attr/active_color_basic" />
|
||||
|
||||
<net.osmand.plus.widgets.TextViewEx
|
||||
android:id="@+id/report_title"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_weight="1"
|
||||
android:text="@string/report"
|
||||
android:textColor="?attr/active_color_basic"
|
||||
android:textSize="@dimen/default_list_text_size"
|
||||
app:typeface="@string/font_roboto_medium" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<include
|
||||
android:id="@+id/dismiss_button"
|
||||
layout="@layout/divider_half_item" />
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/live_updates_container"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="?android:attr/selectableItemBackground"
|
||||
android:minHeight="@dimen/list_item_height"
|
||||
android:paddingStart="@dimen/list_content_padding"
|
||||
android:paddingLeft="@dimen/list_content_padding"
|
||||
android:paddingEnd="@dimen/list_content_padding"
|
||||
android:paddingRight="@dimen/list_content_padding">
|
||||
|
||||
<androidx.appcompat.widget.AppCompatImageView
|
||||
android:id="@+id/live_updates_icon"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_marginEnd="@dimen/map_widget_height"
|
||||
android:layout_marginRight="@dimen/map_widget_height"
|
||||
app:srcCompat="@drawable/ic_action_at_mail"
|
||||
app:tint="?attr/active_color_basic" />
|
||||
|
||||
<net.osmand.plus.widgets.TextViewEx
|
||||
android:id="@+id/live_updates_title"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_marginEnd="@dimen/card_button_progress_size_small"
|
||||
android:layout_marginRight="@dimen/card_button_progress_size_small"
|
||||
android:layout_weight="1"
|
||||
android:letterSpacing="@dimen/text_button_letter_spacing"
|
||||
android:text="@string/live_updates"
|
||||
android:textColor="?attr/active_color_basic"
|
||||
android:textSize="@dimen/default_list_text_size"
|
||||
app:typeface="@string/font_roboto_medium" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<include
|
||||
android:id="@+id/dismiss_button"
|
||||
layout="@layout/divider_half_item" />
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/manage_subscription_container"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="?android:attr/selectableItemBackground"
|
||||
android:minHeight="@dimen/list_item_height"
|
||||
android:paddingStart="@dimen/list_content_padding"
|
||||
android:paddingLeft="@dimen/list_content_padding"
|
||||
android:paddingEnd="@dimen/list_content_padding"
|
||||
android:paddingRight="@dimen/list_content_padding">
|
||||
|
||||
<androidx.appcompat.widget.AppCompatImageView
|
||||
android:id="@+id/manage_subscription_icon"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_marginEnd="@dimen/map_widget_height"
|
||||
android:layout_marginRight="@dimen/map_widget_height"
|
||||
app:srcCompat="@drawable/ic_action_purchases"
|
||||
app:tint="?attr/active_color_basic" />
|
||||
|
||||
<net.osmand.plus.widgets.TextViewEx
|
||||
android:id="@+id/manage_subscription_title"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_marginEnd="@dimen/card_button_progress_size_small"
|
||||
android:layout_marginRight="@dimen/card_button_progress_size_small"
|
||||
android:layout_weight="1"
|
||||
android:letterSpacing="@dimen/text_button_letter_spacing"
|
||||
android:text="@string/manage_subscription"
|
||||
android:textColor="?attr/active_color_basic"
|
||||
android:textSize="@dimen/default_list_text_size"
|
||||
app:typeface="@string/font_roboto_medium" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<include
|
||||
layout="@layout/divider"/>
|
||||
|
||||
</LinearLayout>
|
6
OsmAnd/res/layout/subscriptions_list_card.xml
Normal file
6
OsmAnd/res/layout/subscriptions_list_card.xml
Normal file
|
@ -0,0 +1,6 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="?attr/bg_color"
|
||||
android:orientation="vertical" />
|
96
OsmAnd/res/layout/troubleshooting_card.xml
Normal file
96
OsmAnd/res/layout/troubleshooting_card.xml
Normal file
|
@ -0,0 +1,96 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="?attr/bg_color"
|
||||
android:orientation="vertical">
|
||||
|
||||
<View
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="@dimen/list_content_padding"
|
||||
android:background="?attr/activity_background_color" />
|
||||
|
||||
<include
|
||||
layout="@layout/divider" />
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/troubleshooting_container"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="?android:attr/selectableItemBackground"
|
||||
android:minHeight="@dimen/list_item_height"
|
||||
android:orientation="vertical"
|
||||
android:paddingStart="@dimen/list_content_padding"
|
||||
android:paddingLeft="@dimen/list_content_padding"
|
||||
android:paddingTop="14dp"
|
||||
android:paddingEnd="@dimen/list_content_padding"
|
||||
android:paddingRight="@dimen/list_content_padding"
|
||||
android:paddingBottom="6dp">
|
||||
|
||||
<androidx.appcompat.widget.AppCompatImageView
|
||||
android:id="@+id/troubleshooting_icon"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_marginEnd="@dimen/map_widget_height"
|
||||
android:layout_marginRight="@dimen/map_widget_height"
|
||||
android:paddingBottom="@dimen/dialog_content_bottom_margin"
|
||||
app:srcCompat="@drawable/ic_action_help"
|
||||
app:tint="?attr/profile_icon_color_green" />
|
||||
|
||||
<net.osmand.plus.widgets.TextViewEx
|
||||
android:id="@+id/troubleshooting_title"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginEnd="@dimen/card_button_progress_size_small"
|
||||
android:layout_marginRight="@dimen/card_button_progress_size_small"
|
||||
android:letterSpacing="@dimen/text_button_letter_spacing"
|
||||
android:text="@string/troubleshooting"
|
||||
android:textColor="?android:textColorPrimary"
|
||||
android:textSize="@dimen/default_list_text_size"
|
||||
app:typeface="@string/font_roboto_medium" />
|
||||
|
||||
<net.osmand.plus.widgets.TextViewEx
|
||||
android:id="@+id/troubleshooting_description"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginEnd="@dimen/card_button_progress_size_small"
|
||||
android:layout_marginRight="@dimen/card_button_progress_size_small"
|
||||
android:letterSpacing="@dimen/description_letter_spacing"
|
||||
android:text="@string/troubleshooting_description"
|
||||
android:textColor="?android:textColorSecondary"
|
||||
android:textSize="@dimen/default_desc_text_size"
|
||||
app:typeface="@string/font_roboto_regular" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<include
|
||||
android:id="@+id/restore_purchases"
|
||||
layout="@layout/restore_purchases_button" />
|
||||
|
||||
<include
|
||||
android:id="@+id/dismiss_button"
|
||||
layout="@layout/divider_half_item" />
|
||||
|
||||
<include
|
||||
android:id="@+id/new_device_account_container"
|
||||
layout="@layout/new_device_or_account_button" />
|
||||
|
||||
<include
|
||||
android:id="@+id/dismiss_button"
|
||||
layout="@layout/divider" />
|
||||
|
||||
<include
|
||||
android:id="@+id/contact_support_container"
|
||||
layout="@layout/contact_support" />
|
||||
|
||||
<include
|
||||
layout="@layout/divider"/>
|
||||
|
||||
<View
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="@dimen/dialog_button_ex_min_width"
|
||||
android:background="?attr/activity_background_color" />
|
||||
|
||||
</LinearLayout>
|
|
@ -22,19 +22,7 @@ import android.widget.ImageView;
|
|||
import android.widget.ProgressBar;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.DrawableRes;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.appcompat.widget.SwitchCompat;
|
||||
import androidx.core.content.ContextCompat;
|
||||
import androidx.fragment.app.FragmentActivity;
|
||||
import androidx.fragment.app.FragmentManager;
|
||||
import androidx.swiperefreshlayout.widget.SwipeRefreshLayout;
|
||||
|
||||
import net.osmand.plus.OsmandApplication;
|
||||
import net.osmand.plus.chooseplan.ChoosePlanDialogFragment.ChoosePlanDialogType;
|
||||
import net.osmand.plus.settings.backend.CommonPreference;
|
||||
import net.osmand.plus.settings.backend.OsmandSettings;
|
||||
import net.osmand.plus.R;
|
||||
import net.osmand.plus.Version;
|
||||
import net.osmand.plus.activities.LocalIndexHelper;
|
||||
|
@ -43,13 +31,15 @@ import net.osmand.plus.activities.OsmandBaseExpandableListAdapter;
|
|||
import net.osmand.plus.activities.OsmandInAppPurchaseActivity;
|
||||
import net.osmand.plus.base.BaseOsmAndFragment;
|
||||
import net.osmand.plus.chooseplan.ChoosePlanDialogFragment;
|
||||
import net.osmand.plus.chooseplan.ChoosePlanDialogFragment.ChoosePlanDialogType;
|
||||
import net.osmand.plus.download.ui.AbstractLoadLocalIndexTask;
|
||||
import net.osmand.plus.inapp.InAppPurchaseHelper;
|
||||
import net.osmand.plus.inapp.InAppPurchaseHelper.InAppPurchaseListener;
|
||||
import net.osmand.plus.inapp.InAppPurchaseHelper.InAppPurchaseTaskType;
|
||||
import net.osmand.plus.inapp.InAppPurchases.InAppSubscription;
|
||||
import net.osmand.plus.resources.IncrementalChangesManager;
|
||||
import net.osmand.plus.settings.fragments.PurchasesFragment;
|
||||
import net.osmand.plus.settings.backend.CommonPreference;
|
||||
import net.osmand.plus.settings.backend.OsmandSettings;
|
||||
import net.osmand.util.Algorithms;
|
||||
|
||||
import java.io.File;
|
||||
|
@ -60,6 +50,15 @@ import java.util.HashSet;
|
|||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import androidx.annotation.DrawableRes;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.appcompat.widget.SwitchCompat;
|
||||
import androidx.core.content.ContextCompat;
|
||||
import androidx.fragment.app.FragmentActivity;
|
||||
import androidx.fragment.app.FragmentManager;
|
||||
import androidx.swiperefreshlayout.widget.SwipeRefreshLayout;
|
||||
|
||||
import static net.osmand.plus.liveupdates.LiveUpdatesFragmentNew.showUpdateDialog;
|
||||
import static net.osmand.plus.liveupdates.LiveUpdatesHelper.DEFAULT_LAST_CHECK;
|
||||
import static net.osmand.plus.liveupdates.LiveUpdatesHelper.TimeOfDay;
|
||||
|
@ -182,8 +181,8 @@ public class LiveUpdatesFragment extends BaseOsmAndFragment implements InAppPurc
|
|||
statusTextView.setText(getString(R.string.osm_live_active));
|
||||
statusIcon.setImageDrawable(app.getUIUtilities().getThemedIcon(R.drawable.ic_action_done));
|
||||
|
||||
String countryName = PurchasesFragment.getSupportRegionName(app, getInAppPurchaseHelper());
|
||||
String header = PurchasesFragment.getSupportRegionHeader(app, countryName);
|
||||
String countryName = getSupportRegionName(app, getInAppPurchaseHelper());
|
||||
String header = getSupportRegionHeader(app, countryName);
|
||||
regionNameHeaderTextView.setText(header);
|
||||
regionNameTextView.setText(countryName);
|
||||
|
||||
|
@ -279,6 +278,41 @@ public class LiveUpdatesFragment extends BaseOsmAndFragment implements InAppPurc
|
|||
subscriptionFragment.show(getChildFragmentManager(), SubscriptionFragment.TAG);
|
||||
}
|
||||
|
||||
public static String getSupportRegionName(OsmandApplication app, InAppPurchaseHelper purchaseHelper) {
|
||||
OsmandSettings settings = app.getSettings();
|
||||
String countryName = settings.BILLING_USER_COUNTRY.get();
|
||||
if (purchaseHelper != null) {
|
||||
List<InAppSubscription> subscriptions = purchaseHelper.getLiveUpdates().getVisibleSubscriptions();
|
||||
boolean donationSupported = false;
|
||||
for (InAppSubscription s : subscriptions) {
|
||||
if (s.isDonationSupported()) {
|
||||
donationSupported = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (donationSupported) {
|
||||
if (Algorithms.isEmpty(countryName)) {
|
||||
if (OsmandSettings.BILLING_USER_DONATION_NONE_PARAMETER.equals(settings.BILLING_USER_COUNTRY_DOWNLOAD_NAME.get())) {
|
||||
countryName = app.getString(R.string.osmand_team);
|
||||
} else {
|
||||
countryName = app.getString(R.string.shared_string_world);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
countryName = app.getString(R.string.osmand_team);
|
||||
}
|
||||
} else {
|
||||
countryName = app.getString(R.string.osmand_team);
|
||||
}
|
||||
return countryName;
|
||||
}
|
||||
|
||||
public static String getSupportRegionHeader(OsmandApplication app, String supportRegion) {
|
||||
return supportRegion.equals(app.getString(R.string.osmand_team)) ?
|
||||
app.getString(R.string.default_buttons_support) :
|
||||
app.getString(R.string.osm_live_support_region);
|
||||
}
|
||||
|
||||
protected class LocalIndexesAdapter extends OsmandBaseExpandableListAdapter {
|
||||
public static final int SHOULD_UPDATE_GROUP_POSITION = 0;
|
||||
public static final int SHOULD_NOT_UPDATE_GROUP_POSITION = 1;
|
||||
|
|
|
@ -2,23 +2,13 @@ package net.osmand.plus.settings.fragments;
|
|||
|
||||
import android.app.Activity;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.graphics.Typeface;
|
||||
import android.net.Uri;
|
||||
import android.os.Bundle;
|
||||
import android.text.Spannable;
|
||||
import android.text.SpannableString;
|
||||
import android.text.Spanned;
|
||||
import android.text.method.LinkMovementMethod;
|
||||
import android.text.style.StyleSpan;
|
||||
import android.text.style.URLSpan;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.MotionEvent;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.ImageButton;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.google.android.material.appbar.AppBarLayout;
|
||||
|
@ -32,16 +22,10 @@ import net.osmand.plus.Version;
|
|||
import net.osmand.plus.activities.MapActivity;
|
||||
import net.osmand.plus.activities.OsmandInAppPurchaseActivity;
|
||||
import net.osmand.plus.base.BaseOsmAndFragment;
|
||||
import net.osmand.plus.chooseplan.ChoosePlanDialogFragment;
|
||||
import net.osmand.plus.inapp.InAppPurchaseHelper;
|
||||
import net.osmand.plus.inapp.InAppPurchaseHelper.InAppPurchaseListener;
|
||||
import net.osmand.plus.inapp.InAppPurchases.InAppSubscription;
|
||||
import net.osmand.plus.liveupdates.CountrySelectionFragment;
|
||||
import net.osmand.plus.liveupdates.CountrySelectionFragment.CountryItem;
|
||||
import net.osmand.plus.liveupdates.CountrySelectionFragment.OnFragmentInteractionListener;
|
||||
import net.osmand.plus.liveupdates.LiveUpdatesFragmentNew;
|
||||
import net.osmand.plus.liveupdates.OsmLiveActivity;
|
||||
import net.osmand.plus.settings.backend.OsmandSettings;
|
||||
import net.osmand.plus.wikipedia.WikipediaDialogFragment;
|
||||
import net.osmand.util.Algorithms;
|
||||
|
||||
|
@ -59,11 +43,6 @@ public class PurchasesFragment extends BaseOsmAndFragment implements InAppPurcha
|
|||
|
||||
public static final String KEY_IS_SUBSCRIBER = "action_is_new";
|
||||
|
||||
private static final String PLAY_STORE_SUBSCRIPTION_URL = "https://play.google.com/store/account/subscriptions";
|
||||
private static final String PLAY_STORE_SUBSCRIPTION_DEEPLINK_URL = "https://play.google.com/store/account/subscriptions?sku=%s&package=%s";
|
||||
private static final String EMAIL_DEEPLINK_URI = "mailto:support@osmand.net";
|
||||
private static final String OSMAND_EMAIL = "support@osmand.net";
|
||||
private static final String OSMAND_NEW_DEVICE_URL = "https://docs.osmand.net/en/main@latest/osmand/purchases#new-device--new-account";
|
||||
private static final String OSMAND_PURCHASES_URL = "https://docs.osmand.net/en/main@latest/osmand/purchases";
|
||||
|
||||
private OsmandApplication app;
|
||||
|
@ -71,18 +50,16 @@ public class PurchasesFragment extends BaseOsmAndFragment implements InAppPurcha
|
|||
private InAppPurchaseHelper purchaseHelper;
|
||||
|
||||
private View mainView;
|
||||
ViewGroup cardsContainer;
|
||||
private SubscriptionsCard subscriptionsCard;
|
||||
|
||||
private CountrySelectionFragment countrySelectionFragment = new CountrySelectionFragment();
|
||||
|
||||
private String url;
|
||||
private Boolean isPaidVersion;
|
||||
|
||||
public static boolean showInstance(FragmentManager fragmentManager) {
|
||||
try {
|
||||
PurchasesFragment fragment = new PurchasesFragment();
|
||||
fragmentManager.beginTransaction()
|
||||
.replace(R.id.fragmentContainer, fragment, TAG)
|
||||
.add(R.id.fragmentContainer, fragment, TAG)
|
||||
.addToBackStack(TAG)
|
||||
.commitAllowingStateLoss();
|
||||
return true;
|
||||
|
@ -102,67 +79,39 @@ public class PurchasesFragment extends BaseOsmAndFragment implements InAppPurcha
|
|||
app = getMyApplication();
|
||||
context = requireContext();
|
||||
isPaidVersion = Version.isPaidVersion(app);
|
||||
final MapActivity mapActivity = getMapActivity();
|
||||
final boolean nightMode = !app.getSettings().isLightContent();
|
||||
LayoutInflater themedInflater = UiUtilities.getInflater(context, nightMode);
|
||||
|
||||
if (isPaidVersion) {
|
||||
mainView = themedInflater.inflate(R.layout.purchases_layout, container, false);
|
||||
setSubscriptionClick(mapActivity);
|
||||
} else {
|
||||
mainView = themedInflater.inflate(R.layout.empty_purchases_layout, container, false);
|
||||
LinearLayout osmandLive = mainView.findViewById(R.id.osmand_live);
|
||||
osmandLive.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
if (getMyApplication() != null && getMyActivity() != null) {
|
||||
ChoosePlanDialogFragment.showDialogInstance(getMyApplication(), getMyActivity().getSupportFragmentManager(), ChoosePlanDialogFragment.ChoosePlanDialogType.OSM_LIVE);
|
||||
}
|
||||
}
|
||||
});
|
||||
TextView infoDescription = mainView.findViewById(R.id.info_description);
|
||||
|
||||
String restorePurchases = getString(R.string.restore_purchases);
|
||||
String infoPurchases = String.format(getString(R.string.empty_purchases_description), restorePurchases);
|
||||
infoDescription.setText(infoPurchases);
|
||||
}
|
||||
mainView = themedInflater.inflate(R.layout.purchases_layout, container, false);
|
||||
AndroidUtils.addStatusBarPadding21v(getActivity(), mainView);
|
||||
createToolbar(mainView, nightMode);
|
||||
LinearLayout purchasesRestore = mainView.findViewById(R.id.restore_purchases);
|
||||
purchasesRestore.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
if (purchaseHelper != null) {
|
||||
purchaseHelper.requestInventory();
|
||||
}
|
||||
}
|
||||
});
|
||||
LinearLayout newDeviceAccountContainer = mainView.findViewById(R.id.new_device_account_container);
|
||||
newDeviceAccountContainer.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
WikipediaDialogFragment.showFullArticle(context, Uri.parse(OSMAND_NEW_DEVICE_URL), nightMode);
|
||||
}
|
||||
});
|
||||
cardsContainer = mainView.findViewById(R.id.cards_container);
|
||||
|
||||
setFormatStrings();
|
||||
return mainView;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onResume() {
|
||||
super.onResume();
|
||||
updateCards();
|
||||
}
|
||||
|
||||
private void updateCards() {
|
||||
MapActivity mapActivity = getMapActivity();
|
||||
purchaseHelper = getInAppPurchaseHelper();
|
||||
if (isPaidVersion) {
|
||||
MapActivity mapActivity = getMapActivity();
|
||||
if (getMapActivity() != null && purchaseHelper != null) {
|
||||
ViewGroup subscriptionsCardContainer = mainView.findViewById(R.id.subscriptions_card_container);
|
||||
subscriptionsCardContainer.removeAllViews();
|
||||
subscriptionsCard = new SubscriptionsCard(mapActivity, purchaseHelper);
|
||||
subscriptionsCardContainer.addView(subscriptionsCard.build(mapActivity));
|
||||
}
|
||||
setupSupportRegion();
|
||||
cardsContainer.removeAllViews();
|
||||
if (mapActivity == null || purchaseHelper == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
boolean hasSubscriptions = !Algorithms.isEmpty(purchaseHelper.getEverMadeSubscriptions());
|
||||
if (hasSubscriptions) {
|
||||
subscriptionsCard = new SubscriptionsCard(mapActivity, this, purchaseHelper);
|
||||
cardsContainer.addView(subscriptionsCard.build(mapActivity));
|
||||
}
|
||||
|
||||
cardsContainer.addView(new TroubleshootingOrPurchasingCard(mapActivity, purchaseHelper, isPaidVersion)
|
||||
.build(mapActivity));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -175,95 +124,10 @@ public class PurchasesFragment extends BaseOsmAndFragment implements InAppPurcha
|
|||
public void onViewStateRestored(@Nullable Bundle savedInstanceState) {
|
||||
super.onViewStateRestored(savedInstanceState);
|
||||
if (savedInstanceState != null) {
|
||||
savedInstanceState.getBoolean(KEY_IS_SUBSCRIBER);
|
||||
isPaidVersion = savedInstanceState.getBoolean(KEY_IS_SUBSCRIBER);
|
||||
}
|
||||
}
|
||||
|
||||
private void setSubscriptionClick(final MapActivity mapActivity) {
|
||||
LinearLayout reportContainer = mainView.findViewById(R.id.report_container);
|
||||
reportContainer.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
Intent intent = new Intent(mapActivity, OsmLiveActivity.class);
|
||||
intent.addFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT);
|
||||
if (mapActivity != null) {
|
||||
mapActivity.startActivity(intent);
|
||||
}
|
||||
}
|
||||
});
|
||||
LinearLayout liveUpdatesContainer = mainView.findViewById(R.id.live_updates_container);
|
||||
liveUpdatesContainer.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
FragmentActivity activity = getActivity();
|
||||
if (activity != null) {
|
||||
LiveUpdatesFragmentNew.showInstance(activity.getSupportFragmentManager(), PurchasesFragment.this);
|
||||
}
|
||||
}
|
||||
});
|
||||
getSkuAppId();
|
||||
LinearLayout manageSubscriptionContainer = mainView.findViewById(R.id.manage_subscription_container);
|
||||
manageSubscriptionContainer.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
Intent intent = new Intent(Intent.ACTION_VIEW);
|
||||
intent.setData(Uri.parse(url));
|
||||
if (AndroidUtils.isIntentSafe(context, intent)) {
|
||||
startActivity(intent);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
private void setupSupportRegion() {
|
||||
String region = getSupportRegionName(app, purchaseHelper);
|
||||
String header = getSupportRegionHeader(app, region);
|
||||
TextView supportRegionHeader = mainView.findViewById(R.id.support_region_header);
|
||||
TextView supportRegion = mainView.findViewById(R.id.support_region);
|
||||
supportRegionHeader.setText(header);
|
||||
supportRegion.setText(region);
|
||||
|
||||
View supportRegionContainer = mainView.findViewById(R.id.support_region_container);
|
||||
supportRegionContainer.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
CountrySelectionFragment countryCountrySelectionFragment = countrySelectionFragment;
|
||||
countryCountrySelectionFragment.show(getChildFragmentManager(), CountrySelectionFragment.TAG);
|
||||
}
|
||||
});
|
||||
|
||||
countrySelectionFragment.initCountries(app);
|
||||
}
|
||||
|
||||
public static String getSupportRegionName(OsmandApplication app, InAppPurchaseHelper purchaseHelper) {
|
||||
OsmandSettings settings = app.getSettings();
|
||||
String countryName = settings.BILLING_USER_COUNTRY.get();
|
||||
if (purchaseHelper != null) {
|
||||
InAppSubscription monthlyPurchased = purchaseHelper.getPurchasedMonthlyLiveUpdates();
|
||||
if (monthlyPurchased != null && monthlyPurchased.isDonationSupported()) {
|
||||
if (Algorithms.isEmpty(countryName)) {
|
||||
if (OsmandSettings.BILLING_USER_DONATION_NONE_PARAMETER.equals(settings.BILLING_USER_COUNTRY_DOWNLOAD_NAME.get())) {
|
||||
countryName = app.getString(R.string.osmand_team);
|
||||
} else {
|
||||
countryName = app.getString(R.string.shared_string_world);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
countryName = app.getString(R.string.osmand_team);
|
||||
}
|
||||
} else {
|
||||
countryName = app.getString(R.string.osmand_team);
|
||||
}
|
||||
return countryName;
|
||||
}
|
||||
|
||||
public static String getSupportRegionHeader(OsmandApplication app, String supportRegion) {
|
||||
return supportRegion.equals(app.getString(R.string.osmand_team)) ?
|
||||
app.getString(R.string.default_buttons_support) :
|
||||
app.getString(R.string.osm_live_support_region);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public InAppPurchaseHelper getInAppPurchaseHelper() {
|
||||
Activity activity = getActivity();
|
||||
|
@ -303,69 +167,21 @@ public class PurchasesFragment extends BaseOsmAndFragment implements InAppPurcha
|
|||
appbar.addView(toolbar);
|
||||
}
|
||||
|
||||
public void setFormatStrings() {
|
||||
TextView contactSupportLink = mainView.findViewById(R.id.contact_support_title);
|
||||
TextView supportDescription = mainView.findViewById(R.id.support_link_title);
|
||||
|
||||
SpannableString spannableStringSupport = new SpannableString(getString(R.string.contact_support));
|
||||
spannableStringSupport.setSpan(new URLSpan(EMAIL_DEEPLINK_URI), 0, spannableStringSupport.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
|
||||
|
||||
String supportDescriptionString = getString(R.string.contact_support_description, OSMAND_EMAIL);
|
||||
SpannableString spannableStringMail = new SpannableString(supportDescriptionString);
|
||||
int startIndex = supportDescriptionString.indexOf(OSMAND_EMAIL);
|
||||
int endIndex = startIndex + OSMAND_EMAIL.length();
|
||||
StyleSpan boldSpan = new StyleSpan(Typeface.BOLD);
|
||||
spannableStringMail.setSpan(boldSpan, startIndex, endIndex, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
|
||||
|
||||
contactSupportLink.setText(spannableStringSupport);
|
||||
supportDescription.setText(spannableStringMail);
|
||||
|
||||
AndroidUtils.removeLinkUnderline(contactSupportLink);
|
||||
|
||||
contactSupportLink.setMovementMethod(LinkMovementMethod.getInstance());
|
||||
}
|
||||
|
||||
private void getSkuAppId() {
|
||||
InAppPurchaseHelper purchaseHelper = app.getInAppPurchaseHelper();
|
||||
if (purchaseHelper != null && purchaseHelper.getFullVersion() != null) {
|
||||
String sku = purchaseHelper.getFullVersion().getSku();
|
||||
url = String.format(PLAY_STORE_SUBSCRIPTION_DEEPLINK_URL,
|
||||
sku, context.getPackageName());
|
||||
} else {
|
||||
url = PLAY_STORE_SUBSCRIPTION_URL;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSearchResult(CountryItem selectedCountryItem) {
|
||||
String countryName = selectedCountryItem != null ? selectedCountryItem.getLocalName() : "";
|
||||
String countryDownloadName = selectedCountryItem != null ?
|
||||
selectedCountryItem.getDownloadName() : OsmandSettings.BILLING_USER_DONATION_WORLD_PARAMETER;
|
||||
|
||||
OsmandApplication app = getMyApplication();
|
||||
if (app != null) {
|
||||
TextView supportRegionHeader = mainView.findViewById(R.id.support_region_header);
|
||||
TextView supportRegion = mainView.findViewById(R.id.support_region);
|
||||
supportRegionHeader.setText(getSupportRegionHeader(app, countryName));
|
||||
supportRegion.setText(countryName);
|
||||
app.getSettings().BILLING_USER_COUNTRY.set(countryName);
|
||||
app.getSettings().BILLING_USER_COUNTRY_DOWNLOAD_NAME.set(countryDownloadName);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(InAppPurchaseHelper.InAppPurchaseTaskType taskType, String error) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onGetItems() {
|
||||
if (subscriptionsCard != null) {
|
||||
subscriptionsCard.update();
|
||||
if (app != null) {
|
||||
isPaidVersion = Version.isPaidVersion(app);
|
||||
}
|
||||
updateCards();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onItemPurchased(String sku, boolean active) {
|
||||
isPaidVersion = true;
|
||||
if (purchaseHelper != null) {
|
||||
purchaseHelper.requestInventory();
|
||||
}
|
||||
|
@ -379,7 +195,14 @@ public class PurchasesFragment extends BaseOsmAndFragment implements InAppPurcha
|
|||
public void dismissProgress(InAppPurchaseHelper.InAppPurchaseTaskType taskType) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSearchResult(CountrySelectionFragment.CountryItem name) {
|
||||
if (subscriptionsCard != null) {
|
||||
subscriptionsCard.onSupportRegionSelected(name);
|
||||
}
|
||||
}
|
||||
|
||||
private MapActivity getMapActivity() {
|
||||
return (MapActivity) getActivity();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,121 +1,146 @@
|
|||
package net.osmand.plus.settings.fragments;
|
||||
|
||||
import android.os.Build;
|
||||
import android.view.LayoutInflater;
|
||||
import android.content.Intent;
|
||||
import android.net.Uri;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.TextView;
|
||||
|
||||
import net.osmand.AndroidUtils;
|
||||
import net.osmand.Period;
|
||||
import net.osmand.plus.R;
|
||||
import net.osmand.plus.UiUtilities;
|
||||
import net.osmand.plus.activities.MapActivity;
|
||||
import net.osmand.plus.chooseplan.ChoosePlanDialogFragment;
|
||||
import net.osmand.plus.helpers.AndroidUiHelper;
|
||||
import net.osmand.plus.inapp.InAppPurchaseHelper;
|
||||
import net.osmand.plus.inapp.InAppPurchases.InAppSubscription;
|
||||
import net.osmand.plus.inapp.InAppPurchases.InAppSubscription.SubscriptionState;
|
||||
import net.osmand.plus.liveupdates.CountrySelectionFragment;
|
||||
import net.osmand.plus.liveupdates.LiveUpdatesFragment;
|
||||
import net.osmand.plus.liveupdates.LiveUpdatesFragmentNew;
|
||||
import net.osmand.plus.liveupdates.OsmLiveActivity;
|
||||
import net.osmand.plus.routepreparationmenu.cards.BaseCard;
|
||||
import net.osmand.plus.settings.backend.OsmandSettings;
|
||||
import net.osmand.util.Algorithms;
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Calendar;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.fragment.app.Fragment;
|
||||
|
||||
public class SubscriptionsCard extends BaseCard {
|
||||
|
||||
private final InAppPurchaseHelper purchaseHelper;
|
||||
private static final String PLAY_STORE_SUBSCRIPTION_URL = "https://play.google.com/store/account/subscriptions";
|
||||
private static final String PLAY_STORE_SUBSCRIPTION_DEEPLINK_URL = "https://play.google.com/store/account/subscriptions?sku=%s&package=%s";
|
||||
|
||||
private final SimpleDateFormat dateFormat;
|
||||
private Fragment target;
|
||||
private CountrySelectionFragment countrySelectionFragment = new CountrySelectionFragment();
|
||||
private SubscriptionsListCard subscriptionsListCard;
|
||||
|
||||
private InAppPurchaseHelper purchaseHelper;
|
||||
|
||||
@Override
|
||||
public int getCardLayoutId() {
|
||||
return R.layout.subscriptions_card;
|
||||
}
|
||||
|
||||
public SubscriptionsCard(@NonNull MapActivity mapActivity, @NonNull InAppPurchaseHelper purchaseHelper) {
|
||||
public SubscriptionsCard(@NonNull MapActivity mapActivity, @NonNull Fragment target, @NonNull InAppPurchaseHelper purchaseHelper) {
|
||||
super(mapActivity);
|
||||
this.target = target;
|
||||
this.purchaseHelper = purchaseHelper;
|
||||
this.dateFormat = new SimpleDateFormat("MMM d, yyyy", Locale.getDefault());
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void updateContent() {
|
||||
if (purchaseHelper == null || Algorithms.isEmpty(purchaseHelper.getEverMadeSubscriptions())) {
|
||||
AndroidUiHelper.updateVisibility(view, false);
|
||||
return;
|
||||
} else {
|
||||
AndroidUiHelper.updateVisibility(view, true);
|
||||
}
|
||||
|
||||
LayoutInflater inflater = UiUtilities.getInflater(mapActivity, nightMode);
|
||||
((ViewGroup) view).removeAllViews();
|
||||
updateSubscriptionsListCard();
|
||||
setupSupportRegion();
|
||||
|
||||
List<InAppSubscription> subscriptions = purchaseHelper.getEverMadeSubscriptions();
|
||||
for (int i = 0; i < subscriptions.size(); i++) {
|
||||
InAppSubscription subscription = subscriptions.get(i);
|
||||
SubscriptionState state = subscription.getState();
|
||||
boolean autoRenewed = state == SubscriptionState.ACTIVE || state == SubscriptionState.IN_GRACE_PERIOD;
|
||||
|
||||
View card = inflater.inflate(R.layout.subscription_layout, null, false);
|
||||
((ViewGroup) view).addView(card);
|
||||
|
||||
TextView subscriptionPeriod = card.findViewById(R.id.subscription_type);
|
||||
String period = app.getString(subscription.getPeriodTypeString());
|
||||
if (!Algorithms.isEmpty(period)) {
|
||||
subscriptionPeriod.setText(period);
|
||||
AndroidUiHelper.updateVisibility(subscriptionPeriod, true);
|
||||
LinearLayout reportContainer = view.findViewById(R.id.report_container);
|
||||
reportContainer.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
Intent intent = new Intent(mapActivity, OsmLiveActivity.class);
|
||||
intent.addFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT);
|
||||
mapActivity.startActivity(intent);
|
||||
}
|
||||
});
|
||||
|
||||
if (autoRenewed) {
|
||||
TextView nextBillingDate = card.findViewById(R.id.next_billing_date);
|
||||
String date = getHumanDate(subscription.getPurchaseTime(), subscription.getSubscriptionPeriod());
|
||||
if (!Algorithms.isEmpty(date)) {
|
||||
nextBillingDate.setText(app.getString(R.string.next_billing_date, date));
|
||||
AndroidUiHelper.updateVisibility(nextBillingDate, true);
|
||||
}
|
||||
} else {
|
||||
View renewContainer = card.findViewById(R.id.renewContainer);
|
||||
AndroidUiHelper.updateVisibility(renewContainer, true);
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
|
||||
AndroidUtils.setBackground(mapActivity, renewContainer, nightMode, R.drawable.ripple_light, R.drawable.ripple_dark);
|
||||
} else {
|
||||
AndroidUtils.setBackground(mapActivity, renewContainer, nightMode, R.drawable.btn_unstroked_light, R.drawable.btn_unstroked_dark);
|
||||
}
|
||||
final String sku = subscription.getSku();
|
||||
renewContainer.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
ChoosePlanDialogFragment.subscribe(app, mapActivity, purchaseHelper, sku);
|
||||
}
|
||||
});
|
||||
|
||||
View renew = card.findViewById(R.id.renew);
|
||||
AndroidUtils.setBackground(mapActivity, renew, nightMode,
|
||||
R.drawable.btn_solid_border_light, R.drawable.btn_solid_border_dark);
|
||||
LinearLayout liveUpdatesContainer = view.findViewById(R.id.live_updates_container);
|
||||
liveUpdatesContainer.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
LiveUpdatesFragmentNew.showInstance(mapActivity.getSupportFragmentManager(), target);
|
||||
}
|
||||
});
|
||||
|
||||
TextView status = card.findViewById(R.id.status);
|
||||
status.setText(app.getString(state.getStringRes()));
|
||||
AndroidUtils.setBackground(status, app.getUIUtilities().getIcon(state.getBackgroundRes()));
|
||||
final String subscriptionUrl = getSubscriptionUrl();
|
||||
LinearLayout manageSubscriptionContainer = view.findViewById(R.id.manage_subscription_container);
|
||||
manageSubscriptionContainer.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
Intent intent = new Intent(Intent.ACTION_VIEW);
|
||||
intent.setData(Uri.parse(subscriptionUrl));
|
||||
if (AndroidUtils.isIntentSafe(mapActivity, intent)) {
|
||||
target.startActivity(intent);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
int dividerLayout = i + 1 == subscriptions.size() ? R.layout.simple_divider_item : R.layout.divider_half_item;
|
||||
View divider = inflater.inflate(dividerLayout, (ViewGroup) view, false);
|
||||
((ViewGroup) view).addView(divider);
|
||||
public void updateSubscriptionsListCard() {
|
||||
if (subscriptionsListCard == null) {
|
||||
ViewGroup subscriptionsListContainer = view.findViewById(R.id.subscriptions_list_container);
|
||||
subscriptionsListContainer.removeAllViews();
|
||||
subscriptionsListCard = new SubscriptionsListCard(mapActivity, purchaseHelper);
|
||||
subscriptionsListContainer.addView(subscriptionsListCard.build(mapActivity));
|
||||
} else {
|
||||
subscriptionsListCard.update();
|
||||
}
|
||||
}
|
||||
|
||||
private String getHumanDate(long time, Period period) {
|
||||
if (period == null || period.getUnit() == null) {
|
||||
return "";
|
||||
private void setupSupportRegion() {
|
||||
String region = LiveUpdatesFragment.getSupportRegionName(app, purchaseHelper);
|
||||
String header = LiveUpdatesFragment.getSupportRegionHeader(app, region);
|
||||
TextView supportRegionHeader = view.findViewById(R.id.support_region_header);
|
||||
TextView supportRegion = view.findViewById(R.id.support_region);
|
||||
supportRegionHeader.setText(header);
|
||||
supportRegion.setText(region);
|
||||
|
||||
View supportRegionContainer = view.findViewById(R.id.support_region_container);
|
||||
supportRegionContainer.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
CountrySelectionFragment countryCountrySelectionFragment = countrySelectionFragment;
|
||||
countryCountrySelectionFragment.show(target.getChildFragmentManager(), CountrySelectionFragment.TAG);
|
||||
}
|
||||
});
|
||||
|
||||
countrySelectionFragment.initCountries(app);
|
||||
}
|
||||
|
||||
private String getSubscriptionUrl() {
|
||||
InAppPurchaseHelper purchaseHelper = app.getInAppPurchaseHelper();
|
||||
if (purchaseHelper != null && purchaseHelper.getFullVersion() != null) {
|
||||
String sku = purchaseHelper.getFullVersion().getSku();
|
||||
return String.format(PLAY_STORE_SUBSCRIPTION_DEEPLINK_URL,
|
||||
sku, mapActivity.getPackageName());
|
||||
} else {
|
||||
return PLAY_STORE_SUBSCRIPTION_URL;
|
||||
}
|
||||
Date date = new Date(time);
|
||||
Calendar calendar = Calendar.getInstance();
|
||||
calendar.setTime(date);
|
||||
calendar.add(period.getUnit().getCalendarIdx(), period.getNumberOfUnits());
|
||||
date = calendar.getTime();
|
||||
return dateFormat.format(date);
|
||||
}
|
||||
|
||||
public void onSupportRegionSelected(CountrySelectionFragment.CountryItem selectedCountryItem) {
|
||||
String countryName = selectedCountryItem != null ? selectedCountryItem.getLocalName() : "";
|
||||
String countryDownloadName = selectedCountryItem != null ?
|
||||
selectedCountryItem.getDownloadName() : OsmandSettings.BILLING_USER_DONATION_WORLD_PARAMETER;
|
||||
|
||||
TextView supportRegionHeader = view.findViewById(R.id.support_region_header);
|
||||
TextView supportRegion = view.findViewById(R.id.support_region);
|
||||
supportRegionHeader.setText(LiveUpdatesFragment.getSupportRegionHeader(app, countryName));
|
||||
supportRegion.setText(countryName);
|
||||
app.getSettings().BILLING_USER_COUNTRY.set(countryName);
|
||||
app.getSettings().BILLING_USER_COUNTRY_DOWNLOAD_NAME.set(countryDownloadName);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,124 @@
|
|||
package net.osmand.plus.settings.fragments;
|
||||
|
||||
import android.os.Build;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.TextView;
|
||||
|
||||
import net.osmand.AndroidUtils;
|
||||
import net.osmand.Period;
|
||||
import net.osmand.plus.R;
|
||||
import net.osmand.plus.UiUtilities;
|
||||
import net.osmand.plus.activities.MapActivity;
|
||||
import net.osmand.plus.chooseplan.ChoosePlanDialogFragment;
|
||||
import net.osmand.plus.helpers.AndroidUiHelper;
|
||||
import net.osmand.plus.inapp.InAppPurchaseHelper;
|
||||
import net.osmand.plus.inapp.InAppPurchases.InAppSubscription;
|
||||
import net.osmand.plus.inapp.InAppPurchases.InAppSubscription.SubscriptionState;
|
||||
import net.osmand.plus.routepreparationmenu.cards.BaseCard;
|
||||
import net.osmand.util.Algorithms;
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Calendar;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
public class SubscriptionsListCard extends BaseCard {
|
||||
|
||||
private final InAppPurchaseHelper purchaseHelper;
|
||||
|
||||
private final SimpleDateFormat dateFormat;
|
||||
|
||||
@Override
|
||||
public int getCardLayoutId() {
|
||||
return R.layout.subscriptions_list_card;
|
||||
}
|
||||
|
||||
public SubscriptionsListCard(@NonNull MapActivity mapActivity, @NonNull InAppPurchaseHelper purchaseHelper) {
|
||||
super(mapActivity);
|
||||
this.purchaseHelper = purchaseHelper;
|
||||
this.dateFormat = new SimpleDateFormat("MMM d, yyyy", Locale.getDefault());
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void updateContent() {
|
||||
if (purchaseHelper == null || Algorithms.isEmpty(purchaseHelper.getEverMadeSubscriptions())) {
|
||||
AndroidUiHelper.updateVisibility(view, false);
|
||||
return;
|
||||
} else {
|
||||
AndroidUiHelper.updateVisibility(view, true);
|
||||
}
|
||||
|
||||
LayoutInflater inflater = UiUtilities.getInflater(mapActivity, nightMode);
|
||||
((ViewGroup) view).removeAllViews();
|
||||
|
||||
List<InAppSubscription> subscriptions = purchaseHelper.getEverMadeSubscriptions();
|
||||
for (int i = 0; i < subscriptions.size(); i++) {
|
||||
InAppSubscription subscription = subscriptions.get(i);
|
||||
SubscriptionState state = subscription.getState();
|
||||
boolean autoRenewed = state == SubscriptionState.ACTIVE || state == SubscriptionState.IN_GRACE_PERIOD;
|
||||
|
||||
View card = inflater.inflate(R.layout.subscription_layout, null, false);
|
||||
((ViewGroup) view).addView(card);
|
||||
|
||||
TextView subscriptionPeriod = card.findViewById(R.id.subscription_type);
|
||||
String period = app.getString(subscription.getPeriodTypeString());
|
||||
if (!Algorithms.isEmpty(period)) {
|
||||
subscriptionPeriod.setText(period);
|
||||
AndroidUiHelper.updateVisibility(subscriptionPeriod, true);
|
||||
}
|
||||
|
||||
if (autoRenewed) {
|
||||
TextView nextBillingDate = card.findViewById(R.id.next_billing_date);
|
||||
String date = getHumanDate(subscription.getPurchaseTime(), subscription.getSubscriptionPeriod());
|
||||
if (!Algorithms.isEmpty(date)) {
|
||||
nextBillingDate.setText(app.getString(R.string.next_billing_date, date));
|
||||
AndroidUiHelper.updateVisibility(nextBillingDate, true);
|
||||
}
|
||||
} else {
|
||||
View renewContainer = card.findViewById(R.id.renewContainer);
|
||||
AndroidUiHelper.updateVisibility(renewContainer, true);
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
|
||||
AndroidUtils.setBackground(mapActivity, renewContainer, nightMode, R.drawable.ripple_light, R.drawable.ripple_dark);
|
||||
} else {
|
||||
AndroidUtils.setBackground(mapActivity, renewContainer, nightMode, R.drawable.btn_unstroked_light, R.drawable.btn_unstroked_dark);
|
||||
}
|
||||
final String sku = subscription.getSku();
|
||||
renewContainer.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
ChoosePlanDialogFragment.subscribe(app, mapActivity, purchaseHelper, sku);
|
||||
}
|
||||
});
|
||||
|
||||
View renew = card.findViewById(R.id.renew);
|
||||
AndroidUtils.setBackground(mapActivity, renew, nightMode,
|
||||
R.drawable.btn_solid_border_light, R.drawable.btn_solid_border_dark);
|
||||
}
|
||||
|
||||
TextView status = card.findViewById(R.id.status);
|
||||
status.setText(app.getString(state.getStringRes()));
|
||||
AndroidUtils.setBackground(status, app.getUIUtilities().getIcon(state.getBackgroundRes()));
|
||||
|
||||
int dividerLayout = i + 1 == subscriptions.size() ? R.layout.simple_divider_item : R.layout.divider_half_item;
|
||||
View divider = inflater.inflate(dividerLayout, (ViewGroup) view, false);
|
||||
((ViewGroup) view).addView(divider);
|
||||
}
|
||||
}
|
||||
|
||||
private String getHumanDate(long time, Period period) {
|
||||
if (period == null || period.getUnit() == null) {
|
||||
return "";
|
||||
}
|
||||
Date date = new Date(time);
|
||||
Calendar calendar = Calendar.getInstance();
|
||||
calendar.setTime(date);
|
||||
calendar.add(period.getUnit().getCalendarIdx(), period.getNumberOfUnits());
|
||||
date = calendar.getTime();
|
||||
return dateFormat.format(date);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,126 @@
|
|||
package net.osmand.plus.settings.fragments;
|
||||
|
||||
import android.graphics.Typeface;
|
||||
import android.net.Uri;
|
||||
import android.os.Build;
|
||||
import android.text.Spannable;
|
||||
import android.text.SpannableString;
|
||||
import android.text.Spanned;
|
||||
import android.text.method.LinkMovementMethod;
|
||||
import android.text.style.StyleSpan;
|
||||
import android.text.style.URLSpan;
|
||||
import android.view.View;
|
||||
import android.widget.TextView;
|
||||
|
||||
import net.osmand.AndroidUtils;
|
||||
import net.osmand.plus.R;
|
||||
import net.osmand.plus.activities.MapActivity;
|
||||
import net.osmand.plus.chooseplan.ChoosePlanDialogFragment;
|
||||
import net.osmand.plus.inapp.InAppPurchaseHelper;
|
||||
import net.osmand.plus.routepreparationmenu.cards.BaseCard;
|
||||
import net.osmand.plus.wikipedia.WikipediaDialogFragment;
|
||||
|
||||
import androidx.annotation.IdRes;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.cardview.widget.CardView;
|
||||
import androidx.core.content.ContextCompat;
|
||||
|
||||
public class TroubleshootingOrPurchasingCard extends BaseCard {
|
||||
|
||||
private static final String OSMAND_NEW_DEVICE_URL = "https://docs.osmand.net/en/main@latest/osmand/purchases#new-device--new-account";
|
||||
private static final String OSMAND_EMAIL = "support@osmand.net";
|
||||
private static final String EMAIL_DEEPLINK_URI = "mailto:support@osmand.net";
|
||||
|
||||
protected InAppPurchaseHelper purchaseHelper;
|
||||
|
||||
private final boolean isPaidVersion;
|
||||
|
||||
@Override
|
||||
public int getCardLayoutId() {
|
||||
return isPaidVersion ? R.layout.troubleshooting_card : R.layout.no_purchases_card;
|
||||
}
|
||||
|
||||
public TroubleshootingOrPurchasingCard(@NonNull MapActivity mapActivity, @NonNull InAppPurchaseHelper purchaseHelper, boolean isPaidVersion) {
|
||||
super(mapActivity);
|
||||
this.purchaseHelper = purchaseHelper;
|
||||
this.isPaidVersion = isPaidVersion;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void updateContent() {
|
||||
setupRestorePurchasesBtn(R.id.restore_purchases);
|
||||
setupNewDeviceOrAccountBtn(R.id.new_device_account_container);
|
||||
setupSupportDescription();
|
||||
setupContactUsLink();
|
||||
|
||||
if (!isPaidVersion) {
|
||||
TextView infoDescription = view.findViewById(R.id.info_description);
|
||||
String restorePurchases = app.getString(R.string.restore_purchases);
|
||||
String infoPurchases = String.format(app.getString(R.string.empty_purchases_description), restorePurchases);
|
||||
infoDescription.setText(infoPurchases);
|
||||
|
||||
View osmandLive = view.findViewById(R.id.osmand_live);
|
||||
osmandLive.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
ChoosePlanDialogFragment.showDialogInstance(getMyApplication(),
|
||||
mapActivity.getSupportFragmentManager(),
|
||||
ChoosePlanDialogFragment.ChoosePlanDialogType.OSM_LIVE);
|
||||
}
|
||||
});
|
||||
|
||||
CardView getItButtonContainer = view.findViewById(R.id.card_view);
|
||||
int colorRes = nightMode ? R.color.switch_button_active_dark : R.color.switch_button_active_light;
|
||||
getItButtonContainer.setCardBackgroundColor(ContextCompat.getColor(mapActivity, colorRes));
|
||||
|
||||
View getItButton = view.findViewById(R.id.card_container);
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
|
||||
AndroidUtils.setBackground(mapActivity, getItButton, nightMode, R.drawable.ripple_light, R.drawable.ripple_dark);
|
||||
} else {
|
||||
AndroidUtils.setBackground(mapActivity, getItButton, nightMode, R.drawable.btn_unstroked_light, R.drawable.btn_unstroked_dark);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected void setupRestorePurchasesBtn(@IdRes int btnId) {
|
||||
View purchasesRestore = view.findViewById(btnId);
|
||||
purchasesRestore.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
if (purchaseHelper != null) {
|
||||
purchaseHelper.requestInventory();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
protected void setupNewDeviceOrAccountBtn(@IdRes int btnId) {
|
||||
View newDeviceAccountContainer = view.findViewById(btnId);
|
||||
newDeviceAccountContainer.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
WikipediaDialogFragment.showFullArticle(mapActivity, Uri.parse(OSMAND_NEW_DEVICE_URL), nightMode);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
protected void setupSupportDescription() {
|
||||
TextView supportDescription = view.findViewById(R.id.support_link_title);
|
||||
String supportDescriptionString = app.getString(R.string.contact_support_description, OSMAND_EMAIL);
|
||||
SpannableString spannableStringMail = new SpannableString(supportDescriptionString);
|
||||
int startIndex = supportDescriptionString.indexOf(OSMAND_EMAIL);
|
||||
int endIndex = startIndex + OSMAND_EMAIL.length();
|
||||
StyleSpan boldSpan = new StyleSpan(Typeface.BOLD);
|
||||
spannableStringMail.setSpan(boldSpan, startIndex, endIndex, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
|
||||
supportDescription.setText(spannableStringMail);
|
||||
}
|
||||
|
||||
protected void setupContactUsLink() {
|
||||
TextView contactSupportLink = view.findViewById(R.id.contact_support_title);
|
||||
SpannableString spannableStringSupport = new SpannableString(app.getString(R.string.contact_support));
|
||||
spannableStringSupport.setSpan(new URLSpan(EMAIL_DEEPLINK_URI), 0, spannableStringSupport.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
|
||||
contactSupportLink.setText(spannableStringSupport);
|
||||
AndroidUtils.removeLinkUnderline(contactSupportLink);
|
||||
contactSupportLink.setMovementMethod(LinkMovementMethod.getInstance());
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue