Skip to content

Commit

Permalink
Merge pull request #819 from g-maxime/android-34
Browse files Browse the repository at this point in the history
GUI: Android update
  • Loading branch information
JeromeMartinez authored Apr 3, 2024
2 parents 8ecc3c7 + b536289 commit 72f9df1
Show file tree
Hide file tree
Showing 5 changed files with 55 additions and 12 deletions.
6 changes: 4 additions & 2 deletions Source/GUI/Android/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,11 @@
-->
<manifest
xmlns:android="http://schemas.android.com/apk/res/android">

<uses-permission android:name="com.android.vending.BILLING" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.READ_MEDIA_IMAGES" />
<uses-permission android:name="android.permission.READ_MEDIA_VIDEO" />
<uses-permission android:name="android.permission.READ_MEDIA_AUDIO" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" android:maxSdkVersion="32" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" android:maxSdkVersion="20" />

<application
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,17 @@ class ReportListActivity : AppCompatActivity(), ReportActivityListener {

private fun handleUri(uri: Uri) {
if (uri.scheme == "file") {
if (Build.VERSION.SDK_INT >= 23) {
if (Build.VERSION.SDK_INT >= 33) {
if (checkSelfPermission(android.Manifest.permission.READ_MEDIA_IMAGES) != PackageManager.PERMISSION_GRANTED ||
checkSelfPermission(android.Manifest.permission.READ_MEDIA_VIDEO) != PackageManager.PERMISSION_GRANTED ||
checkSelfPermission(android.Manifest.permission.READ_MEDIA_AUDIO) != PackageManager.PERMISSION_GRANTED) {
pendingFileUris.add(uri)
ActivityCompat.requestPermissions(this@ReportListActivity,
arrayOf(android.Manifest.permission.READ_MEDIA_IMAGES, android.Manifest.permission.READ_MEDIA_VIDEO, android.Manifest.permission.READ_MEDIA_AUDIO),
READ_EXTERNAL_STORAGE_PERMISSION_REQUEST)
return
}
} else if (Build.VERSION.SDK_INT >= 23) {
if (checkSelfPermission(android.Manifest.permission.READ_EXTERNAL_STORAGE) != PackageManager.PERMISSION_GRANTED) {
pendingFileUris.add(uri)
ActivityCompat.requestPermissions(this@ReportListActivity,
Expand All @@ -213,24 +223,24 @@ class ReportListActivity : AppCompatActivity(), ReportActivityListener {
val uri: Uri? = intent.data
if (uri != null) {
handleUri(uri)
intent.putExtra(OPEN_INTENT_PROCESSED, true)
}
intent.putExtra(OPEN_INTENT_PROCESSED, true)
}
Intent.ACTION_SEND -> {
val uri = intent.getParcelableExtra<Uri>(Intent.EXTRA_STREAM)
if (uri != null) {
handleUri(uri)
intent.putExtra(OPEN_INTENT_PROCESSED, true)
}
intent.putExtra(OPEN_INTENT_PROCESSED, true)
}
Intent.ACTION_SEND_MULTIPLE -> {
val uriList = intent.getParcelableArrayListExtra<Uri>(Intent.EXTRA_STREAM)
if (uriList != null) {
for (i in uriList) {
handleUri(i)
}
intent.putExtra(OPEN_INTENT_PROCESSED, true)
}
intent.putExtra(OPEN_INTENT_PROCESSED, true)
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,11 @@ class SubscribeActivity : AppCompatActivity() {
.replace("%PRICE%", subscriptionDetails.price)
activitySubscribeBinding.subscriptionDetailText.visibility = View.VISIBLE
activitySubscribeBinding.subscriptionDetailText.gravity = Gravity.CENTER_HORIZONTAL

activitySubscribeBinding.subscriptionConditionText.text = activitySubscribeBinding.subscriptionConditionText.text.toString()
.replace("%PRICE%", subscriptionDetails.price)
activitySubscribeBinding.subscriptionConditionText.visibility = View.VISIBLE
activitySubscribeBinding.subscriptionConditionText.gravity = Gravity.CENTER_HORIZONTAL
})

subscriptionManager.lifetimeDetails.observe (this, Observer {
Expand Down
22 changes: 19 additions & 3 deletions Source/GUI/Android/app/src/main/res/layout/activity_subscribe.xml
Original file line number Diff line number Diff line change
Expand Up @@ -49,14 +49,15 @@
android:textColor="@android:color/white"
android:background="@color/colorPrimary"
android:layout_gravity="center_horizontal" />

<TextView
android:id="@+id/subscription_detail_text"
android:visibility="invisible"
android:scaleX="0.6"
android:scaleY="0.6"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:visibility="invisible"
android:scaleX="0.7"
android:scaleY="0.7"
android:text="@string/subscription_detail_text" />
<View
android:layout_width="match_parent"
Expand All @@ -73,4 +74,19 @@
android:textColor="@android:color/white"
android:background="@color/colorPrimary"
android:layout_gravity="center_horizontal" />
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_margin="10dp"
android:background="?android:attr/listDivider"/>

<TextView
android:id="@+id/subscription_condition_text"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"

android:scaleX="0.7"
android:scaleY="0.7"
android:text="@string/subscription_condition_text" />
</LinearLayout>
16 changes: 13 additions & 3 deletions Source/GUI/Android/app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,21 @@
<string name="premium_summary" csv="Premium_Summary">Exclusive features for premium subscribers</string>
<string name="subscribe_title" csv="Subscribe">Subscribe</string>
<string name="subscribe_text" csv="Subscribe">Subscribe</string>
<string name="subscribe_button_text" csv="Subscribe_Button">Subscribe for %PRICE% per year</string>
<string name="lifetime_subscribe_button_text" csv="Lifetime_Subscribe_Button">Lifetime subscription for %PRICE%</string>
<string name="subscribe_button_text" csv="Subscribe_Button" formatted="false">Subscribe for %PRICE% per year</string>
<string name="lifetime_subscribe_button_text" csv="Lifetime_Subscribe_Button" formatted="false">Lifetime subscription for %PRICE%</string>
<string name="subscribed_text" csv="Subscribe_Manage">Manage subscription</string>
<string name="thanks_text" csv="Subscription_Thanks">Subscription detected. Thanks for your support!</string>
<string name="subscription_detail_text" formatted="false" csv="Subscription_Android">Free 3 days trial period.</string>
<string name="subscription_detail_text" csv="Subscription_Android">Free 3 days trial period.</string>
<string name="subscription_condition_text" formatted="false">
3-Day Free Trial Subscription:\n\n
During this trial period, you\'ll have unlimited access to all the premium features.\n\n
Please remind that we currently don\'t provide many premium features, we provide a premium offer here for giving you an easy way to show your support to our open source project.\n\n
Subscription Terms:\n\n
Duration: Your 3-day trial subscription begins as soon as you sign up for the annual subscription for the first time.\n\n
Cost: The price for the subscription is %PRICE%. This amount will be charged to your Google Play account upon the end of the trial period annually unless canceled before the end of the trial period.
Conversion: At the end of the trial period, your subscription will automatically convert to a paid subscription unless canceled before the trial ends.\n\n
Cancellation: You can cancel your subscription at any time during the trial period to avoid being charged. To cancel, simply go to your Google Play Store account settings.\n\n
</string>
<string name="store_text" csv="SupportUs">Support us. Get the dark theme and more features to come.</string>
<string name="clear_text" csv="ClearList">Clear list</string>
<string name="text_output_desc" csv="Text">Text</string>
Expand Down

0 comments on commit 72f9df1

Please sign in to comment.