package cz.cvut.fel.dce.qrscanner;
-import android.content.Context;
import android.content.Intent;
-import android.content.res.AssetManager;
-import android.graphics.Bitmap;
-import android.graphics.RectF;
-import android.support.annotation.Nullable;
import android.support.v7.app.ActionBarActivity;
import android.os.Bundle;
import android.util.Log;
import android.view.Menu;
import android.view.MenuItem;
-
-import com.sun.pdfview.PDFFile;
-import com.sun.pdfview.PDFPage;
-
-import net.sf.andpdf.nio.ByteBuffer;
-
-import org.apache.commons.io.IOUtils;
-
-import java.io.IOException;
-import java.io.InputStream;
+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
@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);
}
- // else continue with any other code you need in the method
-
}
+ /**
+ * 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 screen */
+ public void findComponent(View view) {
+ startScan();
+ }
}