update addon layouts

This commit is contained in:
Fabian Freund
2025-12-24 16:16:54 +01:00
parent bd77de00f4
commit 81611ab132
10 changed files with 87 additions and 57 deletions
+7 -6
View File
@@ -154,33 +154,34 @@
android:parentActivityName=".MainActivity" /> android:parentActivityName=".MainActivity" />
<activity <activity
android:theme="@style/Theme.AppCompat.Light" android:theme="@style/AppTheme"
android:name="eu.weblibre.flutter_mozilla_components.addons.AddonDetailsActivity" android:name="eu.weblibre.flutter_mozilla_components.addons.AddonDetailsActivity"
android:exported="false" android:exported="false"
android:label="@string/mozac_feature_addons_addons" /> android:label="@string/mozac_feature_addons_addons" />
<activity android:name="eu.weblibre.flutter_mozilla_components.addons.InstalledAddonDetailsActivity" <activity
android:name="eu.weblibre.flutter_mozilla_components.addons.InstalledAddonDetailsActivity"
android:label="@string/mozac_feature_addons_addons" android:label="@string/mozac_feature_addons_addons"
android:parentActivityName="eu.weblibre.flutter_mozilla_components.addons.AddonsActivity" android:parentActivityName="eu.weblibre.flutter_mozilla_components.addons.AddonsActivity"
android:exported="false" android:exported="false"
android:theme="@style/Theme.AppCompat.Light" /> android:theme="@style/AppTheme" />
<activity <activity
android:name="eu.weblibre.flutter_mozilla_components.addons.PermissionsDetailsActivity" android:name="eu.weblibre.flutter_mozilla_components.addons.PermissionsDetailsActivity"
android:label="@string/mozac_feature_addons_addons" android:label="@string/mozac_feature_addons_addons"
android:exported="false" android:exported="false"
android:theme="@style/Theme.AppCompat.Light" /> android:theme="@style/AppTheme" />
<activity <activity
android:name="eu.weblibre.flutter_mozilla_components.addons.AddonSettingsActivity" android:name="eu.weblibre.flutter_mozilla_components.addons.AddonSettingsActivity"
android:label="@string/mozac_feature_addons_addons" android:label="@string/mozac_feature_addons_addons"
android:exported="false" android:exported="false"
android:theme="@style/Theme.AppCompat.Light" /> android:theme="@style/AppTheme" />
<activity <activity
android:name="eu.weblibre.flutter_mozilla_components.addons.WebExtensionActionPopupActivity" android:name="eu.weblibre.flutter_mozilla_components.addons.WebExtensionActionPopupActivity"
android:label="@string/mozac_feature_addons_addons" android:label="@string/mozac_feature_addons_addons"
android:theme="@style/Theme.AppCompat.Light"/> android:theme="@style/AppTheme"/>
<receiver <receiver
android:name=".SearchBarWidgetReceiver" android:name=".SearchBarWidgetReceiver"
@@ -26,7 +26,11 @@
<item name="android:textColor">?android:attr/textColorPrimary</item> <item name="android:textColor">?android:attr/textColorPrimary</item>
</style> </style>
<style name="AddonsActivityTheme" parent="Theme.AppCompat.Light"> <style name="AppTheme" parent="Theme.Material3.DynamicColors.DayNight">
<item name="preferenceTheme">@style/PreferenceThemeOverlay</item>
</style>
<style name="AddonsActivityTheme" parent="AppTheme">
<item name="mozac_primary_text_color">@color/photonDarkGrey90</item> <item name="mozac_primary_text_color">@color/photonDarkGrey90</item>
</style> </style>
</resources> </resources>
@@ -5,17 +5,21 @@
package eu.weblibre.flutter_mozilla_components.addons package eu.weblibre.flutter_mozilla_components.addons
import android.content.Intent import android.content.Intent
import android.net.Uri import android.graphics.Color
import android.os.Bundle import android.os.Bundle
import android.view.LayoutInflater import android.view.LayoutInflater
import android.view.View import android.view.View
import android.view.ViewGroup import android.view.ViewGroup
import android.widget.TextView import android.widget.TextView
import androidx.activity.SystemBarStyle
import androidx.activity.enableEdgeToEdge
import androidx.appcompat.app.AppCompatActivity import androidx.appcompat.app.AppCompatActivity
import androidx.core.net.toUri
import androidx.recyclerview.widget.LinearLayoutManager import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView import androidx.recyclerview.widget.RecyclerView
import mozilla.components.feature.addons.Addon import mozilla.components.feature.addons.Addon
import mozilla.components.feature.addons.ui.translateName import mozilla.components.feature.addons.ui.translateName
import mozilla.components.support.ktx.android.view.setupPersistentInsets
import mozilla.components.support.utils.ext.getParcelableExtraCompat import mozilla.components.support.utils.ext.getParcelableExtraCompat
import eu.weblibre.flutter_mozilla_components.R import eu.weblibre.flutter_mozilla_components.R
@@ -25,10 +29,15 @@ private const val LEARN_MORE_URL =
/** /**
* An activity to show the permissions of an add-on. * An activity to show the permissions of an add-on.
*/ */
class PermissionsDetailsActivity : AppCompatActivity(), View.OnClickListener { class PermissionsDetailsActivity :
AppCompatActivity(),
View.OnClickListener {
override fun onCreate(savedInstanceState: Bundle?) { override fun onCreate(savedInstanceState: Bundle?) {
enableEdgeToEdge(SystemBarStyle.dark(Color.TRANSPARENT))
super.onCreate(savedInstanceState) super.onCreate(savedInstanceState)
setContentView(R.layout.activity_add_on_permissions) setContentView(R.layout.activity_add_on_permissions)
window.setupPersistentInsets()
val addon = requireNotNull( val addon = requireNotNull(
intent.getParcelableExtraCompat("add_on", Addon::class.java), intent.getParcelableExtraCompat("add_on", Addon::class.java),
) )
@@ -56,9 +65,11 @@ class PermissionsDetailsActivity : AppCompatActivity(), View.OnClickListener {
*/ */
class PermissionsAdapter( class PermissionsAdapter(
private val permissions: List<String>, private val permissions: List<String>,
) : ) : RecyclerView.Adapter<PermissionViewHolder>() {
RecyclerView.Adapter<PermissionViewHolder>() { override fun onCreateViewHolder(
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): PermissionViewHolder { parent: ViewGroup,
viewType: Int,
): PermissionViewHolder {
val context = parent.context val context = parent.context
val inflater = LayoutInflater.from(context) val inflater = LayoutInflater.from(context)
val view = inflater.inflate(R.layout.add_ons_permission_item, parent, false) val view = inflater.inflate(R.layout.add_ons_permission_item, parent, false)
@@ -71,7 +82,10 @@ class PermissionsDetailsActivity : AppCompatActivity(), View.OnClickListener {
override fun getItemCount() = permissions.size override fun getItemCount() = permissions.size
override fun onBindViewHolder(holder: PermissionViewHolder, position: Int) { override fun onBindViewHolder(
holder: PermissionViewHolder,
position: Int,
) {
val permission = permissions[position] val permission = permissions[position]
holder.textView.text = permission holder.textView.text = permission
} }
@@ -86,8 +100,7 @@ class PermissionsDetailsActivity : AppCompatActivity(), View.OnClickListener {
) : RecyclerView.ViewHolder(view) ) : RecyclerView.ViewHolder(view)
override fun onClick(v: View?) { override fun onClick(v: View?) {
val intent = val intent = Intent(Intent.ACTION_VIEW).setData(LEARN_MORE_URL.toUri())
Intent(Intent.ACTION_VIEW).setData(Uri.parse(LEARN_MORE_URL))
startActivity(intent) startActivity(intent)
} }
} }
@@ -107,15 +107,15 @@
android:layout_below="@+id/last_updated_divider" android:layout_below="@+id/last_updated_divider"
android:text="@string/mozac_feature_addons_home_page" /> android:text="@string/mozac_feature_addons_home_page" />
<androidx.appcompat.widget.AppCompatImageView <ImageView
android:id="@+id/home_page_text" android:id="@+id/home_page_text"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_below="@+id/last_updated_divider" android:layout_below="@+id/last_updated_divider"
android:layout_alignParentEnd="true" android:layout_alignParentEnd="true"
android:contentDescription="@string/mozac_feature_addons_home_page" android:contentDescription="@string/mozac_feature_addons_home_page"
app:srcCompat="@drawable/mozac_ic_link_24" android:src="@drawable/mozac_ic_link_24"
app:tint="@android:color/black" /> app:tint="@color/icons" />
<View <View
android:id="@+id/home_page_divider" android:id="@+id/home_page_divider"
@@ -1,11 +1,15 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?><!-- This Source Code Form is subject to the terms of the Mozilla Public
<!-- This Source Code Form is subject to the terms of the Mozilla Public
- License, v. 2.0. If a copy of the MPL was not distributed with this - License, v. 2.0. If a copy of the MPL was not distributed with this
- file, You can obtain one at http://mozilla.org/MPL/2.0/. --> - file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools" <androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/container"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:fitsSystemWindows="true" android:fitsSystemWindows="true" >
tools:ignore="MergeRootFrame" />
<androidx.fragment.app.FragmentContainerView
android:id="@+id/container"
android:layout_width="match_parent"
android:layout_height="match_parent" />
</androidx.constraintlayout.widget.ConstraintLayout>
@@ -4,11 +4,11 @@
- file, You can obtain one at http://mozilla.org/MPL/2.0/. --> - file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools" xmlns:tools="http://schemas.android.com/tools"
android:fitsSystemWindows="true" android:fitsSystemWindows="true"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
xmlns:app="http://schemas.android.com/apk/res-auto"
tools:context=".addons.PermissionsDetailsActivity"> tools:context=".addons.PermissionsDetailsActivity">
<androidx.recyclerview.widget.RecyclerView <androidx.recyclerview.widget.RecyclerView
@@ -21,13 +21,12 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_below="@+id/add_ons_permissions" android:layout_below="@+id/add_ons_permissions"
android:background="?attr/selectableItemBackground" app:drawableEndCompat="@drawable/mozac_ic_link_24"
android:padding="16dp" android:padding="16dp"
android:paddingStart="16dp" android:paddingStart="16dp"
android:paddingEnd="16dp" android:paddingEnd="16dp"
android:background="?attr/selectableItemBackground"
android:text="@string/mozac_feature_addons_learn_more" android:text="@string/mozac_feature_addons_learn_more"
android:textColor="@android:color/black" app:drawableTint="@color/icons" />
app:drawableEndCompat="@drawable/mozac_ic_link_24"
app:drawableTint="@android:color/black" />
</RelativeLayout> </RelativeLayout>
@@ -1,12 +1,15 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?><!-- This Source Code Form is subject to the terms of the Mozilla Public
<!-- This Source Code Form is subject to the terms of the Mozilla Public
- License, v. 2.0. If a copy of the MPL was not distributed with this - License, v. 2.0. If a copy of the MPL was not distributed with this
- file, You can obtain one at http://mozilla.org/MPL/2.0/. --> - file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" <androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/addonSettingsContainer"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:fitsSystemWindows="true" android:fitsSystemWindows="true">
tools:ignore="MergeRootFrame" />
<androidx.fragment.app.FragmentContainerView
android:id="@+id/addonSettingsContainer"
android:layout_width="match_parent"
android:layout_height="match_parent" />
</androidx.constraintlayout.widget.ConstraintLayout>
@@ -1,4 +1,5 @@
<?xml version="1.0" encoding="utf-8"?><!-- This Source Code Form is subject to the terms of the Mozilla Public <?xml version="1.0" encoding="utf-8"?>
<!-- This Source Code Form is subject to the terms of the Mozilla Public
- License, v. 2.0. If a copy of the MPL was not distributed with this - License, v. 2.0. If a copy of the MPL was not distributed with this
- file, You can obtain one at http://mozilla.org/MPL/2.0/. --> - file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android" <ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
@@ -38,10 +39,9 @@
android:drawablePadding="10dp" android:drawablePadding="10dp"
android:padding="16dp" android:padding="16dp"
android:text="@string/mozac_feature_addons_settings" android:text="@string/mozac_feature_addons_settings"
android:textColor="@drawable/addon_textview_selector"
android:textSize="18sp" android:textSize="18sp"
app:drawableStartCompat="@drawable/mozac_ic_preferences" app:drawableStartCompat="@drawable/mozac_ic_preferences"
app:drawableTint="@android:color/black" /> app:drawableTint="@color/icons" />
<TextView <TextView
android:id="@+id/details" android:id="@+id/details"
@@ -52,10 +52,9 @@
android:drawablePadding="6dp" android:drawablePadding="6dp"
android:padding="16dp" android:padding="16dp"
android:text="@string/mozac_feature_addons_details" android:text="@string/mozac_feature_addons_details"
android:textColor="@drawable/addon_textview_selector"
android:textSize="18sp" android:textSize="18sp"
app:drawableStartCompat="@drawable/mozac_ic_information_24" app:drawableStartCompat="@drawable/mozac_ic_information_24"
app:drawableTint="@android:color/black" /> app:drawableTint="@color/icons" />
<TextView <TextView
android:id="@+id/permissions" android:id="@+id/permissions"
@@ -66,7 +65,6 @@
android:drawablePadding="6dp" android:drawablePadding="6dp"
android:padding="16dp" android:padding="16dp"
android:text="@string/mozac_feature_addons_permissions" android:text="@string/mozac_feature_addons_permissions"
android:textColor="@drawable/addon_textview_selector"
android:textSize="18sp" android:textSize="18sp"
app:drawableStartCompat="@drawable/mozac_ic_permissions" /> app:drawableStartCompat="@drawable/mozac_ic_permissions" />
@@ -77,7 +75,7 @@
android:layout_gravity="center_vertical|end" android:layout_gravity="center_vertical|end"
android:layout_below="@+id/permissions" android:layout_below="@+id/permissions"
android:background="?android:attr/selectableItemBackground" android:background="?android:attr/selectableItemBackground"
android:checked="true" android:checked="false"
android:clickable="true" android:clickable="true"
android:focusable="true" android:focusable="true"
android:text="@string/mozac_feature_addons_settings_allow_in_private_browsing_2" android:text="@string/mozac_feature_addons_settings_allow_in_private_browsing_2"
@@ -90,8 +88,7 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_below="@+id/allow_in_private_browsing_switch" android:layout_below="@+id/allow_in_private_browsing_switch"
android:layout_marginTop="16dp" android:layout_marginTop="16dp"
android:text="@string/mozac_feature_addons_remove" android:textColor="@color/photonRed50"
android:textAlignment="center" android:text="@string/mozac_feature_addons_remove" />
android:textColor="@color/photonRed50" />
</RelativeLayout> </RelativeLayout>
</ScrollView> </ScrollView>
@@ -9,20 +9,22 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:background="?android:attr/selectableItemBackground" android:background="?android:attr/selectableItemBackground"
android:orientation="vertical"> android:orientation="vertical"
android:paddingStart="16dp"
android:paddingEnd="16dp">
<TextView <TextView
android:id="@+id/permission" android:id="@+id/permission"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:padding="16dp" android:paddingTop="16dp"
android:textSize="16sp" android:paddingBottom="16dp"
android:textColor="?android:attr/textColorPrimary"
tools:text="Access your data for all websites" /> tools:text="Access your data for all websites" />
<View <View
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="1dp" android:layout_height="1dp"
android:background="?android:attr/listDivider" android:background="@color/photonGrey40"
android:importantForAccessibility="no" /> android:importantForAccessibility="no" />
</LinearLayout> </LinearLayout>
@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- This Source Code Form is subject to the terms of the Mozilla Public
- License, v. 2.0. If a copy of the MPL was not distributed with this
- file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
<resources xmlns:tools="http://schemas.android.com/tools">
<color name="icons">#ffffffff</color>
</resources>