Commit be022e84 authored by kirk's avatar kirk

snapshot before syncing to original repository

parent 0a275f94
......@@ -12,3 +12,4 @@
# Project target.
target=android-17
android.library.reference.1=../../ZxingIntegration
<menu xmlns:android="http://schemas.android.com/apk/res/android" >
<item android:id="@+id/write_tag_item" android:title="@string/write_tag_label" android:showAsAction="never"></item>
<item android:id="@+id/share_qr_item" android:title="@string/share_label" android:showAsAction="never"></item>
<item android:id="@+id/scan_qr_item" android:showAsAction="never" android:title="@string/scan_qr_label"></item>
<item android:id="@+id/share_qr_item" android:title="@string/share_label" android:showAsAction="never"></item><item android:id="@+id/write_tag_item" android:title="@string/write_tag_label" android:showAsAction="never"></item>
</menu>
......@@ -33,5 +33,6 @@
<string name="unparseable_payload">Unparseable payload</string>
<string name="initialized_from_active_connection">Initialized from active connection to %1$s</string>
<string name="no_active_connection">No active connection</string>
<string name="scan_qr_label">Scan QR&#8230;</string>
</resources>
......@@ -40,6 +40,8 @@ import android.util.Log;
import android.view.Menu;
import android.view.MenuItem;
import com.google.zxing.integration.android.IntentIntegrator;
/**
* Launcher {@link Activity} for <code>WyFy</code> app
*
......@@ -291,6 +293,11 @@ public final class MainActivity extends FragmentActivity implements
shareQrCode();
return true;
case R.id.scan_qr_item:
scanQrCode();
return true;
default:
return super.onOptionsItemSelected(item);
......@@ -363,6 +370,11 @@ public final class MainActivity extends FragmentActivity implements
onTagWritten(resultCode, resultData);
break;
case IntentIntegrator.REQUEST_CODE:
onQrCodeScanned(resultCode, resultData);
break;
default:
alert(getString(R.string.unrecognized_request));
......@@ -441,6 +453,23 @@ public final class MainActivity extends FragmentActivity implements
}
/**
* Handle notification that a QR code was scanned at the user's request
* using zxing's {@link IntentIntegrator}
*
* @param resultCode
* the result code
*
* @param resultData
* the {@link Intent} representing the result from the quest
*/
private void onQrCodeScanned(int resultCode, Intent resultData) {
// TODO Auto-generated method stub
throw new RuntimeException("not yet implemented"); //$NON-NLS-1$
}
/**
* Handle result from {@link WriteTagActivity}
*
......@@ -619,6 +648,18 @@ public final class MainActivity extends FragmentActivity implements
}
/**
* Use {@link IntentIntegrator} to request that zxing scan a QR code
*/
private void scanQrCode() {
IntentIntegrator intentIntegrator = new IntentIntegrator(this);
intentIntegrator
.setTargetApplications(IntentIntegrator.TARGET_ALL_KNOWN);
intentIntegrator.initiateScan(IntentIntegrator.QR_CODE_TYPES);
}
/**
* Initialize the UI {@link Fragment} instances according to the current
* screen layout
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment