Skip to content

Commit 094fe38

Browse files
authored
Merge pull request #61 from JLindemann42/development
Development
2 parents bae485a + fb4dbd8 commit 094fe38

11 files changed

Lines changed: 260 additions & 256 deletions

File tree

app/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ android {
2121
applicationId "com.jlindemann.science"
2222
minSdkVersion 24
2323
targetSdkVersion 35
24-
versionCode 108
24+
versionCode 111
2525
versionName "3.0.0"
2626
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
2727
}

app/src/main/AndroidManifest.xml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
<?xml version="1.0" encoding="utf-8"?>
2-
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
2+
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
3+
xmlns:tools="http://schemas.android.com/tools">
34

45
<uses-permission android:name="android.permission.INTERNET" />
56
<uses-permission android:name="com.android.vending.BILLING" />
@@ -9,12 +10,11 @@
910
android:icon="@mipmap/ic_launcher_blue"
1011
android:label="@string/app_name"
1112
android:roundIcon="@mipmap/ic_launcher_blue_round"
12-
android:supportsRtl="true"
13+
android:supportsRtl="false"
14+
tools:replace="android:supportsRtl"
1315
android:theme="@style/AppTheme">
1416

1517
<receiver android:name=".ShortCommandWidget">
16-
17-
1818
<meta-data
1919
android:name="android.appwidget.provider"
2020
android:resource="@xml/short_command_widget_info" />

app/src/main/java/com/jlindemann/science/activities/CalculatorActivity.kt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,9 @@ class CalculatorActivity : BaseActivity() {
6060
setContentView(R.layout.activity_calculator)
6161
findViewById<FrameLayout>(R.id.view_cal).systemUiVisibility = View.SYSTEM_UI_FLAG_LAYOUT_STABLE or View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
6262

63-
findViewById<ImageButton>(R.id.back_btn_cal).setOnClickListener { this.onBackPressed() }
63+
findViewById<ImageButton>(R.id.back_btn_cal).setOnClickListener {
64+
this.onBackPressed()
65+
}
6466

6567
// Initialize SharedPreferences
6668
sharedPreferences = getSharedPreferences("CalculatorPrefs", Context.MODE_PRIVATE)

app/src/main/java/com/jlindemann/science/activities/settings/ProActivity.kt

Lines changed: 21 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -82,8 +82,6 @@ class ProActivity : BaseActivity(), BillingClientStateListener {
8282
setContentView(R.layout.activity_pro_v2)
8383
findViewById<FrameLayout>(R.id.view_pro).systemUiVisibility = View.SYSTEM_UI_FLAG_LAYOUT_STABLE or View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
8484

85-
checkSale()
86-
8785
findViewById<ImageButton>(R.id.back_btn_pro).setOnClickListener {
8886
this.onBackPressed()
8987
}
@@ -136,7 +134,7 @@ class ProActivity : BaseActivity(), BillingClientStateListener {
136134
}
137135
}
138136
}
139-
}
137+
}
140138
initBillingClient(purchasesUpdateListener)
141139
}
142140

@@ -190,11 +188,22 @@ class ProActivity : BaseActivity(), BillingClientStateListener {
190188
BillingClient.BillingResponseCode.OK -> {
191189
if (productDetailsResult.productDetailsList?.isNotEmpty() == true) {
192190
productDetailList.addAll(productDetailsResult.productDetailsList!!)
191+
updateProTextPrice() // Update the price text here
193192
}
194193
}
195194
}
196195
}
197196

197+
private fun updateProTextPrice() {
198+
val proText = findViewById<TextView>(R.id.pro_price)
199+
if (productDetailList.isNotEmpty()) {
200+
val price = productDetailList[0].oneTimePurchaseOfferDetails?.formattedPrice
201+
proText.text = price ?: "Price not available"
202+
} else {
203+
proText.text = "Price not available"
204+
}
205+
}
206+
198207
private fun queryPurchases() {
199208
queryPurchases(BillingClient.ProductType.INAPP)
200209
}
@@ -257,32 +266,6 @@ class ProActivity : BaseActivity(), BillingClientStateListener {
257266
}
258267
}
259268

