use of android.widget.TableRow in project android_frameworks_base by DirtyUnicorns.
the class AddColumnTest method testWidths.
@MediumTest
public void testWidths() throws Exception {
sendKeys(KeyEvent.KEYCODE_DPAD_CENTER);
getInstrumentation().waitForIdleSync();
TableRow row1 = (TableRow) mTable.getChildAt(0);
TableRow row2 = (TableRow) mTable.getChildAt(1);
assertTrue(row1.getChildCount() < row2.getChildCount());
for (int i = 0; i < row1.getChildCount(); i++) {
assertEquals(row2.getChildAt(i).getWidth(), row1.getChildAt(i).getWidth());
}
}
use of android.widget.TableRow in project pictureapp by EyeSeeTea.
the class DynamicTabAdapter method showOrHideChildren.
/**
* Hide or show the childen question from a given question, if is necessary it reloads the
* children questions values or refreshing the children questions answer component
*
* this code will be delete when DynamicTabAdapter refactoring will be completed
*
* @param question is the parent question
*/
private void showOrHideChildren(Question question) {
if (!question.hasChildren()) {
return;
}
for (int i = 0, j = tableLayout.getChildCount(); i < j; i++) {
View view = tableLayout.getChildAt(i);
if (view instanceof TableRow) {
TableRow row = (TableRow) view;
View targetView = row.getChildAt(0);
if (targetView instanceof IMultiQuestionView || targetView instanceof IQuestionView) {
Question rowQuestion = (Question) targetView.getTag();
if (rowQuestion == null) {
continue;
}
List<Question> questionChildren = question.getChildren();
if (questionChildren != null && questionChildren.size() > 0) {
for (Question childQuestion : questionChildren) {
//if the table row question is child of the modified question...
toggleChild(row, rowQuestion, childQuestion);
}
}
}
}
}
}
use of android.widget.TableRow in project pictureapp by EyeSeeTea.
the class AQuestionAnswerChangedListener method showOrHideChildren.
/**
* Hide or show the children question from a given question, if is necessary it reloads the
* children questions values or refreshing the children questions answer component
*
* TODO: Duplicate code in DynamicTabAdapter line 1094
* code in DynamicTabAdapter will be delete when DynamicTabAdapter refactoring will be
* completed
*
* @param question is the parent question
*/
protected void showOrHideChildren(Question question) {
if (!question.hasChildren()) {
return;
}
for (int i = 0, j = mTableLayout.getChildCount(); i < j; i++) {
View view = mTableLayout.getChildAt(i);
if (view instanceof TableRow) {
TableRow row = (TableRow) view;
View answerView = view.findViewById(R.id.answer);
if (answerView == null) {
continue;
}
Question rowQuestion = (Question) answerView.getTag();
if (rowQuestion == null) {
continue;
}
List<Question> questionChildren = question.getChildren();
if (questionChildren != null && questionChildren.size() > 0) {
for (Question childQuestion : questionChildren) {
//if the table row question is child of the modified question...
toggleChild(row, rowQuestion, childQuestion);
}
}
}
}
}
use of android.widget.TableRow in project UltimateAndroid by cymcsg.
the class StretchViewActivity method showTable.
public void showTable() {
TableRow.LayoutParams layoutParams = new TableRow.LayoutParams(TableRow.LayoutParams.MATCH_PARENT, TableRow.LayoutParams.WRAP_CONTENT);
layoutParams.gravity = Gravity.CENTER;
layoutParams.leftMargin = 30;
layoutParams.bottomMargin = 10;
layoutParams.topMargin = 10;
for (int i = 0; i < 40; i++) {
TableRow tableRow = new TableRow(this);
TextView textView = new TextView(this);
textView.setText("Test stretch scroll view " + i);
textView.setTextSize(20);
textView.setPadding(15, 15, 15, 15);
tableRow.addView(textView, layoutParams);
if (i % 2 != 0) {
tableRow.setBackgroundColor(Color.LTGRAY);
} else {
tableRow.setBackgroundColor(Color.WHITE);
}
final int n = i;
tableRow.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Toast.makeText(StretchViewActivity.this, "Click item " + n, Toast.LENGTH_SHORT).show();
}
});
mMainLayout.addView(tableRow);
}
}
use of android.widget.TableRow in project pictureapp by EyeSeeTea.
the class ImageOptionSingleQuestionView method setOptions.
@Override
public void setOptions(List<Option> options) {
TableRow tableRow = null;
for (int i = 0; i < options.size(); i++) {
Option option = options.get(i);
if (isNewRow(i)) {
tableRow = new TableRow(getContext());
tableRow.setLayoutParams(new TableLayout.LayoutParams(TableLayout.LayoutParams.MATCH_PARENT, TableLayout.LayoutParams.MATCH_PARENT, 1));
mImageOptionsContainer.addView(tableRow);
}
ImageOptionView imageOptionView = createOptionView(option);
tableRow.addView(imageOptionView);
mImageOptionViews.add(imageOptionView);
}
}
Aggregations