@@ -33,73 +33,76 @@ permalink: /changelog/
33
33
```
34
34
* Added new toolbar APIs:
35
35
``` kotlin
36
+ val toolbar = BrowserToolbar (context)
36
37
toolbar.textColor: Int = getColor(R .color.photonRed50)
37
38
toolbar.hintColor: Int = getColor(R .color.photonGreen50)
38
39
toolbar.textSize: Float = 12f
39
40
toolbar.typeface: Typeface = Typeface .createFromFile(" fonts/foo.tff" )
40
41
```
41
- These attributes are also available in XML (except for typeface):
42
- ``` xml
43
- <mozilla .components.browser.toolbar.BrowserToolbar
44
- android : id =" @+id/toolbar"
45
- app : browserToolbarTextColor =" #ff0000"
46
- app : browserToolbarHintColor =" #00ff00"
47
- app : browserToolbarTextSize =" 12sp"
48
- android : layout_width =" match_parent"
49
- android : layout_height =" wrap_content" />
50
- ```
51
- * [ Api improvement] ( https://github.com/mozilla-mobile/android-components/issues/772 ) for more flexibility to create a ` BrowserToolbar.Button ` ,
42
+ These attributes are also available in XML (except for typeface):
43
+
44
+ ``` xml
45
+ <mozilla .components.browser.toolbar.BrowserToolbar
46
+ android : id =" @+id/toolbar"
47
+ app : browserToolbarTextColor =" #ff0000"
48
+ app : browserToolbarHintColor =" #00ff00"
49
+ app : browserToolbarTextSize =" 12sp"
50
+ android : layout_width =" match_parent"
51
+ android : layout_height =" wrap_content" />
52
+ ```
53
+
54
+ * [API improvement](https://github.com/mozilla-mobile/android-components/issues/772) for more flexibility to create a `BrowserToolbar.Button`,
52
55
and `BrowserToolbar.ToggleButton`, now you can provide a custom padding:
53
56
```kotlin
54
- val padding = Padding (start = 16 , top = 16 , end = 16 , bottom = 16 )
55
- val button = BrowserToolbar .Button (mozac_ic_back, " Forward" , padding = padding) {}
56
- var toggle = BrowserToolbar .ToggleButton (mozac_ic_pin, mozac_ic_pin_filled, " Pin" , " Unpin" , padding = padding) {}
57
+ val padding = Padding(start = 16, top = 16, end = 16, bottom = 16)
58
+ val button = BrowserToolbar.Button(mozac_ic_back, "Forward", padding = padding) {}
59
+ var toggle = BrowserToolbar.ToggleButton(mozac_ic_pin, mozac_ic_pin_filled, "Pin", "Unpin", padding = padding) {}
57
60
```
58
61
* ** concept-toolbar** :
59
- * [ Api improvement] ( https://github.com/mozilla-mobile/android-components/issues/772 ) for more flexibility to create a ` Toolbar.ActionToggleButton ` ,
62
+ * [ API improvement] ( https://github.com/mozilla-mobile/android-components/issues/772 ) for more flexibility to create a ` Toolbar.ActionToggleButton ` ,
60
63
` Toolbar.ActionButton ` , ` Toolbar.ActionSpace ` and ` Toolbar.ActionImage ` , now you can provide a custom padding:
61
64
``` kotlin
62
- val padding = Padding (start = 16 , top = 16 , end = 16 , bottom = 16 )
63
- var toggle = Toolbar .ActionToggleButton (0 , mozac_ic_pin_filled, " Pin" , " Unpin" , padding = padding) {}
64
- val button = Toolbar .ActionButton (mozac_ic_back, " Forward" , padding = padding) {}
65
- val space = Toolbar .ActionSpace (pxToDp(128 ), padding = padding)
66
- val image = Toolbar .ActionImage (brand, padding = padding)
65
+ val padding = Padding (start = 16 , top = 16 , end = 16 , bottom = 16 )
66
+ var toggle = Toolbar .ActionToggleButton (0 , mozac_ic_pin_filled, " Pin" , " Unpin" , padding = padding) {}
67
+ val button = Toolbar .ActionButton (mozac_ic_back, " Forward" , padding = padding) {}
68
+ val space = Toolbar .ActionSpace (pxToDp(128 ), padding = padding)
69
+ val image = Toolbar .ActionImage (brand, padding = padding)
67
70
```
68
71
* ** support-base** :
69
72
* A new class add for representing an Android Padding.
70
73
``` kotlin
71
- val padding = Padding (16 , 24 , 32 , 40 )
72
- val (start, top, end, bottom) = padding
74
+ val padding = Padding (16 , 24 , 32 , 40 )
75
+ val (start, top, end, bottom) = padding
73
76
```
74
77
* ** support- ktx** :
75
78
* A new extention function that allows you to set `Padding ` object to a `View`.
76
79
```kotlin
77
- val padding = Padding (16 , 24 , 32 , 40 )
78
- val view = View (context)
79
- view.setPadding(padding)
80
+ val padding = Padding (16 , 24 , 32 , 40 )
81
+ val view = View (context)
82
+ view.setPadding(padding)
80
83
```
81
84
* ** concept- engine** , ** browser- engine- system** , ** browser- engine- gecko(- beta/ nightly)**
82
85
* `RequestInterceptor ` was enhanced to support loading an alternative URL .
83
86
: warning: ** This is a breaking change for the `RequestInterceptor ` method signature! **
84
87
```kotlin
85
- // To provide alternative content the new InterceptionResponse.Content type needs to be used
86
- requestInterceptor = object : RequestInterceptor {
87
- override fun onLoadRequest (session : EngineSession , uri : String ): InterceptionResponse ? {
88
- return when (uri) {
89
- " sample:about" -> InterceptionResponse .Content (" <h1>I am the sample browser</h1>" )
90
- else -> null
91
- }
92
- }
88
+ // To provide alternative content the new InterceptionResponse.Content type needs to be used
89
+ requestInterceptor = object : RequestInterceptor {
90
+ override fun onLoadRequest (session : EngineSession , uri : String ): InterceptionResponse ? {
91
+ return when (uri) {
92
+ " sample:about" -> InterceptionResponse .Content (" <h1>I am the sample browser</h1>" )
93
+ else -> null
93
94
}
94
- // To provide an alternative URL the new InterceptionResponse.Url type needs to be used
95
- requestInterceptor = object : RequestInterceptor {
96
- override fun onLoadRequest (session : EngineSession , uri : String ): InterceptionResponse ? {
97
- return when (uri) {
98
- " sample:about" -> InterceptionResponse .Url (" sample:aboutNew" )
99
- else -> null
100
- }
101
- }
102
- }
95
+ }
96
+ }
97
+ // To provide an alternative URL the new InterceptionResponse.Url type needs to be used
98
+ requestInterceptor = object : RequestInterceptor {
99
+ override fun onLoadRequest (session : EngineSession , uri : String ): InterceptionResponse ? {
100
+ return when (uri) {
101
+ " sample:about" -> InterceptionResponse .Url (" sample:aboutNew" )
102
+ else -> null
103
+ }
104
+ }
105
+ }
103
106
```
104
107
* ** concept-storage** :
105
108
* Added a new concept for describing an interface for storing browser data. First iteration includes a description of ` HistoryStorage ` .
@@ -110,27 +113,27 @@ permalink: /changelog/
110
113
Before adding a first session to the engine, initialize the history tracking feature:
111
114
``` kotlin
112
115
val historyTrackingFeature = HistoryTrackingFeature (
113
- components.engine,
114
- components.historyStorage
116
+ components.engine,
117
+ components.historyStorage
115
118
)
116
119
```
117
120
Once the feature has been initialized, history will be tracked for all subsequently added sessions.
118
121
* ** sample-browser** :
119
122
* Updated the sample browser to track browsing history using an in-memory history storage implementation (how much is actually tracked in practice depends on which engine is being used. As of this release, only ` SystemEngine ` provides a full set of necessary APIs).
120
123
* ** lib-crash**
121
124
* Added option to display additional message in prompt and define the theme to be used:
122
- ``` Kotlin
123
- CrashReporter (
124
- promptConfiguration = CrashReporter .PromptConfiguration (
125
- // ..
125
+ ``` kotlin
126
+ CrashReporter (
127
+ promptConfiguration = CrashReporter .PromptConfiguration (
128
+ // ..
126
129
127
- // An additional message that will be shown in the prompt
128
- message = " We are very sorry!"
130
+ // An additional message that will be shown in the prompt
131
+ message = " We are very sorry!"
129
132
130
- // Use a custom theme for the prompt (Extend Theme.Mozac.CrashReporter)
131
- theme = android.R .style.Theme_Holo_Dialog
132
- ),
133
- // ..
133
+ // Use a custom theme for the prompt (Extend Theme.Mozac.CrashReporter)
134
+ theme = android.R .style.Theme_Holo_Dialog
135
+ )
136
+ // ..
134
137
).install(applicationContext)
135
138
```
136
139
* Showing the crash prompt won't play the default activity animation anymore.
0 commit comments