Search in sources :

Example 51 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 52 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 53 with TableRow

use of android.widget.TableRow in project sexytopo by richsmith.

the class TableActivity method syncTableWithSurvey.

public void syncTableWithSurvey() {
    Survey survey = getSurvey();
    List<GraphToListTranslator.SurveyListEntry> tableEntries = graphToListTranslator.toListOfSurveyListEntries(survey);
    if (tableEntries.size() == 0) {
        Toast.makeText(getApplicationContext(), R.string.no_data, Toast.LENGTH_SHORT).show();
    }
    TableLayout tableLayout = (TableLayout) (findViewById(R.id.BodyTable));
    tableLayout.removeAllViews();
    for (GraphToListTranslator.SurveyListEntry entry : tableEntries) {
        TableRow tableRow = (TableRow) LayoutInflater.from(this).inflate(R.layout.table_row, null);
        final Map map = GraphToListTranslator.createMap(entry);
        for (TableCol col : TableCol.values()) {
            if (col == TableCol.COMMENT) {
                continue;
            }
            String display = map.containsKey(col) ? col.format(map.get(col)) : "?";
            int id = TABLE_COL_BY_ANDROID_ID.get(col);
            TextView textView = (TextView) tableRow.findViewById(id);
            textView.setText(display);
            if (isActiveStation(map.get(col))) {
                textView.setBackgroundColor(GraphView.HIGHLIGHT_COLOUR.intValue);
            }
            if (entry.getLeg().hasDestination()) {
                textView.setTypeface(textView.getTypeface(), Typeface.BOLD);
            } else {
                textView.setTypeface(textView.getTypeface(), Typeface.NORMAL);
            }
            fieldToSurveyEntry.put(textView, entry);
            fieldToTableCol.put(textView, col);
            textView.setOnLongClickListener(this);
        }
        int numRows = tableLayout.getChildCount();
        tableLayout.addView(tableRow, numRows);
    }
    tableLayout.requestLayout();
    ScrollView scrollView = (ScrollView) (findViewById(R.id.BodyTableScrollView));
    scrollView.fullScroll(View.FOCUS_DOWN);
}
Also used : TableCol(org.hwyl.sexytopo.model.table.TableCol) Survey(org.hwyl.sexytopo.model.survey.Survey) ScrollView(android.widget.ScrollView) GraphToListTranslator(org.hwyl.sexytopo.control.util.GraphToListTranslator) TableRow(android.widget.TableRow) TextView(android.widget.TextView) TableLayout(android.widget.TableLayout) HashMap(java.util.HashMap) Map(java.util.Map) EnumMap(java.util.EnumMap)

Example 54 with TableRow

use of android.widget.TableRow in project KISS by Neamar.

the class ColorPickerPalette method drawPalette.

/**
     * Adds swatches to table in a serpentine format.
     */
public void drawPalette(int[] colors, int selectedColor, String[] colorContentDescriptions) {
    if (colors == null) {
        return;
    }
    this.removeAllViews();
    int tableElements = 0;
    int rowElements = 0;
    int rowNumber = 0;
    // Fills the table with swatches based on the array of colors.
    TableRow row = createTableRow();
    for (int color : colors) {
        View colorSwatch = createColorSwatch(color, selectedColor);
        setSwatchDescription(rowNumber, tableElements, rowElements, color == selectedColor, colorSwatch, colorContentDescriptions);
        addSwatchToRow(row, colorSwatch, rowNumber);
        tableElements++;
        rowElements++;
        if (rowElements == mNumColumns) {
            addView(row);
            row = createTableRow();
            rowElements = 0;
            rowNumber++;
        }
    }
    // Create blank views to fill the row if the last row has not been filled.
    if (rowElements > 0) {
        while (rowElements != mNumColumns) {
            addSwatchToRow(row, createBlankSpace(), rowNumber);
            rowElements++;
        }
        addView(row);
    }
}
Also used : TableRow(android.widget.TableRow) ImageView(android.widget.ImageView) View(android.view.View)

Example 55 with TableRow

use of android.widget.TableRow in project KISS by Neamar.

the class ColorPickerPalette method createTableRow.

private TableRow createTableRow() {
    TableRow row = new TableRow(getContext());
    ViewGroup.LayoutParams params = new ViewGroup.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
    row.setLayoutParams(params);
    return row;
}
Also used : ViewGroup(android.view.ViewGroup) TableRow(android.widget.TableRow)

Aggregations

TableRow (android.widget.TableRow)77 TextView (android.widget.TextView)53 TableLayout (android.widget.TableLayout)37 View (android.view.View)30 Button (android.widget.Button)11 ImageView (android.widget.ImageView)10 SuppressLint (android.annotation.SuppressLint)7 ScrollView (android.widget.ScrollView)7 CPU (brunonova.drmips.simulator.CPU)7 MediumTest (android.test.suitebuilder.annotation.MediumTest)6 CheckBox (android.widget.CheckBox)6 ViewGroup (android.view.ViewGroup)5 CompoundButton (android.widget.CompoundButton)5 ImageButton (android.widget.ImageButton)5 LinearLayout (android.widget.LinearLayout)5 ListView (android.widget.ListView)5 LayoutParams (android.widget.TableLayout.LayoutParams)5 SpannableStringBuilder (android.text.SpannableStringBuilder)4 ArrayList (java.util.ArrayList)4 Context (android.content.Context)3