diff options
| author | kr.angelov <kr.angelov@gmail.com> | 2014-12-08 16:17:42 +0000 |
|---|---|---|
| committer | kr.angelov <kr.angelov@gmail.com> | 2014-12-08 16:17:42 +0000 |
| commit | 55e2b55e60d588174e7339f9d0ee23da3db97a3e (patch) | |
| tree | 93325b94c2bba6f28d0abb7d57485ff720e2c3d7 /src | |
| parent | d4b8281226a93c3fb326b520df374f68caf14dd1 (diff) | |
restore the visualisation of abstract trees from the app
Diffstat (limited to 'src')
| -rw-r--r-- | src/ui/android/res/layout/alternative_item.xml | 9 | ||||
| -rw-r--r-- | src/ui/android/src/org/grammaticalframework/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"/> - + <org.grammaticalframework.ui.android.ParseTreeView android:id="@+id/desc_details" android:layout_width="match_parent" @@ -26,4 +26,11 @@ android:layout_below="@id/alternative_desc" android:textSize="25sp" /> + + <TextView + android:id="@+id/abstract_tree" + android:layout_width="fill_parent" + android:layout_height="wrap_content" + android:layout_below="@id/desc_details" + android:textSize="15sp"/> </RelativeLayout>
\ 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) |
