Prettify scan result screen, I think

git-svn-id: https://zxing.googlecode.com/svn/trunk@1423 59b500cc-1b3d-0410-9834-0bbf25fbcc57
This commit is contained in:
srowen 2010-06-14 10:59:24 +00:00
parent 58fefb095c
commit 64373435b7
4 changed files with 169 additions and 81 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.1 KiB

View file

@ -48,8 +48,8 @@
<LinearLayout
android:orientation="vertical"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="left|top">
android:layout_height="fill_parent"
android:gravity="right">
<ImageView android:id="@+id/barcode_image_view"
android:layout_width="160dip"
@ -58,45 +58,85 @@
android:maxHeight="160dip"
android:layout_marginBottom="4dip"
android:adjustViewBounds="true"
android:scaleType="centerInside"/>
android:scaleType="fitEnd"/>
<TextView android:id="@+id/format_text_view"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="left"
android:text="@string/msg_default_format"
android:textColor="@color/result_minor_text"
android:textSize="14sp"/>
<LinearLayout
android:orientation="horizontal"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<TextView android:id="@+id/type_text_view"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="left"
android:text="@string/msg_default_type"
android:textColor="@color/result_minor_text"
android:textSize="14sp"/>
<TextView android:id="@+id/format_text_view_label"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/msg_default_format"
android:textColor="@color/result_minor_text"
android:textStyle="bold"
android:textSize="14sp"
android:paddingRight="4dip"/>
<TextView android:id="@+id/time_text_view"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="left"
android:text="@string/msg_default_time"
android:textColor="@color/result_minor_text"
android:textSize="14sp"/>
<TextView android:id="@+id/format_text_view"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="@color/result_minor_text"
android:textSize="14sp"/>
</LinearLayout>
<LinearLayout
android:orientation="horizontal"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<TextView android:id="@+id/type_text_view_label"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/msg_default_type"
android:textColor="@color/result_minor_text"
android:textStyle="bold"
android:textSize="14sp"
android:paddingRight="4dip"/>
<TextView android:id="@+id/type_text_view"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="@color/result_minor_text"
android:textSize="14sp"/>
</LinearLayout>
<LinearLayout
android:orientation="horizontal"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<TextView android:id="@+id/time_text_view_label"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/msg_default_time"
android:textColor="@color/result_minor_text"
android:textStyle="bold"
android:textSize="14sp"
android:paddingRight="4dip"/>
<TextView android:id="@+id/time_text_view"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="@color/result_minor_text"
android:textSize="14sp"/>
</LinearLayout>
</LinearLayout>
<ScrollView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="1">
android:layout_height="wrap_content">
<TextView android:id="@+id/contents_text_view"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:gravity="left|top"
android:text="@string/msg_default_contents"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="@color/result_text"
android:textColorLink="@color/result_text"
android:textSize="22sp"
android:paddingLeft="12dip"
android:autoLink="web"/>
@ -111,20 +151,28 @@
android:layout_height="wrap_content"
android:gravity="center">
<Button android:layout_width="wrap_content"
<Button android:layout_width="0sp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:textSize="14sp"
android:visibility="gone"/>
<Button android:layout_width="wrap_content"
<Button android:layout_width="0sp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:textSize="14sp"
android:visibility="gone"/>
<Button android:layout_width="wrap_content"
<Button android:layout_width="0sp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:textSize="14sp"
android:visibility="gone"/>
<Button android:layout_width="wrap_content"
<Button android:layout_width="0sp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:textSize="14sp"
android:visibility="gone"/>
</LinearLayout>

View file