260-
private fun checkSale() {
261-
val saleStartDate = SimpleDateFormat("yyyy/MM/dd").parse(getString(R.string.next_sale_start)) //Back to school sale
262-
val saleEndDate = SimpleDateFormat("yyyy/MM/dd").parse(getString(R.string.next_sale_end)) //Back to school sale
263-
val calendar = Calendar.getInstance(TimeZone.getDefault())
264-
val date = calendar.time
265-
val proText = findViewById<TextView>(R.id.pro_price)
266-
val proDiscText = findViewById<TextView>(R.id.pro_price_discount)
267-
268-
if (date > saleStartDate) {
269-
//Set new attributes for DonateBtn
270-
proText.text = "1.79 USD"
271-
proText.setTextColor(getColorStateList(R.color.orange))
272-
proDiscText.visibility = View.VISIBLE
273-
proDiscText.paintFlags = Paint.STRIKE_THRU_TEXT_FLAG
274-
}
275-
276-
if (date > saleEndDate) {
277-
Timer().schedule(2) {
278-
proText.text = "1.99 USD"
279-
proDiscText.visibility = View.GONE
280-
}
281-
}
282-
else {
283-
}
284-
}
285-
286269
private fun launchBillingFlow(productDetails: ProductDetails) {
287270
try {
288271
val productDetailsParamsList =
@@ -304,7 +287,7 @@ class ProActivity : BaseActivity(), BillingClientStateListener {
304287
val proPref = ProVersion(this@ProActivity)
305288
var proPrefValue = proPref.getValue()
306289
}
307-
}
290+
}
308291
}
309292
catch (e: IOException) {
310293
ToastUtil.showToast(this, "Try again")
@@ -327,20 +310,16 @@ class ProActivity : BaseActivity(), BillingClientStateListener {
327310
}
328311

329312
override fun onApplySystemInsets(top: Int, bottom: Int, left: Int, right: Int) {
330-
val params = findViewById<FrameLayout>(R.id.common_title_back_pro).layoutParams as ViewGroup.LayoutParams
331-
params.height = top + resources.getDimensionPixelSize(R.dimen.title_bar)
332-
findViewById<FrameLayout>(R.id.common_title_back_pro).layoutParams = params
313+
val params = findViewById<FrameLayout>(R.id.common_title_back_pro).layoutParams as ViewGroup.LayoutParams
314+
params.height = top + resources.getDimensionPixelSize(R.dimen.title_bar)
315+
findViewById<FrameLayout>(R.id.common_title_back_pro).layoutParams = params
333316

334-
findViewById<LinearLayout>(R.id.pro_linear).setPadding(0, top, 0, 0)
317+
findViewById<LinearLayout>(R.id.pro_linear).setPadding(0, top, 0, 0)
335318

336-
val params2 = findViewById<FrameLayout>(R.id.pro_purschase_box).layoutParams as ViewGroup.LayoutParams
337-
params2.height = bottom + resources.getDimensionPixelSize(R.dimen.nav_bar)
338-
findViewById<FrameLayout>(R.id.pro_purschase_box).layoutParams = params2
319+
val params2 = findViewById<FrameLayout>(R.id.pro_purschase_box).layoutParams as ViewGroup.LayoutParams
320+
params2.height = bottom + resources.getDimensionPixelSize(R.dimen.nav_bar)
321+
findViewById<FrameLayout>(R.id.pro_purschase_box).layoutParams = params2
339322

340323
}
341324

342-
}
343-
344-
345-
346-
325+
}
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<ripple xmlns:android="http://schemas.android.com/apk/res/android"
3+
android:color="?attr/actionMenuTextColor">
4+
<item
5+
android:id="@android:id/mask"
6+
android:gravity="center">
7+
<shape android:shape="rectangle">
8+
<solid android:color="?attr/rippleColor"/>
9+
<corners android:radius="24dp"/>
10+
</shape>
11+
</item>
12+
</ripple>

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

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@
7272
android:focusableInTouchMode="true"
7373
android:hint="Formula:"
7474
android:imeOptions="actionSearch"
75-
android:inputType="text"
75+
android:inputType="textNoSuggestions"
7676
android:maxLines="1"
7777
android:paddingStart="18dp"
7878
android:paddingEnd="68dp"
@@ -178,6 +178,17 @@
178178
android:layout_margin="@dimen/margin"
179179
android:textColor="?attr/colorOnSurface"/>
180180

181+
<TextView
182+
android:id="@+id/no_fav_text"
183+
android:layout_width="match_parent"
184+
android:layout_height="wrap_content"
185+
android:textSize="14sp"
186+
android:textAlignment="center"
187+
android:visibility="gone"
188+
android:text="Currently no favorites"
189+
android:layout_margin="@dimen/margin"
190+
android:textColor="?attr/colorOnSurface"/>
191+
181192
<TextView
182193
android:id="@+id/pro_button_cal"
183194
android:layout_width="wrap_content"
@@ -190,7 +201,7 @@
190201
android:backgroundTint="?attr/colorPrimary"
191202
android:clickable="true"
192203
android:focusable="true"
193-
android:foreground="@drawable/toast_card_ripple"
204+
android:foreground="@drawable/toast_ripple"
194205
android:gravity="center"
195206
android:paddingStart="24dp"
196207
android:paddingEnd="24dp"

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

Lines changed: 57 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -9,63 +9,6 @@
99
android:background="?attr/backgroundColor"
1010
android:layout_height="match_parent">
1111

