Skip to content

Commit 81611ab

Browse files
committed
update addon layouts
1 parent bd77de0 commit 81611ab

File tree

10 files changed

+87
-57
lines changed

10 files changed

+87
-57
lines changed

app/android/app/src/main/AndroidManifest.xml

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -154,33 +154,34 @@
154154
android:parentActivityName=".MainActivity" />
155155

156156
<activity
157-
android:theme="@style/Theme.AppCompat.Light"
157+
android:theme="@style/AppTheme"
158158
android:name="eu.weblibre.flutter_mozilla_components.addons.AddonDetailsActivity"
159159
android:exported="false"
160160
android:label="@string/mozac_feature_addons_addons" />
161161

162-
<activity android:name="eu.weblibre.flutter_mozilla_components.addons.InstalledAddonDetailsActivity"
162+
<activity
163+
android:name="eu.weblibre.flutter_mozilla_components.addons.InstalledAddonDetailsActivity"
163164
android:label="@string/mozac_feature_addons_addons"
164165
android:parentActivityName="eu.weblibre.flutter_mozilla_components.addons.AddonsActivity"
165166
android:exported="false"
166-
android:theme="@style/Theme.AppCompat.Light" />
167+
android:theme="@style/AppTheme" />
167168

168169
<activity
169170
android:name="eu.weblibre.flutter_mozilla_components.addons.PermissionsDetailsActivity"
170171
android:label="@string/mozac_feature_addons_addons"
171172
android:exported="false"
172-
android:theme="@style/Theme.AppCompat.Light" />
173+
android:theme="@style/AppTheme" />
173174

174175
<activity
175176
android:name="eu.weblibre.flutter_mozilla_components.addons.AddonSettingsActivity"
176177
android:label="@string/mozac_feature_addons_addons"
177178
android:exported="false"
178-
android:theme="@style/Theme.AppCompat.Light" />
179+
android:theme="@style/AppTheme" />
179180

180181
<activity
181182
android:name="eu.weblibre.flutter_mozilla_components.addons.WebExtensionActionPopupActivity"
182183
android:label="@string/mozac_feature_addons_addons"
183-
android:theme="@style/Theme.AppCompat.Light"/>
184+
android:theme="@style/AppTheme"/>
184185

185186
<receiver
186187
android:name=".SearchBarWidgetReceiver"

app/android/app/src/main/res/values/styles.xml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,11 @@
2626
<item name="android:textColor">?android:attr/textColorPrimary</item>
2727
</style>
2828

29-
<style name="AddonsActivityTheme" parent="Theme.AppCompat.Light">
29+
<style name="AppTheme" parent="Theme.Material3.DynamicColors.DayNight">
30+
<item name="preferenceTheme">@style/PreferenceThemeOverlay</item>
31+
</style>
32+
33+
<style name="AddonsActivityTheme" parent="AppTheme">
3034
<item name="mozac_primary_text_color">@color/photonDarkGrey90</item>
3135
</style>
3236
</resources>

packages/flutter_mozilla_components/android/src/main/kotlin/eu/weblibre/flutter_mozilla_components/addons/PermissionsDetailsActivity.kt

Lines changed: 22 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,21 @@
55
package eu.weblibre.flutter_mozilla_components.addons
66

77
import android.content.Intent
8-
import android.net.Uri
8+
import android.graphics.Color
99
import android.os.Bundle
1010
import android.view.LayoutInflater
1111
import android.view.View
1212
import android.view.ViewGroup
1313
import android.widget.TextView
14+
import androidx.activity.SystemBarStyle
15+
import androidx.activity.enableEdgeToEdge
1416
import androidx.appcompat.app.AppCompatActivity
17+
import androidx.core.net.toUri
1518
import androidx.recyclerview.widget.LinearLayoutManager
1619
import androidx.recyclerview.widget.RecyclerView
1720
import mozilla.components.feature.addons.Addon
1821
import mozilla.components.feature.addons.ui.translateName
22+
import mozilla.components.support.ktx.android.view.setupPersistentInsets
1923
import mozilla.components.support.utils.ext.getParcelableExtraCompat
2024
import eu.weblibre.flutter_mozilla_components.R
2125

