Example usage for android.widget TableRow setWeightSum

List of usage examples for android.widget TableRow setWeightSum

Introduction

In this page you can find the example usage for android.widget TableRow setWeightSum.

Prototype

@android.view.RemotableViewMethod
public void setWeightSum(float weightSum) 

Source Link

Document

Defines the desired weights sum.

Usage

From source file:com.vonglasow.michael.satstat.RadioSectionFragment.java

protected void showCellCdma(CellTowerCdma cell) {
    TableRow row = new TableRow(rilCdmaCells.getContext());
    row.setWeightSum(26);

    TextView newType = new TextView(rilCdmaCells.getContext());
    newType.setLayoutParams(new TableRow.LayoutParams(0, LayoutParams.WRAP_CONTENT, 2));
    newType.setTextAppearance(rilCdmaCells.getContext(), android.R.style.TextAppearance_Medium);
    newType.setTextColor(//from  w  w w.  j  a v  a  2  s. com
            rilCdmaCells.getContext().getResources().getColor(getColorFromGeneration(cell.getGeneration())));
    newType.setText(rilCdmaCells.getContext().getResources().getString(R.string.smallDot));
    row.addView(newType);

    TextView newSid = new TextView(rilCdmaCells.getContext());
    newSid.setLayoutParams(new TableRow.LayoutParams(0, LayoutParams.WRAP_CONTENT, 6));
    newSid.setTextAppearance(rilCdmaCells.getContext(), android.R.style.TextAppearance_Medium);
    newSid.setText(formatCellData(rilCdmaCells.getContext(), null, cell.getSid()));
    row.addView(newSid);

    TextView newNid = new TextView(rilCdmaCells.getContext());
    newNid.setLayoutParams(new TableRow.LayoutParams(0, LayoutParams.WRAP_CONTENT, 5));
    newNid.setTextAppearance(rilCdmaCells.getContext(), android.R.style.TextAppearance_Medium);
    newNid.setText(formatCellData(rilCdmaCells.getContext(), null, cell.getNid()));
    row.addView(newNid);

    TextView newBsid = new TextView(rilCdmaCells.getContext());
    newBsid.setLayoutParams(new TableRow.LayoutParams(0, LayoutParams.WRAP_CONTENT, 9));
    newBsid.setTextAppearance(rilCdmaCells.getContext(), android.R.style.TextAppearance_Medium);
    newBsid.setText(formatCellData(rilCdmaCells.getContext(), null, cell.getBsid()));
    row.addView(newBsid);

    TextView newDbm = new TextView(rilCdmaCells.getContext());
    newDbm.setLayoutParams(new TableRow.LayoutParams(0, LayoutParams.WRAP_CONTENT, 4));
    newDbm.setTextAppearance(rilCdmaCells.getContext(), android.R.style.TextAppearance_Medium);
    newDbm.setText(formatCellDbm(rilCdmaCells.getContext(), null, cell.getDbm()));
    row.addView(newDbm);

    rilCdmaCells.addView(row,
            new TableLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT));
}

From source file:com.vonglasow.michael.satstat.RadioSectionFragment.java

