Giter VIP home page Giter VIP logo

veinview's Introduction

VeinView

License Bintray Android Arsenal

Custom WebView with build in CSS and JS injection capabilities

With VeinView you can easily inject CSS and JavaScript code into your WebView contents, and the enhance the user experience based on your individual needs.

You could apply a dark mode CSS and make Google look like this:

Demo screenshot

Installation

implementation 'com.izikode.izilib:veinview:0.2'

Usage

Use VeinView just like you would use a vanilla WebView.

<android.support.constraint.ConstraintLayout 
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent">

    <com.izikode.izilib.veinview.VeinView
        android:id="@+id/veinview"
        android:layout_width="match_parent"
        android:layout_height="match_parent" />

</android.support.constraint.ConstraintLayout>

Do any setup that you would normally do to your WebViews and before loading the contents, provide VeinView with a new Client; be careful to use a VeinViewClient and not a WebViewClient.

veinView.setVeinViewClient(object: VeinViewClient() {
    override fun onReadyToInject(injector: VeinViewInjector, page: String) {

        injector.injectCSS(R.raw.dark_google_style)

    }
})
  • Use the defaultClient DSL for an even simpler initialization.
veinView.setVeinViewClient(defaultClient { injector, page ->
    injector.injectCSS(R.raw.dark_google_style)
})

Use the provided VeinViewInjector to update the contents to your needs. You can inject a raw resource or plain String objects containing your CSS or JavaScript code. In the above screenshot, the following CSS style is used:

body {
    color: white;
    background-color: black;
}

For a full example, see the sample app.

Licence

Copyright 2018 Fanis Veizis

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.

veinview's People

Contributors

ifanie avatar fanveizi avatar

Stargazers

Riley Marsh avatar Yohanes Dwiki K avatar Mr a avatar Der_Googler avatar  喵叔catuncle avatar mistertest avatar Sotiris Falieris avatar Daniel Ranzi Werle avatar Daniel Graungaard avatar  avatar Mark avatar Earthwormjimjones avatar Roman Fomenko avatar Patrick Pissurno avatar Fernando Wolf Bona avatar Dasser Basyouni avatar Keita Mori avatar  avatar  avatar amin avatar coder avatar Petros Paraskevopoulos avatar Lee avatar  avatar Caner Yılmaz avatar Eliseo Martelli avatar Pranav Lathigara avatar  avatar hyl87 avatar Jhon Kenneth Cariño avatar Matteo Lobello avatar das_vicky avatar KNF Apps avatar kasmadi avatar

Watchers

coder avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.