Hello!

To see the file structure, click on "tree".

Note that updates take place every 10 minutes, commits may not be seen immediately.
working bitmap creation code
authormiles <miles@localhost>
Fri, 20 Sep 2013 22:59:37 +0000 (22:59 +0000)
committermiles <miles@localhost>
Fri, 20 Sep 2013 22:59:37 +0000 (22:59 +0000)
svn path=/; revision=507

Personnel/justin/lab inventory/.classpath
Personnel/justin/lab inventory/bin/classes.dex
Personnel/justin/lab inventory/bin/dexedLibs/core-2.2-2e1cc2cf342d11d34939567c8a3260e5.jar [new file with mode: 0644]
Personnel/justin/lab inventory/bin/lab inventory.apk
Personnel/justin/lab inventory/bin/resources.ap_
Personnel/justin/lab inventory/libs/core-2.2.jar [new file with mode: 0644]
Personnel/justin/lab inventory/res/layout/activity_main.xml
Personnel/justin/lab inventory/src/com/jaiswallab/lab/inventory/MainActivity.java

index 3dc554a2daef10019a9cc4b616f728ae2135c7f9..5535dc6ff22a58f5d9d2526f4eb0ebfb321e5702 100644 (file)
@@ -5,7 +5,7 @@
        <classpathentry exported="true" kind="con" path="com.android.ide.eclipse.adt.ANDROID_FRAMEWORK"/>
        <classpathentry exported="true" kind="con" path="com.android.ide.eclipse.adt.LIBRARIES"/>
        <classpathentry exported="true" kind="con" path="com.android.ide.eclipse.adt.DEPENDENCIES"/>
-       <classpathentry kind="lib" path="/home/miles/Documents/Development/jaiswallab/Personnel/miles/lab inventory/libs/ZXing-2.2.zip"/>
        <classpathentry kind="lib" path="libs/android-integration-2.2.jar"/>
+       <classpathentry kind="lib" path="libs/core-2.2.jar"/>
        <classpathentry kind="output" path="bin/classes"/>
 </classpath>
index 7d650b3480b4a0874d63f5173acb023bfd87259c..a9315b705f1cbed8ef7618378e8b4e8ce2e26eab 100644 (file)
Binary files a/Personnel/justin/lab inventory/bin/classes.dex and b/Personnel/justin/lab inventory/bin/classes.dex differ
diff --git a/Personnel/justin/lab inventory/bin/dexedLibs/core-2.2-2e1cc2cf342d11d34939567c8a3260e5.jar b/Personnel/justin/lab inventory/bin/dexedLibs/core-2.2-2e1cc2cf342d11d34939567c8a3260e5.jar
new file mode 100644 (file)
index 0000000..7ac7bff
Binary files /dev/null and b/Personnel/justin/lab inventory/bin/dexedLibs/core-2.2-2e1cc2cf342d11d34939567c8a3260e5.jar differ
index 796c42ca322dcb105eb6a307286d00a9d19ad9bd..08d8c6f1f9ef80a4d57908fe0b3a7091710e0e02 100644 (file)
Binary files a/Personnel/justin/lab inventory/bin/lab inventory.apk and b/Personnel/justin/lab inventory/bin/lab inventory.apk differ
index cd2547d4f2b0b3489b630ed9de68a15aaba26f14..05f8944fce8fcb8492b9c1033bbef921768f7dfe 100644 (file)
Binary files a/Personnel/justin/lab inventory/bin/resources.ap_ and b/Personnel/justin/lab inventory/bin/resources.ap_ differ
diff --git a/Personnel/justin/lab inventory/libs/core-2.2.jar b/Personnel/justin/lab inventory/libs/core-2.2.jar
new file mode 100644 (file)
index 0000000..9e95ab2
Binary files /dev/null and b/Personnel/justin/lab inventory/libs/core-2.2.jar differ
index d83d0af275e436ce10b06a8a877968798b0b1bd0..a8c1b2dd149f5a35997976aabf52b643a3cd922b 100644 (file)
@@ -49,7 +49,7 @@
         android:ems="10"
         android:text="Data 4" />
 
-    <Print
+    <Button
         android:id="@+id/print"
         android:layout_width="wrap_content"
         android:layout_height="wrap_content"
index 4c26f3140487727e95ac0ce434ccff4cee4144d7..b6c5c2e05e04669fc06ac4a5634a72c172db561f 100644 (file)
@@ -1,10 +1,15 @@
 package com.jaiswallab.lab.inventory;
 
+import com.google.zxing.*;
 import com.google.zxing.integration.android.*;
+import com.google.zxing.qrcode.decoder.ErrorCorrectionLevel;
+import com.google.zxing.qrcode.encoder.ByteMatrix;
+import com.google.zxing.qrcode.encoder.Encoder;
 
 import android.app.Activity;
 import android.content.Intent;
 import android.graphics.Bitmap;
