Git Product home page Git Product logo

sobitmap's Introduction

Android Arsenal

SoBitmap

SoBitmap is not an ImageLoader, it born for process single bitmap. Some conditions, we want a image displayed in some limit, such as the max size, the memory cost and its format. SoBitmap handle these all for you, then release you to concern the real important things. You can totally use SoBitmap as a black box, the only things you need care are the input configuration and the output bitmap.

Feature

  • support local file, MediaStore and network stream

  • support two config way:

    1. exact limit include max input, max output, and compress quality down step
    2. fuzzy limit that you only need set a level or just by default.
  • use okhttp as httpclient for downloading, I think we can trust it(Shall we have a choice about it?)

  • all callback heppen in UI thread, so relax about it

Usage

Include in your project

  • Gradle
repositories {
    maven { url "https://oss.sonatype.org/content/repositories/snapshots" }
}

dependencies {
	compile 'com.github.airk000:sobitmap:0.1.+'
}

Permissions

<!-- if SoBitmap need to load image from network -->
<uses-permission android:name="android.permission.INTERNET" />
<!-- if your want use external storage for cache -->
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />

Min SDK

API9 (Android2.3)

Custom display option

Exactly
Options.ExactOptionsBuilder builder = new Options.ExactOptionsBuilder();
builder.step(10)
        .format(Bitmap.CompressFormat.JPEG)
        .maxOutput(200)
        .maxInput(10 * 1000)
        .maxSize(5000);
Options ops = builder.build();
Fuzzy
Options.FuzzyOptionsBuilder builder = new Options.FuzzyOptionsBuilder();
builder.maxSize(5000)
        .format(Bitmap.CompressFormat.PNG)
        .level(Options.QualityLevel.HIGH);
Options ops = builder.build();
Change the default option
SoBitmap.getInstance(context).setDefaultOption(myCustomOps);

Hunting bitmap

SoBitmap.getInstance(this).hunt(uri, new Callback() {
            @Override
            public void onHunted(Bitmap bitmap, BitmapFactory.Options options) {
                imageView.setImageBitmap(bitmap);
            }

            @Override
            public void onException(HuntException e) {
                textView.setText(e.toString());
            }
        });

TODO:

  • Multi thread speed up the decoding duration

License

Copyright 2016 Kevin Liu

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.

sobitmap's People

Contributors

lkv1988 avatar ravidsrk avatar bryant1410 avatar

Stargazers

Difper avatar  avatar Ahmed Hashem avatar Andrii Konovalenko avatar 김현준 avatar asad.karammi avatar  avatar Roberto Tatasciore avatar  avatar aemxn avatar Nadeem Iqbal avatar Jason Xu avatar Davide avatar zjy avatar Shirish avatar nikee avatar Bardia Heydari avatar OkadaNana avatar 小鄧子 avatar  avatar  avatar They Call Me Sam...u..r...a..i avatar chonamdoo avatar Rafał Kobyłko avatar WilsonL avatar CordingHornet avatar coder avatar guobangbang avatar Pranav Lathigara avatar Trump avatar  avatar Flan-chan avatar 白禄 avatar Yaming avatar tom zhou avatar Romain Rochegude avatar Ran ran avatar Hao avatar Jimson Liang avatar Andrey avatar qiaoyubo avatar lsjwzh avatar ratabb avatar ogaclejapan avatar Chuanzhi Li avatar Matthew Lee avatar Layoute avatar Drakeet avatar Evan avatar Ivan Morgillo avatar 曾祥彬 avatar 李小义 avatar  avatar César Díez Sánchez avatar Tobias Preuss avatar Michael Basil avatar Pedro Veloso avatar  avatar dusunboy avatar 尚晓东 avatar JSBerrocoso avatar Vithorio Polten avatar  avatar Vincent Zuo avatar Jianbo Peng avatar Rainer-Lang avatar DK avatar  avatar Dawid Hyży avatar Hideeee avatar ant sleeping avatar Kent avatar Julien Quiévreux avatar trietbui85 avatar Amine Laadhari avatar kaiinui avatar  avatar Keishin Yokomaku avatar Andrew Chen avatar Aizaz AZ avatar JC avatar Takahiro Menju avatar TK avatar Pedro Paulo Amorim avatar dennis avatar Vladislav Bauer avatar Dante. avatar G avatar

Watchers

Khatanbaatar avatar  avatar xiaozou avatar Tarik Yurtlu avatar chaitanya avatar

sobitmap's Issues

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.