</activity>
</application>
+
</manifest>
\ No newline at end of file
--- /dev/null
+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
+ package="com.jaiswallab.lab.inventory"
+ android:versionCode="1"
+ android:versionName="1.0" >
+
+ <uses-sdk
+ android:minSdkVersion="8"
+ android:targetSdkVersion="18" />
+
+ <application
+ android:icon="@drawable/ic_launcher"
+ android:label="@string/app_name"
+ android:theme="@style/AppTheme" >
+ <activity
+ android:name=".MainActivity"
+ android:label="@string/title_activity_main" >
+ <intent-filter>
+ <action android:name="android.intent.action.MAIN" />
+
+ <category android:name="android.intent.category.LAUNCHER" />
+ </intent-filter>
+ </activity>
+ </application>
+
+
+</manifest>
\ No newline at end of file
--- /dev/null
+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
+ package="com.jaiswallab.lab.inventory"
+ android:versionCode="1"
+ android:versionName="1.0" >
+
+ <uses-sdk
+ android:minSdkVersion="8"
+ android:targetSdkVersion="18" />
+
+ <application
+ android:icon="@drawable/ic_launcher"
+ android:label="@string/app_name"
+ android:theme="@style/AppTheme" >
+ <activity
+ android:name=".MainActivity"
+ android:label="@string/title_activity_main" >
+ <intent-filter>
+ <action android:name="android.intent.action.MAIN" />
+
+ <category android:name="android.intent.category.LAUNCHER" />
+ </intent-filter>
+ </activity>
+ </application>
+
+</manifest>
\ No newline at end of file
android:layout_width="match_parent"
android:layout_height="match_parent" >
- <Button
- android:id="@+id/button2"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_centerHorizontal="true"
- android:layout_centerVertical="true"
- android:text="@string/inventory_button"
- android:onClick="inventoryClick" />
-
- <Button
- android:id="@+id/button1"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_alignParentTop="true"
- android:layout_centerHorizontal="true"
- android:layout_marginTop="64dp"
- android:text="@string/qr_button"
- android:onClick="qrClick" />
-
<EditText
android:id="@+id/editText1"
android:layout_width="wrap_content"
android:layout_marginLeft="24dp"
android:ems="10"
android:text="@string/hello_world" >
+ </EditText>
+
+ <EditText
+ android:id="@+id/editText2"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_alignLeft="@+id/button2"
+ android:layout_alignParentRight="true"
+ android:layout_alignParentTop="true"
+ android:layout_marginTop="154dp"
+ android:ems="10"
+ android:hint="new data:" >
<requestFocus />
</EditText>
-</RelativeLayout>
+ <Button
+ android:id="@+id/button2"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_alignBottom="@+id/editText2"
+ android:layout_alignParentRight="true"
+ android:layout_marginBottom="66dp"
+ android:onClick="scanQRClick"
+ android:text="@string/scan_qr_button" />
+
+ <Button
+ android:id="@+id/button1"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_alignBaseline="@+id/button2"
+ android:layout_alignBottom="@+id/button2"
+ android:layout_alignParentLeft="true"
+ android:onClick="recognizeQRClick"
+ android:text="@string/recognize_qr_button" />
+
+</RelativeLayout>
\ No newline at end of file
<string name="title_activity_main">Lab Inventory</string>
<string name="qr_button">Start QR code scanner</string>
<string name="inventory_button">Check inventory</string>
-
+ <string name="recognize_qr_button">Recognize QR</string>
+ <string name="scan_qr_button">Scan in QR</string>
+
</resources>
\ No newline at end of file
import android.widget.EditText;
+
+
+
public class MainActivity extends Activity {
+
+ boolean scanningNewQR = false;
+ boolean recognizingQR = false;
private EditText text;
@Override
}
// This method is called at click of the QR code button
- public void qrClick(View view) {
- text.setText("QR button clicked again");
+ public void recognizeQRClick(View view) {
+ scanningNewQR = false;
+ recognizingQR = true;
+ text.setText("Recognize QR button clicked");
IntentIntegrator intentIntegrator = new IntentIntegrator(this);
intentIntegrator.initiateScan();
//startActivityForResult(intentIntegrator, 0);
IntentResult scanResult = IntentIntegrator.parseActivityResult(requestCode, resultCode, intent);
if (scanResult != null) {
String contents = scanResult.getContents();
+ if(scanningNewQR) {
+ addNewQR(contents);
+ } else if(recognizingQR){
+ displayQRInfo(contents);
+ }
text.setText(contents);
// handle scan result
}
}
// This method is called at click of the check inventory button
- public void inventoryClick(View view) {
- text.setText("Inventory button clicked");
+ public void scanQRClick(View view) {
+ scanningNewQR = true;
+ recognizingQR = false;
+ text.setText("Scan QR button clicked");
+ IntentIntegrator intentIntegrator = new IntentIntegrator(this);
+ intentIntegrator.initiateScan();
}
+
+ //this will use the information passed to it to create a new ID in the databse
+ //it will also use any input from a variety of text edits in order to populate the database entry
+ //can we store pictures in the database if desired?
+ public void addNewQR(String id) {
+ return;
+ }
+
+ //this will use the information passed to it to reference an existing ID in the database
+ //it will display the database information in a useful format
+ public void displayQRInfo(String id) {
+ return;
+ }
+
}