Code Monkey home page Code Monkey logo

nasca's Introduction

Nasca

Nasca is a high resolution image loading library using WebView for Android that enables less memory usage, faster loading, caching, and easier callbacks.

Nasca supports loading and displaying various types of images from networks that contain animated gifs and webp. Nasca includes a lite API that using your own WebView as ImageView. Nasca’s primary focus is to guarantee scrolling HUGE size images as smooth as possible without using too much app memory.

Download

You can use Gradle like this:

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

dependencies {
    implementation 'com.github.myrealtrip:nasca:$version'
}

How do I use Nasca?

Check out the sample app source code for the example.

Simple use cases will look something like this:

nascaView.loadImages(
    "https://github.com/comprohyo/images/blob/master/image5.jpg?raw=true",
    "https://github.com/comprohyo/images/blob/master/image7.jpg?raw=true"
)

Or this is also possible through using layout-xml.

<com.mrt.nasca.NascaView
    android:id="@+id/nasca"
    android:layout_width="match_parent"
    android:layout_height="match_parent"    
    app:nasca_zoomable="true"
    app:nasca_src="https://github.com/comprohyo/images/blob/master/image5.jpg?raw=true"
/>

If you need callback for click, progress, errors.

nascaView.listener = object : NascaViewListener() {
    override fun onImageClicked(index: Int, url: String) {
        super.onImageClicked(index, url)
        Log.d("onImageClicked", "$index $url")
    }

    override fun onProgressChanged(progress: Int) {
        super.onProgressChanged(progress)
        Log.d("onProgressChanged", "$progress")
    }

    override fun onLoadingFailed(url: String, errorCode: Int, errorMsg: CharSequence?) {
        super.onLoadingFailed(url, errorCode, errorMsg)
        Log.d("onLoadingFailed", "$errorMsg $url")
    }
}

Or Use your own WebView as ImageView (Kotlin Only)

webView.nascaImageLoads(
    false, 
    "https://github.com/comprohyo/images/blob/master/image5.jpg?raw=true",
    "https://github.com/comprohyo/images/blob/master/image7.jpg?raw=true"
)

Compatibility

  • Minimum Android SDK: Nasca requires a minimum API level of 21.
  • Compile Android SDK: Nasca compiled SDK level 28.

License

The MIT License (MIT)

Copyright (c) 2019 Myrealtrip

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

nasca's People

Contributors

comprohyo avatar

Watchers

James Cloos 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.