]> rtime.felk.cvut.cz Git - hornmich/skoda-qr-demo.git/commitdiff
Tune the main activity layout
authorMichal Horn <hornmich@fel.cvut.cz>
Tue, 10 Feb 2015 17:09:17 +0000 (18:09 +0100)
committerMichal Horn <hornmich@fel.cvut.cz>
Tue, 10 Feb 2015 17:09:17 +0000 (18:09 +0100)
QRScanner/mobile/src/main/java/cz/cvut/fel/dce/qrscanner/MainActivity.java
QRScanner/mobile/src/main/res/layout/activity_main.xml
QRScanner/mobile/src/main/res/values/strings.xml

index 67857332bbb9f78afe917d37a72863194b9bc003..de3a44ca2062f8d0d7503ccee16203165ef373cf 100644 (file)
@@ -6,6 +6,7 @@ import android.os.Bundle;
 import android.util.Log;
 import android.view.Menu;
 import android.view.MenuItem;
+import android.view.View;
 
 import cz.cvut.fel.dce.qrscanner.integration.IntentIntegrator;
 import cz.cvut.fel.dce.qrscanner.integration.IntentResult;
@@ -51,12 +52,15 @@ public class MainActivity extends ActionBarActivity {
                        preview.putExtra("COMPONENT_ID", scanResult.getContents());
                        startActivity(preview);
                }
-               // else continue with any other code you need in the method
-
        }
 
        private void startScan() {
                IntentIntegrator integrator = new IntentIntegrator(this);
                integrator.initiateScan(IntentIntegrator.QR_CODE_TYPES);
        }
+
+       /** Called when the user touches the button */
+       public void findComponent(View view) {
+               startScan();
+       }
 }
index 53ce5577b5bb6694e17a4cd9bd67fb0f275ca45c..42faebd255283250e17960bed381b487585e9e51 100644 (file)
@@ -8,9 +8,25 @@
                 android:paddingBottom="@dimen/activity_vertical_margin"
                 tools:context=".MainActivity">
 
-    <TextView
-        android:text="@string/hello_world"
+    <ImageView
         android:layout_width="wrap_content"
-        android:layout_height="wrap_content"/>
+        android:layout_height="wrap_content"
+        android:id="@+id/imageView"
+        android:src="@drawable/skoda_logo"
+        android:layout_alignParentTop="true"
+        android:layout_alignParentRight="true"
+        android:layout_alignParentEnd="true"
+        android:layout_alignParentLeft="true"
+        android:layout_alignParentStart="true"
+        android:onClick="findComponent"
+        android:layout_above="@+id/button"/>
 
+    <Button
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:text="@string/butStartScanning"
+        android:id="@+id/button"
+        android:onClick="findComponent"
+        android:layout_alignParentBottom="true"
+        android:layout_centerHorizontal="true"/>
 </RelativeLayout>
index e3bf5fe7766671019897f64882953a92be2847cf..052ef99c2803dd99e59fbce9b0c4ad099bf64e86 100644 (file)
@@ -58,5 +58,7 @@
        <string name="copy_text">copy text</string>
        <string name="format_currently_not_supported">Format currently not supported</string>
        <string name="toggle_reflow_mode">Toggle reflow mode</string>
+    <string name="mainScreenHeading">Skoda Auto manufacturing helper</string>
+    <string name="butStartScanning">Find component</string>
 
 </resources>