Skip to content

Commit

Permalink
Bump 1.6.4, add visual indicator for subscription
Browse files Browse the repository at this point in the history
  • Loading branch information
pluscubed committed Jan 15, 2018
1 parent 6d8172e commit b69af55
Show file tree
Hide file tree
Showing 9 changed files with 52 additions and 14 deletions.
4 changes: 2 additions & 2 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@ android {
applicationId "com.pluscubed.velociraptor"
minSdkVersion 16
targetSdkVersion 27
versionCode 40
versionName "1.6.3"
versionCode 41
versionName "1.6.4"
vectorDrawables.useSupportLibrary = true
manifestPlaceholders = [appName: "@string/app_name"]
multiDexEnabled true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import com.pluscubed.velociraptor.utils.Utils
import okhttp3.OkHttpClient
import rx.Observable
import rx.schedulers.Schedulers
import timber.log.Timber
import java.util.*

class RaptorLimitProvider(context: Context, client: OkHttpClient, val limitCache: LimitCache) : LimitProvider {
Expand Down Expand Up @@ -106,6 +107,7 @@ class RaptorLimitProvider(context: Context, client: OkHttpClient, val limitCache
}
var speedLimit = raptorResponse.generalSpeedLimit!!
if (imperialWorkaround) {
Timber.d("Imperial Workaround: " + imperialWorkaround);
speedLimit = Utils.convertMphToKmh(speedLimit);
}
val response = LimitResponse.builder()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -130,13 +130,17 @@ public class SettingsActivity extends AppCompatActivity {
Spinner styleSpinner;

//Providers
@BindView(R.id.here_title)
TextView hereTitle;
@BindView(R.id.here_provider_desc)
TextView herePriceDesc;
@BindView(R.id.here_subscribe)
Button hereSubscribeButton;
@BindView(R.id.here_editdata)
Button hereEditDataButton;

@BindView(R.id.tomtom_title)
TextView tomtomTitle;
@BindView(R.id.tomtom_provider_desc)
TextView tomtomPriceDesc;
@BindView(R.id.tomtom_subscribe)
Expand Down Expand Up @@ -468,8 +472,8 @@ public void onPurchasesUpdated(List<Purchase> purchases) {
purchased.add(purchase.getSku());
}

setSubscribeButtonState(hereSubscribeButton, purchased.contains(BillingConstants.SKU_HERE));
setSubscribeButtonState(tomtomSubscribeButton, purchased.contains(BillingConstants.SKU_TOMTOM));
setSubscriptionState(hereSubscribeButton, hereTitle, purchased.contains(BillingConstants.SKU_HERE));
setSubscriptionState(tomtomSubscribeButton, tomtomTitle, purchased.contains(BillingConstants.SKU_TOMTOM));
}
});

Expand All @@ -482,13 +486,15 @@ private boolean isBillingManagerReady() {
&& billingManager.getBillingClientResponseCode() == BillingClient.BillingResponse.OK;
}

private void setSubscribeButtonState(Button button, boolean subscribed) {
private void setSubscriptionState(Button button, TextView title, boolean subscribed) {
if (subscribed) {
button.setEnabled(false);
button.setText(R.string.subscribed);
title.setCompoundDrawablesWithIntrinsicBounds(0, 0, R.drawable.ic_done_green_20dp, 0);
} else {
button.setEnabled(true);
button.setText(R.string.subscribe);
title.setCompoundDrawablesWithIntrinsicBounds(0, 0, R.drawable.ic_cross_red_20dp, 0);
}
}

Expand Down
9 changes: 9 additions & 0 deletions app/src/main/res/drawable/ic_cross_red_20dp.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="20dp"
android:height="20dp"
android:viewportHeight="24.0"
android:viewportWidth="24.0">
<path
android:fillColor="#f44336"
android:pathData="M19,6.41L17.59,5 12,10.59 6.41,5 5,6.41 10.59,12 5,17.59 6.41,19 12,13.41 17.59,19 19,17.59 13.41,12z" />
</vector>
9 changes: 9 additions & 0 deletions app/src/main/res/drawable/ic_done_green_20dp.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="20dp"
android:height="20dp"
android:viewportHeight="24.0"
android:viewportWidth="24.0">
<path
android:fillColor="#4caf50"
android:pathData="M9,16.2L4.8,12l-1.4,1.4L9,19 21,7l-1.4,-1.4L9,16.2z" />
</vector>
14 changes: 11 additions & 3 deletions app/src/main/res/layout/activity_settings_providers.xml
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,10 @@
android:paddingTop="16dp">

<TextView
android:layout_width="match_parent"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:drawablePadding="8dp"
android:drawableRight="@drawable/ic_done_green_20dp"
android:paddingEnd="8dp"
android:paddingRight="8dp"
android:text="@string/openstreetmap"
Expand Down Expand Up @@ -125,8 +127,11 @@
android:paddingTop="16dp">

<TextView
android:layout_width="match_parent"
android:id="@+id/tomtom_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:drawablePadding="8dp"
android:drawableRight="@drawable/ic_cross_red_20dp"
android:paddingEnd="8dp"
android:paddingRight="8dp"
android:text="@string/tomtom_provider"
Expand Down Expand Up @@ -203,8 +208,11 @@
android:paddingTop="16dp">

<TextView
android:layout_width="match_parent"
android:id="@+id/here_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:drawablePadding="8dp"
android:drawableRight="@drawable/ic_cross_red_20dp"
android:paddingEnd="8dp"
android:paddingRight="8dp"
android:text="@string/here_provider"
Expand Down
6 changes: 6 additions & 0 deletions app/src/main/res/raw/changelog.html
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,12 @@
</style>
</head>
<body>
<h4>v1.6.4 - 1/14/18</h4>
<ul>
<li>Fix mph speed limits from HERE & TomTom</li>
</ul>
<br />

<h4>v1.6.3 - 1/13/18</h4>
<ul>
<li>Add terms of use</li>
Expand Down
9 changes: 4 additions & 5 deletions app/src/main/res/raw/third_party_license_metadata
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,7 @@
70269:46 leakcanary-analyzer
70317:46 haha
70365:46 leakcanary-watcher
70413:46 leakcanary-android-no-op
70461:46 kotlin-annotation-processing-gradle
70509:46 kotlin-compiler-embeddable
70557:46 kotlin-reflect
70605:46 kotlin-script-runtime
70413:46 kotlin-annotation-processing-gradle
70461:46 kotlin-compiler-embeddable
70509:46 kotlin-reflect
70557:46 kotlin-script-runtime
1 change: 0 additions & 1 deletion app/src/main/res/raw/third_party_licenses
Original file line number Diff line number Diff line change
Expand Up @@ -1347,4 +1347,3 @@ http://www.apache.org/licenses/LICENSE-2.0.txt
http://www.apache.org/licenses/LICENSE-2.0.txt
http://www.apache.org/licenses/LICENSE-2.0.txt
http://www.apache.org/licenses/LICENSE-2.0.txt
http://www.apache.org/licenses/LICENSE-2.0.txt

0 comments on commit b69af55

Please sign in to comment.