Skip to content
This repository was archived by the owner on Jul 22, 2021. It is now read-only.

Commit 49c1d6e

Browse files
Add supporter badge to donation page
Signed-off-by: sunilpaulmathew <sunil.kde@gmail.com>
1 parent 0423596 commit 49c1d6e

File tree

5 files changed

+48
-15
lines changed

5 files changed

+48
-15
lines changed

app/src/main/java/com/smartpack/scriptmanager/utils/AboutActivity.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,10 @@ protected void onCreate(@Nullable Bundle savedInstanceState) {
4040
MaterialTextView mCancelButton = findViewById(R.id.cancel_button);
4141
MaterialTextView mAppTitle = findViewById(R.id.app_title);
4242
MaterialTextView mChangeLog = findViewById(R.id.changelog);
43+
44+
boolean isProUser = Utils.getBoolean("support_received", false, this) || !Utils.isNotDonated(this);
4345
mDeveloper.setOnClickListener(v -> Utils.launchUrl("https://github.com/sunilpaulmathew", this));
44-
mAppTitle.setText(getString(R.string.app_name) + " " + BuildConfig.VERSION_NAME);
46+
mAppTitle.setText(getString(R.string.app_name) + (isProUser ? " Pro " : " ") + BuildConfig.VERSION_NAME);
4547
String change_log = null;
4648
try {
4749
change_log = new JSONObject(Objects.requireNonNull(Utils.readAssetFile(

app/src/main/java/com/smartpack/scriptmanager/utils/BillingActivity.java

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,15 @@ protected void onCreate(@Nullable Bundle savedInstanceState) {
5858
setContentView(R.layout.activity_billing);
5959

6060
AppCompatImageButton mBack = findViewById(R.id.back_button);
61+
AppCompatImageButton mSupporterIcon = findViewById(R.id.supporter_button);
62+
MaterialTextView mSupporterMessage = findViewById(R.id.supporter_message);
6163
MaterialTextView mCancel = findViewById(R.id.cancel_button);
6264

65+
if (Utils.getBoolean("support_received", false, this) || !Utils.isNotDonated(this)) {
66+
mSupporterIcon.setVisibility(View.VISIBLE);
67+
mSupporterMessage.setText(getString(R.string.support_status_message));
68+
}
69+
6370
mData.add(new RecycleViewItem(getString(R.string.support_app), getResources().getDrawable(R.drawable.ic_donation_app)));
6471
mData.add(new RecycleViewItem(getString(R.string.support_coffee), getResources().getDrawable(R.drawable.ic_coffee)));
6572
mData.add(new RecycleViewItem(getString(R.string.support_meal), getResources().getDrawable(R.drawable.ic_meal)));
@@ -210,8 +217,9 @@ private void handlePurchases(Purchase purchase) {
210217
new MaterialAlertDialogBuilder(this)
211218
.setMessage(getString(R.string.support_received_message))
212219
.setPositiveButton(getString(R.string.cancel), (dialogInterface, i) -> {
213-
})
214-
.show();
220+
}).show();
221+
222+
Utils.saveBoolean("support_received", true, this);
215223
}
216224
}
217225
} catch (Exception ignored) {}
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
<vector android:height="32dp" android:tint="?attr/colorControlNormal"
2+
android:viewportHeight="24" android:viewportWidth="24"
3+
android:width="32dp" xmlns:android="http://schemas.android.com/apk/res/android">
4+
<path android:fillColor="@android:color/white" android:pathData="M12,21.35l-1.45,-1.32C5.4,15.36 2,12.28 2,8.5 2,5.42 4.42,3 7.5,3c1.74,0 3.41,0.81 4.5,2.09C13.09,3.81 14.76,3 16.5,3 19.58,3 22,5.42 22,8.5c0,3.78 -3.4,6.86 -8.55,11.54L12,21.35z"/>
5+
</vector>

app/src/main/res/layout/activity_billing.xml

Lines changed: 27 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
<LinearLayout
99
android:layout_width="match_parent"
1010
android:layout_height="match_parent"
11-
android:background="?android:attr/colorBackground"
1211
android:orientation="vertical" >
1312

1413
<LinearLayout
@@ -31,30 +30,48 @@
3130
android:layout_gravity="start"
3231
android:src="@drawable/ic_back"
3332
android:background="@color/black"
34-
android:tint="?android:attr/colorAccent"/>
33+
android:tint="?attr/colorAccent"/>
3534

3635
<com.google.android.material.textview.MaterialTextView
3736
android:layout_width="wrap_content"
3837
android:layout_height="50dp"
3938
android:layout_marginStart="50dp"
4039
android:layout_marginEnd="50dp"
4140
android:gravity="center_vertical"
42-
android:textColor="?android:attr/colorAccent"
41+
android:textColor="?attr/colorAccent"
4342
android:text="@string/support_development"
4443
android:layout_gravity="center"
4544
android:textStyle="bold"
4645
android:textSize="17sp"
4746
android:padding="10dp" />
4847
</FrameLayout>
4948

50-
<com.google.android.material.textview.MaterialTextView
49+
<LinearLayout
5150
android:layout_width="match_parent"
5251
android:layout_height="wrap_content"
53-
android:textColor="@color/white"
54-
android:text="@string/support_development_summary"
55-
android:linksClickable="true"
56-
android:gravity="center"
57-
android:padding="15dp" />
52+
android:orientation="horizontal"
53+
android:gravity="end|center_vertical"
54+
android:layout_marginStart="25dp"
55+
android:layout_marginEnd="25dp" >
56+
57+
<androidx.appcompat.widget.AppCompatImageButton
58+
android:id="@+id/supporter_button"
59+
android:layout_width="50dp"
60+
android:layout_height="50dp"
61+
android:gravity="center_vertical"
62+
android:layout_gravity="start|center"
63+
android:src="@drawable/ic_heart"
64+
android:background="@color/black"
65+
android:tint="?attr/colorAccent"
66+
android:visibility="gone" />
67+
68+
<com.google.android.material.textview.MaterialTextView
69+
android:id="@+id/supporter_message"
70+
android:layout_width="match_parent"
71+
android:layout_height="wrap_content"
72+
android:text="@string/support_development_summary"
73+
android:gravity="center" />
74+
</LinearLayout>
5875
</LinearLayout>
5976

6077
<androidx.core.widget.NestedScrollView
@@ -78,6 +95,6 @@
7895
android:textStyle="bold"
7996
android:background="@color/black"
8097
android:text="@string/cancel"
81-
android:textColor="?android:attr/colorAccent"
98+
android:textColor="?attr/colorAccent"
8299
android:textSize="18sp" />
83100
</RelativeLayout>

app/src/main/res/values/strings.xml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,14 +59,15 @@
5959
<string name="support_acknowledged">Donation Acknowledged \u2665</string>
6060
<string name="support_app">Buy Donation App</string>
6161
<string name="support_development">Support Development</string>
62-
<string name="support_development_summary">If you like to appreciate the efforts of the developer to provide this tool entirely free, please consider sending a small donation by clicking one among the below-provided options!</string>
62+
<string name="support_development_summary">If you like to appreciate the efforts of the developer to provide this tool entirely free, please consider sending a small donation by clicking one among the below-provided options! Buying any of this product will award you a supporter badge here!</string>
6363
<string name="support_dinner">Buy me a Dinner</string>
6464
<string name="support_group">Support Group</string>
6565
<string name="support_meal">Buy me a Meal</string>
6666
<string name="support_coffee">Buy me a Coffee</string>
6767
<string name="support_already_received_message">You\'re already supported the development with this item before!</string>
68-
<string name="support_received_message">Thank you very much for your support \u2665\nIt will motivate me a lot to continue my projects more active!</string>
68+
<string name="support_received_message">Thank you very much for your support \u2665\nIt will motivate me a lot to continue my projects more active! Moreover, you\'ll receive a supporter badge on the top of this page.</string>
6969
<string name="support_retry_message">Please try purchasing again!</string>
70+
<string name="support_status_message">Thank you very much for your support!</string>
7071
<string name="sure_question">Delete %s?</string>
7172
<string name="test">Test</string>
7273
<string name="testing">"Testing script… Please be patient!"</string>

0 commit comments

Comments
 (0)