Skip to content

Commit

Permalink
Better tweak to last change -- scale text size dynamically
Browse files Browse the repository at this point in the history
git-svn-id: http://zxing.googlecode.com/svn/trunk/android@1424 59b500cc-1b3d-0410-9834-0bbf25fbcc57
  • Loading branch information
srowen committed Jun 14, 2010
1 parent 5536861 commit 23018c8
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/com/google/zxing/client/android/CaptureActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

package com.google.zxing.client.android;

import android.util.TypedValue;
import com.google.zxing.BarcodeFormat;
import com.google.zxing.Result;
import com.google.zxing.ResultPoint;
Expand Down Expand Up @@ -521,6 +522,9 @@ private void handleDecodeInternally(Result rawResult, Bitmap barcode) {
TextView contentsTextView = (TextView) findViewById(R.id.contents_text_view);
CharSequence displayContents = resultHandler.getDisplayContents();
contentsTextView.setText(displayContents);
// Crudely scale betweeen 22 and 48 -- bigger font for shorter text
int scaledSize = Math.max(22, 48 - displayContents.length() / 4);
contentsTextView.setTextSize(TypedValue.COMPLEX_UNIT_SP, scaledSize);

int buttonCount = resultHandler.getButtonCount();
ViewGroup buttonView = (ViewGroup) findViewById(R.id.result_button_view);
Expand Down

0 comments on commit 23018c8

Please sign in to comment.