FileDocCategorySizeDatePackage
ConfirmRateLimitActivity.javaAPI DocAndroid 1.5 API3582Wed May 06 22:42:46 BST 2009com.android.mms.ui

ConfirmRateLimitActivity

public class ConfirmRateLimitActivity extends android.app.Activity

Fields Summary
private static final String
TAG
private static final boolean
DEBUG
private static final boolean
LOCAL_LOGV
private long
mCreateTime
private android.os.Handler
mHandler
private Runnable
mRunnable
Constructors Summary
Methods Summary
private voiddoAnswer(boolean answer)

        Intent intent = new Intent(RATE_LIMIT_CONFIRMED_ACTION);
        intent.putExtra("answer", answer);
        sendBroadcast(intent);
        finish();
    
protected voidonCreate(android.os.Bundle savedInstanceState)


    
        
        super.onCreate(savedInstanceState);

        requestWindowFeature(Window.FEATURE_NO_TITLE);
        setContentView(R.layout.confirm_rate_limit_activity);

        Button button = (Button) findViewById(R.id.btn_yes);
        button.setOnClickListener(new OnClickListener() {
            public void onClick(View v) {
                doAnswer(true);
            }
        });

        button = (Button) findViewById(R.id.btn_no);
        button.setOnClickListener(new OnClickListener() {
            public void onClick(View v) {
                doAnswer(false);
            }
        });

        mHandler = new Handler();
        mRunnable = new Runnable() {
            public void run() {
                if (LOCAL_LOGV) {
                    Log.v(TAG, "Runnable executed.");
                }
                doAnswer(false);
            }
        };

        mCreateTime = System.currentTimeMillis();
    
public booleanonKeyDown(int keyCode, android.view.KeyEvent event)

        if ((keyCode == KeyEvent.KEYCODE_BACK)
                && (event.getRepeatCount() == 0)) {
            doAnswer(false);
        }
        return super.onKeyDown(keyCode, event);
    
protected voidonPause()

        super.onPause();

        if (mHandler != null) {
            mHandler.removeCallbacks(mRunnable);
        }
    
protected voidonResume()

        super.onResume();

        long delay = mCreateTime - System.currentTimeMillis()
                        + (RateController.ANSWER_TIMEOUT - 500);

        if (delay <= 0) {
            doAnswer(false);
        } else if (mHandler != null) {
            // Close this activity after certain seconds if no user action.
            mHandler.postDelayed(mRunnable, delay);
        }