12-
<FrameLayout
13-
android:id="@+id/common_title_back_fav"
14-
android:layout_width="match_parent"
15-
android:layout_height="56dp"
16-
android:elevation="1dp"
17-
android:background="?attr/colorSurface"
18-
android:gravity="center|center_vertical"
19-
android:orientation="horizontal"
20-
app:layout_constraintTop_toTopOf="parent">
21-
22-
<FrameLayout
23-
android:id="@+id/common_title_back_fav_color"
24-
android:layout_width="match_parent"
25-
android:layout_height="match_parent"
26-
android:background="?attr/colorPrimary"
27-
android:alpha="0.11"/>
28-
29-
<LinearLayout
30-
android:gravity="bottom"
31-
android:layout_width="match_parent"
32-
android:layout_height="match_parent"
33-
android:orientation="vertical">
34-
35-
<FrameLayout
36-
android:id="@+id/title_box"
37-
android:layout_width="match_parent"
38-
android:layout_height="56dp">
39-
40-
<ImageButton
41-
android:id="@+id/back_btn_fav"
42-
style="?android:attr/borderlessButtonStyle"
43-
android:layout_width="56dp"
44-
android:layout_height="56dp"
45-
android:layout_gravity="center_vertical"
46-
android:rotation="180"
47-
android:elevation="2dp"
48-
app:tint="?attr/colorOnSecondaryContainer"
49-
android:src="@drawable/ic_arrow_back_whit" />
50-
51-
<TextView
52-
android:id="@+id/favorite_set_title"
53-
android:layout_width="wrap_content"
54-
android:layout_marginStart="70dp"
55-
android:alpha="0.9"
56-
android:layout_height="56dp"
57-
android:gravity="center"
58-
android:paddingStart="0dp"
59-
android:paddingEnd="0dp"
60-
android:text="@string/favorite_settings_title"
61-
android:textAlignment="center"
62-
android:textColor="?attr/colorOnSecondaryContainer"
63-
android:textSize="20sp"
64-
android:textStyle="normal" />
65-
</FrameLayout>
66-
</LinearLayout>
67-
</FrameLayout>
68-
6912
<ScrollView
7013
android:id="@+id/fav_set_scroll"
7114
android:layout_width="match_parent"
@@ -688,4 +631,61 @@
688631

689632
</LinearLayout>
690633
</ScrollView>
634+
635+
<FrameLayout
636+
android:id="@+id/common_title_back_fav"
637+
android:layout_width="match_parent"
638+
android:layout_height="56dp"
639+
android:elevation="1dp"
640+
android:background="?attr/colorSurface"
641+
android:gravity="center|center_vertical"
642+
android:orientation="horizontal"
643+
app:layout_constraintTop_toTopOf="parent">
644+
645+
<FrameLayout
646+
android:id="@+id/common_title_back_fav_color"
647+
android:layout_width="match_parent"
648+
android:layout_height="match_parent"
649+
android:background="?attr/colorPrimary"
650+
android:alpha="0.11"/>
651+
652+
<LinearLayout
653+
android:gravity="bottom"
654+
android:layout_width="match_parent"
655+
android:layout_height="match_parent"
656+
android:orientation="vertical">
657+
658+
<FrameLayout
659+
android:id="@+id/title_box"
660+
android:layout_width="match_parent"
661+
android:layout_height="56dp">
662+
663+
<ImageButton
664+
android:id="@+id/back_btn_fav"
665+
style="?android:attr/borderlessButtonStyle"
666+
android:layout_width="56dp"
667+
android:layout_height="56dp"
668+
android:layout_gravity="center_vertical"
669+
android:rotation="180"
670+
android:elevation="2dp"
671+
app:tint="?attr/colorOnSecondaryContainer"
672+
android:src="@drawable/ic_arrow_back_whit" />
673+
674+
<TextView
675+
android:id="@+id/favorite_set_title"
676+
android:layout_width="wrap_content"
677+
android:layout_marginStart="70dp"
678+
android:alpha="0.9"
679+
android:layout_height="56dp"
680+
android:gravity="center"
681+
android:paddingStart="0dp"
682+
android:paddingEnd="0dp"
683+
android:text="@string/favorite_settings_title"
684+
android:textAlignment="center"
685+
android:textColor="?attr/colorOnSecondaryContainer"
686+
android:textSize="20sp"
687+
android:textStyle="normal" />
688+
</FrameLayout>
689+
</LinearLayout>
690+
</FrameLayout>
691691
</androidx.constraintlayout.widget.ConstraintLayout>

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

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,8 @@
8282

8383
<HorizontalScrollView
8484
android:layout_width="match_parent"
85-
android:layout_height="wrap_content">
85+
android:layout_height="wrap_content"
86+
android:paddingBottom="40dp">
8687

8788
<LinearLayout
8889
android:layout_width="wrap_content"
@@ -380,7 +381,7 @@
380381
android:layout_height="wrap_content"
381382
android:layout_gravity="center_vertical"
382383
android:layout_marginStart="30dp"
383-
android:text="1.99 USD"
384+
android:text="pro_price"
384385
android:textColor="?attr/colorPrimary"
385386
android:textSize="18sp"
386387
android:textStyle="bold" />
@@ -393,7 +394,7 @@
393394
android:layout_marginStart="30dp"
394395
android:layout_marginTop="28dp"
395396
android:layout_marginBottom="8dp"
396-
android:text="1.99 USD"
397+
android:text="pro_price_discount"
397398
android:textColor="?attr/colorPrimary"
398399
android:textSize="12sp"
399400
android:textStyle="bold"

0 commit comments

Comments
 (0)