From 55e2b55e60d588174e7339f9d0ee23da3db97a3e Mon Sep 17 00:00:00 2001 From: "kr.angelov" Date: Mon, 8 Dec 2014 16:17:42 +0000 Subject: [PATCH] restore the visualisation of abstract trees from the app --- .../android/res/layout/alternative_item.xml | 9 ++++++- .../ui/android/AlternativesActivity.java | 26 +++++++++++++++++-- 2 files changed, 32 insertions(+), 3 deletions(-) diff --git a/src/ui/android/res/layout/alternative_item.xml b/src/ui/android/res/layout/alternative_item.xml index d88384bba..f35d1b938 100644 --- a/src/ui/android/res/layout/alternative_item.xml +++ b/src/ui/android/res/layout/alternative_item.xml @@ -18,7 +18,7 @@ android:layout_toRightOf="@id/arrow" android:paddingLeft="10dp" android:textSize="25sp"/> - + + + \ No newline at end of file diff --git a/src/ui/android/src/org/grammaticalframework/ui/android/AlternativesActivity.java b/src/ui/android/src/org/grammaticalframework/ui/android/AlternativesActivity.java index 89bf92ac6..0bebbc3ea 100644 --- a/src/ui/android/src/org/grammaticalframework/ui/android/AlternativesActivity.java +++ b/src/ui/android/src/org/grammaticalframework/ui/android/AlternativesActivity.java @@ -106,6 +106,10 @@ public class AlternativesActivity extends ListActivity { View view = (View) expandedView.findViewById(R.id.desc_details); ((RelativeLayout) expandedView).removeView(view); + TextView textView = (TextView) expandedView.findViewById(R.id.abstract_tree); + if (textView != null) + ((RelativeLayout) expandedView).removeView(textView); + expandedView = null; } @@ -141,7 +145,7 @@ public class AlternativesActivity extends ListActivity { parseView = new ParseTreeView(this); parseView.setId(R.id.desc_details); RelativeLayout.LayoutParams params = - new RelativeLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT); + new RelativeLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT); params.addRule(RelativeLayout.BELOW, R.id.alternative_desc); ((RelativeLayout) view).addView(parseView, params); } @@ -158,7 +162,19 @@ public class AlternativesActivity extends ListActivity { brackets[0] = b; } } - parseView.setBrackets(brackets); + parseView.setBrackets(brackets); + + TextView textView = (TextView) view.findViewById(R.id.abstract_tree); + if (textView == null) { + textView = new TextView(this); + textView.setId(R.id.abstract_tree); + textView.setTextSize(15); + RelativeLayout.LayoutParams params = + new RelativeLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT); + params.addRule(RelativeLayout.BELOW, R.id.desc_details); + ((RelativeLayout) view).addView(textView, params); + } + textView.setText(ep.getExpr().toString()); expandedView = view; } @@ -206,6 +222,12 @@ public class AlternativesActivity extends ListActivity { LayoutInflater inflater = (LayoutInflater) getContext().getSystemService(Activity.LAYOUT_INFLATER_SERVICE); convertView = inflater.inflate(R.layout.alternative_item, null); + + View treeView = (View) convertView.findViewById(R.id.desc_details); + ((RelativeLayout) convertView).removeView(treeView); + + TextView textView = (TextView) convertView.findViewById(R.id.abstract_tree); + ((RelativeLayout) convertView).removeView(textView); } TextView descView = (TextView)