Methods Summary |
---|
private void | cancelPost()
mHandler.removeCallbacks(mNextImageRunnable);
mPosted = false;
|
private void | loadImage()
ImageManager.IImage image = mImageList.getImageAt(mCurrentPosition);
if (image == null)
return;
Bitmap bitmap = image.thumbBitmap();
if (bitmap == null)
return;
mSwitcher.setImageDrawable(new BitmapDrawable(bitmap));
post();
|
private void | loadNextImage()
if (++mCurrentPosition >= mImageList.getCount())
mCurrentPosition = 0;
loadImage();
|
private void | loadPreviousImage()
if (mCurrentPosition == 0)
mCurrentPosition = mImageList.getCount() - 1;
else
mCurrentPosition -= 1;
loadImage();
|
public android.view.View | makeView()
ImageView i = new ImageView(this);
i.setBackgroundColor(0xFF000000);
i.setScaleType(ImageView.ScaleType.FIT_CENTER);
i.setLayoutParams(new LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT));
return i;
|
protected void | onCreate(android.os.Bundle icicle)
super.onCreate(icicle);
Window wp = getWindow();
wp.setFlags(FLAG_KEEP_SCREEN_ON, FLAG_KEEP_SCREEN_ON);
setContentView(R.layout.slide_show);
mSwitcher = (ImageView)findViewById(R.id.imageview);
if (android.util.Config.LOGV)
Log.v(TAG, "mSwitcher " + mSwitcher);
|
public boolean | onKeyDown(int keyCode, android.view.KeyEvent event)
switch (keyCode) {
case KeyEvent.KEYCODE_DPAD_LEFT:
cancelPost();
loadPreviousImage();
return true;
case KeyEvent.KEYCODE_DPAD_RIGHT:
cancelPost();
loadNextImage();
return true;
case KeyEvent.KEYCODE_DPAD_CENTER:
if (mPosted)
cancelPost();
else
loadNextImage();
return true;
}
return super.onKeyDown(keyCode, event);
|
protected void | onPause()
super.onPause();
cancelPost();
|
protected void | onResume()
super.onResume();
if (mImageList == null) {
mImageList = new FileImageList();
mCurrentPosition = 0;
}
loadImage();
|
private void | post()
mHandler.postDelayed(mNextImageRunnable, sNextImageInterval);
mPosted = true;
|