Methods Summary |
---|
private void | doAnswer(boolean answer)
Intent intent = new Intent(RATE_LIMIT_CONFIRMED_ACTION);
intent.putExtra("answer", answer);
sendBroadcast(intent);
finish();
|
protected void | onCreate(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 boolean | onKeyDown(int keyCode, android.view.KeyEvent event)
if ((keyCode == KeyEvent.KEYCODE_BACK)
&& (event.getRepeatCount() == 0)) {
doAnswer(false);
}
return super.onKeyDown(keyCode, event);
|
protected void | onPause()
super.onPause();
if (mHandler != null) {
mHandler.removeCallbacks(mRunnable);
}
|
protected void | onResume()
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);
}
|