Commit b7944b86 authored by djamel's avatar djamel

ajout d'une entrée manuel du code bar

parent 7645b424
......@@ -13,6 +13,7 @@ import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;
import android.widget.EditText;
import android.widget.TextView;
import android.widget.Toast;
......@@ -26,7 +27,7 @@ import javax.crypto.Mac;
import javax.crypto.spec.SecretKeySpec;
public class Read_QR_Code extends ActionBarActivity {
public class Read_QR_Code extends ActionBarActivity implements View.OnClickListener {
static final String ACTION_SCAN = "com.google.zxing.client.android.SCAN";
private ArrayList<Key_List> key_list;
......@@ -41,6 +42,23 @@ public class Read_QR_Code extends ActionBarActivity {
if (intent != null) {
key_list = intent.getParcelableArrayListExtra("key_list");
}
findViewById(R.id.ButtonBarCode).setOnClickListener(this);
}
@Override
public void onClick(View v) {
switch(v.getId()) {
case R.id.ButtonBarCode :
EditText barCode = (EditText)findViewById(R.id.barCode);
String str = barCode.getText().toString();
if (str.isEmpty()) {
display(getString(R.string.empty_text_area), false);
}
else {
validateTicket(str);
}
}
}
public void scanQR(View v) {
......
......@@ -29,4 +29,27 @@
android:text="@string/scanner"
android:textSize="18dp" >
</Button>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:weightSum="5"
android:layout_marginTop="20dp">
<EditText
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="3"
android:hint="@string/barCode"
android:id="@+id/barCode"/>
<Button
android:layout_width="0dp"
android:layout_height="wrap_content"
android:text="@string/check"
android:id="@+id/ButtonBarCode"
android:layout_weight="2"
android:layout_gravity="right"/>
</LinearLayout>
</LinearLayout>
\ No newline at end of file
......@@ -11,4 +11,6 @@
<string name="ebillet_false">Le billet n\'est pas valide</string>
<string name="id">id</string>
<string name="key">key</string>
<string name="barCode">code bar</string>
<string name="check">Vérifier</string>
</resources>
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