protected void showCellGsm(CellTowerGsm cell) {
    TableRow row = new TableRow(rilCells.getContext());
    row.setWeightSum(29);

    TextView newType = new TextView(rilCells.getContext());
    newType.setLayoutParams(new TableRow.LayoutParams(0, LayoutParams.WRAP_CONTENT, 2));
    newType.setTextAppearance(rilCells.getContext(), android.R.style.TextAppearance_Medium);
    newType.setTextColor(//from ww w.  ja  va 2s . co  m
            rilCells.getContext().getResources().getColor(getColorFromGeneration(cell.getGeneration())));
    newType.setText(rilCells.getContext().getResources().getString(R.string.smallDot));
    row.addView(newType);

    TextView newMcc = new TextView(rilCells.getContext());
    newMcc.setLayoutParams(new TableRow.LayoutParams(0, LayoutParams.WRAP_CONTENT, 3));
    newMcc.setTextAppearance(rilCells.getContext(), android.R.style.TextAppearance_Medium);
    newMcc.setText(formatCellData(rilCells.getContext(), "%03d", cell.getMcc()));
    row.addView(newMcc);

    TextView newMnc = new TextView(rilCells.getContext());
    newMnc.setLayoutParams(new TableRow.LayoutParams(0, LayoutParams.WRAP_CONTENT, 3));
    newMnc.setTextAppearance(rilCells.getContext(), android.R.style.TextAppearance_Medium);
    newMnc.setText(formatCellData(rilCells.getContext(), "%02d", cell.getMnc()));
    row.addView(newMnc);

    TextView newLac = new TextView(rilCells.getContext());
    newLac.setLayoutParams(new TableRow.LayoutParams(0, LayoutParams.WRAP_CONTENT, 5));
    newLac.setTextAppearance(rilCells.getContext(), android.R.style.TextAppearance_Medium);
    newLac.setText(formatCellData(rilCells.getContext(), null, cell.getLac()));
    row.addView(newLac);

    TextView newCid = new TextView(rilCells.getContext());
    newCid.setLayoutParams(new TableRow.LayoutParams(0, LayoutParams.WRAP_CONTENT, 9));
    newCid.setTextAppearance(rilCells.getContext(), android.R.style.TextAppearance_Medium);
    if ((mainActivity.prefCid) && (cell.getCid() != CellTower.UNKNOWN) && (cell.getCid() > 0x0ffff)) {
        int rtcid = cell.getCid() / 0x10000;
        int cid = cell.getCid() % 0x10000;
        newCid.setText(String.format("%d-%d", rtcid, cid));
    } else
        newCid.setText(formatCellData(rilCells.getContext(), null, cell.getCid()));
    row.addView(newCid);

    TextView newPsc = new TextView(rilCells.getContext());
    newPsc.setLayoutParams(new TableRow.LayoutParams(0, LayoutParams.WRAP_CONTENT, 3));
    newPsc.setTextAppearance(rilCells.getContext(), android.R.style.TextAppearance_Medium);
    newPsc.setText(formatCellData(rilCells.getContext(), null, cell.getPsc()));
    row.addView(newPsc);

    TextView newDbm = new TextView(rilCells.getContext());
    newDbm.setLayoutParams(new TableRow.LayoutParams(0, LayoutParams.WRAP_CONTENT, 4));
    newDbm.setTextAppearance(rilCells.getContext(), android.R.style.TextAppearance_Medium);
    newDbm.setText(formatCellDbm(rilCells.getContext(), null, cell.getDbm()));
    row.addView(newDbm);

    rilCells.addView(row, new TableLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT));
}

From source file:com.vonglasow.michael.satstat.RadioSectionFragment.java

