Merge remote-tracking branch 'origin/master'

This commit is contained in:
Weblate 2016-01-27 10:30:51 +01:00
commit 0f572bf33e
8 changed files with 69 additions and 17 deletions

View file

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

View file

@ -0,0 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_pressed="true"><shape android:shape="rectangle">
<solid android:color="@color/map_widget_dark_pressed" />
<corners android:radius="@dimen/map_button_rect_rad" />
</shape></item>
<item><shape android:shape="rectangle">
<solid android:color="@color/fab_color_pressed" />
<corners android:radius="@dimen/map_button_rect_rad" />
</shape></item>
</selector>

View file

@ -13,7 +13,7 @@
android:id="@+id/subscription_banner"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/osmand_orange"
android:background="@drawable/bg_card_orange"
android:orientation="vertical"
android:paddingBottom="8dp"
android:paddingLeft="24dp"
@ -60,7 +60,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="@color/color_white"
android:background="@drawable/btn_round_transparent"
android:background="@drawable/btn_round_shade"
android:text="@string/shared_string_read_more"/>
<Button
@ -69,7 +69,7 @@
android:layout_height="wrap_content"
android:layout_marginLeft="32dp"
android:textColor="@color/color_white"
android:background="@drawable/btn_round_transparent"
android:background="@drawable/btn_round_shade"
android:text="@string/osm_live_subscribe_btn"/>
</LinearLayout>
</LinearLayout>

View file

@ -63,6 +63,7 @@
android:layout_gravity="center_vertical"
android:layout_marginLeft="16dp"
android:layout_marginRight="16dp"
android:paddingLeft="2dp"
android:hint="@string/shared_string_email_address"
android:inputType="textEmailAddress"/>
@ -72,6 +73,7 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:paddingLeft="2dp"
android:layout_marginLeft="72dp"
android:layout_marginRight="16dp"
android:text="@string/osm_live_email_desc"
@ -103,6 +105,7 @@
android:layout_gravity="center_vertical"
android:layout_marginLeft="16dp"
android:layout_marginRight="16dp"
android:paddingLeft="2dp"
android:hint="@string/osm_live_user_public_name"
android:inputType="text"/>
@ -117,6 +120,7 @@
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"/>
@ -148,6 +152,8 @@
android:layout_marginLeft="16dp"
android:layout_marginRight="16dp"
android:layout_marginTop="4dp"
android:paddingLeft="2dp"
android:paddingRight="0dp"
android:drawableRight="@drawable/ic_action_arrow_drop_down"
android:editable="false"
android:hint="@string/osm_live_support_region"/>

View file

