From 68107a440873e2f9255c3e787b576bcef5c715e9 Mon Sep 17 00:00:00 2001 From: serso Date: Sun, 27 Mar 2016 15:41:03 +0200 Subject: [PATCH] Show values for variables --- .../calculator/variables/VariablesFragment.java | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/org/solovyev/android/calculator/variables/VariablesFragment.java b/app/src/main/java/org/solovyev/android/calculator/variables/VariablesFragment.java index eb628fe9..0b602ff1 100644 --- a/app/src/main/java/org/solovyev/android/calculator/variables/VariablesFragment.java +++ b/app/src/main/java/org/solovyev/android/calculator/variables/VariablesFragment.java @@ -26,6 +26,7 @@ import android.content.DialogInterface; import android.os.Bundle; import android.support.annotation.NonNull; import android.support.v4.app.FragmentActivity; +import android.text.TextUtils; import android.view.*; import com.squareup.otto.Bus; import com.squareup.otto.Subscribe; @@ -156,6 +157,14 @@ public class VariablesFragment extends BaseEntitiesFragment { @NonNull @Override protected String getName(@Nonnull IConstant variable) { - return variable.getName(); + final String name = variable.getName(); + if (!variable.isDefined()) { + return name; + } + final String value = variable.getValue(); + if(TextUtils.isEmpty(value)) { + return name; + } + return name + " = " + value; } }