@ -48,8 +48,8 @@
<LinearLayout
android:orientation="vertical"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="left|top">
android:layout_height="fill_parent"
android:gravity="right">
<ImageView android:id="@+id/barcode_image_view"
android:layout_width="160dip"
@ -58,45 +58,85 @@
android:maxHeight="160dip"
android:layout_marginBottom="4dip"
android:adjustViewBounds="true"
android:scaleType="centerInside"/>
android:scaleType="fitEnd"/>
<TextView android:id="@+id/format_text_view"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="left"
android:text="@string/msg_default_format"
android:textColor="@color/result_minor_text"
android:textSize="14sp"/>
<LinearLayout
android:orientation="horizontal"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<TextView android:id="@+id/type_text_view"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="left"
android:text="@string/msg_default_type"
android:textColor="@color/result_minor_text"
android:textSize="14sp"/>
<TextView android:id="@+id/format_text_view_label"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/msg_default_format"
android:textColor="@color/result_minor_text"
android:textStyle="bold"
android:textSize="14sp"
android:paddingRight="4dip"/>
<TextView android:id="@+id/time_text_view"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="left"
android:text="@string/msg_default_time"
android:textColor="@color/result_minor_text"
android:textSize="14sp"/>
<TextView android:id="@+id/format_text_view"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="@color/result_minor_text"
android:textSize="14sp"/>
</LinearLayout>
<LinearLayout
android:orientation="horizontal"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<TextView android:id="@+id/type_text_view_label"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/msg_default_type"
android:textColor="@color/result_minor_text"
android:textStyle="bold"
android:textSize="14sp"
android:paddingRight="4dip"/>
<TextView android:id="@+id/type_text_view"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="@color/result_minor_text"
android:textSize="14sp"/>
</LinearLayout>
<LinearLayout
android:orientation="horizontal"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<TextView android:id="@+id/time_text_view_label"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/msg_default_time"
android:textColor="@color/result_minor_text"
android:textStyle="bold"
android:textSize="14sp"
android:paddingRight="4dip"/>
<TextView android:id="@+id/time_text_view"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="@color/result_minor_text"
android:textSize="14sp"/>
</LinearLayout>
</LinearLayout>
<ScrollView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="1">
android:layout_height="wrap_content">
<TextView android:id="@+id/contents_text_view"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:gravity="left|top"
android:text="@string/msg_default_contents"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="@color/result_text"
android:textColorLink="@color/result_text"
android:textSize="22sp"
android:paddingLeft="12dip"
android:autoLink="web"/>
@ -111,20 +151,28 @@
android:layout_height="wrap_content"
android:gravity="center">
<Button android:layout_width="wrap_content"
<Button android:layout_width="0sp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:textSize="14sp"
android:visibility="gone"/>
<Button android:layout_width="wrap_content"
<Button android:layout_width="0sp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:textSize="14sp"
android:visibility="gone"/>
<Button android:layout_width="wrap_content"
<Button android:layout_width="0sp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:textSize="14sp"
android:visibility="gone"/>
<Button android:layout_width="wrap_content"
<Button android:layout_width="0sp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:textSize="14sp"
android:visibility="gone"/>
</LinearLayout>

View file

@ -49,8 +49,6 @@ import android.os.Message;
import android.os.Vibrator;
import android.preference.PreferenceManager;
import android.text.ClipboardManager;
import android.text.SpannableStringBuilder;
import android.text.style.UnderlineSpan;
import android.util.Log;
import android.view.Gravity;
import android.view.KeyEvent;
@ -499,7 +497,7 @@ public final class CaptureActivity extends Activity implements SurfaceHolder.Cal
ImageView barcodeImageView = (ImageView) findViewById(R.id.barcode_image_view);
if (barcode == null) {
barcodeImageView.setImageResource(R.drawable.zxing_icon);
barcodeImageView.setImageResource(R.drawable.launcher_icon_large);
} else {
barcodeImageView.setImageBitmap(barcode);
}
@ -507,28 +505,22 @@ public final class CaptureActivity extends Activity implements SurfaceHolder.Cal
TextView formatTextView = (TextView) findViewById(R.id.format_text_view);
formatTextView.setVisibility(View.VISIBLE);
formatTextView.setText(getString(R.string.msg_default_format) + ": " +
rawResult.getBarcodeFormat().toString());
formatTextView.setText(rawResult.getBarcodeFormat().toString());
ResultHandler resultHandler = ResultHandlerFactory.makeResultHandler(this, rawResult);
TextView typeTextView = (TextView) findViewById(R.id.type_text_view);
typeTextView.setVisibility(View.VISIBLE);
typeTextView.setText(getString(R.string.msg_default_type) + ": " +
resultHandler.getType().toString());
typeTextView.setText(resultHandler.getType().toString());
DateFormat formatter = DateFormat.getDateTimeInstance(DateFormat.SHORT, DateFormat.SHORT);
String formattedTime = formatter.format(new Date(rawResult.getTimestamp()));
TextView timeTextView = (TextView) findViewById(R.id.time_text_view);
timeTextView.setVisibility(View.VISIBLE);
timeTextView.setText(getString(R.string.msg_default_time) + ": " + formattedTime);
timeTextView.setText(formattedTime);
TextView contentsTextView = (TextView) findViewById(R.id.contents_text_view);
CharSequence title = getString(resultHandler.getDisplayTitle());
SpannableStringBuilder styled = new SpannableStringBuilder(title + "\n\n");
styled.setSpan(new UnderlineSpan(), 0, title.length(), 0);
CharSequence displayContents = resultHandler.getDisplayContents();
styled.append(displayContents);
contentsTextView.setText(styled);
contentsTextView.setText(displayContents);
int buttonCount = resultHandler.getButtonCount();
ViewGroup buttonView = (ViewGroup) findViewById(R.id.result_button_view);