Commit 39165855 authored by Sawyer Blatz's avatar Sawyer Blatz
Browse files

Add UI Widgets component with Button styling

parent 281a63fd
......@@ -224,6 +224,10 @@ projects:
path: components/ui/colors
description: 'The standard set of Photon colors.'
publish: true
ui-widgets:
path: components/ui/widgets
description: 'The standard set of Mozilla widgets.'
publish: true
ui-fonts:
path: components/ui/fonts
description: 'Convenience accessor for fonts used by Mozilla.'
......
# [Android Components](../../../README.md) > UI > Widgets
The standard set of Mozilla widgets.
## Usage
### Setting up the dependency
Use Gradle to download the library from [maven.mozilla.org](https://maven.mozilla.org/) ([Setup repository](../../../README.md#maven-repository)):
```Groovy
implementation "org.mozilla.components:ui-widgets:{latest-version}"
```
## License
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/
/* 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/. */
apply plugin: 'com.android.library'
android {
compileSdkVersion config.compileSdkVersion
defaultConfig {
minSdkVersion config.minSdkVersion
targetSdkVersion config.targetSdkVersion
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation Dependencies.google_material
}
apply from: '../../../publish.gradle'
ext.configurePublish(config.componentsGroupId, archivesBaseName, project.ext.description)
\ No newline at end of file
# Add project specific ProGuard rules here.
# You can control the set of applied configuration files using the
# proguardFiles setting in build.gradle.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html
# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
# public *;
#}
# Uncomment this to preserve the line number information for
# debugging stack traces.
#-keepattributes SourceFile,LineNumberTable
# If you keep the line number information, uncomment this to
# hide the original source file name.
#-renamesourcefileattribute SourceFile
<!-- 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/. -->
<manifest package="mozilla.components.ui.widgets" />
<?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/. -->
<ripple xmlns:android="http://schemas.android.com/apk/res/android"
android:color="?android:attr/colorControlHighlight">
<item android:id="@android:id/mask">
<shape>
<solid android:color="#000000" />
<corners android:radius="4dp" />
</shape>
</item>
<item>
<shape android:shape="rectangle">
<corners android:radius="4dp" />
</shape>
</item>
</ripple>
<?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>
<attr name="mozac_font_semibold" format="reference" />
<attr name="mozac_accent" format="reference" />
<attr name="mozac_contrast_text" format="reference" />
</resources>
<?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>
<!-- Button Colors -->
<color name="mozac_grey_button_color">#E0E0E6</color>
<color name="mozac_destructive_button_text_color">#C50042</color>
<color name="mozac_grey_button_text_color">#312A65</color>
</resources>
<?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:android="http://schemas.android.com/apk/res/android">
<!-- Button styling -->
<style name="Mozac.Widgets.NeutralButton" parent="Widget.MaterialComponents.Button.TextButton">
<item name="iconTint">@color/mozac_grey_button_text_color</item>
<item name="iconPadding">8dp</item>
<item name="iconGravity">textStart</item>
<item name="android:textAlignment">center</item>
<item name="android:background">@drawable/rounded_button_background</item>
<item name="android:layout_width">match_parent</item>
<item name="android:layout_height">48dp</item>
<item name="android:textStyle">bold</item>
<item name="android:textAllCaps">false</item>
<item name="backgroundTint">@color/mozac_grey_button_color</item>
<item name="android:textColor">@color/mozac_grey_button_text_color</item>
<item name="android:letterSpacing">0</item>
<item name="fontFamily">?mozac_font_semibold</item>
</style>
<style name="Mozac.Widgets.DestructiveButton" parent="Mozac.Widgets.NeutralButton">
<item name="iconTint">@color/mozac_destructive_button_text_color</item>
<item name="android:textColor">@color/mozac_destructive_button_text_color</item>
</style>
<style name="Mozac.Widgets.PositiveButton" parent="Mozac.Widgets.NeutralButton">
<item name="backgroundTint">?mozac_accent</item>
<item name="iconTint">?mozac_contrast_text</item>
<item name="android:textColor">?mozac_contrast_text</item>
</style>
</resources>
......@@ -21,6 +21,10 @@ permalink: /changelog/
* **feature-sitepermissions**
* ⚠️ **This is a breaking change**: The `SitePermissionsFeature`'s constructor, now requires a new parameter `onShouldShowRequestPermissionRationale` a lambda to allow the feature to query [ActivityCompat.shouldShowRequestPermissionRationale](https://developer.android.com/reference/androidx/core/app/ActivityCompat#shouldShowRequestPermissionRationale(android.app.Activity,%20java.lang.String)) or [Fragment.shouldShowRequestPermissionRationale](https://developer.android.com/reference/androidx/fragment/app/Fragment#shouldShowRequestPermissionRationale(java.lang.String)). This allows the `SitePermissionsFeature` to handle when a user clicks "Deny & don't ask again" button in a system permission dialog, for more information see [issue #6565](https://github.com/mozilla-mobile/android-components/issues/6565).
* **ui-widgets**
* 🆕 New component for standardized Mozilla widgets and styles. A living style guide will be published soon that helps explain design choices made.
* First version includes styling for buttons: `NeutralButton`, `PositiveButton`, and `DestructiveButton`
* **feature-addons**
* Added `AddonsManagerAdapter.updateAddon` and `AddonsManagerAdapter.updateAddons` to allow partial updates.
* ⚠️ **This is a breaking change**: `AddonsManagerAdapterDelegate.onNotYetSupportedSectionClicked(unsupportedAddons: ArrayList<Addon>)` is changed to `AddonsManagerAdapterDelegate.onNotYetSupportedSectionClicked(unsupportedAddons: List<Addon>)`.
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment