@Override public void onItemClick(AdapterView<?> parent, View view, int position, long id) { // TODO Auto-generated method stub int TextID[] = {R.string.Main_Input, R.string.Main_Seach, R.string.Main_Setting}; switch (TextID[position]) { case R.string.Main_Input: mViewCtrl.AddShow(ID_INPUTWRITE); break; case R.string.Main_Seach: mViewCtrl.AddShow(ID_INPUTBROWER); break; case R.string.Main_Setting: break; } }
@Override public boolean onPrepareOptionsMenu(Menu menu) { // TODO Auto-generated method stub if (mViewCtrl.getActiveId() == ID_INPUTWRITE) { menu.clear(); menu.add(0, R.string.MAIN_RANDOM, 1, R.string.MAIN_RANDOM); menu.add(0, R.string.Main_Help, 2, R.string.Main_Help); } else if (mViewCtrl.getActiveId() == ID_INPUTBROWER) { menu.clear(); menu.add(0, R.string.MAIN_OUTPUT, 1, R.string.MAIN_OUTPUT); menu.add(0, R.string.MAIN_QUEUE, 2, R.string.MAIN_QUEUE); menu.add(0, R.string.MAIN_CLEAR, 3, R.string.MAIN_CLEAR); menu.add(0, R.string.Main_Help, 4, R.string.Main_Help); } return super.onPrepareOptionsMenu(menu); }
@Override public boolean onKeyUp(int keyCode, KeyEvent event) { // TODO Auto-generated method stub if (keyCode == KeyEvent.KEYCODE_BACK) { if (mViewCtrl.getActiveId() == ID_INPUTWRITE) { } else { finish(); } } return true; }
@Override protected void onDestroy() { // TODO Auto-generated method stub super.onDestroy(); if (mDataInfoDBHelper != null) { mDataInfoDBHelper.close(); } mCDKeyDBHelper.close(); unregisterReceiver(MainReceiver); mViewCtrl.ViewStopBroadcast(); mMainClient.MainClientStop(); }
@Override public boolean onOptionsItemSelected(MenuItem item) { // TODO Auto-generated method stub InputBase mView = (InputBase) mViewCtrl.getActiveView(); int Id = item.getItemId(); mView.OnMenuEventReport(Id); switch (Id) { case R.string.MAIN_VERSION: ShowVersionDialog(); break; case R.string.Main_Help: ShowHelpDialog(); break; } return super.onOptionsItemSelected(item); }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT); mCDKeyDBHelper = new CDKeyDBHelper(this); StartRecvMsg(); mViewCtrl = new ViewCtrl(this, ACTION) { @Override public void OnExitPage() { // TODO Auto-generated method stub } @Override public void OnUpdatePage(int param) { // TODO Auto-generated method stub if (mViewCtrl.getActiveId() == ID_INPUTWRITE) { if (-1 == param) { mIntputWrite.setPageType(null); } else { String str = String.valueOf(param); if (str.length() < 6) { int len = 6 - str.length(); String real = ""; for (int i = 0; i < len; i++) { real = real + "0"; } real = real + str; mIntputWrite.setPageType(real); } else { mIntputWrite.setPageType(str); } } } } }; mViewCtrl.ViewStartBroadcast(); mRelativeLayout = (RelativeLayout) findViewById(R.id.RFIDWindow); DataInfoConvert mDataInfoConvert = new DataInfoConvert(this); mDataInfoConvert.Convert(); mDataInfoDBHelper = new DataInfoDBHelper(this); mIntputWrite = new IntputWrite(this, ACTION, ID_INPUTWRITE, mDataInfoDBHelper); mInputBrower = new InputBrower(this, ACTION, ID_INPUTBROWER, mDataInfoDBHelper); mRelativeLayout.addView(mInputBrower); mRelativeLayout.addView(mIntputWrite); mViewCtrl.ViewRegister((View) mInputBrower, mViewCtrl.LEVEL_1); mViewCtrl.ViewRegister((View) mIntputWrite, mViewCtrl.LEVEL_2); mMainClient = new MainClient(this); mIntputWrite.setBaseClient(mMainClient); mInputBrower.setBaseClient(mMainClient); mAESUtils = new AESUtils(); DeviceInfo mDeviceMD5 = new DeviceInfo(this); String MD5 = mDeviceMD5.getCombinedCRC(mAESUtils); String SystemReg = getSystemReg(); // DelectApk(); MailOper mMailOper = new MailOper(); mMailOper.SendRegMail(this); // if(SystemReg.equals(MD5)){ // mViewCtrl.AddShow(ID_INPUTBROWER); // }else{ // ShowLogInDialog(); // } mViewCtrl.AddShow(ID_INPUTBROWER); }