protected void showCellLte(CellTowerLte cell) {
    TableRow row = new TableRow(rilLteCells.getContext());
    row.setWeightSum(29);

    TextView newType = new TextView(rilLteCells.getContext());
    newType.setLayoutParams(new TableRow.LayoutParams(0, LayoutParams.WRAP_CONTENT, 2));
    newType.setTextAppearance(rilLteCells.getContext(), android.R.style.TextAppearance_Medium);
    newType.setTextColor(//from w  w  w  . j ava2s .co  m
            rilLteCells.getContext().getResources().getColor(getColorFromGeneration(cell.getGeneration())));
    newType.setText(rilLteCells.getContext().getResources().getString(R.string.smallDot));
    row.addView(newType);

    TextView newMcc = new TextView(rilLteCells.getContext());
    newMcc.setLayoutParams(new TableRow.LayoutParams(0, LayoutParams.WRAP_CONTENT, 3));
    newMcc.setTextAppearance(rilLteCells.getContext(), android.R.style.TextAppearance_Medium);
    newMcc.setText(formatCellData(rilLteCells.getContext(), "%03d", cell.getMcc()));
    row.addView(newMcc);

    TextView newMnc = new TextView(rilLteCells.getContext());
    newMnc.setLayoutParams(new TableRow.LayoutParams(0, LayoutParams.WRAP_CONTENT, 3));
    newMnc.setTextAppearance(rilLteCells.getContext(), android.R.style.TextAppearance_Medium);
    newMnc.setText(formatCellData(rilLteCells.getContext(), "%02d", cell.getMnc()));
    row.addView(newMnc);

    TextView newTac = new TextView(rilLteCells.getContext());
    newTac.setLayoutParams(new TableRow.LayoutParams(0, LayoutParams.WRAP_CONTENT, 5));
    newTac.setTextAppearance(rilLteCells.getContext(), android.R.style.TextAppearance_Medium);
    newTac.setText(formatCellData(rilLteCells.getContext(), null, cell.getTac()));
    row.addView(newTac);

    TextView newCi = new TextView(rilLteCells.getContext());
    newCi.setLayoutParams(new TableRow.LayoutParams(0, LayoutParams.WRAP_CONTENT, 9));
    newCi.setTextAppearance(rilLteCells.getContext(), android.R.style.TextAppearance_Medium);
    if ((mainActivity.prefCid) && (cell.getCi() != CellTower.UNKNOWN)) {
        int eNodeBId = cell.getCi() / 0x100;
        int sectorId = cell.getCi() % 0x100;
        newCi.setText(String.format("%d-%d", eNodeBId, sectorId));
    } else
        newCi.setText(formatCellData(rilLteCells.getContext(), null, cell.getCi()));
    row.addView(newCi);

    TextView newPci = new TextView(rilLteCells.getContext());
    newPci.setLayoutParams(new TableRow.LayoutParams(0, LayoutParams.WRAP_CONTENT, 3));
    newPci.setTextAppearance(rilLteCells.getContext(), android.R.style.TextAppearance_Medium);
    newPci.setText(formatCellData(rilLteCells.getContext(), null, cell.getPci()));
    row.addView(newPci);

    TextView newDbm = new TextView(rilLteCells.getContext());
    newDbm.setLayoutParams(new TableRow.LayoutParams(0, LayoutParams.WRAP_CONTENT, 4));
    newDbm.setTextAppearance(rilLteCells.getContext(), android.R.style.TextAppearance_Medium);
    newDbm.setText(formatCellDbm(rilLteCells.getContext(), null, cell.getDbm()));
    row.addView(newDbm);

    rilLteCells.addView(row,
            new TableLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT));
}

From source file:ru.adios.budgeter.widgets.DataTableLayout.java

private TableRow constructRow(Context context, float weightSum) {
    final TableRow row = new TableRow(context);
    row.setId(ElementsIdProvider.getNextId());
    row.setLayoutParams(new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT));
    row.setWeightSum(weightSum);
    return row;// w w  w.j a  va  2 s .com
}

From source file:ru.adios.budgeter.widgets.DataTableLayout.java

/**
 * Requires tableName to be checked, i.e. isPresent() == true .
 *///from  w  ww.j  a v a2s  .  c o m
private void addTitleRowWithSeparator(Context context, float layoutWeightSum, float titleViewWeight) {
    final TableRow tableNameRow = new TableRow(context);
    tableNameRow.setId(ElementsIdProvider.getNextId());
    tableNameRow.setLayoutParams(new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT));
    tableNameRow.setWeightSum(1f);

    titleView = Optional
            .of(getCenteredRowText(context, tableName.get(), layoutWeightSum, true, titleViewWeight));
    tableNameRow.addView(titleView.get());
    addView(tableNameRow, 1);
    addView(constructRowSeparator(1), 2);
    headerOffset += 2;
}

From source file:com.vonglasow.michael.satstat.MainActivity.java

