Exemplo n.º 1
0
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    requestWindowFeature(Window.FEATURE_NO_TITLE);
    getWindow()
        .setFlags(
            WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON,
            WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);

    mContext = this;

    setContentView(R.layout.main);

    txTimeDiv = (TextView) findViewById(R.id.txTimeDiv);
    txScaleFactor = (TextView) findViewById(R.id.txScaleFactor);

    btTimeDiv = (Button) findViewById(R.id.btTimeDiv);
    btScaleFactor = (Button) findViewById(R.id.btScaleFactor);

    pm = (PowerManager) getSystemService(Context.POWER_SERVICE);
    wl = pm.newWakeLock(PowerManager.SCREEN_DIM_WAKE_LOCK, Globals.TAG);

    fileCreator = new FileCreator("scope-mobile.txt");
    fileCreator.createNewFile();

    // debug file
    fileCreator2 = new FileCreator("scope-mobile-all.txt");
    fileCreator2.createNewFile();

    mBluetoothAdapter = BluetoothAdapter.getDefaultAdapter();

    if (mBluetoothAdapter == null) {
      Toast.makeText(this, "Bluetooth is not available", Toast.LENGTH_LONG).show();
      finish();
      return;
    }
    graphLayout = new GraphLayout(this);
    layout = (LinearLayout) findViewById(R.id.graphView);
    layout.addView(graphLayout.drawGraphSensor());
  }