AppLinksFragment: Support opening amazon appstore links

Signed-off-by: Aayush Gupta <aayushgupta219@gmail.com>
This commit is contained in:
Aayush Gupta
2023-09-18 15:23:06 +05:30
parent 29dc3692d2
commit dbcc05f675
4 changed files with 57 additions and 1 deletions

View File

@@ -21,11 +21,13 @@ class AppLinksFragment : Fragment(R.layout.fragment_app_links) {
private val playStoreDomain = "play.google.com"
private val marketDomain = "market.android.com"
private val amazonAppStoreDomain = "www.amazon.com"
// AppLink buttons
private var buttons = mapOf(
playStoreDomain to binding.playStoreButton,
marketDomain to binding.marketButton
marketDomain to binding.marketButton,
amazonAppStoreDomain to binding.amazonAppStoreButton
)
private val startForResult =

View File

@@ -125,4 +125,49 @@
android:layout_marginStart="@dimen/margin_small"
android:text="@string/action_enable" />
</RelativeLayout>
<RelativeLayout
android:id="@+id/amazonAppStoreLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginHorizontal="@dimen/margin_normal"
android:layout_marginVertical="@dimen/margin_large"
android:background="@drawable/bg_outlined_padded"
android:orientation="horizontal"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/marketLayout">
<androidx.appcompat.widget.AppCompatTextView
android:id="@+id/amazonAppStoreTitle"
style="@style/AuroraTextStyle.Subtitle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_toStartOf="@id/amazonAppStoreButton"
android:text="@string/app_link_amazon_appstore"
android:textSize="18sp"
android:textStyle="bold" />
<androidx.appcompat.widget.AppCompatTextView
android:id="@+id/amazonAppStoreDesc"
style="@style/AuroraTextStyle.Line1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/amazonAppStoreTitle"
android:layout_alignStart="@id/amazonAppStoreTitle"
android:layout_alignEnd="@id/amazonAppStoreTitle"
android:layout_marginTop="@dimen/margin_xxsmall"
android:maxLines="5"
android:text="@string/amazon_appstore_desc" />
<com.google.android.material.button.MaterialButton
android:id="@+id/amazonAppStoreButton"
style="@style/Widget.Material3.Button.TextButton.Dialog.Flush"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:layout_centerVertical="true"
android:layout_marginStart="@dimen/margin_small"
android:text="@string/action_enable" />
</RelativeLayout>
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@@ -315,6 +315,13 @@
android:name="packageName"
android:defaultValue=""
app:argType="string" />
<!-- Amazon Appstore -->
<deepLink
app:action="android.intent.action.VIEW"
app:uri="amzn://apps/android?p={packageName}" />
<deepLink
app:action="android.intent.action.VIEW"
app:uri="www.amazon.com/gp/mas/dl/android?p={packageName}" />
<!-- Android Market (deprecated) -->
<deepLink
app:action="android.intent.action.VIEW"

View File

@@ -380,4 +380,6 @@
<string name="google_play_store_desc">Google Play, also known as the Google Play Store and formerly Android Market.</string>
<string name="app_link_android_market" translatable="false">market.android.com</string>
<string name="android_market_desc">Android Market was an online store offering software applications designed for Android devices, retired in 2017.</string>
<string name="app_link_amazon_appstore" translatable="false">www.amazon.com</string>
<string name="amazon_appstore_desc">Amazon Appstore is an app store for Android-compatible platforms operated by Amazon.</string>
</resources>