+import android.graphics.BitmapFactory;
 import android.net.Uri;
 import android.os.Bundle;
 import android.provider.MediaStore;
@@ -52,9 +57,7 @@ public class MainActivity extends Activity {
     public void printQRClick(View view) {
        printingNewQR = true;
        recognizingQR = false;
-       text1.setText("Print QR button clicked");
-       //IntentIntegrator intentIntegrator = new IntentIntegrator(this);
-       //intentIntegrator.initiateScan();
+       addNewQR();
     }
     
     public void onActivityResult(int requestCode, int resultCode, Intent intent) {
@@ -62,13 +65,14 @@ public class MainActivity extends Activity {
        if (scanResult != null) {
                String contents = scanResult.getContents();
                if(printingNewQR) {
-       //              addNewQR(contents);
+                       return;
                } else if(recognizingQR){
                        displayQRInfo(contents);
                }
                text1.setText(contents);
                // handle scan result
        }
+       
          // else continue with any other code you need in the method
        }
     
@@ -77,23 +81,27 @@ public class MainActivity extends Activity {
     //this will use the information passed to it to create a new ID in the database
     //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;
+    public void addNewQR() {
+
        int rand1 = (int) (100*Math.random());
        int rand2 = (int) (100*Math.random());
        int rand3 = (int) (100*Math.random());
        int rand4 = (int) (100*Math.random());
-       String barcode_content = text1.getText().toString() + Integer.toString(rand1)
-                                  + text2.getText().toString() + Integer.toString(rand2)
-                                  + text3.getText().toString() + Integer.toString(rand3)
-                                  + text4.getText().toString() + Integer.toString(rand4);
+       String barcode_content = text1.getText().toString() + Integer.toString(rand1) + text2.getText().toString() + Integer.toString(rand2) + text3.getText().toString() + Integer.toString(rand3) + text4.getText().toString() + Integer.toString(rand4);
+       text1.setText(barcode_content);
+       return;
+       /*
        try {
            // generate a 150x150 QR code
-           Bitmap barcode_bitmap = encodeAsBitmap(barcode_content, BarcodeFormat.QR_CODE, 150, 150);
+           ByteMatrix barcode_matrix = Encoder.encode(barcode_content, ErrorCorrectionLevel.L).getMatrix();
+//         Bitmap barcode_bitmap = BitmapFactory.decodeByteArray(barcode_matrix, 0, barcode_matrix.length);
+
+           Bitmap barcode_bitmap = ByteMatrix2Bitmap(barcode_matrix);
 
+           
            String barcodeUrl = MediaStore.Images.Media.insertImage(getContentResolver(), barcode_bitmap, "NEW QR", "A newly created QR code");
            
-           Uri barcodeUri = Uri.parse(imgUrl);
+           Uri barcodeUri = Uri.parse(barcodeUrl);
            
                Intent printIntent = new Intent(this, PrintDialogActivity.class);
                printIntent.setDataAndType(barcodeUri, "image/bmp"); //TODO make sure image/bmp is correct.
@@ -103,8 +111,28 @@ public class MainActivity extends Activity {
        } catch (WriterException e) { //eek }
 
        }
+       */      
+   
+    } 
+
+    private static Bitmap ByteMatrix2Bitmap(ByteMatrix matrix){
+               int width = matrix.getWidth(); 
+               int height = matrix.getHeight(); 
+        byte[][] array = matrix.getArray(); 
+        
+        byte[] imgdata = new byte[width * height];
+        for (int y = 0; y < height; y++) { 
+               for (int x = 0; x < width; x++) { 
+                       if (array[y][x]==0)
+                               imgdata[y * width + x] = 0;
+                       else
+                               imgdata[y * width + x] = 1;
+               } 
+        }
+        
+               Bitmap bitmap =  BitmapFactory.decodeByteArray(imgdata,0,imgdata.length);
+               return bitmap;
     }
-   */ 
     
     
     //this will use the information passed to it to reference an existing ID in the database
@@ -113,21 +141,4 @@ public class MainActivity extends Activity {
        return;
     }
     
-}
-
-    
-/*    public void onActivityResult(int requestCode, int resultCode, Intent intent) {
-        if (requestCode == 0) {
-            if (resultCode == RESULT_OK) {
-                // contents contains whatever was encoded
-                String contents = intent.getStringExtra("SCAN_RESULT");
-               text.setText(contents);
-                // Format contains the type of code i.e. UPC, EAN, QRCode etc...
-                String format = intent.getStringExtra("SCAN_RESULT_FORMAT");
-
-
-            }
-        }
-
-    }
-*/
\ No newline at end of file
+}
\ No newline at end of file