Last active
December 19, 2015 11:29
-
-
Save jinqian/5948367 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public void DisplayImage(final Namespace ns, String key, final ImageView imageView) { | |
| Bitmap bitmap = getBitmap(ns, key); | |
| if (bitmap != null) { | |
| Log.d(TAG, "BITMAP ALREADY DOWNLOWDED"); | |
| imageView.setImageBitmap(bitmap); | |
| } | |
| else { | |
| imageView.setImageResource(R.drawable.stub); | |
| ns.load(key, new Namespace.LoadListener() { | |
| @Override | |
| public void onLoadStart(String namespace, String key) { | |
| Log.d(TAG, "START LOADING IMAGE:" + key); | |
| } | |
| @Override | |
| public void onLoadFailed(String namespace, String key, WinchError e) { | |
| // TODO Auto-generated method stub | |
| } | |
| @Override | |
| public void onLoadProgress(String namespace, String key, | |
| float progress) { | |
| imageView.setImageResource(ms.overlay.R.drawable.stub); | |
| } | |
| @Override | |
| public void onLoadComplete(String namespace, String key) { | |
| Log.d(TAG, "IMAGE LOADED: " + key); | |
| //TODO provoke a update list to display list correctly.... | |
| byte[] blob = null; | |
| try { | |
| blob = ns.get(key); | |
| } catch (WinchError e) { | |
| e.printStackTrace(); | |
| } | |
| Bitmap bmp = BitmapFactory | |
| .decodeByteArray(blob, 0, blob.length); | |
| imageView.setImageBitmap(bmp); | |
| } | |
| }); | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment