Skip to content

alimogh/ExtraWebView

Repository files navigation

Extra WebView Library

the flexible and easy to use WebView library with beautiful themes.

Android ArsenalBuild Status

A quick overview

  • compatible with API Level 17
  • RTL support
  • multi theme support
  • with full screen mode
  • share URL easy way
  • search in page support
  • with Bookmark and Vote icon that handle with EventBus library

Preview

Demo

You can download the latest demo APK from here: https://github.com/bkhezry/ExtraWebView/blob/master/assets/DemoExtraWebView-last.apk

Screenshots

### full screen mode

Setup

1. Provide the gradle dependency

Add it in your root build.gradle at the end of repositories:

allprojects{repositories{... maven{url "https://jitpack.io" } } }

Add the dependency:

dependencies{implementation 'com.github.bkhezry:ExtraWebView:1.2.۵' }

2. Add your code

add ItemActivity to AndroidManifest.xml

 <activityandroid:name="com.github.bkhezry.extrawebview.ItemActivity"android:screenOrientation="portrait" />
DataModeldataModel = newDataModelBuilder() .withId(id) .withType("blog") .withBy(authorName) .withTime(timestamp) .withUrl(url) .withDescription(description) .withBookmark(true) .withViewed(true) .withRank(0) .withVoted(true) .withPageTitle(title) .build(); newExtraWebViewCreator() .withContext(MainActivity.this) .withBookmarkIcon(true) .withVoteIcon(true) .withCustomFont("fonts/IRANSansMobile.ttf") .withThemeName(themeName) .withDataModel(dataModel) .show();

after that new activity start with WebView ui

DataModel attributes

NameTypeDefaultDescription
idLong@NonNullunique id of post. use in bookmark and vote icon event handler
typeStringblogtype of post. use in future development
byString@NonNullauthor name of post
timeLong@NonNullcreate time of post as timestamp format
urlString@NonNullurl of post
descriptionString@NonNulldescription of post
bookmarkbooleanfalsebookmark status of post
viewedbooleanfalseviewed status of post. use in future development
rankinteger0rank of post by users. use in future development
votedbooleanfalsevote status of post
pageTitleString@NonNulltitle of post

ExtraWebViewCreator attributes

NameTypeDefaultDescription
contextContext@NonNullcontext of current activity
bookmarkIconbooleanfalseshow icon of bookmark when true
customFontString@Nullableuse calligraphy library to set custom font. path of font in assets folder
themeNameStringlightname of theme use in WebView ui
dataModelDataModel@NonNullobject of DataModel class

List of theme name: light, dark, sepia, green, solarized and solarized_darkThemePreference.java

Additional Setup

you can handle bookmark and vote icon click event. add this code to onCreate method of activity:

EventBus.getDefault().register(this);

after that subscribe method as listener:

@Subscribe(threadMode = ThreadMode.MAIN) publicvoiddoThis(IntentServiceResultintentServiceResult){if (intentServiceResult.isChecked()){} else{} }

when each icon has been clicked, EventBus return object of IntentServiceResult.

IntentServiceResult attributes

NameTypevalue
idLongcurrent post id
typeEventStringBOOKMARK or VOTE
isCheckedbooleanstatus of icon. if true icon is checked

Credits

Demo App using this library

Developed By

License

Copyright 2016 Behrouz Khezry Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. 

About

the flexible and easy to use WebView library

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Java99.5%
  • IDL0.5%