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;
}
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);
}
}
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;
}
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();
}
});
}
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();
}
});
}
Aggregations