Пример #1
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
    setSupportActionBar(toolbar);

    // setup the History plot:
    XYPlot accPlot = (XYPlot) findViewById(R.id.accPlot);
    TextView accText1 = (TextView) findViewById(R.id.accCaption1);
    TextView accText2 = (TextView) findViewById(R.id.accCaption2);
    plotPanels[0] = new PlotPanelManager(accPlot, accText1, accText2, handler, "Accelerometer");

    XYPlot gyroPlot = (XYPlot) findViewById(R.id.gyroPlot);
    TextView gyroText1 = (TextView) findViewById(R.id.gyroCaption1);
    TextView gyroText2 = (TextView) findViewById(R.id.gyroCaption2);
    plotPanels[1] = new PlotPanelManager(gyroPlot, gyroText1, gyroText2, handler, "Gyroscope");

    for (PlotPanelManager panel : plotPanels) panel.setup();

    // sensorDataProvider = new LocalSensorDataProvider(this, getApplicationContext());
    sensorDataProvider = new WearSensorDataProvider(this, getApplicationContext());

    clockText = (TextView) findViewById(R.id.time);

    handler.postDelayed(clockUpdateProcedure, 1000);

    // setup google client to receiveData information from wear
    // IntentFilter messageFilter = new IntentFilter(Intent.ACTION_SEND);
    // MessageReceiver messageReceiver = new MessageReceiver();
    // LocalBroadcastManager.getInstance(this).registerReceiver(messageReceiver, messageFilter);
  }
Пример #2
0
 @Override
 public void receiveData(int type, long[] timestamps, float[][] data) {
   PlotPanelManager panel = plotPanels[type];
   panel.receiveData(timestamps, data);
 }