List of usage examples for android.widget TextView getContentDescription
@ViewDebug.ExportedProperty(category = "accessibility") public CharSequence getContentDescription()
From source file:co.scandy.example.scandycoreandroidexample.MainActivity.java
void bindScanControls() { // Listen for changes to size bar ((SeekBar) findViewById(R.id.scan_size)).setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() { @Override/*w w w . ja va 2s .co m*/ public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) { // Update Scandy Core scan size based on the value of the seekbar float x = (float) (((SeekBar) findViewById(R.id.scan_size)).getProgress() * SIZE_STEP_SCALE); x += 0.25; ScandyCore.setScanSize(x, x, x); // Update the TextView with the new scan size TextView textView = (TextView) findViewById(R.id.scan_size_text); textView.setText(textView.getContentDescription() + " " + x + "m"); } @Override public void onStartTrackingTouch(SeekBar seekBar) { } @Override public void onStopTrackingTouch(SeekBar seekBar) { } }); // Listen for changes to resolution bar ((SeekBar) findViewById(R.id.scan_resolution)) .setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() { @Override public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) { // The ScanResolution id is the index of the seekbar + 1 to offset the 0 index. ScanResolution resolution = new ScanResolution(progress + 1, ""); // Tell Scandy Core that we want a new resolution ScandyCore.setResolution(resolution); } @Override public void onStartTrackingTouch(SeekBar seekBar) { } @Override public void onStopTrackingTouch(SeekBar seekBar) { } }); // Listen for clicking on the Mesh button ((Button) findViewById(R.id.mesh)).setOnClickListener(new Button.OnClickListener() { @Override public void onClick(View v) { // Tell Scandy Core to generate a mesh based on the last scan ScandyCore.generateMesh(); } }); // Listen for clicking on the Save button ((Button) findViewById(R.id.save)).setOnClickListener(new Button.OnClickListener() { @Override public void onClick(View v) { // Save the mesh that Scandy Core just generated through scanning // NOTE: you could ask a user where to save this scan File dir = new File(Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOWNLOADS) .getAbsolutePath()); ScandyCore.saveMesh( dir.getAbsolutePath() + "ScandyCoreAndroidExample-" + System.currentTimeMillis() + ".ply"); } }); // First initialize all our class Toggle Buttons mPreviewToggle = (ToggleButton) findViewById(R.id.preview_toggle); mScanToggle = (ToggleButton) findViewById(R.id.scan_toggle); // Configure Preview Toggle mPreviewToggle.setEnabled(false); mPreviewToggle.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { @Override public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { // Start / stop the preview based on this button if (isChecked) { ScandyCore.startPreview(); } else { ScandyCore.stopScanning(); } } }); // Configure Scan Toggle mScanToggle.setEnabled(false); mScanToggle.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { @Override public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { // Start / stop the scan based on this button if (isChecked) { ScandyCore.startScanning(); } else { ScandyCore.stopScanning(); } } }); }