diff --git a/ClientAlphaPrototype/bin/ClientAlphaPrototype.apk b/ClientAlphaPrototype/bin/ClientAlphaPrototype.apk
index 9e41ae0..c9690f3 100644
Binary files a/ClientAlphaPrototype/bin/ClientAlphaPrototype.apk and b/ClientAlphaPrototype/bin/ClientAlphaPrototype.apk differ
diff --git a/ClientAlphaPrototype/bin/classes.dex b/ClientAlphaPrototype/bin/classes.dex
index 28c1894..786e422 100644
Binary files a/ClientAlphaPrototype/bin/classes.dex and b/ClientAlphaPrototype/bin/classes.dex differ
diff --git a/ClientAlphaPrototype/bin/classes/com/example/clientalphaprototype/R$attr.class b/ClientAlphaPrototype/bin/classes/com/example/clientalphaprototype/R$attr.class
index aa88808..48da16a 100644
Binary files a/ClientAlphaPrototype/bin/classes/com/example/clientalphaprototype/R$attr.class and b/ClientAlphaPrototype/bin/classes/com/example/clientalphaprototype/R$attr.class differ
diff --git a/ClientAlphaPrototype/bin/classes/com/example/clientalphaprototype/R$dimen.class b/ClientAlphaPrototype/bin/classes/com/example/clientalphaprototype/R$dimen.class
index 6082146..69b7e69 100644
Binary files a/ClientAlphaPrototype/bin/classes/com/example/clientalphaprototype/R$dimen.class and b/ClientAlphaPrototype/bin/classes/com/example/clientalphaprototype/R$dimen.class differ
diff --git a/ClientAlphaPrototype/bin/classes/com/example/clientalphaprototype/R$drawable.class b/ClientAlphaPrototype/bin/classes/com/example/clientalphaprototype/R$drawable.class
index ac5676e..e355e21 100644
Binary files a/ClientAlphaPrototype/bin/classes/com/example/clientalphaprototype/R$drawable.class and b/ClientAlphaPrototype/bin/classes/com/example/clientalphaprototype/R$drawable.class differ
diff --git a/ClientAlphaPrototype/bin/classes/com/example/clientalphaprototype/R$id.class b/ClientAlphaPrototype/bin/classes/com/example/clientalphaprototype/R$id.class
index a07ad54..274c0df 100644
Binary files a/ClientAlphaPrototype/bin/classes/com/example/clientalphaprototype/R$id.class and b/ClientAlphaPrototype/bin/classes/com/example/clientalphaprototype/R$id.class differ
diff --git a/ClientAlphaPrototype/bin/classes/com/example/clientalphaprototype/R$layout.class b/ClientAlphaPrototype/bin/classes/com/example/clientalphaprototype/R$layout.class
index dd23f0c..701ec73 100644
Binary files a/ClientAlphaPrototype/bin/classes/com/example/clientalphaprototype/R$layout.class and b/ClientAlphaPrototype/bin/classes/com/example/clientalphaprototype/R$layout.class differ
diff --git a/ClientAlphaPrototype/bin/classes/com/example/clientalphaprototype/R$menu.class b/ClientAlphaPrototype/bin/classes/com/example/clientalphaprototype/R$menu.class
index b856125..87f387e 100644
Binary files a/ClientAlphaPrototype/bin/classes/com/example/clientalphaprototype/R$menu.class and b/ClientAlphaPrototype/bin/classes/com/example/clientalphaprototype/R$menu.class differ
diff --git a/ClientAlphaPrototype/bin/classes/com/example/clientalphaprototype/R$string.class b/ClientAlphaPrototype/bin/classes/com/example/clientalphaprototype/R$string.class
index 7083e09..f4aba0a 100644
Binary files a/ClientAlphaPrototype/bin/classes/com/example/clientalphaprototype/R$string.class and b/ClientAlphaPrototype/bin/classes/com/example/clientalphaprototype/R$string.class differ
diff --git a/ClientAlphaPrototype/bin/classes/com/example/clientalphaprototype/R$style.class b/ClientAlphaPrototype/bin/classes/com/example/clientalphaprototype/R$style.class
index 2dbfb4e..afd341f 100644
Binary files a/ClientAlphaPrototype/bin/classes/com/example/clientalphaprototype/R$style.class and b/ClientAlphaPrototype/bin/classes/com/example/clientalphaprototype/R$style.class differ
diff --git a/ClientAlphaPrototype/bin/classes/com/example/clientalphaprototype/R.class b/ClientAlphaPrototype/bin/classes/com/example/clientalphaprototype/R.class
index f8d889e..d303b49 100644
Binary files a/ClientAlphaPrototype/bin/classes/com/example/clientalphaprototype/R.class and b/ClientAlphaPrototype/bin/classes/com/example/clientalphaprototype/R.class differ
diff --git a/ClientAlphaPrototype/bin/classes/com/example/clientalphaprototype/ScanActivity$1.class b/ClientAlphaPrototype/bin/classes/com/example/clientalphaprototype/ScanActivity$1.class
index 8f5166c..58746bc 100644
Binary files a/ClientAlphaPrototype/bin/classes/com/example/clientalphaprototype/ScanActivity$1.class and b/ClientAlphaPrototype/bin/classes/com/example/clientalphaprototype/ScanActivity$1.class differ
diff --git a/ClientAlphaPrototype/bin/classes/com/example/clientalphaprototype/ScanActivity.class b/ClientAlphaPrototype/bin/classes/com/example/clientalphaprototype/ScanActivity.class
index 30f6af4..80e1b87 100644
Binary files a/ClientAlphaPrototype/bin/classes/com/example/clientalphaprototype/ScanActivity.class and b/ClientAlphaPrototype/bin/classes/com/example/clientalphaprototype/ScanActivity.class differ
diff --git a/ClientAlphaPrototype/bin/dexedLibs/android-support-v4-88392992613c8509305a52ac0e99cc38.jar b/ClientAlphaPrototype/bin/dexedLibs/android-support-v4-88392992613c8509305a52ac0e99cc38.jar
index ff2ed19..c6c0016 100644
Binary files a/ClientAlphaPrototype/bin/dexedLibs/android-support-v4-88392992613c8509305a52ac0e99cc38.jar and b/ClientAlphaPrototype/bin/dexedLibs/android-support-v4-88392992613c8509305a52ac0e99cc38.jar differ
diff --git a/ClientAlphaPrototype/bin/dexedLibs/jackson-annotations-2.2.3-d63219809b0db56220657d9801d46c96.jar b/ClientAlphaPrototype/bin/dexedLibs/jackson-annotations-2.2.3-d63219809b0db56220657d9801d46c96.jar
index 9108ad6..a612052 100644
Binary files a/ClientAlphaPrototype/bin/dexedLibs/jackson-annotations-2.2.3-d63219809b0db56220657d9801d46c96.jar and b/ClientAlphaPrototype/bin/dexedLibs/jackson-annotations-2.2.3-d63219809b0db56220657d9801d46c96.jar differ
diff --git a/ClientAlphaPrototype/bin/dexedLibs/jackson-core-2.3.0-2f7dcfb2f6654be15eb269df52490167.jar b/ClientAlphaPrototype/bin/dexedLibs/jackson-core-2.3.0-2f7dcfb2f6654be15eb269df52490167.jar
index aa3311b..61f632b 100644
Binary files a/ClientAlphaPrototype/bin/dexedLibs/jackson-core-2.3.0-2f7dcfb2f6654be15eb269df52490167.jar and b/ClientAlphaPrototype/bin/dexedLibs/jackson-core-2.3.0-2f7dcfb2f6654be15eb269df52490167.jar differ
diff --git a/ClientAlphaPrototype/bin/dexedLibs/jackson-databind-2.2.3-4b94d888e77e984d254c732e9e3467ea.jar b/ClientAlphaPrototype/bin/dexedLibs/jackson-databind-2.2.3-4b94d888e77e984d254c732e9e3467ea.jar
index 0ee5ec3..2588b08 100644
Binary files a/ClientAlphaPrototype/bin/dexedLibs/jackson-databind-2.2.3-4b94d888e77e984d254c732e9e3467ea.jar and b/ClientAlphaPrototype/bin/dexedLibs/jackson-databind-2.2.3-4b94d888e77e984d254c732e9e3467ea.jar differ
diff --git a/ClientAlphaPrototype/bin/dexedLibs/mockito-all-1.9.5-4902815ba706e8f5eac5ec6c68c81cc0.jar b/ClientAlphaPrototype/bin/dexedLibs/mockito-all-1.9.5-4902815ba706e8f5eac5ec6c68c81cc0.jar
index 81ad36e..906e8fb 100644
Binary files a/ClientAlphaPrototype/bin/dexedLibs/mockito-all-1.9.5-4902815ba706e8f5eac5ec6c68c81cc0.jar and b/ClientAlphaPrototype/bin/dexedLibs/mockito-all-1.9.5-4902815ba706e8f5eac5ec6c68c81cc0.jar differ
diff --git a/ClientAlphaPrototype/bin/dexedLibs/zbar-aad6359c03b0c6d6aacace6704fef60c.jar b/ClientAlphaPrototype/bin/dexedLibs/zbar-aad6359c03b0c6d6aacace6704fef60c.jar
index f3c4702..2a0cf7c 100644
Binary files a/ClientAlphaPrototype/bin/dexedLibs/zbar-aad6359c03b0c6d6aacace6704fef60c.jar and b/ClientAlphaPrototype/bin/dexedLibs/zbar-aad6359c03b0c6d6aacace6704fef60c.jar differ
diff --git a/ClientAlphaPrototype/bin/dexedLibs/zbarscanneractivity-3ead9030b3bb3c9f84877cae80219dec.jar b/ClientAlphaPrototype/bin/dexedLibs/zbarscanneractivity-3ead9030b3bb3c9f84877cae80219dec.jar
index f3a1789..b3c6d22 100644
Binary files a/ClientAlphaPrototype/bin/dexedLibs/zbarscanneractivity-3ead9030b3bb3c9f84877cae80219dec.jar and b/ClientAlphaPrototype/bin/dexedLibs/zbarscanneractivity-3ead9030b3bb3c9f84877cae80219dec.jar differ
diff --git a/ClientAlphaPrototype/bin/resources.ap_ b/ClientAlphaPrototype/bin/resources.ap_
index 06eba61..8d99f4e 100644
Binary files a/ClientAlphaPrototype/bin/resources.ap_ and b/ClientAlphaPrototype/bin/resources.ap_ differ
diff --git a/ClientAlphaPrototype/gen/com/example/clientalphaprototype/R.java b/ClientAlphaPrototype/gen/com/example/clientalphaprototype/R.java
index 4f86165..88b6cdc 100644
--- a/ClientAlphaPrototype/gen/com/example/clientalphaprototype/R.java
+++ b/ClientAlphaPrototype/gen/com/example/clientalphaprototype/R.java
@@ -9,6 +9,14 @@
public final class R {
public static final class attr {
+ /**
Must be an integer value, such as "100".
+
This may also be a reference to a resource (in the form
+"@[package:]type:name") or
+theme attribute (in the form
+"?[package:][type:]name")
+containing a value of this type.
+ */
+ public static final int trimLength=0x7f010000;
}
public static final class dimen {
/** Default screen margins, per the Android Design guidelines.
@@ -28,23 +36,27 @@ public static final class drawable {
public static final int image3=0x7f020004;
}
public static final class id {
- public static final int action_settings=0x7f080010;
+ public static final int Menu=0x7f080012;
+ public static final int ScanAgain=0x7f080013;
+ public static final int action_settings=0x7f080014;
public static final int basket_button=0x7f080001;
public static final int basket_list=0x7f080002;
public static final int button1=0x7f080000;
- public static final int button_addToBasket=0x7f080007;
- public static final int button_scan=0x7f08000d;
+ public static final int button_addToBasket=0x7f08000c;
+ public static final int button_scan=0x7f08000e;
public static final int categories_listview=0x7f080003;
- public static final int editText_notes=0x7f080006;
- public static final int large_txt=0x7f08000f;
+ public static final int editText_notes=0x7f08000b;
+ public static final int expandable_scaninfo=0x7f08000f;
+ public static final int large_txt=0x7f080011;
public static final int pager=0x7f080004;
- public static final int price_txt=0x7f08000b;
+ public static final int price_txt=0x7f080009;
public static final int products_gallery=0x7f080005;
- public static final int products_imageview=0x7f080008;
- public static final int products_listview=0x7f08000c;
- public static final int small_txt=0x7f08000e;
+ public static final int products_imageview=0x7f080007;
+ public static final int products_listview=0x7f08000d;
+ public static final int scrollView1=0x7f080008;
+ public static final int small_txt=0x7f080010;
public static final int textView_description=0x7f08000a;
- public static final int textView_title=0x7f080009;
+ public static final int textView_title=0x7f080006;
}
public static final class layout {
public static final int actionbar_submit_view=0x7f030000;
@@ -105,4 +117,33 @@ public static final class style {
*/
public static final int AppTheme=0x7f060001;
}
+ public static final class styleable {
+ /** Attributes that can be used with a ExpandableTextView.
+
+ @see #ExpandableTextView_trimLength
+ */
+ public static final int[] ExpandableTextView = {
+ 0x7f010000
+ };
+ /**
+
This symbol is the offset where the {@link com.example.clientalphaprototype.R.attr#trimLength}
+ attribute's value can be found in the {@link #ExpandableTextView} array.
+
+
+
Must be an integer value, such as "100".
+
This may also be a reference to a resource (in the form
+"@[package:]type:name") or
+theme attribute (in the form
+"?[package:][type:]name")
+containing a value of this type.
+ @attr name com.example.clientalphaprototype:trimLength
+ */
+ public static final int ExpandableTextView_trimLength = 0;
+ };
}
diff --git a/ClientAlphaPrototype/res/layout/activity_productdetails.xml b/ClientAlphaPrototype/res/layout/activity_productdetails.xml
index 93c8f0c..934e03c 100644
--- a/ClientAlphaPrototype/res/layout/activity_productdetails.xml
+++ b/ClientAlphaPrototype/res/layout/activity_productdetails.xml
@@ -15,63 +15,75 @@
android:layout_alignParentRight="true"
android:layout_alignParentTop="true" />
-
+ android:text="Large Text"
+ android:textAppearance="?android:attr/textAppearanceLarge" />
+
+
-
-
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
\ No newline at end of file
diff --git a/ClientAlphaPrototype/res/layout/activity_scan.xml b/ClientAlphaPrototype/res/layout/activity_scan.xml
index 0e53bd8..8ec2a7c 100644
--- a/ClientAlphaPrototype/res/layout/activity_scan.xml
+++ b/ClientAlphaPrototype/res/layout/activity_scan.xml
@@ -12,9 +12,15 @@
android:id="@+id/button_scan"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
- android:layout_alignParentTop="true"
android:layout_centerHorizontal="true"
- android:layout_marginTop="160dp"
- android:text="I am ready to order" />
+ android:layout_centerVertical="true"
+ android:text="scan" />
-
+
+
+
\ No newline at end of file
diff --git a/ClientAlphaPrototype/res/layout/basket_listview.xml b/ClientAlphaPrototype/res/layout/basket_listview.xml
index 780aa82..c32c6e0 100644
--- a/ClientAlphaPrototype/res/layout/basket_listview.xml
+++ b/ClientAlphaPrototype/res/layout/basket_listview.xml
@@ -12,7 +12,7 @@
android:ellipsize="marquee"
android:gravity="left"
android:singleLine="true"
- android:textSize="12sp" />
+ android:textSize="12sp"/>
+ android:textSize="12sp"/>
-
+
+
+
diff --git a/ClientAlphaPrototype/res/menu/categories.xml b/ClientAlphaPrototype/res/menu/categories.xml
index c002028..5c87f22 100644
--- a/ClientAlphaPrototype/res/menu/categories.xml
+++ b/ClientAlphaPrototype/res/menu/categories.xml
@@ -1,9 +1,8 @@
+
+
diff --git a/ClientAlphaPrototype/res/menu/details.xml b/ClientAlphaPrototype/res/menu/details.xml
index c002028..f1cfc95 100644
--- a/ClientAlphaPrototype/res/menu/details.xml
+++ b/ClientAlphaPrototype/res/menu/details.xml
@@ -1,9 +1,9 @@
diff --git a/ClientAlphaPrototype/res/menu/main_menu.xml b/ClientAlphaPrototype/res/menu/main_menu.xml
index c002028..bb29b9a 100644
--- a/ClientAlphaPrototype/res/menu/main_menu.xml
+++ b/ClientAlphaPrototype/res/menu/main_menu.xml
@@ -1,9 +1,10 @@
+
diff --git a/ClientAlphaPrototype/res/menu/products.xml b/ClientAlphaPrototype/res/menu/products.xml
index c002028..bb29b9a 100644
--- a/ClientAlphaPrototype/res/menu/products.xml
+++ b/ClientAlphaPrototype/res/menu/products.xml
@@ -1,9 +1,10 @@
+
diff --git a/ClientAlphaPrototype/res/values/attrs.xml b/ClientAlphaPrototype/res/values/attrs.xml
new file mode 100644
index 0000000..9e4efad
--- /dev/null
+++ b/ClientAlphaPrototype/res/values/attrs.xml
@@ -0,0 +1,8 @@
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/ClientAlphaPrototype/src/com/example/clientalphaprototype/BasketActivity.java b/ClientAlphaPrototype/src/com/example/clientalphaprototype/BasketActivity.java
index 5202ee7..5cb67ca 100644
--- a/ClientAlphaPrototype/src/com/example/clientalphaprototype/BasketActivity.java
+++ b/ClientAlphaPrototype/src/com/example/clientalphaprototype/BasketActivity.java
@@ -12,6 +12,7 @@
import android.net.NetworkInfo;
import android.os.Bundle;
import android.view.Menu;
+import android.view.MenuItem;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.AdapterView;
@@ -151,5 +152,23 @@ public boolean onCreateOptionsMenu(Menu menu) {
getMenuInflater().inflate(R.menu.basket, menu);
return true;
}
-
+
+ @Override
+ public boolean onOptionsItemSelected(MenuItem item) {
+
+ switch(item.getItemId()) {
+ case R.id.Menu:
+ Intent menuIntent = new Intent(this, CategoriesActivity.class);
+ this.startActivity(menuIntent);
+ break;
+ case R.id.ScanAgain:
+ Intent scanIntent = new Intent(this, ScanActivity.class);
+ this.startActivity(scanIntent);
+ break;
+ default:
+ return super.onOptionsItemSelected(item);
+ }
+
+ return true;
+ }
}
diff --git a/ClientAlphaPrototype/src/com/example/clientalphaprototype/CategoriesActivity.java b/ClientAlphaPrototype/src/com/example/clientalphaprototype/CategoriesActivity.java
index 4c0c760..62357e5 100644
--- a/ClientAlphaPrototype/src/com/example/clientalphaprototype/CategoriesActivity.java
+++ b/ClientAlphaPrototype/src/com/example/clientalphaprototype/CategoriesActivity.java
@@ -18,6 +18,7 @@
import android.net.NetworkInfo;
import android.os.Bundle;
import android.view.Menu;
+import android.view.MenuItem;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.AdapterView;
@@ -162,7 +163,23 @@ public boolean isNetworkAvailable() {
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.categories, menu);
+
return true;
}
+
+ @Override
+ public boolean onOptionsItemSelected(MenuItem item) {
+
+ switch(item.getItemId()) {
+ case R.id.ScanAgain:
+ Intent scanIntent = new Intent(this, ScanActivity.class);
+ this.startActivity(scanIntent);
+ break;
+ default:
+ return super.onOptionsItemSelected(item);
+ }
+
+ return true;
+ }
}
diff --git a/ClientAlphaPrototype/src/com/example/clientalphaprototype/DetailsActivity.java b/ClientAlphaPrototype/src/com/example/clientalphaprototype/DetailsActivity.java
index 30dcf5f..20a5d23 100644
--- a/ClientAlphaPrototype/src/com/example/clientalphaprototype/DetailsActivity.java
+++ b/ClientAlphaPrototype/src/com/example/clientalphaprototype/DetailsActivity.java
@@ -22,6 +22,7 @@
import android.net.NetworkInfo;
import android.os.Bundle;
import android.view.Menu;
+import android.view.MenuItem;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.AdapterView;
@@ -38,15 +39,10 @@ public class DetailsActivity extends Activity {
OrderHolder orderHolder = new OrderHolder();
DetailedProduct product;
final String currencySign = "€";
- ImageView currentImage;
+ ImageView currentImage;
String notes;
+ List imgIds;
- private Integer[] imgIds = {
- R.drawable.image1,
- R.drawable.image2,
- R.drawable.image3,
- };
-
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
@@ -55,6 +51,8 @@ protected void onCreate(Bundle savedInstanceState) {
notes = null;
Bundle extras = getIntent().getExtras();
+ imgIds = new ArrayList();
+
if (extras != null) {
notes = extras.getString("notes");
parseJson(extras.getString("product"));
@@ -73,15 +71,27 @@ public void onClick(View v) {
EditText mEdit = (EditText) findViewById(R.id.editText_notes);
orderHolder.add(new BasketProduct(product.getId(), product
.getName(), product.getPrice(), mEdit.getText()
- .toString(),product.getUri()));
+ .toString(), product.getUri()));
setBasketTitle();
}
});
}
+ //TODO: encapsulate this in an image parsing class and share it with the gallery widget
+ void initializeImages() {
+ for(int i=0;i<3;i++)
+ {
+ imgIds.add(R.drawable.image1);
+ imgIds.add(R.drawable.image2);
+ imgIds.add(R.drawable.image3);
+ }
+ }
+
@SuppressWarnings("deprecation")
void initializeView() {
EditText mEdit = (EditText) findViewById(R.id.editText_notes);
+
+ initializeImages();
if (notes != null)
mEdit.setText(notes);
@@ -97,19 +107,20 @@ void initializeView() {
TextView description = (TextView) findViewById(R.id.textView_description);
// TODO: review
description.setText(product.getAttributes().get(0));
-
+
Gallery gallery = (Gallery) findViewById(R.id.products_gallery);
- gallery.setSpacing(1);
- gallery.setAdapter(new DetailsImageAdapter(this));
- currentImage=(ImageView)findViewById(R.id.products_imageview);
- gallery.setOnItemClickListener(new OnItemClickListener() {
- public void onItemClick(AdapterView> parent, View v, int position, long id) {
- currentImage.setImageResource(imgIds[position]);
- }
- });
-
+ gallery.setSpacing(1);
+ gallery.setAdapter(new DetailsImageAdapter(this));
+ currentImage = (ImageView) findViewById(R.id.products_imageview);
+ gallery.setOnItemClickListener(new OnItemClickListener() {
+ public void onItemClick(AdapterView> parent, View v,
+ int position, long id) {
+ currentImage.setImageResource(imgIds.get(position));
+ }
+ });
+
// TODO: review
- //ImageView img = (ImageView) findViewById(R.id.product_Img);
+ // ImageView img = (ImageView) findViewById(R.id.product_Img);
// img.setImageResource("uri");
}
@@ -119,17 +130,15 @@ protected void onResume() {
super.onResume();
setBasketTitle();
}
-
- void setBasketTitle()
- {
- Button testButton = (Button) findViewById(R.id.basket_button);
- int basketSum = OrderHolder.count();
- if(basketSum != 0)
- {
- testButton.setText("Basket x"+ basketSum );
- }
+
+ void setBasketTitle() {
+ Button testButton = (Button) findViewById(R.id.basket_button);
+ int basketSum = OrderHolder.count();
+ if (basketSum != 0) {
+ testButton.setText("Basket x" + basketSum);
+ }
}
-
+
void initializeActionBar() {
ActionBar actionBar = getActionBar();
@@ -186,10 +195,10 @@ void parseJson(String url) {
void createMockProduct() {
List attributes = new ArrayList();
- attributes.add("Some attribute...");
+ attributes.add("A product's description goes here \n now \n testing \n if \n scrollView \n works \n..\n..\n..\n..\n..\n..\n ..\n..\nif you are reading this then it works!\n");
product = new DetailedProduct(1, "Product", BigDecimal.valueOf(1.99),
- "your notes here", attributes,"example uri");
+ "your notes here", attributes, "example uri");
}
@Override
@@ -198,6 +207,24 @@ public boolean onCreateOptionsMenu(Menu menu) {
getMenuInflater().inflate(R.menu.details, menu);
return true;
}
+
+ @Override
+ public boolean onOptionsItemSelected(MenuItem item) {
+
+ switch(item.getItemId()) {
+ case R.id.Menu:
+ Intent menuIntent = new Intent(this, CategoriesActivity.class);
+ this.startActivity(menuIntent);
+ break;
+ case R.id.ScanAgain:
+ Intent scanIntent = new Intent(this, ScanActivity.class);
+ this.startActivity(scanIntent);
+ break;
+ default:
+ return super.onOptionsItemSelected(item);
+ }
-}
+ return true;
+ }
+}
diff --git a/ClientAlphaPrototype/src/com/example/clientalphaprototype/ProductsActivity.java b/ClientAlphaPrototype/src/com/example/clientalphaprototype/ProductsActivity.java
index 8667264..8916a41 100644
--- a/ClientAlphaPrototype/src/com/example/clientalphaprototype/ProductsActivity.java
+++ b/ClientAlphaPrototype/src/com/example/clientalphaprototype/ProductsActivity.java
@@ -21,6 +21,7 @@
import android.content.Context;
import android.content.Intent;
import android.view.Menu;
+import android.view.MenuItem;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.AdapterView;
@@ -176,5 +177,24 @@ public boolean onCreateOptionsMenu(Menu menu) {
getMenuInflater().inflate(R.menu.products, menu);
return true;
}
+
+ @Override
+ public boolean onOptionsItemSelected(MenuItem item) {
+
+ switch(item.getItemId()) {
+ case R.id.Menu:
+ Intent menuIntent = new Intent(this, CategoriesActivity.class);
+ this.startActivity(menuIntent);
+ break;
+ case R.id.ScanAgain:
+ Intent scanIntent = new Intent(this, ScanActivity.class);
+ this.startActivity(scanIntent);
+ break;
+ default:
+ return super.onOptionsItemSelected(item);
+ }
+
+ return true;
+ }
}
diff --git a/ClientAlphaPrototype/src/com/example/clientalphaprototype/ScanActivity.java b/ClientAlphaPrototype/src/com/example/clientalphaprototype/ScanActivity.java
index 295a408..a02acc5 100644
--- a/ClientAlphaPrototype/src/com/example/clientalphaprototype/ScanActivity.java
+++ b/ClientAlphaPrototype/src/com/example/clientalphaprototype/ScanActivity.java
@@ -22,6 +22,7 @@
import com.dm.zbar.android.scanner.ZBarConstants;
import com.dm.zbar.android.scanner.ZBarScannerActivity;
+import com.example.clientalphaprototype.adapters.ExpandableTextView;
import com.example.clientalphaprototype.model.Category;
import com.example.clientalphaprototype.util.JsonUtil;
import com.fasterxml.jackson.core.JsonParseException;
@@ -30,6 +31,7 @@
public class ScanActivity extends Activity {
private static final int ZBAR_SCANNER_REQUEST = 0;
+ final String text = " press the scan button and place your phone's camera on top of the bar code to proceed to the catalogue";
List categories;
@Override
@@ -42,6 +44,9 @@ protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_scan);
+ ExpandableTextView expandableTextView = (ExpandableTextView) findViewById(R.id.expandable_scaninfo);
+ expandableTextView.setText(text);
+
initializeScanButton();
}
@@ -69,12 +74,6 @@ public void onClick(View v) {
});
}
- @Override
- public boolean onCreateOptionsMenu(Menu menu) {
- // Inflate the menu; this adds items to the action bar if it is present.
- getMenuInflater().inflate(R.menu.scan, menu);
- return true;
- }
public boolean isCameraAvailable() {
PackageManager pm = getPackageManager();
diff --git a/ClientAlphaPrototype/src/com/example/clientalphaprototype/adapters/DetailsImageAdapter.java b/ClientAlphaPrototype/src/com/example/clientalphaprototype/adapters/DetailsImageAdapter.java
index 5d63ac0..d629562 100644
--- a/ClientAlphaPrototype/src/com/example/clientalphaprototype/adapters/DetailsImageAdapter.java
+++ b/ClientAlphaPrototype/src/com/example/clientalphaprototype/adapters/DetailsImageAdapter.java
@@ -1,5 +1,8 @@
package com.example.clientalphaprototype.adapters;
+import java.util.ArrayList;
+import java.util.List;
+
import com.example.clientalphaprototype.R;
import android.content.Context;
@@ -13,28 +16,27 @@
public class DetailsImageAdapter extends BaseAdapter
{
private Context mContext;
-
- private Integer[] mImageIds = {
- R.drawable.image1,
- R.drawable.image2,
- R.drawable.image3,
- };
-
+ List imgIds;
+
public DetailsImageAdapter(Context context)
{
+ imgIds = new ArrayList();
+ setImages();
+
mContext = context;
}
-
+
public int getCount() {
- return mImageIds.length;
+
+ return imgIds.size();
}
public Object getItem(int position) {
- return position;
+ return null;
}
public long getItemId(int position) {
- return position;
+ return 0;
}
@Override
@@ -42,10 +44,19 @@ public View getView(int index, View view, ViewGroup viewGroup)
{
ImageView i = new ImageView(mContext);
- i.setImageResource(mImageIds[index]);
+ i.setImageResource(imgIds.get(index));
i.setLayoutParams(new Gallery.LayoutParams(100, 100));
i.setScaleType(ImageView.ScaleType.FIT_XY);
-
+
return i;
}
+
+ private void setImages(){
+ for(int i=0;i<3;i++)
+ {
+ imgIds.add(R.drawable.image1);
+ imgIds.add(R.drawable.image2);
+ imgIds.add(R.drawable.image3);
+ }
+ }
}
\ No newline at end of file
diff --git a/ClientAlphaPrototype/src/com/example/clientalphaprototype/adapters/ExpandableTextView.java b/ClientAlphaPrototype/src/com/example/clientalphaprototype/adapters/ExpandableTextView.java
new file mode 100644
index 0000000..b2ba983
--- /dev/null
+++ b/ClientAlphaPrototype/src/com/example/clientalphaprototype/adapters/ExpandableTextView.java
@@ -0,0 +1,81 @@
+package com.example.clientalphaprototype.adapters;
+
+import com.example.clientalphaprototype.R;
+
+import android.content.Context;
+import android.content.res.TypedArray;
+import android.text.SpannableStringBuilder;
+import android.util.AttributeSet;
+import android.view.View;
+import android.widget.TextView;
+
+public class ExpandableTextView extends TextView {
+
+ private static final int DEFAULT_TRIM_LENGTH = 0;
+ private static final String ELLIPSIS = "how does this work?";
+
+ private CharSequence originalText;
+ private CharSequence trimmedText;
+ private BufferType bufferType;
+ private boolean trim = true;
+ private int trimLength;
+
+ public ExpandableTextView(Context context) {
+ this(context, null);
+ }
+
+ public ExpandableTextView(Context context, AttributeSet attrs) {
+ super(context, attrs);
+
+ TypedArray typedArray = context.obtainStyledAttributes(attrs, R.styleable.ExpandableTextView);
+ this.trimLength = typedArray.getInt(R.styleable.ExpandableTextView_trimLength, DEFAULT_TRIM_LENGTH);
+ typedArray.recycle();
+
+ setOnClickListener(new OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ trim = !trim;
+ setText();
+ requestFocusFromTouch();
+ }
+ });
+ }
+
+ private void setText() {
+ super.setText(getDisplayableText(), bufferType);
+ }
+
+ private CharSequence getDisplayableText() {
+ return trim ? trimmedText : originalText;
+ }
+
+ @Override
+ public void setText(CharSequence text, BufferType type) {
+ originalText = text;
+ trimmedText = getTrimmedText(text);
+ bufferType = type;
+ setText();
+ }
+
+ private CharSequence getTrimmedText(CharSequence text) {
+ if (originalText != null && originalText.length() > trimLength) {
+ return new SpannableStringBuilder(originalText, 0, trimLength + 1).append(ELLIPSIS);
+ } else {
+ return originalText;
+ }
+ }
+
+ public CharSequence getOriginalText() {
+ return originalText;
+ }
+
+ public void setTrimLength(int trimLength) {
+ this.trimLength = trimLength;
+ trimmedText = getTrimmedText(originalText);
+ setText();
+ }
+
+ public int getTrimLength() {
+ return trimLength;
+ }
+}
\ No newline at end of file