List of usage examples for android.widget TableRow findViewById
@Nullable public final <T extends View> T findViewById(@IdRes int id)
From source file:com.bonsai.wallet32.SweepKeyActivity.java
private void addAccountHeader(TableLayout table) { TableRow row = (TableRow) LayoutInflater.from(this).inflate(R.layout.receive_to_header, table, false); TextView tv = (TextView) row.findViewById(R.id.header_btc); tv.setText(mBTCFmt.unitStr());//from ww w . j a v a2s . com table.addView(row); }
From source file:com.bonsai.wallet32.SweepKeyActivity.java
private void addAccountRow(TableLayout table, int acctId, String acctName, long btc, double fiat) { TableRow row = (TableRow) LayoutInflater.from(this).inflate(R.layout.receive_to_row, table, false); RadioButton tv0 = (RadioButton) row.findViewById(R.id.to_account); tv0.setId(acctId); // Change id to the acctId. tv0.setText(acctName);/*from ww w. j a va 2 s. c o m*/ tv0.setOnCheckedChangeListener(mReceiveToListener); if (acctId == mAccountId) tv0.setChecked(true); TextView tv1 = (TextView) row.findViewById(R.id.row_btc); tv1.setText(String.format("%s", mBTCFmt.formatCol(btc, 0, true, true))); TextView tv2 = (TextView) row.findViewById(R.id.row_fiat); tv2.setText(String.format("%.02f", fiat)); table.addView(row); }
From source file:org.hawkular.client.android.fragment.ConfirmOperationFragment.java
private void createTable(OperationProperties operationProperties) { TableRow row = null; Map<String, OperationParameter> operationParameters = operationProperties.getOperationParameters(); if (operationParameters != null) { for (Map.Entry<String, OperationParameter> entry : operationParameters.entrySet()) { switch (entry.getValue().getType()) { case "string": { row = (TableRow) LayoutInflater.from(getActivity()).inflate(R.layout.row_edit, null); EditText data = (EditText) row.findViewById(R.id.data); data.setText(entry.getValue().getDefaultValue()); data.setInputType(InputType.TYPE_CLASS_TEXT); break; }// www . j a v a2 s .com case "int": { row = (TableRow) LayoutInflater.from(getActivity()).inflate(R.layout.row_edit, null); EditText data = (EditText) row.findViewById(R.id.data); data.setText(entry.getValue().getDefaultValue()); data.setInputType(InputType.TYPE_CLASS_NUMBER); break; } case "float": { row = (TableRow) LayoutInflater.from(getActivity()).inflate(R.layout.row_edit, null); EditText data = (EditText) row.findViewById(R.id.data); data.setText(entry.getValue().getDefaultValue()); data.setInputType(InputType.TYPE_CLASS_NUMBER | InputType.TYPE_NUMBER_FLAG_DECIMAL); break; } case "bool": { row = (TableRow) LayoutInflater.from(getActivity()).inflate(R.layout.row_toggle, null); SwitchCompat data = (SwitchCompat) row.findViewById(R.id.data); data.setChecked(entry.getValue().getDefaultValue().equals("true")); break; } } if (row != null) { TextView name = (TextView) row.findViewById(R.id.name); name.setText(entry.getKey()); table.addView(row); } } table.requestLayout(); } }
From source file:com.bonsai.btcreceive.AccountFragment.java
private void addAddressRow(int tableId, int index, TableLayout table, String path, String addr, String ntrans, String btcstr, String fiatstr) { TableRow row = (TableRow) LayoutInflater.from(getActivity()).inflate(R.layout.address_table_row, table, false);/*from www . j a v a 2 s . c o m*/ row.setTag(tableId); row.setId(index); row.setOnClickListener(new OnClickListener() { @Override public void onClick(View view) { int tableId = (Integer) view.getTag(); int index = view.getId(); viewAddress(tableId, index); } }); { TextView tv = (TextView) row.findViewById(R.id.row_path); tv.setText(path); } { TextView tv = (TextView) row.findViewById(R.id.row_addr); tv.setText(addr); } { TextView tv = (TextView) row.findViewById(R.id.row_ntrans); tv.setText(ntrans); } { TextView tv = (TextView) row.findViewById(R.id.row_btc); tv.setText(btcstr); } { TextView tv = (TextView) row.findViewById(R.id.row_fiat); tv.setText(fiatstr); } table.addView(row); }
From source file:com.money.manager.ex.reports.IncomeVsExpensesListFragment.java
/** * Add header to ListView//www . j a va 2 s.c o m */ private View addListViewHeader() { TableRow row = (TableRow) View.inflate(getActivity(), R.layout.tablerow_income_vs_expenses, null); int[] ids = new int[] { R.id.textViewYear, R.id.textViewMonth, R.id.textViewIncome, R.id.textViewExpenses, R.id.textViewDifference }; for (int id : ids) { TextView textView = (TextView) row.findViewById(id); textView.setTypeface(null, Typeface.BOLD); textView.setSingleLine(true); } getListView().addHeaderView(row); return row; }
From source file:ivl.android.moneybalance.ExpenseEditorActivity.java
private void createCustomSplitRows() { Map<Long, Double> weights = expense.getSplitWeights(); customSplitEntries = new CustomSplitEntry[persons.size()]; int dynamicId = 0; LayoutInflater inflater = getLayoutInflater(); for (int i = 0; i < persons.size(); i++) { Person person = persons.get(i);// w w w .j a va2 s. c o m boolean enabled = true; Double weight = 1.0; if (weights != null) { Double w = weights.get(person.getId()); if (w != null) weight = w; else enabled = false; } TableRow row = (TableRow) inflater.inflate(R.layout.split_row, customSplitTable, false); customSplitTable.addView(row); final CustomSplitEntry customSplitEntry = new CustomSplitEntry(); customSplitEntries[i] = customSplitEntry; customSplitEntry.enabled = (CheckBox) row.findViewById(R.id.split_enabled); customSplitEntry.enabled.setId(dynamicId++); customSplitEntry.enabled.setText(person.getName() + ":"); customSplitEntry.enabled.setChecked(enabled); customSplitEntry.enabled.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { @Override public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { customSplitEntry.weight.setEnabled(isChecked); updateCustomSplit(); } }); customSplitEntry.weight = (EditText) row.findViewById(R.id.split_weight); customSplitEntry.weight.setId(dynamicId++); customSplitEntry.weight.setEnabled(enabled); customSplitEntry.weight.setText(currencyHelper.format(weight, false)); customSplitEntry.weight.addTextChangedListener(updateCustomSplitTextWatcher); customSplitEntry.result = (TextView) row.findViewById(R.id.split_share); } customSplitCheckBox.setChecked(weights != null); customSplitTable.setVisibility(weights != null ? View.VISIBLE : View.GONE); }
From source file:com.vonglasow.michael.satstat.ui.RadioSectionFragment.java
protected void showCellCdma(CellTowerCdma cellTower) { TableRow row = (TableRow) mainActivity.getLayoutInflater().inflate(R.layout.ril_list_item, null); TextView type = (TextView) row.findViewById(R.id.type); TextView sid = (TextView) row.findViewById(R.id.sid); TextView nid = (TextView) row.findViewById(R.id.nid); TextView bsid = (TextView) row.findViewById(R.id.bsid); TextView dbm = (TextView) row.findViewById(R.id.dbm); type.setTextColor(rilCdmaCells.getContext().getResources() .getColor(getColorFromGeneration(cellTower.getGeneration()))); type.setText(rilCdmaCells.getContext().getResources().getString(R.string.smallDot)); sid.setText(formatCellData(rilCdmaCells.getContext(), null, cellTower.getSid())); nid.setText(formatCellData(rilCdmaCells.getContext(), null, cellTower.getNid())); bsid.setText(formatCellData(rilCdmaCells.getContext(), null, cellTower.getBsid())); dbm.setText(formatCellDbm(rilCdmaCells.getContext(), null, cellTower.getDbm())); rilCdmaCells.addView(row,/*w w w . j a v a 2 s. co m*/ new TableLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT)); }
From source file:com.vonglasow.michael.satstat.ui.RadioSectionFragment.java
protected void showCellGsm(CellTowerGsm cellTower) { TableRow row = (TableRow) mainActivity.getLayoutInflater().inflate(R.layout.ril_list_item, null); TextView type = (TextView) row.findViewById(R.id.type); TextView mcc = (TextView) row.findViewById(R.id.mcc); TextView mnc = (TextView) row.findViewById(R.id.mnc); TextView area = (TextView) row.findViewById(R.id.area); TextView cell = (TextView) row.findViewById(R.id.cell); TextView cell2 = (TextView) row.findViewById(R.id.cell2); TextView unit = (TextView) row.findViewById(R.id.unit); TextView dbm = (TextView) row.findViewById(R.id.dbm); type.setTextColor(//w w w .ja va 2 s . c om rilCells.getContext().getResources().getColor(getColorFromGeneration(cellTower.getGeneration()))); type.setText(rilCells.getContext().getResources().getString(R.string.smallDot)); mcc.setText(formatCellData(rilCells.getContext(), "%03d", cellTower.getMcc())); mnc.setText(formatCellData(rilCells.getContext(), "%02d", cellTower.getMnc())); area.setText(formatCellData(rilCells.getContext(), null, cellTower.getLac())); int rtcid = cellTower.getCid() / 0x10000; int cid = cellTower.getCid() % 0x10000; if ((mainActivity.prefCid) && (cellTower.getCid() != CellTower.UNKNOWN) && (cellTower.getCid() > 0x0ffff)) { cell.setText(String.format("%d-%d", rtcid, cid)); cell2.setText(formatCellData(rilCells.getContext(), null, cellTower.getCid())); } else { cell.setText(formatCellData(rilCells.getContext(), null, cellTower.getCid())); cell2.setText(String.format("%d-%d", rtcid, cid)); } cell2.setVisibility((mainActivity.prefCid2 && (cellTower.getCid() > 0x0ffff)) ? View.VISIBLE : View.GONE); unit.setText(formatCellData(rilCells.getContext(), null, cellTower.getPsc())); dbm.setText(formatCellDbm(rilCells.getContext(), null, cellTower.getDbm())); rilCells.addView(row, new TableLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT)); }
From source file:com.vonglasow.michael.satstat.ui.RadioSectionFragment.java
protected void showCellLte(CellTowerLte cellTower) { TableRow row = (TableRow) mainActivity.getLayoutInflater().inflate(R.layout.ril_list_item, null); TextView type = (TextView) row.findViewById(R.id.type); TextView mcc = (TextView) row.findViewById(R.id.mcc); TextView mnc = (TextView) row.findViewById(R.id.mnc); TextView area = (TextView) row.findViewById(R.id.area); TextView cell = (TextView) row.findViewById(R.id.cell); TextView cell2 = (TextView) row.findViewById(R.id.cell2); TextView unit = (TextView) row.findViewById(R.id.unit); TextView dbm = (TextView) row.findViewById(R.id.dbm); type.setTextColor(rilLteCells.getContext().getResources() .getColor(getColorFromGeneration(cellTower.getGeneration()))); type.setText(rilLteCells.getContext().getResources().getString(R.string.smallDot)); mcc.setText(formatCellData(rilLteCells.getContext(), "%03d", cellTower.getMcc())); mnc.setText(formatCellData(rilLteCells.getContext(), "%02d", cellTower.getMnc())); area.setText(formatCellData(rilLteCells.getContext(), null, cellTower.getTac())); int eNodeBId = cellTower.getCi() / 0x100; int sectorId = cellTower.getCi() % 0x100; if ((mainActivity.prefCid) && (cellTower.getCi() != CellTower.UNKNOWN)) { cell.setText(String.format("%d-%d", eNodeBId, sectorId)); cell2.setText(formatCellData(rilLteCells.getContext(), null, cellTower.getCi())); } else {// w ww . j a v a2s .c o m cell.setText(formatCellData(rilLteCells.getContext(), null, cellTower.getCi())); cell2.setText(String.format("%d-%d", eNodeBId, sectorId)); } cell2.setVisibility(mainActivity.prefCid2 ? View.VISIBLE : View.GONE); unit.setText(formatCellData(rilLteCells.getContext(), null, cellTower.getPci())); dbm.setText(formatCellDbm(rilLteCells.getContext(), null, cellTower.getDbm())); rilLteCells.addView(row, new TableLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT)); }
From source file:com.keysolutions.meteorparties.PartyDetailFragment.java
/** * Displays party info//from w w w . j av a 2s . c om * @param savedInstanceState instance state * @param rootView view the party display elements are in */ public void showPartyInfo(Bundle savedInstanceState, View rootView) { ((TextView) rootView.findViewById(R.id.party_title)).setText(mParty.getTitle()); ((TextView) rootView.findViewById(R.id.party_description)).setText(mParty.getDescription()); // get ready to show my RSVP info String myUserId = MyDDPState.getInstance().getUserId(); // add RSVP list // NOTE: if you have a lot of RSVPs, you should be using a ListView // The TableLayout is used here to make it this demo simple to // understand if (mParty.getRsvps() != null) { TableLayout table = (TableLayout) rootView.findViewById(R.id.rsvp_list); table.removeAllViews(); // add header TableRow tr = (TableRow) getLayoutInflater(savedInstanceState).inflate(R.layout.header_party_rsvp, null); table.addView(tr); for (Map<String, String> rsvp : mParty.getRsvps()) { String rsvpValue = rsvp.get("rsvp"); String rsvpUser = rsvp.get("user"); if ((myUserId == null) || (!myUserId.equals(rsvpUser))) { // don't add row for my RSVP because that's displayed later tr = (TableRow) getLayoutInflater(savedInstanceState).inflate(R.layout.row_party_rsvp, null); TextView tv; tv = (TextView) tr.findViewById(R.id.user); String email = MyDDPState.getInstance().getUserEmail(rsvpUser); tv.setText(email); tv = (TextView) tr.findViewById(R.id.rsvp); String rsvpDisplayed = ""; int rsvpColor = 0; if (rsvpValue.equals("yes")) { rsvpDisplayed = "Going"; rsvpColor = 0xFF00FF00; } else if (rsvpValue.equals("no")) { rsvpDisplayed = "Declined"; rsvpColor = 0xFFFF0000; } else if (rsvpValue.equals("maybe")) { rsvpDisplayed = "Maybe"; rsvpColor = 0xFF0000FF; } tv.setText(rsvpDisplayed); tv.setTextColor(rsvpColor); table.addView(tr); } } } }