summaryrefslogtreecommitdiffstats
path: root/mobile/android/android-components/components/feature/readerview/README.md
blob: c3a4439fdd3ad778bab9e17fafa009697f482048 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
# [Android Components](../../../README.md) > Feature > Reader View

 A component wrapping/providing a Reader View WebExtension.

## 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:feature-readerview:{latest-version}"
```

### Integration

Initializing the feature:

```kotlin
val readerViewFeature = ReaderViewFeature(
    context,
    engine,
    sessionManager,
    onReaderViewAvailableChange = {
    	// e.g. readerViewToolbarActionVisible = it
    }
)

```

Showing and hiding Reader View:

```kotlin
readerViewFeature.showReaderView()
readerViewFeature.hideReaderView()
```

Showing and hiding the Reader View appearance UI (to adjust font size, font type and color scheme). Note that changes to the appearance settings are automatically persisted as user preferences.

```kotlin
readerViewFeature.showAppearanceControls()
readerViewFeature.hideAppearanceControls()
```

## 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/