Skip to content

Commit

Permalink
Use denomination symbol in app-widget, rather than denomination code.
Browse files Browse the repository at this point in the history
  • Loading branch information
schildbach committed Sep 2, 2014
1 parent 1c8d96c commit 74ff650
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 23 deletions.
42 changes: 20 additions & 22 deletions wallet/res/layout/wallet_balance_widget_content.xml
Original file line number Diff line number Diff line change
Expand Up @@ -17,40 +17,38 @@
android:gravity="left|center_vertical"
android:orientation="vertical" >

<ImageView
android:layout_width="28dp"
android:layout_height="28dp"
android:layout_gravity="top|left"
android:layout_marginLeft="12dp"
android:layout_marginTop="4dp"
android:src="@drawable/app_icon" />

<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="12dp"
android:orientation="horizontal" >

<ImageView
android:layout_width="32dp"
android:layout_height="32dp"
android:layout_gravity="center"
android:src="@drawable/app_icon" />

<TextView
android:id="@+id/widget_wallet_prefix"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="12dp"
android:layout_gravity="center_vertical" />

<TextView
android:id="@+id/widget_wallet_balance"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="4sp"
android:ellipsize="none"
android:fadingEdge="horizontal"
android:fadingEdgeLength="12dp"
android:singleLine="true"
android:textColor="#bbb"
android:textSize="24sp"
tools:ignore="HardcodedText" />
android:textColor="#eee"
android:textSize="@dimen/font_size_large" />
</LinearLayout>

<TextView
android:id="@+id/widget_wallet_balance"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="12dp"
android:ellipsize="none"
android:fadingEdge="horizontal"
android:fadingEdgeLength="12dp"
android:singleLine="true"
android:textColor="#eee"
android:textSize="30sp" />
</LinearLayout>

<ImageView
Expand Down
11 changes: 10 additions & 1 deletion wallet/src/de/schildbach/wallet/WalletBalanceWidgetProvider.java
Original file line number Diff line number Diff line change
Expand Up @@ -96,8 +96,17 @@ private static void updateWidgets(final Context context, @Nonnull final AppWidge
for (final int appWidgetId : appWidgetIds)
{
final RemoteViews views = new RemoteViews(context.getPackageName(), R.layout.wallet_balance_widget_content);
views.setTextViewText(R.id.widget_wallet_prefix, config.getBtcPrefix());

final String currencyCode = config.getBtcPrefix();
if (Constants.CURRENCY_CODE_BTC.equals(currencyCode))
views.setImageViewResource(R.id.widget_wallet_prefix, R.drawable.currency_symbol_btc);
else if (Constants.CURRENCY_CODE_MBTC.equals(currencyCode))
views.setImageViewResource(R.id.widget_wallet_prefix, R.drawable.currency_symbol_mbtc);
else if (Constants.CURRENCY_CODE_UBTC.equals(currencyCode))
views.setImageViewResource(R.id.widget_wallet_prefix, R.drawable.currency_symbol_ubtc);

views.setTextViewText(R.id.widget_wallet_balance, balanceStr);

views.setOnClickPendingIntent(R.id.widget_button_balance,
PendingIntent.getActivity(context, 0, new Intent(context, WalletActivity.class), 0));
views.setOnClickPendingIntent(R.id.widget_button_request,
Expand Down

0 comments on commit 74ff650

Please sign in to comment.