コード例 #1
0
ファイル: MainActivity.java プロジェクト: snorlax94/sdk
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    altitudeTextView = (TextView) findViewById(R.id.altitudeTextView);

    speedVrtTextView = (TextView) findViewById(R.id.speedTextView);
    speedVrtTextView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 52);

    mHUDMetricsManager = (HUDMetricsManager) HUDOS.getHUDService(HUDOS.HUD_METRICS_SERVICE);
    mNotificationManager = (NotificationManager) getSystemService(NOTIFICATION_SERVICE);
  }
コード例 #2
0
ファイル: MainActivity.java プロジェクト: snorlax94/sdk
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    // Get view references (from activity_main.xml)
    mConnectDevice = (TextView) findViewById(R.id.connected_device);
    mHUDConnected = (TextView) findViewById(R.id.hud_connected);
    mLocalWeb = (TextView) findViewById(R.id.local_web_connected);
    mRemoteWeb = (TextView) findViewById(R.id.remote_web_connected);

    mDownloadFile = (Button) findViewById(R.id.download_file_button);
    mUploadFile = (Button) findViewById(R.id.upload_file_button);
    mDownloadImage = (Button) findViewById(R.id.load_image_button);

    mDownloadFile.setOnClickListener(this);
    mUploadFile.setOnClickListener(this);
    mDownloadImage.setOnClickListener(this);

    mDownloadFile.setEnabled(false);
    mUploadFile.setEnabled(false);
    mDownloadImage.setEnabled(false);

    // Get an instance of HUDConnectivityManager
    mHUDConnectivityManager =
        (HUDConnectivityManager) HUDOS.getHUDService(HUDOS.HUD_CONNECTIVITY_SERVICE);
    if (mHUDConnectivityManager == null) {
      Log.e(TAG, "Failed to get HUDConnectivityManager");
      finish();
    }

    setViewColor(mHUDConnected, COL_RED);
    setViewColor(mLocalWeb, COL_RED);
    setViewColor(mRemoteWeb, COL_RED);
    if (mHUDConnectivityManager.isHUDConnected()) {
      Log.d(TAG, "HUD is connected.");
      mHUDConnected.setText("HUD Connected");
    } else {
      Log.d(TAG, "HUD is disconnected.");
      mHUDConnected.setText("HUD Disconnected");
    }

    // !!!! -------- IMPORTANT NOTICE -------- !!!! //
    // Note: This following line is necessary for HUDConnectivityManager to run properly
    System.load("/system/lib/libreconinstruments_jni.so");
    // !!!! -------- IMPORTANT NOTICE -------- !!!! //
  }