Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/sundeepk/asyncbackgroundviewpager
Load and display a background image to a ViewPager asynchronously, with automatic disk caching.
https://github.com/sundeepk/asyncbackgroundviewpager
Last synced: 2 months ago
JSON representation
Load and display a background image to a ViewPager asynchronously, with automatic disk caching.
- Host: GitHub
- URL: https://github.com/sundeepk/asyncbackgroundviewpager
- Owner: SundeepK
- Created: 2013-12-01T22:45:23.000Z (about 11 years ago)
- Default Branch: master
- Last Pushed: 2013-12-02T23:07:28.000Z (about 11 years ago)
- Last Synced: 2024-04-16T11:24:49.547Z (9 months ago)
- Language: Java
- Size: 2.35 MB
- Stars: 6
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
AsyncBackgroundViewPager
==============Simple way to load a large background image that spans across a ViewPager widget. Scrolling between tabs automatiacally scrolls the background for you to. It also handels disk caching so that the same images will be loaded into memory much more efficiently rather than downloading them again. It also provides a away of automatically calculating the optimal image size for you as well :). This widget makes heavy use of the [Simple Image Cache](https://github.com/SundeepK/SIC/blob/master/README.md) for code reuse. I will be commiting a version with out the SIC once it is finished.
**Layout code**
Simply define a AsyncBackgroundViewPager:
``` xml
```
``` java
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
Button but = (Button) findViewById(R.id.buttonChangeImage);
_viewPage = (AsyncBackgroundViewPager) findViewById(R.id.viewPager);
_viewPage.setAdapter(new TestAdapter(getSupportFragmentManager()));
_viewPage.setExternalStorageDir("/storage/sdcard0/Pictures/test", 5);
try {
_viewPage.loadImage(
new URI("someurlToAImage.com/image.jpeg")
, 1, false);
} catch (URISyntaxException e) {
e.printStackTrace();
}
}
```