@ -41,14 +41,9 @@ public class InAppHelper {
private static boolean mSubscribedToLiveUpdates = false;
private static String mLiveUpdatesPrice;
public static final String SKU_LIVE_UPDATES = "osm_live_subscription_1";
// Static test
//public static final String SKU_LIVE_UPDATES = "android.test.purchased";
//public static final String SKU_LIVE_UPDATES = "android.test.canceled";
//public static final String SKU_LIVE_UPDATES = "android.test.refunded";
//public static final String SKU_LIVE_UPDATES = "android.test.item_unavailable";
private static final String SKU_LIVE_UPDATES_FULL = "osm_live_subscription_2";
private static final String SKU_LIVE_UPDATES_FREE = "osm_free_live_subscription_2";
private static String SKU_LIVE_UPDATES;
// (arbitrary) request code for the purchase flow
private static final int RC_REQUEST = 10001;
@ -80,9 +75,20 @@ public class InAppHelper {
return mLiveUpdatesPrice;
}
public static String getSkuLiveUpdates() {
return SKU_LIVE_UPDATES;
}
public InAppHelper(OsmandApplication ctx, InAppCallbacks callbacks) {
this.ctx = ctx;
this.callbacks = callbacks;
if (SKU_LIVE_UPDATES == null) {
if (Version.isFreeVersion(ctx)) {
SKU_LIVE_UPDATES = SKU_LIVE_UPDATES_FREE;
} else {
SKU_LIVE_UPDATES = SKU_LIVE_UPDATES_FULL;
}
}
}
public void start(final boolean stopAfterResult) {
@ -110,7 +116,7 @@ public class InAppHelper {
mHelper = new IabHelper(ctx, base64EncodedPublicKey);
// enable debug logging (for a production application, you should set this to false).
mHelper.enableDebugLogging(true);
mHelper.enableDebugLogging(false);
// Start setup. This is asynchronous and the specified listener
// will be called once setup completes.
@ -401,7 +407,7 @@ public class InAppHelper {
}
private String sendRequest(String url, Map<String, String> parameters, String userOperation) {
Log.d(TAG, "Sending request " + url); //$NON-NLS-1$
Log.d(TAG, "Sending request " + url);
HttpURLConnection connection = null;
try {
connection = NetworkUtils.getHttpURLConnection(url);

View file

@ -78,7 +78,6 @@ public class LiveUpdatesFragment extends BaseOsmAndFragment {
Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.fragment_live_updates, container, false);
listView = (ExpandableListView) view.findViewById(android.R.id.list);
// View header = inflater.inflate(R.layout.live_updates_header, listView, false);
View bottomShadowView = inflater.inflate(R.layout.shadow_bottom, listView, false);
listView.addFooterView(bottomShadowView);

View file

@ -172,7 +172,7 @@ public class SubscriptionFragment extends BaseOsmAndDialogFragment implements In
@Override
public void onItemPurchased(String sku) {
if (InAppHelper.SKU_LIVE_UPDATES.equals(sku)) {
if (InAppHelper.getSkuLiveUpdates().equals(sku)) {
Fragment parentFragment = getParentFragment();
if (parentFragment instanceof LiveUpdatesFragment) {
((LiveUpdatesFragment) parentFragment).updateSubscriptionBanner();
@ -190,6 +190,7 @@ public class SubscriptionFragment extends BaseOsmAndDialogFragment implements In
dlg = new ProgressDialog(getActivity());
dlg.setTitle("");
dlg.setMessage(getString(R.string.wait_current_task_finished));
dlg.setCancelable(false);
dlg.show();
}

View file

@ -76,6 +76,8 @@ public class MapContextMenuFragment extends Fragment implements DownloadEvents {
private int menuBottomViewHeight;
private int menuFullHeight;
private int menuFullHeightMax;
private int menuTopViewHeightExcludingTitle;
private int menuTitleTopBottomPadding;
private int screenHeight;
private int viewHeight;
@ -717,8 +719,19 @@ public class MapContextMenuFragment extends Fragment implements DownloadEvents {
menuFullHeight = view.findViewById(R.id.context_menu_main).getHeight();
int dy = 0;
if (!menu.isLandscapeLayout() && menuTopViewHeight != 0) {
dy = Math.max(0, newMenuTopViewHeight - menuTopViewHeight - (newMenuTopShadowAllHeight - menuTopShadowAllHeight));
if (!menu.isLandscapeLayout()) {
TextView line1 = (TextView) view.findViewById(R.id.context_menu_line1);
if (menuTopViewHeight != 0) {
int titleHeight = line1.getLineCount() * line1.getLineHeight() + menuTitleTopBottomPadding;
if (titleHeight < line1.getMeasuredHeight()) {
titleHeight = line1.getMeasuredHeight();
}
newMenuTopViewHeight = menuTopViewHeightExcludingTitle + titleHeight;
dy = Math.max(0, newMenuTopViewHeight - menuTopViewHeight - (newMenuTopShadowAllHeight - menuTopShadowAllHeight));
} else {
menuTopViewHeightExcludingTitle = newMenuTopViewHeight - line1.getMeasuredHeight();
menuTitleTopBottomPadding = line1.getMeasuredHeight() - line1.getLineCount() * line1.getLineHeight();
}
}
menuTopViewHeight = newMenuTopViewHeight;
menuTopShadowAllHeight = newMenuTopShadowAllHeight;