Search in sources :

Example 31 with TableRow

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());
    }
}
Also used : TableRow(android.widget.TableRow) MediumTest(android.test.suitebuilder.annotation.MediumTest)

Example 32 with TableRow

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);
                    }
                }
            }
        }
    }
}
Also used : IQuestionView(org.eyeseetea.malariacare.views.question.IQuestionView) TableRow(android.widget.TableRow) IMultiQuestionView(org.eyeseetea.malariacare.views.question.IMultiQuestionView) Question(org.eyeseetea.malariacare.data.database.model.Question) AKeyboardQuestionView(org.eyeseetea.malariacare.views.question.AKeyboardQuestionView) ImageView(android.widget.ImageView) AOptionQuestionView(org.eyeseetea.malariacare.views.question.AOptionQuestionView) View(android.view.View) INavigationQuestionView(org.eyeseetea.malariacare.views.question.INavigationQuestionView) IQuestionView(org.eyeseetea.malariacare.views.question.IQuestionView) ImageRadioButtonSingleQuestionView(org.eyeseetea.malariacare.views.question.singlequestion.ImageRadioButtonSingleQuestionView) CustomTextView(org.eyeseetea.sdk.presentation.views.CustomTextView) ListView(android.widget.ListView) IMultiQuestionView(org.eyeseetea.malariacare.views.question.IMultiQuestionView) DynamicStockImageRadioButtonSingleQuestionView(org.eyeseetea.malariacare.views.question.singlequestion.DynamicStockImageRadioButtonSingleQuestionView) IImageQuestionView(org.eyeseetea.malariacare.views.question.IImageQuestionView) NumberRadioButtonMultiquestionView(org.eyeseetea.malariacare.views.question.multiquestion.NumberRadioButtonMultiquestionView) ScrollView(android.widget.ScrollView)

Example 33 with TableRow

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);
                }
            }
        }
    }
}
Also used : TableRow(android.widget.TableRow) Question(org.eyeseetea.malariacare.data.database.model.Question) View(android.view.View)

Example 34 with TableRow

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);
    }
}
Also used : TableRow(android.widget.TableRow) TextView(android.widget.TextView) TextView(android.widget.TextView) View(android.view.View)

Example 35 with 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);
    }
}
Also used : TableRow(android.widget.TableRow) Option(org.eyeseetea.malariacare.data.database.model.Option) TableLayout(android.widget.TableLayout) ImageOptionView(org.eyeseetea.malariacare.views.option.ImageOptionView)

Aggregations

TableRow (android.widget.TableRow)43 TextView (android.widget.TextView)25 View (android.view.View)21 TableLayout (android.widget.TableLayout)14 Button (android.widget.Button)8 ImageView (android.widget.ImageView)8 CPU (brunonova.drmips.simulator.CPU)7 MediumTest (android.test.suitebuilder.annotation.MediumTest)6 ViewGroup (android.view.ViewGroup)4 Question (org.eyeseetea.malariacare.data.database.model.Question)4 SuppressLint (android.annotation.SuppressLint)3 ListView (android.widget.ListView)3 ScrollView (android.widget.ScrollView)3 Option (org.eyeseetea.malariacare.data.database.model.Option)3 AOptionQuestionView (org.eyeseetea.malariacare.views.question.AOptionQuestionView)3 IImageQuestionView (org.eyeseetea.malariacare.views.question.IImageQuestionView)3 IMultiQuestionView (org.eyeseetea.malariacare.views.question.IMultiQuestionView)3 IQuestionView (org.eyeseetea.malariacare.views.question.IQuestionView)3 NumberRadioButtonMultiquestionView (org.eyeseetea.malariacare.views.question.multiquestion.NumberRadioButtonMultiquestionView)3 DynamicStockImageRadioButtonSingleQuestionView (org.eyeseetea.malariacare.views.question.singlequestion.DynamicStockImageRadioButtonSingleQuestionView)3