Search in sources :

Example 36 with TableRow

use of android.widget.TableRow in project android_frameworks_base by AOSPA.

the class AddColumn method onCreate.

@Override
protected void onCreate(Bundle icicle) {
    super.onCreate(icicle);
    setContentView(R.layout.add_column_in_table);
    final Button addRowButton = (Button) findViewById(R.id.add_row_button);
    addRowButton.setOnClickListener(new View.OnClickListener() {

        public void onClick(View v) {
            final TableLayout table = (TableLayout) findViewById(R.id.table);
            final TableRow newRow = new TableRow(AddColumn.this);
            for (int i = 0; i < 4; i++) {
                final TextView view = new TextView(AddColumn.this);
                view.setText("Column " + (i + 1));
                view.setPadding(3, 3, 3, 3);
                newRow.addView(view, new TableRow.LayoutParams());
            }
            table.addView(newRow, new TableLayout.LayoutParams());
            newRow.requestLayout();
        }
    });
}
Also used : Button(android.widget.Button) TableRow(android.widget.TableRow) TextView(android.widget.TextView) TextView(android.widget.TextView) View(android.view.View) TableLayout(android.widget.TableLayout)

Example 37 with TableRow

use of android.widget.TableRow in project android_frameworks_base by ResurrectionRemix.

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 38 with TableRow

use of android.widget.TableRow in project android_frameworks_base by crdroidandroid.

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 39 with TableRow

use of android.widget.TableRow in project drmips by brunonova.

the class DrMIPSActivity method refreshAssembledCodeTableValues.

/**
	 * Refreshes the assembled code table highlights.
	 */
private void refreshAssembledCodeTableValues() {
    TableRow row;
    CPU cpu = getCPU();
    for (int i = 0; i < cpu.getInstructionMemory().getNumberOfInstructions(); i++) {
        row = (TableRow) tblAssembledCode.getChildAt(i + 1);
        // Highlight instructions being executed
        if (i == cpu.getPC().getCurrentInstructionIndex())
            row.setBackgroundColor(Util.getThemeColor(this, getCPU().isPipeline() ? R.attr.ifColor : R.attr.instColor));
        else if (cpu.isPipeline()) {
            if (i == cpu.getIfIdReg().getCurrentInstructionIndex())
                row.setBackgroundColor(Util.getThemeColor(this, R.attr.idColor));
            else if (i == cpu.getIdExReg().getCurrentInstructionIndex())
                row.setBackgroundColor(Util.getThemeColor(this, R.attr.exColor));
            else if (i == cpu.getExMemReg().getCurrentInstructionIndex())
                row.setBackgroundColor(Util.getThemeColor(this, R.attr.memColor));
            else if (i == cpu.getMemWbReg().getCurrentInstructionIndex())
                row.setBackgroundColor(Util.getThemeColor(this, R.attr.wbColor));
            else
                // remove background color
                row.setBackgroundResource(0);
        } else
            // remove background color
            row.setBackgroundResource(0);
    }
    tblAssembledCode.requestLayout();
}
Also used : TableRow(android.widget.TableRow) CPU(brunonova.drmips.simulator.CPU)

Example 40 with TableRow

use of android.widget.TableRow in project drmips by brunonova.

the class DrMIPSActivity method refreshDataMemoryTable.

/**
	 * Refreshes both the rows and values of the data memory table.
	 */
private void refreshDataMemoryTable() {
    while (// remove all rows except header
    tblDataMemory.getChildCount() > 1) tblDataMemory.removeViewAt(1);
    CPU cpu = getCPU();
    if (cpu.hasDataMemory()) {
        TableRow row;
        TextView address, value;
        for (int i = 0; i < cpu.getDataMemory().getMemorySize(); i++) {
            row = new TableRow(this);
            row.setOnLongClickListener(dataMemoryRowOnLongClickListener);
            address = new TextView(this);
            address.setTextAppearance(this, android.R.style.TextAppearance_Medium);
            address.setTypeface(Typeface.MONOSPACE);
            value = new TextView(this);
            value.setTextAppearance(this, android.R.style.TextAppearance_Medium);
            value.setTypeface(Typeface.MONOSPACE);
            value.setGravity(Gravity.RIGHT);
            row.addView(address);
            row.addView(value);
            tblDataMemory.addView(row);
        }
        // refresh values
        refreshDataMemoryTableValues();
    }
}
Also used : TableRow(android.widget.TableRow) CPU(brunonova.drmips.simulator.CPU) TextView(android.widget.TextView)

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