package com.gs.apidemo;

import android.app.Activity;
import android.view.KeyEvent;

public class BaseActivity extends Activity {
    public static final int KEY_CODE_LEFT = 1803;
    public static final int KEY_CODE_MID = 1804;
    public static final int KEY_CODE_RIGHT = 1805;
    @Override
    public boolean onKeyDown(int keyCode, KeyEvent event) {
        if (keyCode == KEY_CODE_LEFT) {
            return true;
        } else if (keyCode == KEY_CODE_MID) {
            return true;
        } else if (keyCode == KEY_CODE_RIGHT) {
            return true;
        }
        return super.onKeyDown(keyCode, event);
    }

    @Override
    public boolean onKeyUp(int keyCode, KeyEvent event) {
        if (keyCode == KEY_CODE_LEFT) {
            return true;
        } else if (keyCode == KEY_CODE_MID) {
            return true;
        } else if (keyCode == KEY_CODE_RIGHT) {
            finish();
            return true;
        }
        return super.onKeyUp(keyCode, event);
    }
}
