Search in sources :

Example 1 with TableRow

use of android.widget.TableRow in project qksms by moezbhatti.

the class ColorPickerPalette method createTableRow.

private TableRow createTableRow() {
    TableRow localTableRow = new TableRow(getContext());
    localTableRow.setLayoutParams(new ViewGroup.LayoutParams(-2, -2));
    return localTableRow;
}
Also used : ViewGroup(android.view.ViewGroup) TableRow(android.widget.TableRow)

Example 2 with TableRow

use of android.widget.TableRow in project qksms by moezbhatti.

the class ColorPickerPalette method drawPalette.

public void drawPalette(int[] colors, int selectedColor) {
    if (colors == null) {
        return;
    }
    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) {
        tableElements++;
        View colorSwatch = createColorSwatch(color, selectedColor);
        setSwatchDescription(rowNumber, tableElements, rowElements, color == selectedColor, colorSwatch);
        addSwatchToRow(row, colorSwatch, rowNumber);
        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 3 with TableRow

use of android.widget.TableRow in project mounts2sd by SpazeDog.

the class FragmentTabLog method onCreateView.

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    ViewGroup view = (ViewGroup) inflater.inflate(R.layout.fragment_tab_log, container, false);
    TableLayout table = (TableLayout) view.findViewById(R.id.log_table);
    if (oLogEntry == null) {
        RootFW rootfw = Root.initiate();
        FileData data = rootfw.file(getResources().getString(R.string.config_dir_tmp) + "/log.txt").read();
        if (data == null) {
            data = rootfw.file("/data/m2sd.fallback.log").read();
            if (data != null) {
                oLogEntry = data.getArray();
            }
        } else {
            oLogEntry = data.getArray();
        }
        if (oLogEntry == null || oLogEntry.length == 0) {
            oLogEntry = new String[] { "I/" + getResources().getString(R.string.log_empty) };
        }
        Root.release();
    }
    Boolean bool = false;
    Integer color1 = getResources().getColor(resolveAttr(R.attr.colorRef_logItemBackgroundFirst));
    Integer color2 = getResources().getColor(resolveAttr(R.attr.colorRef_logItemBackgroundSecond));
    for (int i = 0; i < oLogEntry.length; i++) {
        TableRow row = (TableRow) inflater.inflate(R.layout.inflate_log_item, table, false);
        String[] parts = oLogEntry[i].split("/", 2);
        ((TextView) row.getChildAt(0)).setText(parts.length > 1 ? parts[0] : "?");
        ((TextView) row.getChildAt(1)).setText(parts.length > 1 ? parts[1] : parts[0]);
        if ((bool = !bool)) {
            row.setBackgroundColor(color1);
        } else {
            row.setBackgroundColor(color2);
        }
        table.addView(row);
    }
    return (View) view;
}
Also used : ViewGroup(android.view.ViewGroup) TableRow(android.widget.TableRow) TextView(android.widget.TextView) TableLayout(android.widget.TableLayout) FileData(com.spazedog.lib.rootfw3.extenders.FileExtender.FileData) View(android.view.View) TextView(android.widget.TextView) RootFW(com.spazedog.lib.rootfw3.RootFW)

Example 4 with TableRow

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

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

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

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)

Aggregations

TableRow (android.widget.TableRow)79 TextView (android.widget.TextView)54 TableLayout (android.widget.TableLayout)38 View (android.view.View)31 Button (android.widget.Button)12 ImageView (android.widget.ImageView)10 SuppressLint (android.annotation.SuppressLint)8 CPU (brunonova.drmips.simulator.CPU)7 MediumTest (android.test.suitebuilder.annotation.MediumTest)6 CheckBox (android.widget.CheckBox)6 CompoundButton (android.widget.CompoundButton)6 LinearLayout (android.widget.LinearLayout)6 ScrollView (android.widget.ScrollView)6 ViewGroup (android.view.ViewGroup)5 ListView (android.widget.ListView)5 LayoutParams (android.widget.TableLayout.LayoutParams)5 ArrayList (java.util.ArrayList)5 SpannableStringBuilder (android.text.SpannableStringBuilder)4 ImageButton (android.widget.ImageButton)4 Context (android.content.Context)3