Changed osm live subscription form
This commit is contained in:
parent
09a7f13702
commit
9116cdb093
5 changed files with 354 additions and 195 deletions
|
@ -15,17 +15,17 @@
|
|||
|
||||
<ImageButton
|
||||
android:id="@+id/closeButton"
|
||||
android:contentDescription="@string/shared_string_close"
|
||||
style="@style/Widget.AppCompat.Button.Borderless"
|
||||
android:layout_width="52dp"
|
||||
android:layout_height="52dp"
|
||||
android:contentDescription="@string/shared_string_close"
|
||||
android:src="@drawable/ic_action_remove_dark"/>
|
||||
|
||||
<net.osmand.plus.widgets.TextViewEx
|
||||
android:id="@+id/titleTextView"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="16dp"
|
||||
android:layout_marginLeft="20dp"
|
||||
android:text="@string/osm_live_subscription"
|
||||
android:textColor="@color/color_white"
|
||||
android:textSize="@dimen/default_list_text_size_large"
|
||||
|
@ -52,132 +52,242 @@
|
|||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:minHeight="56dp"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/emailIcon"
|
||||
android:layout_width="56dp"
|
||||
android:layout_height="48dp"
|
||||
android:scaleType="center"
|
||||
android:src="@drawable/ic_action_message"/>
|
||||
|
||||
<EditText
|
||||
android:id="@+id/emailEdit"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_marginLeft="16dp"
|
||||
android:layout_marginRight="16dp"
|
||||
android:hint="@string/shared_string_email_address"
|
||||
android:inputType="textEmailAddress"
|
||||
android:paddingLeft="2dp"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_marginLeft="72dp"
|
||||
android:layout_marginRight="16dp"
|
||||
android:paddingLeft="2dp"
|
||||
android:text="@string/osm_live_email_desc"
|
||||
android:textColor="?android:attr/textColorSecondary"/>
|
||||
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="?attr/bg_color"
|
||||
android:orientation="vertical">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:minHeight="56dp"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/userNameIcon"
|
||||
android:layout_width="56dp"
|
||||
android:layout_height="48dp"
|
||||
android:scaleType="center"
|
||||
android:src="@drawable/ic_person"/>
|
||||
|
||||
<EditText
|
||||
android:id="@+id/userNameEdit"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_marginLeft="16dp"
|
||||
android:layout_marginRight="16dp"
|
||||
android:hint="@string/osm_live_user_public_name"
|
||||
android:inputType="text"
|
||||
android:paddingLeft="2dp"/>
|
||||
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<CheckBox
|
||||
android:id="@+id/hideUserNameCheckbox"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="12dp"
|
||||
android:layout_marginLeft="72dp"
|
||||
android:layout_marginRight="16dp"
|
||||
android:layout_marginTop="8dp"
|
||||
android:paddingLeft="2dp"
|
||||
android:text="@string/osm_live_hide_user_name"
|
||||
android:textColor="?android:attr/textColorPrimary"/>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/headerLayout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="8dp"
|
||||
android:layout_marginTop="4dp"
|
||||
android:minHeight="56dp"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/countryIcon"
|
||||
android:layout_width="56dp"
|
||||
android:layout_height="48dp"
|
||||
android:scaleType="center"
|
||||
android:src="@drawable/ic_world_globe_dark"/>
|
||||
android:orientation="vertical"
|
||||
android:visibility="visible">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="16dp"
|
||||
android:layout_marginRight="16dp"
|
||||
android:layout_marginBottom="8dp"
|
||||
android:layout_marginTop="8dp"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingLeft="2dp"
|
||||
android:text="@string/osm_live_support_region"
|
||||
android:textColor="?android:attr/textColorSecondary"/>
|
||||
|
||||
<net.osmand.plus.widgets.AutoCompleteTextViewEx
|
||||
android:id="@+id/selectCountryEdit"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:drawableRight="@drawable/ic_action_arrow_drop_down"
|
||||
android:editable="false"
|
||||
android:paddingLeft="2dp"
|
||||
android:paddingRight="0dp"
|
||||
android:text="Ukraine"/>
|
||||
android:minHeight="56dp"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<android.support.v7.widget.AppCompatImageView
|
||||
android:layout_width="56dp"
|
||||
android:layout_height="48dp"
|
||||
android:scaleType="center"
|
||||
android:src="@drawable/ic_action_osm_live"
|
||||
android:tint="@color/osmand_orange"/>
|
||||
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="16dp"
|
||||
android:layout_marginRight="16dp"
|
||||
android:layout_marginTop="8dp"
|
||||
android:paddingLeft="2dp"
|
||||
android:text="@string/osm_live_region_desc"
|
||||
android:text="@string/osm_live_subscription_desc"
|
||||
android:textColor="?android:attr/textColorPrimary"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="8dp"
|
||||
android:layout_marginTop="4dp"
|
||||
android:minHeight="56dp"
|
||||
android:orientation="vertical">
|
||||
|
||||
<android.support.v7.widget.AppCompatCheckBox
|
||||
android:id="@+id/donationCheckbox"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="16dp"
|
||||
android:paddingLeft="34dp"
|
||||
android:text="@string/donation_to_osm"/>
|
||||
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="72dp"
|
||||
android:layout_marginRight="16dp"
|
||||
android:layout_marginTop="8dp"
|
||||
android:paddingLeft="2dp"
|
||||
android:text="@string/donation_to_osm_desc"
|
||||
android:textColor="?android:attr/textColorSecondary"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/paramsLayout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
android:visibility="gone">
|
||||
|
||||
<View
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dp"
|
||||
android:layout_marginBottom="6dp"
|
||||
android:background="?attr/dashboard_divider"/>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="8dp"
|
||||
android:layout_marginTop="4dp"
|
||||
android:minHeight="56dp"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/countryIcon"
|
||||
android:layout_width="56dp"
|
||||
android:layout_height="48dp"
|
||||
android:scaleType="center"
|
||||
android:src="@drawable/ic_world_globe_dark"/>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="16dp"
|
||||
android:layout_marginRight="16dp"
|
||||
android:layout_marginTop="8dp"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingLeft="2dp"
|
||||
android:text="@string/osm_live_support_region"
|
||||
android:textColor="?android:attr/textColorSecondary"/>
|
||||
|
||||
<net.osmand.plus.widgets.AutoCompleteTextViewEx
|
||||
android:id="@+id/selectCountryEdit"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:drawableRight="@drawable/ic_action_arrow_drop_down"
|
||||
android:editable="false"
|
||||
android:paddingLeft="2dp"
|
||||
android:paddingRight="0dp"
|
||||
android:text="Ukraine"/>
|
||||
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="8dp"
|
||||
android:paddingLeft="2dp"
|
||||
android:text="@string/osm_live_region_desc"
|
||||
android:textColor="?android:attr/textColorSecondary"/>
|
||||
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:minHeight="56dp"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/emailIcon"
|
||||
android:layout_width="56dp"
|
||||
android:layout_height="48dp"
|
||||
android:scaleType="center"
|
||||
android:src="@drawable/ic_action_message"/>
|
||||
|
||||
<EditText
|
||||
android:id="@+id/emailEdit"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_marginLeft="16dp"
|
||||
android:layout_marginRight="16dp"
|
||||
android:hint="@string/shared_string_email_address"
|
||||
android:inputType="textEmailAddress"
|
||||
android:paddingLeft="2dp"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_marginLeft="72dp"
|
||||
android:layout_marginRight="16dp"
|
||||
android:paddingLeft="2dp"
|
||||
android:text="@string/osm_live_email_desc"
|
||||
android:textColor="?android:attr/textColorSecondary"/>
|
||||
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:minHeight="56dp"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/userNameIcon"
|
||||
android:layout_width="56dp"
|
||||
android:layout_height="48dp"
|
||||
android:scaleType="center"
|
||||
android:src="@drawable/ic_person"/>
|
||||
|
||||
<EditText
|
||||
android:id="@+id/userNameEdit"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_marginLeft="16dp"
|
||||
android:layout_marginRight="16dp"
|
||||
android:hint="@string/osm_live_user_public_name"
|
||||
android:inputType="text"
|
||||
android:paddingLeft="2dp"/>
|
||||
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<CheckBox
|
||||
android:id="@+id/hideUserNameCheckbox"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="12dp"
|
||||
android:layout_marginLeft="72dp"
|
||||
android:layout_marginRight="16dp"
|
||||
android:layout_marginTop="8dp"
|
||||
android:paddingLeft="4dp"
|
||||
android:text="@string/osm_live_hide_user_name"
|
||||
android:textColor="?android:attr/textColorPrimary"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/editModeBottomView"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="16dp"
|
||||
android:layout_marginTop="16dp"
|
||||
android:visibility="gone">
|
||||
|
||||
<Button
|
||||
android:id="@+id/saveChangesButton"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="72dp"
|
||||
android:layout_marginRight="16dp"
|
||||
android:background="@drawable/btn_round_blue"
|
||||
android:paddingLeft="16dp"
|
||||
android:paddingRight="16dp"
|
||||
android:text="@string/shared_string_save_changes"
|
||||
android:textColor="@color/color_white"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
|
@ -185,99 +295,111 @@
|
|||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/editModeBottomView"
|
||||
<include layout="@layout/card_bottom_divider"/>
|
||||
|
||||
<View
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="16dp"
|
||||
android:layout_marginTop="16dp"
|
||||
android:visibility="gone">
|
||||
android:layout_height="8dp"/>
|
||||
|
||||
<Button
|
||||
android:id="@+id/saveChangesButton"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="72dp"
|
||||
android:layout_marginRight="16dp"
|
||||
android:background="@drawable/btn_round_blue"
|
||||
android:paddingLeft="16dp"
|
||||
android:paddingRight="16dp"
|
||||
android:text="@string/shared_string_save_changes"
|
||||
android:textColor="@color/color_white"/>
|
||||
|
||||
</LinearLayout>
|
||||
<include layout="@layout/card_top_divider"/>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/purchaseCard"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="8dp"
|
||||
android:background="?attr/bg_card"
|
||||
android:background="?attr/bg_color"
|
||||
android:orientation="vertical"
|
||||
android:visibility="visible">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="16dp"
|
||||
android:layout_marginTop="8dp"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<net.osmand.plus.widgets.TextViewEx
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:text="@string/osm_live_month_cost"
|
||||
android:textColor="?android:attr/textColorPrimary"
|
||||
android:textSize="@dimen/default_list_text_size_large"
|
||||
android:textStyle="bold"/>
|
||||
<android.support.v7.widget.AppCompatImageView
|
||||
android:layout_width="56dp"
|
||||
android:layout_height="48dp"
|
||||
android:scaleType="center"
|
||||
android:tint="?attr/color_dialog_buttons"
|
||||
android:src="@drawable/ic_action_foot_dark"/>
|
||||
|
||||
<net.osmand.plus.widgets.TextViewEx
|
||||
android:id="@+id/priceTextView"
|
||||
android:layout_width="wrap_content"
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="16dp"
|
||||
android:gravity="right"
|
||||
android:text="@string/osm_live_default_price"
|
||||
android:textColor="?attr/color_dialog_buttons"
|
||||
android:textSize="@dimen/default_list_text_size_large"
|
||||
android:textStyle="bold"/>
|
||||
android:layout_marginRight="16dp"
|
||||
android:orientation="vertical">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="8dp"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<net.osmand.plus.widgets.TextViewEx
|
||||
android:id="@+id/priceTextView"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="right"
|
||||
android:text="@string/osm_live_default_price"
|
||||
android:textColor="?attr/color_dialog_buttons"
|
||||
android:textSize="@dimen/default_list_text_size_large"
|
||||
android:textStyle="bold"/>
|
||||
|
||||
<net.osmand.plus.widgets.TextViewEx
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text=" - "
|
||||
android:textColor="?android:attr/textColorPrimary"
|
||||
android:textSize="@dimen/default_list_text_size_large"
|
||||
android:textStyle="bold"/>
|
||||
|
||||
<net.osmand.plus.widgets.TextViewEx
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/osm_live_month_cost"
|
||||
android:textColor="?android:attr/textColorPrimary"
|
||||
android:textSize="@dimen/default_list_text_size_large"
|
||||
android:textStyle="bold"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<net.osmand.plus.widgets.TextViewEx
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="8dp"
|
||||
android:text="@string/osm_live_payment_desc"
|
||||
android:textColor="?android:attr/textColorSecondary"
|
||||
android:textSize="@dimen/default_desc_text_size"/>
|
||||
|
||||
<android.support.v7.widget.AppCompatButton
|
||||
android:id="@+id/subscribeButton"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="16dp"
|
||||
android:layout_marginBottom="20dp"
|
||||
android:background="@drawable/blue_button_drawable"
|
||||
android:paddingBottom="4dp"
|
||||
android:paddingLeft="14dp"
|
||||
android:paddingRight="14dp"
|
||||
android:paddingTop="4dp"
|
||||
android:text="@string/osm_live_subscribe_btn"
|
||||
android:textColor="@color/color_white"
|
||||
android:visibility="visible"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<net.osmand.plus.widgets.TextViewEx
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="16dp"
|
||||
android:layout_marginRight="16dp"
|
||||
android:text="@string/osm_live_month_cost_desc"
|
||||
android:textColor="?android:attr/textColorSecondary"
|
||||
android:textSize="@dimen/default_desc_text_size"/>
|
||||
|
||||
<View
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dp"
|
||||
android:layout_marginBottom="10dp"
|
||||
android:layout_marginLeft="16dp"
|
||||
android:layout_marginRight="16dp"
|
||||
android:layout_marginTop="10dp"
|
||||
android:background="?attr/divider_color"/>
|
||||
|
||||
<Button
|
||||
android:id="@+id/subscribeButton"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="right"
|
||||
android:layout_marginBottom="10dp"
|
||||
android:layout_marginLeft="16dp"
|
||||
android:layout_marginRight="6dp"
|
||||
android:background="?attr/selectableItemBackground"
|
||||
android:paddingLeft="10dp"
|
||||
android:paddingRight="10dp"
|
||||
android:text="@string/osm_live_subscribe_btn"
|
||||
android:textColor="?attr/color_dialog_buttons"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<include layout="@layout/card_bottom_divider"/>
|
||||
|
||||
<View
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="16dp"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</ScrollView>
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
<?xml version='1.0' encoding='utf-8'?>
|
||||
<?xml version='1.0' encoding='utf-8'?>
|
||||
<resources>
|
||||
<!--
|
||||
Disclaimer:
|
||||
|
@ -9,6 +9,10 @@
|
|||
3. All your modified/created strings are in the top of the file (to make easier find what\'s translated).
|
||||
PLEASE: Have a look at http://code.google.com/p/osmand/wiki/UIConsistency, it may really improve your and our work :-) Thx - Hardy
|
||||
-->
|
||||
<string name="osm_live_payment_desc">Subscription fee will be charged each month. You can always cancel your subscription on Google Play.</string>
|
||||
<string name="donation_to_osm">Donation to OpenStreetMap community</string>
|
||||
<string name="donation_to_osm_desc">Part of your donation will be sent to OSM users who submit changes to the OpenStreetMaps. Cost of the subscription remains the same.</string>
|
||||
<string name="osm_live_subscription_desc">Subscription enables hourly, daily, weekly updates and unlimited downloads for all maps around the world.</string>
|
||||
<string name="get_it">Get it</string>
|
||||
<string name="get_for">Get for %1$s</string>
|
||||
<string name="get_for_month">Get for %1$s month</string>
|
||||
|
|
|
@ -895,11 +895,14 @@ public class OsmandSettings {
|
|||
// this value string is synchronized with settings_pref.xml preference name
|
||||
public final OsmandPreference<String> USER_NAME = new StringPreference("user_name", "").makeGlobal();
|
||||
|
||||
public static final String BILLING_USER_DONATION_WORLD_PARAMETER = "";
|
||||
public static final String BILLING_USER_DONATION_NONE_PARAMETER = "none";
|
||||
|
||||
public final OsmandPreference<String> BILLING_USER_ID = new StringPreference("billing_user_id", "").makeGlobal();
|
||||
public final OsmandPreference<String> BILLING_USER_NAME = new StringPreference("billing_user_name", "").makeGlobal();
|
||||
public final OsmandPreference<String> BILLING_USER_EMAIL = new StringPreference("billing_user_email", "").makeGlobal();
|
||||
public final OsmandPreference<String> BILLING_USER_COUNTRY = new StringPreference("billing_user_country", "").makeGlobal();
|
||||
public final OsmandPreference<String> BILLING_USER_COUNTRY_DOWNLOAD_NAME = new StringPreference("billing_user_country_download_name", "").makeGlobal();
|
||||
public final OsmandPreference<String> BILLING_USER_COUNTRY_DOWNLOAD_NAME = new StringPreference("billing_user_country_download_name", BILLING_USER_DONATION_NONE_PARAMETER).makeGlobal();
|
||||
public final OsmandPreference<Boolean> BILLING_HIDE_USER_NAME = new BooleanPreference("billing_hide_user_name", false).makeGlobal();
|
||||
public final OsmandPreference<Boolean> BILLING_PURCHASE_TOKEN_SENT = new BooleanPreference("billing_purchase_token_sent", false).makeGlobal();
|
||||
public final OsmandPreference<Boolean> LIVE_UPDATES_PURCHASED = new BooleanPreference("billing_live_updates_purchased", false).makeGlobal();
|
||||
|
|
|
@ -463,10 +463,10 @@ public class InAppHelper {
|
|||
ctx.getSettings().BILLING_USER_COUNTRY_DOWNLOAD_NAME.set(prefferedCountry);
|
||||
CountrySelectionFragment countrySelectionFragment = new CountrySelectionFragment();
|
||||
countrySelectionFragment.initCountries(ctx);
|
||||
CountryItem countryItem;
|
||||
CountryItem countryItem = null;
|
||||
if (Algorithms.isEmpty(prefferedCountry)) {
|
||||
countryItem = countrySelectionFragment.getCountryItems().get(0);
|
||||
} else {
|
||||
} else if (!prefferedCountry.equals(OsmandSettings.BILLING_USER_DONATION_NONE_PARAMETER)) {
|
||||
countryItem = countrySelectionFragment.getCountryItem(prefferedCountry);
|
||||
}
|
||||
if (countryItem != null) {
|
||||
|
|
|
@ -4,12 +4,14 @@ import android.app.Activity;
|
|||
import android.app.ProgressDialog;
|
||||
import android.os.Bundle;
|
||||
import android.support.v4.app.Fragment;
|
||||
import android.support.v7.widget.AppCompatCheckBox;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.MotionEvent;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.Button;
|
||||
import android.widget.CheckBox;
|
||||
import android.widget.CompoundButton;
|
||||
import android.widget.EditText;
|
||||
import android.widget.ImageButton;
|
||||
import android.widget.ImageView;
|
||||
|
@ -41,10 +43,12 @@ public class SubscriptionFragment extends BaseOsmAndDialogFragment implements In
|
|||
private static final String EMAIL_ID = "email_id";
|
||||
private static final String COUNTRY_ITEM_ID = "country_id";
|
||||
private static final String HIDE_USER_NAME_ID = "hide_user_name_id";
|
||||
private static final String DONATION_ID = "donation_id";
|
||||
|
||||
private OsmandSettings settings;
|
||||
private ProgressDialog dlg;
|
||||
private boolean editMode;
|
||||
private boolean donation;
|
||||
|
||||
private String prevEmail;
|
||||
private CountryItem selectedCountryItem;
|
||||
|
@ -76,6 +80,8 @@ public class SubscriptionFragment extends BaseOsmAndDialogFragment implements In
|
|||
outState.putString(EMAIL_ID, emailEdit.getText().toString());
|
||||
CheckBox hideUserNameCheckbox = (CheckBox) view.findViewById(R.id.hideUserNameCheckbox);
|
||||
outState.putBoolean(HIDE_USER_NAME_ID, hideUserNameCheckbox.isChecked());
|
||||
CheckBox donationCheckbox = (CheckBox) view.findViewById(R.id.donationCheckbox);
|
||||
outState.putBoolean(DONATION_ID, donationCheckbox.isChecked());
|
||||
if (selectedCountryItem != null) {
|
||||
outState.putSerializable(COUNTRY_ITEM_ID, selectedCountryItem);
|
||||
}
|
||||
|
@ -109,17 +115,20 @@ public class SubscriptionFragment extends BaseOsmAndDialogFragment implements In
|
|||
String email = settings.BILLING_USER_EMAIL.get();
|
||||
String countryDownloadName = settings.BILLING_USER_COUNTRY_DOWNLOAD_NAME.get();
|
||||
boolean hideUserName = settings.BILLING_HIDE_USER_NAME.get();
|
||||
donation = !countryDownloadName.equals(OsmandSettings.BILLING_USER_DONATION_NONE_PARAMETER);
|
||||
|
||||
if (savedInstanceState != null) {
|
||||
userName = savedInstanceState.getString(USER_NAME_ID);
|
||||
email = savedInstanceState.getString(EMAIL_ID);
|
||||
hideUserName = savedInstanceState.getBoolean(HIDE_USER_NAME_ID);
|
||||
donation = savedInstanceState.getBoolean(DONATION_ID);
|
||||
Object obj = savedInstanceState.getSerializable(COUNTRY_ITEM_ID);
|
||||
if (obj instanceof CountryItem) {
|
||||
selectedCountryItem = (CountryItem) obj;
|
||||
countryDownloadName = selectedCountryItem.getDownloadName();
|
||||
} else {
|
||||
countryDownloadName = "";
|
||||
countryDownloadName =
|
||||
donation ? OsmandSettings.BILLING_USER_DONATION_WORLD_PARAMETER : OsmandSettings.BILLING_USER_DONATION_NONE_PARAMETER;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -144,6 +153,20 @@ public class SubscriptionFragment extends BaseOsmAndDialogFragment implements In
|
|||
title.setText(getString(R.string.osm_live_subscription));
|
||||
}
|
||||
|
||||
final View headerLayout = view.findViewById(R.id.headerLayout);
|
||||
final View paramsLayout = view.findViewById(R.id.paramsLayout);
|
||||
AppCompatCheckBox donationCheckbox = (AppCompatCheckBox) view.findViewById(R.id.donationCheckbox);
|
||||
donationCheckbox.setChecked(donation);
|
||||
donationCheckbox.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
||||
@Override
|
||||
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
|
||||
donation = isChecked;
|
||||
paramsLayout.setVisibility(isChecked ? View.VISIBLE : View.GONE);
|
||||
}
|
||||
});
|
||||
headerLayout.setVisibility(View.VISIBLE);
|
||||
paramsLayout.setVisibility(donation ? View.VISIBLE : View.GONE);
|
||||
|
||||
final EditText userNameEdit = (EditText) view.findViewById(R.id.userNameEdit);
|
||||
if (!Algorithms.isEmpty(userName)) {
|
||||
userNameEdit.setText(userName);
|
||||
|
@ -155,7 +178,7 @@ public class SubscriptionFragment extends BaseOsmAndDialogFragment implements In
|
|||
}
|
||||
|
||||
countrySelectionFragment.initCountries(getMyApplication());
|
||||
if (Algorithms.isEmpty(countryDownloadName)) {
|
||||
if (Algorithms.isEmpty(countryDownloadName) || countryDownloadName.equals(OsmandSettings.BILLING_USER_DONATION_NONE_PARAMETER)) {
|
||||
selectedCountryItem = countrySelectionFragment.getCountryItems().get(0);
|
||||
} else {
|
||||
selectedCountryItem = countrySelectionFragment.getCountryItem(countryDownloadName);
|
||||
|
@ -297,16 +320,23 @@ public class SubscriptionFragment extends BaseOsmAndDialogFragment implements In
|
|||
}
|
||||
|
||||
private boolean applySettings(String userName, String email, boolean hideUserName) {
|
||||
String countryName = selectedCountryItem != null ? selectedCountryItem.getLocalName() : "";
|
||||
String countryDownloadName = selectedCountryItem != null ? selectedCountryItem.getDownloadName() : "";
|
||||
|
||||
if (Algorithms.isEmpty(email) || !AndroidUtils.isValidEmail(email)) {
|
||||
getMyApplication().showToastMessage(getString(R.string.osm_live_enter_email));
|
||||
return false;
|
||||
}
|
||||
if (Algorithms.isEmpty(userName) && !hideUserName) {
|
||||
getMyApplication().showToastMessage(getString(R.string.osm_live_enter_user_name));
|
||||
return false;
|
||||
String countryName;
|
||||
String countryDownloadName;
|
||||
if (!donation) {
|
||||
countryName = "";
|
||||
countryDownloadName = OsmandSettings.BILLING_USER_DONATION_NONE_PARAMETER;
|
||||
} else {
|
||||
countryName = selectedCountryItem != null ? selectedCountryItem.getLocalName() : "";
|
||||
countryDownloadName = selectedCountryItem != null ?
|
||||
selectedCountryItem.getDownloadName() : OsmandSettings.BILLING_USER_DONATION_WORLD_PARAMETER;
|
||||
if (Algorithms.isEmpty(email) || !AndroidUtils.isValidEmail(email)) {
|
||||
getMyApplication().showToastMessage(getString(R.string.osm_live_enter_email));
|
||||
return false;
|
||||
}
|
||||
if (Algorithms.isEmpty(userName) && !hideUserName) {
|
||||
getMyApplication().showToastMessage(getString(R.string.osm_live_enter_user_name));
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
settings.BILLING_USER_NAME.set(userName);
|
||||
|
|
Loading…
Reference in a new issue