@@ -25,10 +29,15 @@ private const val LEARN_MORE_URL =
2529
/**
2630
* An activity to show the permissions of an add-on.
2731
*/
28-
class PermissionsDetailsActivity : AppCompatActivity(), View.OnClickListener {
32+
class PermissionsDetailsActivity :
33+
AppCompatActivity(),
34+
View.OnClickListener {
2935
override fun onCreate(savedInstanceState: Bundle?) {
36+
enableEdgeToEdge(SystemBarStyle.dark(Color.TRANSPARENT))
3037
super.onCreate(savedInstanceState)
3138
setContentView(R.layout.activity_add_on_permissions)
39+
window.setupPersistentInsets()
40+
3241
val addon = requireNotNull(
3342
intent.getParcelableExtraCompat("add_on", Addon::class.java),
3443
)
@@ -56,9 +65,11 @@ class PermissionsDetailsActivity : AppCompatActivity(), View.OnClickListener {
5665
*/
5766
class PermissionsAdapter(
5867
private val permissions: List<String>,
59-
) :
60-
RecyclerView.Adapter<PermissionViewHolder>() {
61-
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): PermissionViewHolder {
68+
) : RecyclerView.Adapter<PermissionViewHolder>() {
69+
override fun onCreateViewHolder(
70+
parent: ViewGroup,
71+
viewType: Int,
72+
): PermissionViewHolder {
6273
val context = parent.context
6374
val inflater = LayoutInflater.from(context)
6475
val view = inflater.inflate(R.layout.add_ons_permission_item, parent, false)
@@ -71,7 +82,10 @@ class PermissionsDetailsActivity : AppCompatActivity(), View.OnClickListener {
7182

7283
override fun getItemCount() = permissions.size
7384

74-
override fun onBindViewHolder(holder: PermissionViewHolder, position: Int) {
85+
override fun onBindViewHolder(
86+
holder: PermissionViewHolder,
87+
position: Int,
88+
) {
7589
val permission = permissions[position]
7690
holder.textView.text = permission
7791
}
@@ -86,8 +100,7 @@ class PermissionsDetailsActivity : AppCompatActivity(), View.OnClickListener {
86100
) : RecyclerView.ViewHolder(view)
87101

88102
override fun onClick(v: View?) {
89-
val intent =
90-
Intent(Intent.ACTION_VIEW).setData(Uri.parse(LEARN_MORE_URL))
103+
val intent = Intent(Intent.ACTION_VIEW).setData(LEARN_MORE_URL.toUri())
91104
startActivity(intent)
92105
}
93-
}
106+
}

packages/flutter_mozilla_components/android/src/main/res/layout/activity_add_on_details.xml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -107,15 +107,15 @@
107107
android:layout_below="@+id/last_updated_divider"
108108
android:text="@string/mozac_feature_addons_home_page" />
109109

110-
<androidx.appcompat.widget.AppCompatImageView
110+
<ImageView
111111
android:id="@+id/home_page_text"
112112
android:layout_width="wrap_content"
113113
android:layout_height="wrap_content"
114114
android:layout_below="@+id/last_updated_divider"
115115
android:layout_alignParentEnd="true"
116116
android:contentDescription="@string/mozac_feature_addons_home_page"
117-
app:srcCompat="@drawable/mozac_ic_link_24"
118-
app:tint="@android:color/black" />
117+
android:src="@drawable/mozac_ic_link_24"
118+
app:tint="@color/icons" />
119119

120120
<View
121121
android:id="@+id/home_page_divider"
@@ -154,4 +154,4 @@
154154
tools:text="591,642" />
155155

156156
</RelativeLayout>
157-
</ScrollView>
157+
</ScrollView>
Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,15 @@
1-
<?xml version="1.0" encoding="utf-8"?>
2-
<!-- This Source Code Form is subject to the terms of the Mozilla Public
1+
<?xml version="1.0" encoding="utf-8"?><!-- This Source Code Form is subject to the terms of the Mozilla Public
32
- License, v. 2.0. If a copy of the MPL was not distributed with this
43
- file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
5-
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
6-
xmlns:tools="http://schemas.android.com/tools"
7-
android:id="@+id/container"
4+
5+
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
86
android:layout_width="match_parent"
97
android:layout_height="match_parent"
10-
android:fitsSystemWindows="true"
11-
tools:ignore="MergeRootFrame" />
8+
android:fitsSystemWindows="true" >
9+
10+
<androidx.fragment.app.FragmentContainerView
11+
android:id="@+id/container"
12+
android:layout_width="match_parent"
13+
android:layout_height="match_parent" />
14+
15+
</androidx.constraintlayout.widget.ConstraintLayout>

packages/flutter_mozilla_components/android/src/main/res/layout/activity_add_on_permissions.xml

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,11 @@
44
- file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
55

66
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
7-
xmlns:app="http://schemas.android.com/apk/res-auto"
87
xmlns:tools="http://schemas.android.com/tools"
98
android:fitsSystemWindows="true"
109
android:layout_width="match_parent"
1110
android:layout_height="wrap_content"
11+
xmlns:app="http://schemas.android.com/apk/res-auto"
1212
tools:context=".addons.PermissionsDetailsActivity">
1313

1414
<androidx.recyclerview.widget.RecyclerView
@@ -21,13 +21,12 @@
2121
android:layout_width="match_parent"
2222
android:layout_height="wrap_content"
2323
android:layout_below="@+id/add_ons_permissions"
24-
android:background="?attr/selectableItemBackground"
24+
app:drawableEndCompat="@drawable/mozac_ic_link_24"
2525
android:padding="16dp"
2626
android:paddingStart="16dp"
2727
android:paddingEnd="16dp"
28+
android:background="?attr/selectableItemBackground"
2829
android:text="@string/mozac_feature_addons_learn_more"
29-
android:textColor="@android:color/black"
30-
app:drawableEndCompat="@drawable/mozac_ic_link_24"
31-
app:drawableTint="@android:color/black" />
30+
app:drawableTint="@color/icons" />
3231

33-
</RelativeLayout>
32+
</RelativeLayout>
Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,15 @@
1-
<?xml version="1.0" encoding="utf-8"?>
2-
<!-- This Source Code Form is subject to the terms of the Mozilla Public
1+
<?xml version="1.0" encoding="utf-8"?><!-- This Source Code Form is subject to the terms of the Mozilla Public
32
- License, v. 2.0. If a copy of the MPL was not distributed with this
43
- file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
54

6-
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
7-
xmlns:tools="http://schemas.android.com/tools"
8-
android:id="@+id/addonSettingsContainer"
5+
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
96
android:layout_width="match_parent"
107
android:layout_height="match_parent"
11-
android:fitsSystemWindows="true"
12-
tools:ignore="MergeRootFrame" />
8+
android:fitsSystemWindows="true">
9+
10+
<androidx.fragment.app.FragmentContainerView
11+
android:id="@+id/addonSettingsContainer"
12+
android:layout_width="match_parent"
13+
android:layout_height="match_parent" />
14+
15+
</androidx.constraintlayout.widget.ConstraintLayout>

packages/flutter_mozilla_components/android/src/main/res/layout/activity_installed_add_on_details.xml

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
<?xml version="1.0" encoding="utf-8"?><!-- This Source Code Form is subject to the terms of the Mozilla Public
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<!-- This Source Code Form is subject to the terms of the Mozilla Public
23
- License, v. 2.0. If a copy of the MPL was not distributed with this
34
- file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
45
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
@@ -38,10 +39,9 @@
3839
android:drawablePadding="10dp"
3940
android:padding="16dp"
4041
android:text="@string/mozac_feature_addons_settings"
41-
android:textColor="@drawable/addon_textview_selector"
4242
android:textSize="18sp"
4343
app:drawableStartCompat="@drawable/mozac_ic_preferences"
44-
app:drawableTint="@android:color/black" />
44+
app:drawableTint="@color/icons" />
4545

4646
<TextView
4747
android:id="@+id/details"
@@ -52,10 +52,9 @@
5252
android:drawablePadding="6dp"
5353
android:padding="16dp"
5454
android:text="@string/mozac_feature_addons_details"
55-
android:textColor="@drawable/addon_textview_selector"
5655
android:textSize="18sp"
5756
app:drawableStartCompat="@drawable/mozac_ic_information_24"
58-
app:drawableTint="@android:color/black" />
57+
app:drawableTint="@color/icons" />
5958

6059
<TextView
6160
android:id="@+id/permissions"
@@ -66,7 +65,6 @@
6665
android:drawablePadding="6dp"
6766
android:padding="16dp"
6867
android:text="@string/mozac_feature_addons_permissions"
69-
android:textColor="@drawable/addon_textview_selector"
7068
android:textSize="18sp"
7169
app:drawableStartCompat="@drawable/mozac_ic_permissions" />
7270

@@ -77,7 +75,7 @@
7775
android:layout_gravity="center_vertical|end"
7876
android:layout_below="@+id/permissions"
7977
android:background="?android:attr/selectableItemBackground"
80-
android:checked="true"
78+
android:checked="false"
8179
android:clickable="true"
8280
android:focusable="true"
8381
android:text="@string/mozac_feature_addons_settings_allow_in_private_browsing_2"
@@ -90,8 +88,7 @@
9088
android:layout_height="wrap_content"
9189
android:layout_below="@+id/allow_in_private_browsing_switch"
9290
android:layout_marginTop="16dp"
93-
android:text="@string/mozac_feature_addons_remove"
94-
android:textAlignment="center"
95-
android:textColor="@color/photonRed50" />
91+
android:textColor="@color/photonRed50"
92+
android:text="@string/mozac_feature_addons_remove" />
9693
</RelativeLayout>
97-
</ScrollView>
94+
</ScrollView>

packages/flutter_mozilla_components/android/src/main/res/layout/add_ons_permission_item.xml

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,20 +9,22 @@
99
android:layout_width="match_parent"
1010
android:layout_height="wrap_content"
1111
android:background="?android:attr/selectableItemBackground"
12-
android:orientation="vertical">
12+
android:orientation="vertical"
13+
android:paddingStart="16dp"
14+
android:paddingEnd="16dp">
1315

1416
<TextView
1517
android:id="@+id/permission"
1618
android:layout_width="match_parent"
1719
android:layout_height="wrap_content"
18-
android:padding="16dp"
19-
android:textSize="16sp"
20-
android:textColor="?android:attr/textColorPrimary"
20+
android:paddingTop="16dp"
21+
android:paddingBottom="16dp"
2122
tools:text="Access your data for all websites" />
2223

2324
<View
2425
android:layout_width="match_parent"
2526
android:layout_height="1dp"
26-
android:background="?android:attr/listDivider"
27+
android:background="@color/photonGrey40"
2728
android:importantForAccessibility="no" />
28-
</LinearLayout>
29+
30+
</LinearLayout>
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<!-- This Source Code Form is subject to the terms of the Mozilla Public
3+
- License, v. 2.0. If a copy of the MPL was not distributed with this
4+
- file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
5+
<resources xmlns:tools="http://schemas.android.com/tools">
6+
<color name="icons">#ffffffff</color>
7+
</resources>

0 commit comments

Comments
 (0)