예제 #1
0
  private void initView() {
    mSessionEditText = (EditText) findViewById(R.id.et_sessionid);
    mUserIdEditText = (EditText) findViewById(R.id.et_userid);
    mRadioGroup = (RadioGroup) findViewById(R.id.rb_orientation);
    mStartBtn = (Button) findViewById(R.id.btnStart);
    mStartBtn.setOnClickListener(
        new View.OnClickListener() {
          @Override
          public void onClick(View v) {
            String sessionId = mSessionEditText.getText().toString().trim();
            String userId = mUserIdEditText.getText().toString().trim();
            if (TextUtils.isEmpty(sessionId)) {
              Toast.makeText(MyActivity.this, "pls input the sessionId!", Toast.LENGTH_SHORT)
                  .show();
              return;
            }
            int id = mRadioGroup.getCheckedRadioButtonId();
            int orientation = ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED;
            if (id == R.id.rb_hor) {
              orientation = ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE;
            } else if (id == R.id.rb_ver) orientation = ActivityInfo.SCREEN_ORIENTATION_PORTRAIT;

            GameActivity.start(MyActivity.this, sessionId, userId, orientation);
          }
        });

    String userId = String.valueOf((int) (Math.random() * 10 + 1));
    mUserIdEditText.setText(userId);
    mHelper = ArcVoiceHelper.getInstance(getApplicationContext());
    mHelper.init(ARC_APP_ID, ARC_APP_CREDENTIALS, ARC_REGION, userId);
  }
예제 #2
0
 @Override
 protected void onDestroy() {
   mHelper.stop();
   super.onDestroy();
 }
예제 #3
0
 @Override
 protected void onPause() {
   LogUtils.e("MyActivity onPause");
   mHelper.hiddenAll();
   super.onPause();
 }
예제 #4
0
 @Override
 protected void onResume() {
   LogUtils.e("MyActivity onResume");
   mHelper.show();
   super.onResume();
 }