Beispiel #1
0
 @Override
 protected View getLayoutView() {
   mCard = new Card(this);
   mCard.setText(R.string.login_hint);
   mCard.setFootnote(R.string.tap_to_scan_qr_code);
   return mCard.toView();
 }
 @Override
 protected void onResume() {
   Log.d("MainActivity", "onResume()");
   super.onResume();
   isInitialized = false;
   suspandTimer = false;
   alertAlreadyTrigged = false;
   Card cardProtectMode = new Card(this);
   cardProtectMode.setText("Protect Mode On");
   setContentView(cardProtectMode.toView());
 }
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    //        LiveCard liveCard = TimelineManager.from(this).createLiveCard(LIVE_CARD_STRING);
    //        RemoteViews remoteViews = new RemoteViews(getPackageName(), R.layout.livecard1);
    //
    //        liveCard.setViews(remoteViews);

    Card showCardWithText = showCardWithText("Tap and say a quantity and divise");
    Intent intent = getIntent();
    target = (String) intent.getExtras().get("target");
    setContentView(showCardWithText.toView());
  }
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    getWindow().addFlags(WindowManager.LayoutParams.FLAG_TURN_SCREEN_ON);
    getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);

    mCard = new Card(this);

    mCard.setImageLayout(ImageLayout.LEFT);
    mCard.addImage(R.drawable.ic_angle_150);
    mCard.setFootnote(R.string.tap_to_set_angle);

    mSensorManager = (SensorManager) getSystemService(Context.SENSOR_SERVICE);
    mGravity = mSensorManager.getDefaultSensor(Sensor.TYPE_GRAVITY);

    setContentView(mCard.getView());
  }
  @Override
  public void onSensorChanged(SensorEvent event) {
    // Don't constantly update the View
    if (System.currentTimeMillis() - mLastViewUpdate > UPDATE_TIME_MILLIS) {
      mLastReading = event.values[2];

      // Convert the meters per second acceleration to angle
      double angle = Math.asin(mLastReading / 9.80665f);

      // Convert from radians to degrees and limit decimal places
      angle =
          new BigDecimal(angle * -180 / Math.PI).setScale(1, RoundingMode.HALF_UP).doubleValue();

      mCard.setText(" " + angle + "\n degrees");

      setContentView(mCard.getView());

      mLastViewUpdate = System.currentTimeMillis();
    }
  }
Beispiel #6
0
  private void createCards() {
    properties = new ArrayList<Card>();

    Card house1 = new Card(this);
    house1.setText("First house");
    house1.setFootnote("Footer");
    properties.add(house1);

    Card house2 = new Card(this);
    house2.setText("House2");
    house2.setImageLayout(Card.ImageLayout.LEFT);
    // house2.addImage(uri)
    properties.add(house2);
  }
Beispiel #7
0
 private void showStatus(int status) {
   mCard.setText(status);
   setContentView(mCard.toView());
 }
 private Card showCardWithText(String text) {
   Card card = new Card(this);
   card.setText(text);
   TimelineManager.from(this).insert(card);
   return card;
 }