import cz.cvut.fel.dce.qrscanner.integration.IntentIntegrator;
import cz.cvut.fel.dce.qrscanner.integration.IntentResult;
-
+/**
+ * An {@link android.app.Activity} showing an immersive card with a Skoda Auto logo, waiting for
+ * user to tap the screen to start the QR code scanning.
+ */
public class MainActivity extends ActionBarActivity {
+ /**
+ * An activity tag for debug, error and info messages.
+ */
public static final String TAG = "MainActivity";
@Override
@Override
public boolean onOptionsItemSelected(MenuItem item) {
- // Handle action bar item clicks here. The action bar will
- // automatically handle clicks on the Home/Up button, so long
- // as you specify a parent activity in AndroidManifest.xml.
int id = item.getItemId();
- //noinspection SimplifiableIfStatement
if (id == R.id.start_scan) {
startScan();
}
if (scanResult != null) {
Log.i(TAG, scanResult.toString());
Intent preview = new Intent(this, PreviewActivity.class);
- preview.putExtra("COMPONENT_ID", scanResult.getContents());
+ preview.putExtra(PreviewActivity.COMP_ID_INTENT_KEY, scanResult.getContents());
startActivity(preview);
}
}
+ /**
+ * Start the scan code activity
+ */
private void startScan() {
IntentIntegrator integrator = new IntentIntegrator(this);
integrator.initiateScan(IntentIntegrator.QR_CODE_TYPES);
}
- /** Called when the user touches the button */
+ /** Called when the user touches the screen */
public void findComponent(View view) {
startScan();
}