コード例 #1
0
ファイル: MainActivity.java プロジェクト: mailat/dina12
  private void confirmText(String spokenText) {
    mStartGameButton.setVisibility(View.GONE);
    mCategoryLayout.setVisibility(View.VISIBLE);

    mCategoryTextView.setText("Selected category: " + spokenText);
    mSelectedCategory = spokenText;

    mDelayedView.setTotalTimeMs(3000);
    mDelayedView.start();
  }
コード例 #2
0
ファイル: MainActivity.java プロジェクト: mailat/dina12
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    setAmbientEnabled();

    mContainerView = (BoxInsetLayout) findViewById(R.id.container);
    mStartGameButton = (Button) findViewById(R.id.start_game);
    mStartGameButton.setOnClickListener(
        new View.OnClickListener() {
          @Override
          public void onClick(View v) {
            displaySpeechRecognizer();
          }
        });

    mDelayedView = (DelayedConfirmationView) findViewById(R.id.delayed_confirm);
    mDelayedView.setListener(mDelayedConfirmationListener);

    mCategoryTextView = (TextView) findViewById(R.id.selected_category);

    mCategoryLayout = findViewById(R.id.category_layout);

    mGoogleApiClient =
        new GoogleApiClient.Builder(this)
            .addConnectionCallbacks(
                new GoogleApiClient.ConnectionCallbacks() {
                  @Override
                  public void onConnected(Bundle bundle) {
                    Log.d(TAG, "onConnected");
                    Wearable.MessageApi.addListener(mGoogleApiClient, MainActivity.this);
                  }

                  @Override
                  public void onConnectionSuspended(int i) {
                    Log.d(TAG, "onConnectionSuspended");
                  }
                })
            .addOnConnectionFailedListener(
                new GoogleApiClient.OnConnectionFailedListener() {
                  @Override
                  public void onConnectionFailed(ConnectionResult connectionResult) {
                    Log.d(TAG, "onConnectionFailed");
                  }
                })
            .addApi(Wearable.API)
            .build();
  }