protected static void showCellCdma(CellTowerCdma cell) {
    TableRow row = new TableRow(rilCdmaCells.getContext());
    row.setWeightSum(26);

    TextView newType = new TextView(rilCdmaCells.getContext());
    newType.setLayoutParams(new TableRow.LayoutParams(0, LayoutParams.WRAP_CONTENT, 2));
    newType.setTextAppearance(rilCdmaCells.getContext(), android.R.style.TextAppearance_Medium);
    newType.setTextColor(/* w w w. j  a va  2  s .  c o  m*/
            rilCdmaCells.getContext().getResources().getColor(getColorFromGeneration(cell.getGeneration())));
    newType.setText(rilCdmaCells.getContext().getResources().getString(R.string.smallDot));
    row.addView(newType);

    TextView newSid = new TextView(rilCdmaCells.getContext());
    newSid.setLayoutParams(new TableRow.LayoutParams(0, LayoutParams.WRAP_CONTENT, 6));
    newSid.setTextAppearance(rilCdmaCells.getContext(), android.R.style.TextAppearance_Medium);
    newSid.setText(formatCellData(rilCdmaCells.getContext(), null, cell.getSid()));
    row.addView(newSid);

    TextView newNid = new TextView(rilCdmaCells.getContext());
    newNid.setLayoutParams(new TableRow.LayoutParams(0, LayoutParams.WRAP_CONTENT, 5));
    newNid.setTextAppearance(rilCdmaCells.getContext(), android.R.style.TextAppearance_Medium);
    newNid.setText(formatCellData(rilCdmaCells.getContext(), null, cell.getNid()));
    row.addView(newNid);

    TextView newBsid = new TextView(rilCdmaCells.getContext());
    newBsid.setLayoutParams(new TableRow.LayoutParams(0, LayoutParams.WRAP_CONTENT, 9));
    newBsid.setTextAppearance(rilCdmaCells.getContext(), android.R.style.TextAppearance_Medium);
    newBsid.setText(formatCellData(rilCdmaCells.getContext(), null, cell.getBsid()));
    row.addView(newBsid);

    TextView newDbm = new TextView(rilCdmaCells.getContext());
    newDbm.setLayoutParams(new TableRow.LayoutParams(0, LayoutParams.WRAP_CONTENT, 4));
    newDbm.setTextAppearance(rilCdmaCells.getContext(), android.R.style.TextAppearance_Medium);
    newDbm.setText(formatCellDbm(rilCdmaCells.getContext(), null, cell.getDbm()));
    row.addView(newDbm);

    rilCdmaCells.addView(row,
            new TableLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT));
}

From source file:com.vonglasow.michael.satstat.MainActivity.java

protected static void showCellGsm(CellTowerGsm cell) {
    TableRow row = new TableRow(rilCells.getContext());
    row.setWeightSum(29);

    TextView newType = new TextView(rilCells.getContext());
    newType.setLayoutParams(new TableRow.LayoutParams(0, LayoutParams.WRAP_CONTENT, 2));
    newType.setTextAppearance(rilCells.getContext(), android.R.style.TextAppearance_Medium);
    newType.setTextColor(/*from w  w  w.jav a 2 s  .  c o m*/
            rilCells.getContext().getResources().getColor(getColorFromGeneration(cell.getGeneration())));
    newType.setText(rilCells.getContext().getResources().getString(R.string.smallDot));
    row.addView(newType);

    TextView newMcc = new TextView(rilCells.getContext());
    newMcc.setLayoutParams(new TableRow.LayoutParams(0, LayoutParams.WRAP_CONTENT, 3));
    newMcc.setTextAppearance(rilCells.getContext(), android.R.style.TextAppearance_Medium);
    newMcc.setText(formatCellData(rilCells.getContext(), "%03d", cell.getMcc()));
    row.addView(newMcc);

    TextView newMnc = new TextView(rilCells.getContext());
    newMnc.setLayoutParams(new TableRow.LayoutParams(0, LayoutParams.WRAP_CONTENT, 3));
    newMnc.setTextAppearance(rilCells.getContext(), android.R.style.TextAppearance_Medium);
    newMnc.setText(formatCellData(rilCells.getContext(), "%02d", cell.getMnc()));
    row.addView(newMnc);

    TextView newLac = new TextView(rilCells.getContext());
    newLac.setLayoutParams(new TableRow.LayoutParams(0, LayoutParams.WRAP_CONTENT, 5));
    newLac.setTextAppearance(rilCells.getContext(), android.R.style.TextAppearance_Medium);
    newLac.setText(formatCellData(rilCells.getContext(), null, cell.getLac()));
    row.addView(newLac);

    TextView newCid = new TextView(rilCells.getContext());
    newCid.setLayoutParams(new TableRow.LayoutParams(0, LayoutParams.WRAP_CONTENT, 9));
    newCid.setTextAppearance(rilCells.getContext(), android.R.style.TextAppearance_Medium);
    newCid.setText(formatCellData(rilCells.getContext(), null, cell.getCid()));
    row.addView(newCid);

    TextView newPsc = new TextView(rilCells.getContext());
    newPsc.setLayoutParams(new TableRow.LayoutParams(0, LayoutParams.WRAP_CONTENT, 3));
    newPsc.setTextAppearance(rilCells.getContext(), android.R.style.TextAppearance_Medium);
    newPsc.setText(formatCellData(rilCells.getContext(), null, cell.getPsc()));
    row.addView(newPsc);

    TextView newDbm = new TextView(rilCells.getContext());
    newDbm.setLayoutParams(new TableRow.LayoutParams(0, LayoutParams.WRAP_CONTENT, 4));
    newDbm.setTextAppearance(rilCells.getContext(), android.R.style.TextAppearance_Medium);
    newDbm.setText(formatCellDbm(rilCells.getContext(), null, cell.getDbm()));
    row.addView(newDbm);

    rilCells.addView(row, new TableLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT));
}

