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.MainActivity.java
private void addBalanceSum(TableLayout table, String acct, long btc, double fiat) { TableRow row = (TableRow) LayoutInflater.from(this).inflate(R.layout.balance_table_sum, table, false); TextView tv0 = (TextView) row.findViewById(R.id.row_label); tv0.setText(acct);/*from w w w . j a v a2 s . c o m*/ TextView tv1 = (TextView) row.findViewById(R.id.row_btc); tv1.setText(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:com.cssweb.android.quote.QuoteDetail.java
/** * /* w w w . java2 s . co m*/ * @param jArr * @param table * @param zrsp * @throws JSONException */ private void appendRow(JSONArray jArr, TableLayout table, double zrsp) throws JSONException { table.setStretchAllColumns(true); table.removeAllViews(); if ("cf".equals(exchange.toLowerCase()) || "dc".equals(exchange.toLowerCase()) || "sf".equals(exchange.toLowerCase()) || "cz".equals(exchange.toLowerCase())) { int len = jArr.length(); int color = Utils.getTextColor(mContext, 0); for (int i = 0; i < len; i++) { LinearLayout linearLayout = (LinearLayout) findViewById(R.id.title23); linearLayout.setVisibility(View.VISIBLE); JSONArray jA = (JSONArray) jArr.get(i); TableRow row = (TableRow) LayoutInflater.from(this).inflate(R.layout.zr_quote_price_item, null); TextView t1 = (TextView) row.findViewById(R.id.zr_table_col1); TextView t2 = (TextView) row.findViewById(R.id.zr_table_col2); TextView t3 = (TextView) row.findViewById(R.id.zr_table_col3); TextView t4 = (TextView) row.findViewById(R.id.zr_table_col4); TextView t5 = (TextView) row.findViewById(R.id.zr_table_col5); t1.setText(jA.getString(4)); t2.setText(Utils.dataFormation(jA.getDouble(0), Utils.getStockDigit(type))); t2.setTextColor(Utils.getTextColor(mContext, jA.getDouble(0), zrsp)); t2.setGravity(Gravity.RIGHT | Gravity.CENTER_VERTICAL); double cjsl = Arith.round(jA.getDouble(1), 0); t3.setText(Utils.dataFormation(cjsl, 0)); t3.setGravity(Gravity.RIGHT | Gravity.CENTER_VERTICAL); t4.setText(jA.getString(7)); t5.setText(jA.getString(8)); table.addView(row); if ("B".equals(jA.getString(6))) { color = Utils.getTextColor(mContext, 3); t3.setTextColor(color); t4.setTextColor(color); t5.setTextColor(color); } else if ("S".equals(jA.getString(6))) { color = Utils.getTextColor(mContext, 4); t3.setTextColor(color); t4.setTextColor(color); t5.setTextColor(color); } else { t3.setTextColor(color); t4.setTextColor(color); t5.setTextColor(color); } } } else { if (stocktype.charAt(0) == '0') {// //for (int i = jArr.length()-1; i >= 0; i--) { for (int i = 0; i <= jArr.length() - 1; i++) { JSONArray jA = (JSONArray) jArr.get(i); TableRow row = (TableRow) LayoutInflater.from(this).inflate(R.layout.zr_quote_price_item, null); TextView t1 = (TextView) row.findViewById(R.id.zr_table_col1); TextView t2 = (TextView) row.findViewById(R.id.zr_table_col2); TextView t3 = (TextView) row.findViewById(R.id.zr_table_col3); TextView t4 = (TextView) row.findViewById(R.id.zr_table_col4); t1.setText(jA.getString(4)); t2.setText(Utils.dataFormation(jA.getDouble(0), Utils.getStockDigit(type))); t2.setTextColor(Utils.getTextColor(mContext, jA.getDouble(0), zrsp)); t2.setGravity(Gravity.RIGHT | Gravity.CENTER_VERTICAL); double cjsl = Arith.round(jA.getDouble(1), 0); t3.setText(Utils.dataFormation(cjsl, 0)); if (cjsl > 500) t3.setTextColor(Utils.getTextColor(mContext, 6)); else t3.setTextColor(Utils.getTextColor(mContext, 1)); t3.setGravity(Gravity.RIGHT | Gravity.CENTER_VERTICAL); t4.setText(jA.getString(6)); if ("B".equals(jA.getString(6))) t4.setTextColor(Utils.getTextColor(mContext, 3)); else t4.setTextColor(Utils.getTextColor(mContext, 4)); table.addView(row); } //? int num = jArr.length(); if (num < 16) { while (num < 16) { TableRow row = (TableRow) LayoutInflater.from(this).inflate(R.layout.zr_quote_price_item, null); table.addView(row); num++; } } } else if (stocktype.charAt(0) == '1' || stocktype.charAt(0) == '2') {// //for (int i = jArr.length()-1; i >= 0; i--) { for (int i = 0; i <= jArr.length() - 1; i++) { JSONArray jA = (JSONArray) jArr.get(i); TableRow row = (TableRow) LayoutInflater.from(this).inflate(R.layout.zr_quote_price_item, null); TextView t1 = (TextView) row.findViewById(R.id.zr_table_col1); TextView t2 = (TextView) row.findViewById(R.id.zr_table_col2); TextView t3 = (TextView) row.findViewById(R.id.zr_table_col4); t1.setText(jA.getString(4)); t2.setText(Utils.dataFormation(jA.getDouble(0), Utils.getStockDigit(type))); t2.setTextColor(Utils.getTextColor(mContext, jA.getDouble(0), zrsp)); t3.setText(Utils.getAmountFormat(jA.getDouble(5), true)); t3.setTextColor(Utils.getTextColor(mContext, 1)); table.addView(row); } //? int num = jArr.length(); if (num < 16) { while (num < 16) { TableRow row = (TableRow) LayoutInflater.from(this).inflate(R.layout.zr_quote_price_item, null); table.addView(row); num++; } } } } }
From source file:com.bonsai.btcreceive.ViewTransactionActivity.java
private void addTransputsSum(TableLayout table, long btc) { TableRow row = (TableRow) LayoutInflater.from(this).inflate(R.layout.transputs_table_sum, table, false); TextView tv1 = (TextView) row.findViewById(R.id.row_btc); tv1.setText(String.format("%s", mBTCFmt.format(btc))); table.addView(row);//from w ww .j a va 2s .c o m }
From source file:com.bonsai.btcreceive.ViewTransactionActivity.java
private void addTransputsHeader(TableLayout table) { TableRow row = (TableRow) LayoutInflater.from(this).inflate(R.layout.transputs_table_header, table, false); TextView tv = (TextView) row.findViewById(R.id.header_btc); tv.setText(mBTCFmt.unitStr());//from w w w . j av a 2s . co m table.addView(row); }
From source file:org.comixwall.pffw.InfoIfs.java
@Override public void onBindViewHolder(IfViewHolder holder, int position) { If ifInfo = ifsList.get(position);/*from w w w. j ava 2s . c o m*/ holder.name.setText(ifInfo.name); holder.number.setText(ifInfo.num); holder.statesRules.setText(String.format(holder.statesRules.getResources().getString(R.string.states_rules), ifInfo.states, ifInfo.rules)); holder.cleared .setText(String.format(holder.cleared.getResources().getString(R.string.cleared), ifInfo.cleared)); holder.table.removeAllViews(); TableRow row = (TableRow) LayoutInflater.from(holder.table.getContext()).inflate(R.layout.ifs_table_row, new TableRow(holder.table.getContext()), true); ((TextView) row.findViewById(R.id.rowHeader)).setText(R.string.in4); ((TextView) row.findViewById(R.id.passPackets)).setText(ifInfo.in4PassPackets); ((TextView) row.findViewById(R.id.passBytes)).setText(ifInfo.in4PassBytes); ((TextView) row.findViewById(R.id.blockPackets)).setText(ifInfo.in4BlockPackets); ((TextView) row.findViewById(R.id.blockBytes)).setText(ifInfo.in4BlockBytes); holder.table.addView(row); row = (TableRow) LayoutInflater.from(holder.table.getContext()).inflate(R.layout.ifs_table_row, new TableRow(holder.table.getContext()), true); ((TextView) row.findViewById(R.id.rowHeader)).setText(R.string.out4); ((TextView) row.findViewById(R.id.passPackets)).setText(ifInfo.out4PassPackets); ((TextView) row.findViewById(R.id.passBytes)).setText(ifInfo.out4PassBytes); ((TextView) row.findViewById(R.id.blockPackets)).setText(ifInfo.out4BlockPackets); ((TextView) row.findViewById(R.id.blockBytes)).setText(ifInfo.out4BlockBytes); holder.table.addView(row); row = (TableRow) LayoutInflater.from(holder.table.getContext()).inflate(R.layout.ifs_table_row, new TableRow(holder.table.getContext()), true); ((TextView) row.findViewById(R.id.rowHeader)).setText(R.string.in6); ((TextView) row.findViewById(R.id.passPackets)).setText(ifInfo.in6PassPackets); ((TextView) row.findViewById(R.id.passBytes)).setText(ifInfo.in6PassBytes); ((TextView) row.findViewById(R.id.blockPackets)).setText(ifInfo.in6BlockPackets); ((TextView) row.findViewById(R.id.blockBytes)).setText(ifInfo.in6BlockBytes); holder.table.addView(row); row = (TableRow) LayoutInflater.from(holder.table.getContext()).inflate(R.layout.ifs_table_row, new TableRow(holder.table.getContext()), true); ((TextView) row.findViewById(R.id.rowHeader)).setText(R.string.out6); ((TextView) row.findViewById(R.id.passPackets)).setText(ifInfo.out6PassPackets); ((TextView) row.findViewById(R.id.passBytes)).setText(ifInfo.out6PassBytes); ((TextView) row.findViewById(R.id.blockPackets)).setText(ifInfo.out6BlockPackets); ((TextView) row.findViewById(R.id.blockBytes)).setText(ifInfo.out6BlockBytes); holder.table.addView(row); }
From source file:com.money.manager.ex.reports.IncomeVsExpensesListFragment.java
/** * Add footer to ListView// w w w . j a va2s . c o m * * @return View of footer */ private View addListViewFooter() { TableRow row = (TableRow) View.inflate(getActivity(), R.layout.tablerow_income_vs_expenses, null); TextView txtYear = (TextView) row.findViewById(R.id.textViewYear); txtYear.setText(getString(R.string.total)); txtYear.setTypeface(null, Typeface.BOLD); TextView txtMonth = (TextView) row.findViewById(R.id.textViewMonth); txtMonth.setText(null); return row; }
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);//from w ww . j a v a 2 s . c o 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.ultramegatech.ey.ElementDetailsFragment.java
/** * Populate the table of common isotopes. *///www . j ava 2 s . c o m private void populateIsotopes() { final Isotope[] isotopes = Isotopes.getIsotopes(mElement.number); if (isotopes != null) { final LayoutInflater inflater = getLayoutInflater(); for (Isotope isotope : isotopes) { final TableRow tableRow = (TableRow) inflater.inflate(R.layout.isotope_table_row, mIsoTable, false); final TextView symbolText = (TextView) tableRow.findViewById(R.id.isoSymbol); symbolText.setText(isotope.getSymbol()); final TextView massText = (TextView) tableRow.findViewById(R.id.isoMass); massText.setText(DECIMAL_FORMAT.format(isotope.mass)); mIsoTable.addView(tableRow); } } }
From source file:de.grobox.liberario.TripsActivity.java
private void addTrips(final TableLayout main, List<Trip> trip_list, boolean append) { if (trip_list != null) { // reverse order of trips if they should be prepended if (!append) { ArrayList<Trip> tempResults = new ArrayList<Trip>(trip_list); Collections.reverse(tempResults); trip_list = tempResults;//from w ww. ja v a 2 s . c o m } for (final Trip trip : trip_list) { final LinearLayout trip_layout = (LinearLayout) LayoutInflater.from(this).inflate(R.layout.trip, null); TableRow row = (TableRow) trip_layout.findViewById(R.id.tripTableRow); // Locations TextView fromView = (TextView) row.findViewById(R.id.fromView); fromView.setText(trip.from.uniqueShortName()); TextView toView = ((TextView) row.findViewById(R.id.toView)); toView.setText(trip.to.uniqueShortName()); // Departure Time and Delay TextView departureTimeView = (TextView) row.findViewById(R.id.departureTimeView); TextView departureDelayView = (TextView) row.findViewById(R.id.departureDelayView); if (trip.getFirstPublicLeg() != null) { LiberarioUtils.setDepartureTimes(this, departureTimeView, departureDelayView, trip.getFirstPublicLeg().departureStop); } else { departureTimeView.setText(DateUtils.getTime(this, trip.getFirstDepartureTime())); } // Arrival Time and Delay TextView arrivalTimeView = (TextView) row.findViewById(R.id.arrivalTimeView); TextView arrivalDelayView = (TextView) row.findViewById(R.id.arrivalDelayView); if (trip.getLastPublicLeg() != null) { LiberarioUtils.setArrivalTimes(this, arrivalTimeView, arrivalDelayView, trip.getLastPublicLeg().arrivalStop); } else { arrivalTimeView.setText(DateUtils.getTime(this, trip.getLastArrivalTime())); } // Duration TextView durationView = (TextView) trip_layout.findViewById(R.id.durationView); durationView .setText(DateUtils.getDuration(trip.getFirstDepartureTime(), trip.getLastArrivalTime())); // Transports FlowLayout lineLayout = (FlowLayout) trip_layout.findViewById(R.id.lineLayout); // for each leg for (final Leg leg : trip.legs) { if (leg instanceof Trip.Public) { LiberarioUtils.addLineBox(this, lineLayout, ((Public) leg).line); } else if (leg instanceof Trip.Individual) { LiberarioUtils.addWalkingBox(this, lineLayout); } } // remember trip in view for onClick event trip_layout.setTag(trip); // make trip details fold out and in on click trip_layout.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { View v = main.getChildAt(main.indexOfChild(view) + 1); if (v != null) { if (v.getVisibility() == View.GONE) { v.setVisibility(View.VISIBLE); } else if (v.getVisibility() == View.VISIBLE) { v.setVisibility(View.GONE); } } } }); trip_layout.setOnLongClickListener(new View.OnLongClickListener() { @Override public boolean onLongClick(View view) { selectTrip(view, trip_layout); return true; } }); // show more button for trip details final ImageView showMoreView = (ImageView) trip_layout.findViewById(R.id.showMoreView); showMoreView.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { selectTrip(view, trip_layout); } }); // Create container for trip details fragment FrameLayout fragmentContainer = new FrameLayout(this); fragmentContainer.setId(mContainerId); fragmentContainer.setVisibility(View.GONE); // Create a new Fragment to be placed in the activity layout TripDetailFragment tripDetailFragment = new TripDetailFragment(); // In case this activity was started with special instructions from an // Intent, pass the Intent's extras to the fragment as arguments Bundle bundle = new Bundle(); bundle.putSerializable("de.schildbach.pte.dto.Trip", trip); bundle.putSerializable("de.schildbach.pte.dto.Trip.from", from); bundle.putSerializable("de.schildbach.pte.dto.Trip.to", to); tripDetailFragment.setArguments(bundle); // Add the fragment to the 'fragment_container' FrameLayout getSupportFragmentManager().beginTransaction().add(mContainerId, tripDetailFragment).commit(); mContainerId++; if (append) { trip_layout.addView(LiberarioUtils.getDivider(this)); main.addView(trip_layout); main.addView(fragmentContainer); } else { trip_layout.addView(LiberarioUtils.getDivider(this), 0); main.addView(trip_layout, 0); main.addView(fragmentContainer, 1); } } // end foreach trip } else { // TODO offer option to query again for trips } }
From source file:org.comixwall.pffw.StatsBase.java
void updateLists(String key) { mStats.get(key).totalLabel//from w ww . jav a2s . com .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; } } } }