mirror of
https://github.com/GrammaticalFramework/gf-core.git
synced 2026-04-23 11:42:49 -06:00
restore the visualisation of abstract trees from the app
This commit is contained in:
@@ -18,7 +18,7 @@
|
|||||||
android:layout_toRightOf="@id/arrow"
|
android:layout_toRightOf="@id/arrow"
|
||||||
android:paddingLeft="10dp"
|
android:paddingLeft="10dp"
|
||||||
android:textSize="25sp"/>
|
android:textSize="25sp"/>
|
||||||
|
|
||||||
<org.grammaticalframework.ui.android.ParseTreeView
|
<org.grammaticalframework.ui.android.ParseTreeView
|
||||||
android:id="@+id/desc_details"
|
android:id="@+id/desc_details"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
@@ -26,4 +26,11 @@
|
|||||||
android:layout_below="@id/alternative_desc"
|
android:layout_below="@id/alternative_desc"
|
||||||
android:textSize="25sp"
|
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>
|
</RelativeLayout>
|
||||||
@@ -106,6 +106,10 @@ public class AlternativesActivity extends ListActivity {
|
|||||||
View view = (View) expandedView.findViewById(R.id.desc_details);
|
View view = (View) expandedView.findViewById(R.id.desc_details);
|
||||||
((RelativeLayout) expandedView).removeView(view);
|
((RelativeLayout) expandedView).removeView(view);
|
||||||
|
|
||||||
|
TextView textView = (TextView) expandedView.findViewById(R.id.abstract_tree);
|
||||||
|
if (textView != null)
|
||||||
|
((RelativeLayout) expandedView).removeView(textView);
|
||||||
|
|
||||||
expandedView = null;
|
expandedView = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -141,7 +145,7 @@ public class AlternativesActivity extends ListActivity {
|
|||||||
parseView = new ParseTreeView(this);
|
parseView = new ParseTreeView(this);
|
||||||
parseView.setId(R.id.desc_details);
|
parseView.setId(R.id.desc_details);
|
||||||
RelativeLayout.LayoutParams params =
|
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);
|
params.addRule(RelativeLayout.BELOW, R.id.alternative_desc);
|
||||||
((RelativeLayout) view).addView(parseView, params);
|
((RelativeLayout) view).addView(parseView, params);
|
||||||
}
|
}
|
||||||
@@ -158,7 +162,19 @@ public class AlternativesActivity extends ListActivity {
|
|||||||
brackets[0] = b;
|
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;
|
expandedView = view;
|
||||||
}
|
}
|
||||||
@@ -206,6 +222,12 @@ public class AlternativesActivity extends ListActivity {
|
|||||||
LayoutInflater inflater = (LayoutInflater)
|
LayoutInflater inflater = (LayoutInflater)
|
||||||
getContext().getSystemService(Activity.LAYOUT_INFLATER_SERVICE);
|
getContext().getSystemService(Activity.LAYOUT_INFLATER_SERVICE);
|
||||||
convertView = inflater.inflate(R.layout.alternative_item, null);
|
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)
|
TextView descView = (TextView)
|
||||||
|
|||||||
Reference in New Issue
Block a user