From source file:com.vonglasow.michael.satstat.MainActivity.java

protected static void showCellLte(CellTowerLte cell) {
    TableRow row = new TableRow(rilLteCells.getContext());
    row.setWeightSum(29);

    TextView newType = new TextView(rilLteCells.getContext());
    newType.setLayoutParams(new TableRow.LayoutParams(0, LayoutParams.WRAP_CONTENT, 2));
    newType.setTextAppearance(rilLteCells.getContext(), android.R.style.TextAppearance_Medium);
    newType.setTextColor(/*w  ww  . j av  a 2s.  c  o m*/
            rilLteCells.getContext().getResources().getColor(getColorFromGeneration(cell.getGeneration())));
    newType.setText(rilLteCells.getContext().getResources().getString(R.string.smallDot));
    row.addView(newType);

    TextView newMcc = new TextView(rilLteCells.getContext());
    newMcc.setLayoutParams(new TableRow.LayoutParams(0, LayoutParams.WRAP_CONTENT, 3));
    newMcc.setTextAppearance(rilLteCells.getContext(), android.R.style.TextAppearance_Medium);
    newMcc.setText(formatCellData(rilLteCells.getContext(), "%03d", cell.getMcc()));
    row.addView(newMcc);

    TextView newMnc = new TextView(rilLteCells.getContext());
    newMnc.setLayoutParams(new TableRow.LayoutParams(0, LayoutParams.WRAP_CONTENT, 3));
    newMnc.setTextAppearance(rilLteCells.getContext(), android.R.style.TextAppearance_Medium);
    newMnc.setText(formatCellData(rilLteCells.getContext(), "%02d", cell.getMnc()));
    row.addView(newMnc);

    TextView newTac = new TextView(rilLteCells.getContext());
    newTac.setLayoutParams(new TableRow.LayoutParams(0, LayoutParams.WRAP_CONTENT, 5));
    newTac.setTextAppearance(rilLteCells.getContext(), android.R.style.TextAppearance_Medium);
    newTac.setText(formatCellData(rilLteCells.getContext(), null, cell.getTac()));
    row.addView(newTac);

    TextView newCi = new TextView(rilLteCells.getContext());
    newCi.setLayoutParams(new TableRow.LayoutParams(0, LayoutParams.WRAP_CONTENT, 9));
    newCi.setTextAppearance(rilLteCells.getContext(), android.R.style.TextAppearance_Medium);
    newCi.setText(formatCellData(rilLteCells.getContext(), null, cell.getCi()));
    row.addView(newCi);

    TextView newPci = new TextView(rilLteCells.getContext());
    newPci.setLayoutParams(new TableRow.LayoutParams(0, LayoutParams.WRAP_CONTENT, 3));
    newPci.setTextAppearance(rilLteCells.getContext(), android.R.style.TextAppearance_Medium);
    newPci.setText(formatCellData(rilLteCells.getContext(), null, cell.getPci()));
    row.addView(newPci);

    TextView newDbm = new TextView(rilLteCells.getContext());
    newDbm.setLayoutParams(new TableRow.LayoutParams(0, LayoutParams.WRAP_CONTENT, 4));
    newDbm.setTextAppearance(rilLteCells.getContext(), android.R.style.TextAppearance_Medium);
    newDbm.setText(formatCellDbm(rilLteCells.getContext(), null, cell.getDbm()));
    row.addView(newDbm);

    rilLteCells.addView(row,
            new TableLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT));
}