List of usage examples for android.widget TableLayout addView
@Override public void addView(View child)
From source file:com.btmura.android.reddit.app.MarkdownTableFragment.java
private void populateTable(final View view, final LayoutInflater inflater) { final TableLayout table = (TableLayout) view.findViewById(R.id.table); MarkdownTableScanner.scan(getTableDataExtra(), new OnTableScanListener<TableRow>() { @Override// w ww. j a v a 2 s . com public TableRow onRowStart() { return new TableRow(getActivity()); } @Override public void onCell(TableRow container, Cell cell) { int layout = cell.isHeader ? R.layout.markdown_table_cell_header : R.layout.markdown_table_cell; TextView tv = (TextView) inflater.inflate(layout, container, false); tv.setGravity(cell.gravity); tv.setMovementMethod(LinkMovementMethod.getInstance()); tv.setText(formatter.formatAll(getActivity(), cell.contents)); container.addView(tv); table.setColumnShrinkable(cell.column, true); table.setColumnStretchable(cell.column, true); } @Override public void onRowEnd(TableRow row) { table.addView(row); } }); }
From source file:lk.ac.mrt.cse.dbs.simpleexpensemanager.ui.ExpenseLogsFragment.java
private void generateTransactionsTable(View rootView, TableLayout logsTableLayout, List<Transaction> transactionList) { for (Transaction transaction : transactionList) { TableRow tr = new TableRow(rootView.getContext()); TextView lDateVal = new TextView(rootView.getContext()); SimpleDateFormat sdf = new SimpleDateFormat(getActivity().getString(R.string.config_date_log_pattern)); String formattedDate = sdf.format(transaction.getDate()); lDateVal.setText(formattedDate); tr.addView(lDateVal);//w ww.jav a 2s .c o m TextView lAccountNoVal = new TextView(rootView.getContext()); lAccountNoVal.setText(transaction.getAccountNo()); tr.addView(lAccountNoVal); TextView lExpenseTypeVal = new TextView(rootView.getContext()); lExpenseTypeVal.setText(transaction.getExpenseType().toString()); tr.addView(lExpenseTypeVal); TextView lAmountVal = new TextView(rootView.getContext()); lAmountVal.setText(String.valueOf(transaction.getAmount())); tr.addView(lAmountVal); logsTableLayout.addView(tr); } }
From source file:com.ultramegasoft.flavordex2.fragment.ViewInfoFragment.java
/** * Populates the table of extra fields./* w w w . j av a 2 s . c o m*/ * * @param data A LinkedHashMap containing the extra values */ protected void populateExtras(@NonNull LinkedHashMap<String, ExtraFieldHolder> data) { final Activity activity = getActivity(); if (activity == null) { return; } final TableLayout table = activity.findViewById(R.id.entry_info); if (!mExtraRows.isEmpty()) { for (View tableRow : mExtraRows) { table.removeView(tableRow); } mExtraRows.clear(); } if (data.size() > 0) { final LayoutInflater inflater = LayoutInflater.from(activity); for (ExtraFieldHolder extra : data.values()) { if (extra.preset) { continue; } final View root = inflater.inflate(R.layout.view_info_extra, table, false); ((TextView) root.findViewById(R.id.label)).setText(getString(R.string.label_field, extra.name)); ((TextView) root.findViewById(R.id.value)).setText(extra.value); table.addView(root); mExtraRows.add(root); } } }
From source file:com.bonsai.wallet32.SendBitcoinActivity.java
private void addAccountHeader(TableLayout table) { TableRow row = (TableRow) LayoutInflater.from(this).inflate(R.layout.send_from_header, table, false); TextView tv = (TextView) row.findViewById(R.id.header_btc); tv.setText(mBTCFmt.unitStr());/*from ww w . j a v a 2 s. c o m*/ table.addView(row); }
From source file:org.mifos.androidclient.templates.OperationFormActivity.java
public void setOperationSummaryContent(Map<String, String> operationResults) { TableLayout operationSummary = (TableLayout) findViewById(R.id.operationForm_operationSummary); TableLayoutHelper helper = new TableLayoutHelper(this); operationSummary.removeAllViews();/* w w w. j av a 2 s. c om*/ for (Map.Entry<String, String> entry : operationResults.entrySet()) { if (!entry.getKey().equals(STATUS_KEY)) { TableRow row = helper.createTableRow(); TextView cell = helper.createTableCell( ServerMessageTranslator.translate(this, entry.getKey(), entry.getKey()), 1); row.addView(cell); cell = helper.createTableCell( ServerMessageTranslator.translate(this, entry.getValue(), entry.getValue()), 2); row.addView(cell); operationSummary.addView(row); } } }
From source file:com.df.app.carCheck.VehicleInfoLayout.java
/** * edit/*from w ww .ja v a 2 s. co m*/ */ private void showListDialog(int titleId, ArrayAdapter<String> adapter, final Handler handler) { View view1 = ((Activity) getContext()).getLayoutInflater().inflate(R.layout.popup_layout, null); final AlertDialog dialog = new AlertDialog.Builder(getContext()).setView(view1).create(); TableLayout contentArea = (TableLayout) view1.findViewById(R.id.contentArea); final ListView listView = new ListView(view1.getContext()); listView.setAdapter(adapter); listView.setOnItemClickListener(new AdapterView.OnItemClickListener() { @Override public void onItemClick(AdapterView<?> adapterView, View view, int i, long l) { handler.sendEmptyMessage(i); dialog.dismiss(); } }); contentArea.addView(listView); setTextView(view1, R.id.title, getResources().getString(titleId)); dialog.show(); }
From source file:org.comixwall.pffw.StatsBase.java
void updateLists(String key) { mStats.get(key).totalLabel/*from w ww. ja v a2 s .c o m*/ .setText(String.format(getResources().getString(R.string.total_smallcaps), mStats.get(key).total)); for (String k : statsKeys) { TableLayout statsTable = mStats.get(key).statsTables.get(k); statsTable.removeAllViews(); Object[] kvps = mStats.get(key).lists.get(k).entrySet().toArray(); Arrays.sort(kvps, reverseComparator); int count = 1; for (Object entry : kvps) { TableRow row = (TableRow) getActivity().getLayoutInflater().inflate(R.layout.stats_table_row, new TableRow(this.view.getContext()), true); ((TextView) row.findViewById(R.id.tableValue)) .setText(((Map.Entry<String, Integer>) entry).getValue().toString()); ((TextView) row.findViewById(R.id.tableKey)).setText(((Map.Entry<String, Integer>) entry).getKey()); statsTable.addView(row); if (++count > 10) { break; } } } }
From source file:org.gnucash.android.ui.report.BalanceSheetFragment.java
/** * Loads rows for the individual accounts and adds them to the report * @param accountTypes Account types for which to load balances * @param tableLayout Table layout into which to load the rows *///from w w w.j av a2s. c om private void loadAccountViews(List<AccountType> accountTypes, TableLayout tableLayout) { LayoutInflater inflater = LayoutInflater.from(getActivity()); Cursor cursor = mAccountsDbAdapter.fetchAccounts( DatabaseSchema.AccountEntry.COLUMN_TYPE + " IN ( '" + TextUtils.join("' , '", accountTypes) + "' ) AND " + DatabaseSchema.AccountEntry.COLUMN_PLACEHOLDER + " = 0", null, DatabaseSchema.AccountEntry.COLUMN_FULL_NAME + " ASC"); while (cursor.moveToNext()) { String accountUID = cursor .getString(cursor.getColumnIndexOrThrow(DatabaseSchema.AccountEntry.COLUMN_UID)); String name = cursor.getString(cursor.getColumnIndexOrThrow(DatabaseSchema.AccountEntry.COLUMN_NAME)); Money balance = mAccountsDbAdapter.getAccountBalance(accountUID); View view = inflater.inflate(R.layout.row_balance_sheet, tableLayout, false); ((TextView) view.findViewById(R.id.account_name)).setText(name); TextView balanceTextView = ((TextView) view.findViewById(R.id.account_balance)); TransactionsActivity.displayBalance(balanceTextView, balance); tableLayout.addView(view); } View totalView = inflater.inflate(R.layout.row_balance_sheet, tableLayout, false); TableLayout.LayoutParams layoutParams = (TableLayout.LayoutParams) totalView.getLayoutParams(); layoutParams.setMargins(layoutParams.leftMargin, 20, layoutParams.rightMargin, layoutParams.bottomMargin); totalView.setLayoutParams(layoutParams); TextView accountName = (TextView) totalView.findViewById(R.id.account_name); accountName.setTextSize(16); accountName.setText(R.string.label_balance_sheet_total); TextView accountBalance = (TextView) totalView.findViewById(R.id.account_balance); accountBalance.setTextSize(16); accountBalance.setTypeface(null, Typeface.BOLD); TransactionsActivity.displayBalance(accountBalance, mAccountsDbAdapter.getAccountBalance(accountTypes, -1, System.currentTimeMillis())); tableLayout.addView(totalView); }
From source file:com.bonsai.btcreceive.ViewTransactionActivity.java
private void addTransputsRow(int tableId, int index, TableLayout table, String accountName, String chainCode, String path, String addr, String btcstr) { TableRow row = (TableRow) LayoutInflater.from(this).inflate(R.layout.transputs_table_row, table, false); row.setTag(tableId);/*w w w. j a v a 2s .co m*/ row.setId(index); { TextView tv = (TextView) row.findViewById(R.id.row_account); tv.setText(accountName); } { TextView tv = (TextView) row.findViewById(R.id.row_chain); tv.setText(chainCode); } { 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_btc); tv.setText(btcstr); } 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 w ww. j a v a 2s. c om 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); }