Malevich


Source link: https://github.com/recoilme/malevich

malevich

Android displaying bitmaps library

This library is just wrapper for Google tutorial Loading Large Bitmaps Efficiently:

http://developer.android.com/intl/ru/training/displaying-bitmaps/load-bitmap.html

Example of usage:

https://github.com/recoilme/android-DisplayingBitmaps

How to use:

// init Malevich malevich = new Malevich.Builder(this).build();

// use malevich.load(mImageUrl).into(mImageView);
  

Thats all!

Advansed usage:

Memory and disk caching params

ImageCache.ImageCacheParams cacheParams = new ImageCache.ImageCacheParams(this, "dir");

cacheParams.memoryCacheEnabled = true; //Enable memory cache

cacheParams.setMemCacheSizePercent(0.4f);
  //Percent of available memory for cache

cacheParams.compressQuality = 90; // Compress quality

cacheParams.compressFormat = Bitmap.CompressFormat.PNG; // Compress format

cacheParams.diskCacheEnabled = true; // Use disk cache

cacheParams.diskCacheSize = 10485760; // Disk cache size 

Malevich Builder

malevich = new Malevich.Builder(this)

.debug(true) // write log

.maxSize(1024) // max size of image in px

.LoadingImage(R.drawable.some) // preloader image or recource

.CacheParams(casheParams) // custom cache

.build();
 

Loading image

malevich.load(some).into(ImageView);
 

you may load:

  1. Bitmap
  2. BitmapDrawable
  3. Resource id
  4. HttpUrl

Transform image after loading with prebuild utils or custom method

malevich.load(url).width(mItemHeight).height(mItemHeight).imageDecodedListener(new Malevich.ImageDecodedListener() {

@Override

public Bitmap onImageDecoded(String data, int reqWidth, int reqHeight, Bitmap bitmap) {

  // Get squared bitmap and transform it to circle

 return Malevich.Utils.getSquaredCircleBitmap(bitmap,reqWidth);

}

  
}
).into(imageView);
 

Pause loading on scroll

mGridView.setOnScrollListener(new AbsListView.OnScrollListener() {

 @Override

 public void onScrollStateChanged(AbsListView absListView, int scrollState) {

  // Pause fetcher to ensure smoother scrolling when flinging

  if (scrollState == AbsListView.OnScrollListener.SCROLL_STATE_FLING) {

// Pause image loading on scroll to help with performance

malevich.setPauseWork(true);

  
}
 else {

malevich.setPauseWork(false);

  
}

 
}

  @Override

 public void onScroll(AbsListView absListView, int firstVisibleItem,

int visibleItemCount, int totalItemCount) {

 
}

}
);
 

Can?el and pausing tasks


 @Override
  public void onResume() {

super.onResume();

malevich.setExitTasksEarly(false);

mAdapter.notifyDataSetChanged();

  
}

@Override
  public void onPause() {

super.onPause();

malevich.setPauseWork(false);

malevich.setExitTasksEarly(true);

malevich.flushCache();

  
}

@Override
  public void onDestroy() {

super.onDestroy();

malevich.closeCache();

  
}
 

Resources

This is a library that can help you to receive results from startActivityForResult() as an Observable.

A Download Button ProgressBar animation.

Fun interactive Android count widget. Stepper Touch for Android is based on a Material Up showcase with a newly introduced SpringAnimator for animations.

instapk is an android studio plugin which will share apk to slack teams with a single button click! No more browse or drag n drop, be at your place!

A simple timeout sensor that detects if there hasn't been any user interaction for a specified amount of time. If the timer runs up without interaction, a dialog will popup giving them another 30 seconds to 'stay logged in' otherwise the app will kill itself.

Sometime, to do round textview or round view group is hard. Need to apply dynamic color? Nine patch is not answer? You are on the right place.

Topics


2D Engines   3D Engines   9-Patch   Action Bars   Activities   ADB   Advertisements   Analytics   Animations   ANR   AOP   API   APK   APT   Architecture   Audio   Autocomplete   Background Processing   Backward Compatibility   Badges   Bar Codes   Benchmarking   Bitmaps   Bluetooth   Blur Effects   Bread Crumbs   BRMS   Browser Extensions   Build Systems   Bundles   Buttons   Caching   Camera   Canvas   Cards   Carousels   Changelog   Checkboxes   Cloud Storages   Color Analysis   Color Pickers   Colors   Comet/Push   Compass Sensors   Conferences   Content Providers   Continuous Integration   Crash Reports   Credit Cards   Credits   CSV   Curl/Flip   Data Binding   Data Generators   Data Structures   Database   Database Browsers   Date &   Debugging   Decompilers   Deep Links   Dependency Injections   Design   Design Patterns   Dex   Dialogs   Distributed Computing   Distribution Platforms   Download Managers   Drawables   Emoji   Emulators   EPUB   Equalizers &   Event Buses   Exception Handling   Face Recognition   Feedback &   File System   File/Directory   Fingerprint   Floating Action   Fonts   Forms   Fragments   FRP   FSM   Functional Programming   Gamepads   Games   Geocaching   Gestures   GIF   Glow Pad   Gradle Plugins   Graphics   Grid Views   Highlighting   HTML   HTTP Mocking   Icons   IDE   IDE Plugins   Image Croppers   Image Loaders   Image Pickers   Image Processing   Image Views   Instrumentation   Intents   Job Schedulers   JSON   Keyboard   Kotlin   Layouts   Library Demos   List View   List Views   Localization   Location   Lock Patterns   Logcat   Logging   Mails   Maps   Markdown   Mathematics   Maven Plugins   MBaaS   Media   Menus   Messaging   MIME   Mobile Web   Native Image   Navigation   NDK   Networking   NFC   NoSQL   Number Pickers   OAuth   Object Mocking   OCR Engines   OpenGL   ORM   Other Pickers   Parallax List   Parcelables   Particle Systems   Password Inputs   PDF   Permissions   Physics Engines   Platforms   Plugin Frameworks   Preferences   Progress Indicators   ProGuard   Properties   Protocol Buffer   Pull To   Purchases   Push/Pull   QR Codes   Quick Return   Radio Buttons   Range Bars   Ratings   Recycler Views   Resources   REST   Ripple Effects   RSS   Screenshots   Scripting   Scroll Views   SDK   Search Inputs   Security   Sensors   Services   Showcase Views   Signatures   Sliding Panels   Snackbars   SOAP   Social Networks   Spannable   Spinners   Splash Screens   SSH   Static Analysis   Status Bars   Styling   SVG   System   Tags   Task Managers   TDD &   Template Engines   Testing   Testing Tools   Text Formatting   Text Views   Text Watchers   Text-to   Toasts   Toolkits For   Tools   Tooltips   Trainings   TV   Twitter   Updaters   USB   User Stories   Utils   Validation   Video   View Adapters   View Pagers   Views   Watch Face   Wearable Data   Wearables   Weather   Web Tools   Web Views   WebRTC   WebSockets   Wheel Widgets   Wi-Fi   Widgets   Windows   Wizards   XML   XMPP   YAML   ZIP Codes