You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
> maxBodySize:- max body size to fetch from internet (default 1000000 bytes)
70
+
71
+
> timeout:- timeout for network request (default 60000 ms)
72
+
73
+
> jsoupProxy:- Specify proxy while fetching from internet. This will be an instance of JsoupProxy to specify host and port. See: [JsoupProxy](#jsoupproxy-class)
74
+
75
+
76
+
##### Listener (OpenGraphCallback)
51
77
The class requires you to implement two callback functions,`onError(error: String)` and `onPostResponse(openGraphResult: OpenGraphResult)`. The former is invoked in case of error (incorrect url), and the latter is invoked on successful response.
52
78
79
+
##### showNullOnEmpty
53
80
The `showNullOnEmpty` is an optional parameter, with a default value of `false`. If set to `true`, the parser would invoke `onError` if the `title` and `description` are empty for the link provided.
54
81
82
+
##### CacheProvider
55
83
The `cacheProvider` is also an optional parameter. It can be passed in two ways :-
56
-
1. The default `OpenGraphCacheProvider`, which implements `SharedPreferences` from the library itself.
57
-
2. A custom Shared Preferences class which should implement the interface `CacheProvider`. The `CacheProvider` interface provides two callback functions `getOpenGraphResult` and `setOpenGraphResult`, where `getOpenGraphResult` is used to write to the cache, and `setOpenGraphResult` is used to read from the cache.
84
+
1. The default `OpenGraphCacheProvider`, which implements `SharedPreferences` from the library itself.
85
+
2. A custom Shared Preferences class which should implement the interface `CacheProvider`. The `CacheProvider` interface provides two callback functions `getOpenGraphResult` and `setOpenGraphResult`, where `getOpenGraphResult` is used to write to the cache, and `setOpenGraphResult` is used to read from the cache.
58
86
87
+
---------
59
88
60
-
Inside `onPostResponse(openGraphResult: OpenGraphResult)` you can use the data to show on your UI like this.
89
+
Inside `onPostResponse(openGraphResult: OpenGraphResult)` you can use the data to show on your UI like this.
61
90
62
91
override fun onPostResponse(openGraphResult: OpenGraphResult) {
63
92
linkPreviewLayout.apply {
@@ -69,12 +98,17 @@ Inside `onPostResponse(openGraphResult: OpenGraphResult)` you can use the data t
69
98
70
99
## OpenGraphResult class
71
100
The data class ***OpenGraphResult*** contains:
72
-
- title -> The title of the page the link points to
73
-
- description -> The description metadata of the page
74
-
- url -> The url of the page
75
-
- image -> The image metadata for the page
76
-
- siteName -> The name of the website (BASE URL).
77
-
- type -> The type of the object e.g., "video.movie".
101
+
- title -> The title of the page the link points to
102
+
- description -> The description metadata of the page
103
+
- url -> The url of the page
104
+
- image -> The image metadata for the page
105
+
- siteName -> The name of the website (BASE URL).
106
+
- type -> The type of the object e.g., "video.movie".
0 commit comments