]> rtime.felk.cvut.cz Git - hornmich/skoda-qr-demo.git/blobdiff - QRScanner/mobile/src/main/java/cz/cvut/fel/dce/qrscanner/MainActivity.java
Clean and coment the code.
[hornmich/skoda-qr-demo.git] / QRScanner / mobile / src / main / java / cz / cvut / fel / dce / qrscanner / MainActivity.java
index de3a44ca2062f8d0d7503ccee16203165ef373cf..c8ba7cfb11fb5a4288308d39bce25dd3cbf1f898 100644 (file)
@@ -11,8 +11,14 @@ import android.view.View;
 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
@@ -31,12 +37,8 @@ public class MainActivity extends ActionBarActivity {
 
        @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();
                }
@@ -49,17 +51,20 @@ public class MainActivity extends ActionBarActivity {
                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();
        }