design update

This commit is contained in:
ligi 2014-09-21 19:06:54 +02:00
parent 619f0d3db6
commit 0e858292b5
3 changed files with 54 additions and 19 deletions

View file

@ -25,6 +25,8 @@ import org.ligi.passandroid.R;
import org.ligi.passandroid.helper.PassVisualizer;
import org.ligi.passandroid.maps.PassbookMapsFacade;
import org.ligi.passandroid.model.Pass;
import org.ligi.passandroid.model.PassField;
import org.ligi.passandroid.model.PassFieldList;
import java.io.File;
@ -51,8 +53,8 @@ public class PassViewActivity extends PassViewActivityBase {
@InjectView(R.id.back_fields)
TextView back_tv;
@InjectView(R.id.main_fields)
TextView front_tv;
@InjectView(R.id.front_field_container)
ViewGroup frontFieldsContainer;
@InjectView(R.id.barcode_alt_text)
TextView barcodeAlternatvieText;
@ -126,13 +128,10 @@ public class PassViewActivity extends PassViewActivityBase {
}
if (pass.getType() != null) {
String front_str = "";
front_str += PassVisualizer.getFieldListAsString(pass.getHeaderFields());
front_str += PassVisualizer.getFieldListAsString(pass.getPrimaryFields());
front_str += PassVisualizer.getFieldListAsString(pass.getSecondaryFields());
front_str += PassVisualizer.getFieldListAsString(pass.getAuxiliaryFields());
front_tv.setText(Html.fromHtml(front_str));
addFrontFields(pass.getHeaderFields());
addFrontFields(pass.getPrimaryFields());
addFrontFields(pass.getSecondaryFields());
addFrontFields(pass.getAuxiliaryFields());
}
String back_str = "";
@ -148,6 +147,17 @@ public class PassViewActivity extends PassViewActivityBase {
PassVisualizer.visualize(this, pass, contentView);
}
private void addFrontFields(PassFieldList passFields) {
for (PassField field : passFields) {
View v = getLayoutInflater().inflate(R.layout.main_field_item, null);
TextView key = (TextView) v.findViewById(R.id.key);
key.setText(field.label);
TextView value = (TextView) v.findViewById(R.id.value);
value.setText(field.value);
frontFieldsContainer.addView(v);
}
}
private static void setBitmapSafe(ImageView imageView, Optional<Bitmap> bitmapOptional) {
if (bitmapOptional.isPresent()) {

View file

@ -0,0 +1,28 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<TextView
android:layout_weight="1"
android:layout_height="wrap_content"
android:layout_width="0dip"
android:gravity="right"
android:paddingRight="4dp"
android:fontFamily="sans-serif"
android:textSize="18sp"
tools:text="Key"
android:id="@+id/key" />
<TextView
android:layout_weight="1"
android:layout_height="wrap_content"
android:layout_width="0dip"
android:fontFamily="sans-serif-light"
android:paddingLeft="4dp"
android:textSize="18sp"
tools:text="Value"
android:id="@+id/value" />
</LinearLayout>

View file

@ -12,12 +12,11 @@
android:contentDescription="@string/logo"
android:paddingBottom="10dp" />
<TextView
android:id="@+id/main_fields"
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="20dp"
android:orientation="vertical"
android:id="@+id/front_field_container"
/>
<ImageView
@ -25,23 +24,21 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:contentDescription="@string/logo"
android:paddingBottom="10dp" />
android:contentDescription="@string/logo" />
<TextView
android:id="@+id/barcode_alt_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal" />
android:layout_gravity="center_horizontal"
android:paddingBottom="10dp" />
<TextView
android:id="@+id/back_fields"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="20dp"
/>
android:padding="20dp" />
<ImageView
android:id="@+id/logo_img"