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); }
@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 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(); } }
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; }