[components] Add longClickListener documentation, fix style problems
move TwoStateButton background to match argument order
This commit is contained in:
committed by
mergify[bot]
parent
7fe1b10694
commit
ea9cb18430
@@ -384,6 +384,7 @@ class BrowserToolbar @JvmOverloads constructor(
|
|||||||
* @param background A custom (stateful) background drawable resource to be used.
|
* @param background A custom (stateful) background drawable resource to be used.
|
||||||
* @param padding a custom [Padding] for this Button.
|
* @param padding a custom [Padding] for this Button.
|
||||||
* @param iconTintColorResource Optional ID of color resource to tint the icon.
|
* @param iconTintColorResource Optional ID of color resource to tint the icon.
|
||||||
|
* @param longClickListener Callback that will be invoked whenever the button is long-pressed.
|
||||||
* @param listener Callback that will be invoked whenever the button is pressed
|
* @param listener Callback that will be invoked whenever the button is pressed
|
||||||
*/
|
*/
|
||||||
@Suppress("LongParameterList")
|
@Suppress("LongParameterList")
|
||||||
@@ -460,6 +461,7 @@ class BrowserToolbar @JvmOverloads constructor(
|
|||||||
* @param longClickListener Callback that will be invoked whenever the button is long-pressed.
|
* @param longClickListener Callback that will be invoked whenever the button is long-pressed.
|
||||||
* @param listener Callback that will be invoked whenever the button is pressed.
|
* @param listener Callback that will be invoked whenever the button is pressed.
|
||||||
*/
|
*/
|
||||||
|
@Suppress("LongParameterList")
|
||||||
open class TwoStateButton(
|
open class TwoStateButton(
|
||||||
val primaryImage: Drawable,
|
val primaryImage: Drawable,
|
||||||
val primaryContentDescription: String,
|
val primaryContentDescription: String,
|
||||||
@@ -475,9 +477,9 @@ class BrowserToolbar @JvmOverloads constructor(
|
|||||||
) : BrowserToolbar.Button(
|
) : BrowserToolbar.Button(
|
||||||
primaryImage,
|
primaryImage,
|
||||||
primaryContentDescription,
|
primaryContentDescription,
|
||||||
longClickListener=longClickListener,
|
background = background,
|
||||||
|
longClickListener = longClickListener,
|
||||||
listener = listener,
|
listener = listener,
|
||||||
background = background
|
|
||||||
) {
|
) {
|
||||||
var enabled: Boolean = false
|
var enabled: Boolean = false
|
||||||
private set
|
private set
|
||||||
|
|||||||
@@ -232,6 +232,7 @@ interface Toolbar {
|
|||||||
* @param visible Lambda that returns true or false to indicate whether this button should be shown.
|
* @param visible Lambda that returns true or false to indicate whether this button should be shown.
|
||||||
* @param padding A optional custom padding.
|
* @param padding A optional custom padding.
|
||||||
* @param iconTintColorResource Optional ID of color resource to tint the icon.
|
* @param iconTintColorResource Optional ID of color resource to tint the icon.
|
||||||
|
* @param longClickListener Callback that will be invoked whenever the button is long-pressed.
|
||||||
* @param listener Callback that will be invoked whenever the button is pressed
|
* @param listener Callback that will be invoked whenever the button is pressed
|
||||||
*/
|
*/
|
||||||
@Suppress("LongParameterList")
|
@Suppress("LongParameterList")
|
||||||
|
|||||||
@@ -146,7 +146,7 @@ class ToolbarActivity : AppCompatActivity() {
|
|||||||
// //////////////////////////////////////////////////////////////////////////////////////////
|
// //////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
val reload = BrowserToolbar.TwoStateButton(
|
val reload = BrowserToolbar.TwoStateButton(
|
||||||
primaryImage =resources.getThemedDrawable(mozilla.components.ui.icons.R.drawable.mozac_ic_refresh)!!,
|
primaryImage = resources.getThemedDrawable(mozilla.components.ui.icons.R.drawable.mozac_ic_refresh)!!,
|
||||||
primaryContentDescription = "Reload",
|
primaryContentDescription = "Reload",
|
||||||
secondaryImage = resources.getThemedDrawable(mozilla.components.ui.icons.R.drawable.mozac_ic_stop)!!,
|
secondaryImage = resources.getThemedDrawable(mozilla.components.ui.icons.R.drawable.mozac_ic_stop)!!,
|
||||||
secondaryContentDescription = "Stop",
|
secondaryContentDescription = "Stop",
|
||||||
|
|||||||
Reference in New Issue
Block a user