BlurStickyHeaderListView


Source link: https://github.com/emmano/BlurStickyHeaderListView

BlurStickyHeaderListView

What is BlurStickyHeaderListView?

It is a custom ListView with a header that displays pictures from an URL. It then adds a nice blur/parallax effect to the downloaded picture. It also provides the option of a sticky title. Here is a video of it in action.

How do I use the thing?

Add compile 'me.emmano:blurstickyheaderlistview:0.1.+' to the dependencies{ } in your build.gradle. If you do not aleady have jcenter() added to your project, do so by adding the following to build.gradle:

repositories {

  jcenter() 
}
 

You also need to add renderscript to your project. If using android studio add the following to defaultConfig{ } inside build.gradle:

defaultConfig {

  //Other config...
  renderscriptTargetApi 19
  renderscriptSupportMode true 
}
 

BlurStickyHeaderListView is pretty straight forward to use. You have two alternatives:

  1. Using BlurListFragment.
  2. Using BlurListView.

Regardless of which option you use the API is the same. Here is a snippet for your reference.

import com.emmano.blurstickyheaderlistviewlib.fragment.BlurListFragment;  import android.os.Bundle; import android.support.v4.app.FragmentActivity; import android.view.Menu; import android.view.MenuItem; import android.widget.ArrayAdapter;  import java.util.Arrays;
public class MyActivity extends FragmentActivity {

public static final String DUMMY_TEXT =

 "Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore "

+ "magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat."

+ " Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur."

+ " Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.";

@Override
  protected void onCreate(Bundle savedInstanceState) {

super.onCreate(savedInstanceState);

setContentView(R.layout.activity_my);

if (savedInstanceState == null) {

 final ArrayAdapter<String> listAdapter = new ArrayAdapter<>(this, android.R.layout.simple_list_item_1, Arrays.asList(DUMMY_TEXT, DUMMY_TEXT));

final BlurListFragment blurListFragment = new BlurListFragment();

 //Set up the BlurListFragment before you call FragmentTransaction.commit() methods called after commit() will do nothing.

 blurListFragment.setRetainInstance(true);
 // for configuration changes.

 blurListFragment.controlActionBar(true);

 blurListFragment.setActionBarColor("#RRGGBB") //adds Google+ effect to ActionBar.

 blurListFragment.setEnableLogging(true);

  // For more image configuration stuff BlurListFragment.loadHeaderImage(RequestCreator picassoCreator) could be used

  blurListFragment.loadHeaderImage("http://someimage",R.drawable.ic_launcher);

 blurListFragment.setBlurHeaderListAdapter(listAdapter);

 blurListFragment.shouldTitleStick(true);

 getSupportFragmentManager().beginTransaction().add(R.id.container, blurListFragment,BlurListFragment.class.getSimpleName()).commit();

 
}

  
}

@Override
  public boolean onCreateOptionsMenu(Menu menu) {

// Inflate the menu; this adds items to the action bar if it is present.

getMenuInflater().inflate(R.menu.my, menu);

return true;
  
}

@Override
  public boolean onOptionsItemSelected(MenuItem item) {

// Handle action bar item clicks here. The action bar will

// automatically handle clicks on the Home/Up button, so long

// as you specify a parent activity in AndroidManifest.xml.

int id = item.getItemId();

if (id == R.id.action_settings) {

 return true;

}

return super.onOptionsItemSelected(item);

  
}
 
}

Limitations

  1. In order for this library to work, you need to set your ActionBar to overlay mode. Go here for steps on how to set your ActionBar to overlay mode.

License

The MIT License (MIT)  Copyright (c) 2014 Emmanuel Ortiguela  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. 

Resources

This lightweight library makes it easy to use HTTP requests. Although the purpose is to make the use of Json data easy, it also allows to retrieve the server response using other formats, XML and TEXT.

SpannedGridLayouManager is a layout manager that will resize and reorder views based on a provided SpanSize.

Photo Editor SDK contains a lot of features like edit, scale, rotate and draw on images like Instagram stories.

A reactive layer on top of universal image loader (easy and hassle-free) using RxJava 2.

A fluent tooltip for Android.

In shortest terms, Silly Android is a set of most commonly used workarounds, fixes and utilities, all of which should have been included in the core Android framework by default. When you find yourself asking questions like "Why is this simple task so complicated to do?" or "How was this not done by default?" - Silly Android should be the help you need.

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