44###A quick overview
55- compatible with ** API Level 17**
66- ** RTL** support
7- - ** multi themes ** support
8- - ** full screen** mode
7+ - ** multi theme ** support
8+ - with ** full screen** mode
99- share URL ** easy way**
1010- search in page support
1111- with ** Bookmark** and ** Vote** icon that handle with ** EventBus** library
@@ -17,18 +17,110 @@ You can download the latest demo APK from here: https://github.com/bkhezry/Extra
1717##Screenshots
1818<img src =" assets/screenshot_1.png " />
1919<img src =" assets/screenshot_2.png " />
20- <img src =" assets/screenshot_3.png " width =" 400px " />
20+ ###full screen mode
21+ <img src =" assets/screenshot_3.png " width =" 350px " />
2122
2223#Setup
2324##1 . Provide the gradle dependency
24-
25+ Add it in your root build.gradle at the end of repositories:
26+ ``` gradle
27+ allprojects {
28+ repositories {
29+ ...
30+ maven { url "https://jitpack.io" }
31+ }
32+ }
33+ ```
34+ Add the dependency:
35+ ``` gradle
36+ dependencies {
37+ compile 'com.github.bkhezry:ExtraWebView:1.2.0'
38+ }
39+ ```
2540
2641##2 . Add your code
27-
28-
42+ add ItemActivity to AndroidManifest.xml
43+ ``` xml
44+ <activity
45+ android : name =" com.github.bkhezry.extrawebview.ItemActivity"
46+ android : screenOrientation =" portrait" />
47+ ```
48+ ``` java
49+ DataModel dataModel = new DataModelBuilder ()
50+ .withId(id)
51+ .withType(" blog" )
52+ .withBy(authorName)
53+ .withTime(timestamp)
54+ .withUrl(url)
55+ .withDescription(description)
56+ .withBookmark(true )
57+ .withViewed(true )
58+ .withRank(0 )
59+ .withVoted(true )
60+ .withPageTitle(title)
61+ .build();
62+ new ExtraWebViewCreator ()
63+ .withContext(MainActivity . this )
64+ .withBookmarkIcon(true )
65+ .withVoteIcon(true )
66+ .withCustomFont(" fonts/IRANSansMobile.ttf" )
67+ .withThemeName(themeName)
68+ .withDataModel(dataModel)
69+ .show();
70+ ```
71+ after that new activity start with WebView ui
72+
73+ ## DataModel attributes
74+
75+ | Name | Type | Default | Description |
76+ | :----:| :----:| :-------:| :-----------:|
77+ | id| Long| @NonNull | unique id of post. use in bookmark and vote icon event handler |
78+ | type| String| blog| type of post. use in future development |
79+ | by| String| @NonNull | author name of post|
80+ | time| Long| @NonNull | create time of post as timestamp format |
81+ | url| String| @NonNull | url of post |
82+ | description| String| @NonNull | description of post |
83+ | bookmark| boolean| false| bookmark status of post |
84+ | viewed| boolean| false| viewed status of post. use in future development |
85+ | rank| integer | 0 | rank of post by users. use in future development |
86+ | voted| boolean| false | vote status of post |
87+ | pageTitle| String| @NonNull | title of post |
88+
89+ ## ExtraWebViewCreator attributes
90+ | Name | Type | Default | Description |
91+ | :----:| :----:| :-------:| :-----------:|
92+ | context| Context| @NonNull | context of current activity |
93+ | bookmarkIcon| boolean| false| show icon of bookmark when true |
94+ | customFont| String| @Nullable | use calligraphy library to set custom font. path of font in assets folder|
95+ | themeName| String| light| name of theme use in WebView ui |
96+ | dataModel| DataModel| @NonNull | object of DataModel class |
97+
98+ List of theme name: ` light ` , ` dark ` , ` sepia ` , ` green ` , ` solarized ` and ` solarized_dark `
99+ [ ThemePreference.java] ( https://github.com/bkhezry/ExtraWebView/blob/master/library/src/main/java/com/github/bkhezry/extrawebview/data/ThemePreference.java )
29100#Additional Setup
30-
31-
101+ you can handle bookmark and vote icon click event.
102+ add this code to onCreate method of activity:
103+ ``` java
104+ EventBus . getDefault(). register(this );
105+ ```
106+ after that subscribe method as listener:
107+ ``` java
108+ @Subscribe (threadMode = ThreadMode . MAIN )
109+ public void doThis(IntentServiceResult intentServiceResult) {
110+ if (intentServiceResult. isChecked()) {
111+
112+ } else {
113+
114+ }
115+ }
116+ ```
117+ when each icon has been clicked, EventBus return object of IntentServiceResult.
118+ ## IntentServiceResult attributes
119+ | Name | Type | value |
120+ | :----:| :----:| :-------:|
121+ | id| Long| current post id |
122+ | typeEvent| String| BOOKMARK or VOTE|
123+ | isChecked| boolean| status of icon. if true icon is checked |
32124#Credits
33125
34126- Ha Duy Trung - [ GitHub] ( https://github.com/hidroh )
0 commit comments