/appquest-memory

Android AppQuest Memory application for the App Quest 2016.

Primary LanguageJavaMIT LicenseMIT

AppQuest Memory

HSR

About

AppQuest Memory is the 2. application for the App Quest 2016 Treasure Hunt. The application must be able to take pictures, scan the QR-codes and store them in pairs. While the Treasure Hunt the goal will be to find as many pairs as possible. Finally it must be possible to upload all the bundled QR-code strings to the AppQuest LogBook.

General

AppQuest Repository AppQuest 2016
Application Requirements http://appquest.hsr.ch/2016/memory
Minimum API Level API level 23 (Marshmallow)
Development Environment Android Studio

Example

AppQuest Memory App Android Bot 1 QR Code Android Bot 2 QR Code

Given code snippets

build.gradle

dependencies {
    ...
    compile 'com.journeyapps:zxing-android-embedded:3.3.0'
}

MyActivity.java

public void takeQrCodePicture() {
    IntentIntegrator integrator = new IntentIntegrator(this);
    integrator.setCaptureActivity(MyCaptureActivity.class);
    integrator.setDesiredBarcodeFormats(IntentIntegrator.QR_CODE_TYPES);
    integrator.setOrientationLocked(false);
    integrator.addExtra(Intents.Scan.BARCODE_IMAGE_ENABLED, true);
    integrator.initiateScan();
}
    
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
    if (requestCode == IntentIntegrator.REQUEST_CODE 
        && resultCode == RESULT_OK) {

        Bundle extras = data.getExtras();
        String path = extras.getString(
            Intents.Scan.RESULT_BARCODE_IMAGE_PATH);
        
        // Ein Bitmap zur Darstellung erhalten wir so:
        // Bitmap bmp = BitmapFactory.decodeFile(path)
        
        String code = extras.getString(
            Intents.Scan.RESULT);
    }
}

MyCaptureActivity.java

import com.journeyapps.barcodescanner.CaptureActivity;

public class MyCaptureActivity extends CaptureActivity { }

RecyclerView with 2 columns

RecyclerView rv = (RecyclerView)findViewById(R.id.recyclerView);
GridLayoutManager gridLayoutManager = new GridLayoutManager(this, 2);
rv.setLayoutManager(gridLayoutManager);

AppQuest Logbuch format

{
  "task": "Memory",
  "solution": [["$Wort1","$Wort2"], ["$Wort3", "$Wort4"], ...]
}

License

MIT License