FileDocCategorySizeDatePackage
ChooseLockPatternExample.javaAPI DocAndroid 1.5 API3428Wed May 06 22:42:48 BST 2009com.android.settings

ChooseLockPatternExample

public class ChooseLockPatternExample extends android.app.Activity implements View.OnClickListener

Fields Summary
private static final int
REQUESTCODE_CHOOSE
private static final long
START_DELAY
protected static final String
TAG
private android.view.View
mNextButton
private android.view.View
mSkipButton
private android.view.View
mImageView
private android.graphics.drawable.AnimationDrawable
mAnimation
private android.os.Handler
mHandler
private Runnable
mRunnable
Constructors Summary
Methods Summary
private voidinitViews()

        mNextButton = findViewById(R.id.next_button);
        mNextButton.setOnClickListener(this);
        
        mSkipButton = findViewById(R.id.skip_button);
        mSkipButton.setOnClickListener(this);
        
        mImageView = (ImageView) findViewById(R.id.lock_anim);
        mImageView.setBackgroundResource(R.drawable.lock_anim);
        mImageView.setOnClickListener(this);
        mAnimation = (AnimationDrawable) mImageView.getBackground();
    
protected voidonActivityResult(int requestCode, int resultCode, android.content.Intent data)

        if (requestCode == REQUESTCODE_CHOOSE && resultCode == ChooseLockPattern.RESULT_FINISHED) {
            setResult(resultCode);
            finish();
        }
    
public voidonClick(android.view.View v)

        if (v == mSkipButton) {
            // Canceling, so finish all
            setResult(ChooseLockPattern.RESULT_FINISHED);
            finish();
        } else if (v == mNextButton) {
            stopAnimation(mAnimation);
            Intent intent = new Intent(this, ChooseLockPattern.class);
            startActivityForResult(intent, REQUESTCODE_CHOOSE);
        }
    
protected voidonCreate(android.os.Bundle savedInstanceState)

   
    
        
        super.onCreate(savedInstanceState);
        setContentView(R.layout.choose_lock_pattern_example);
        initViews();
    
protected voidonPause()

        super.onPause();
        stopAnimation(mAnimation);
    
protected voidonResume()

        super.onResume();
        mHandler.postDelayed(mRunnable, START_DELAY);
    
protected voidstartAnimation(android.graphics.drawable.AnimationDrawable animation)

        if (animation != null && !animation.isRunning()) {
            animation.run();
        }
    
protected voidstopAnimation(android.graphics.drawable.AnimationDrawable animation)

        if (animation != null && animation.isRunning()) animation.stop();