List of usage examples for android.widget TableRow setTag
public void setTag(final Object tag)
From source file:com.google.cloud.solutions.cloudadventure.GameScoresFragment.java
/** * Updates the View for showing the player scores. * * @param player the player whose scores have been updated *//*from w w w.j av a 2 s . c o m*/ private void updateScoresTable(Player player) { String handle = player.getHandle(); TableRow row = new TableRow(getActivity()); row.setTag(handle); TextView text = new TextView(getActivity()); text.setTag(handle + PLAYER_TAG_SUFFIX); text.setGravity(Gravity.CENTER); text.setText(handle); row.addView(text); text = new TextView(getActivity()); text.setTag(handle + GEMS_TAG_SUFFIX); text.setGravity(Gravity.CENTER); text.setText(Long.toString(player.getGemsCollected())); row.addView(text); text = new TextView(getActivity()); text.setTag(handle + MOBS_TAG_SUFFIX); text.setGravity(Gravity.CENTER); text.setText(Long.toString(player.getMobsKilled())); row.addView(text); text = new TextView(getActivity()); text.setTag(handle + DEATHS_TAG_SUFFIX); text.setGravity(Gravity.CENTER); text.setText(Long.toString(player.getNumDeaths())); row.addView(text); mScoresTable.addView(row); }
From source file:com.applift.api.tester.activity.RequestActivity.java
private TableRow newRow(String key) { TableRow row = (TableRow) LayoutInflater.from(this).inflate(R.layout.view_request_table_row, null); Holder h = new Holder(row, key); row.setTag(h); return row;/*from w ww . j a v a2s . co m*/ }
From source file:net.kjmaster.cookiemom.editor.EditDataActivity.java
private void populateTable(final List<CookieTransactions> cookieTransactionsList, Context mContext) { edit_data_table.setShrinkAllColumns(true); for (final CookieTransactions cookieTransactions : cookieTransactionsList) { if ((cookieTransactions.getTransBoxes() != 0) || (cookieTransactions.getTransCash() != 0)) { TableRow tr = new TableRow(mContext); tr.setTag(cookieTransactions); TextView textView = new TextView(mContext); textView.setText(java.text.DateFormat.getInstance().format(cookieTransactions.getTransDate())); textView.setEnabled(false);//from w w w . j av a2 s. c o m tr.addView(textView); TextView textView2 = new TextView(mContext); try { if (cookieTransactions.getTransScoutId() < 0) { if (cookieTransactions.getTransBoothId() > 0) { textView2.setText(cookieTransactions.getBooth().getBoothLocation()); } else { textView2.setText("Cupboard"); } } else { textView2.setText(cookieTransactions.getScout().getScoutName()); } } catch (Exception e) { textView2.setText(""); } textView2.setEnabled(false); tr.addView(textView2); TextView textView1 = new TextView(mContext); textView1.setText(cookieTransactions.getCookieType()); textView1.setEnabled(false); tr.addView(textView1); EditText textView3 = new EditText(mContext); textView3.setText(cookieTransactions.getTransBoxes().toString()); textView3.addTextChangedListener(new TextWatcher() { @Override public void beforeTextChanged(CharSequence charSequence, int i, int i2, int i3) { if (mActionMode == null) { startActionMode(actionCall); } } @Override public void onTextChanged(CharSequence charSequence, int i, int i2, int i3) { } @Override public void afterTextChanged(Editable editable) { try { cookieTransactions.setTransBoxes(Integer.valueOf(editable.toString())); cookieTransactionsList.add(cookieTransactions); //Main.daoSession.getCookieTransactionsDao().update(cookieTransactions); } catch (Exception ignored) { } } }); tr.addView(textView3); EditText textView4 = new EditText(mContext); textView4.setText( NumberFormat.getCurrencyInstance().format(cookieTransactions.getTransCash().floatValue())); textView4.addTextChangedListener(new TextWatcher() { @Override public void beforeTextChanged(CharSequence charSequence, int i, int i2, int i3) { if (mActionMode == null) { startActionMode(actionCall); } } @Override public void onTextChanged(CharSequence charSequence, int i, int i2, int i3) { } @Override public void afterTextChanged(Editable editable) { try { cookieTransactions.setTransCash(Double.valueOf(editable.toString())); cookieTransactionsList.add(cookieTransactions); } catch (Exception ignored) { } } }); tr.addView(textView4); edit_data_table.addView(tr); } } }
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 w ww. j a v a2s . 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.svpino.longhorn.artifacts.StockTileProcessor.java
private static int createFixedHeaderRow(Fragment fragment, TableLayout tableLayout, List<Stock> stocks, SparseArray<View> tiles, int height, int margin) { View view = tableLayout.getChildAt(0); if (view == null || view.getTag() != "fixed-header") { TableRow indexesTableRow = new TableRow(fragment.getActivity()); TableRow.LayoutParams indixesLayoutParams = new TableRow.LayoutParams(); indixesLayoutParams.topMargin = margin; indixesLayoutParams.rightMargin = margin; indixesLayoutParams.bottomMargin = margin; indixesLayoutParams.height = height; TableRow.LayoutParams lastIndexLayoutParams = new TableRow.LayoutParams(); lastIndexLayoutParams.topMargin = margin; lastIndexLayoutParams.bottomMargin = margin; lastIndexLayoutParams.height = height; View tile1 = createTile(fragment, stocks.get(0), 0, false); View tile2 = createTile(fragment, stocks.get(1), 1, false); View tile3 = createTile(fragment, stocks.get(2), 2, false); tiles.put(0, tile1);/*from ww w . j a v a2 s .c o m*/ tiles.put(1, tile2); tiles.put(2, tile3); indexesTableRow.addView(tile1, indixesLayoutParams); indexesTableRow.addView(tile2, indixesLayoutParams); indexesTableRow.addView(tile3, lastIndexLayoutParams); indexesTableRow.setTag("fixed-header"); tableLayout.addView(indexesTableRow); } return 3; }
From source file:com.bonsai.btcreceive.TransactionsFragment.java
private void addTransactionRow(String hash, TableLayout table, String datestr, String timestr, String confstr, String btcstr, String btcbalstr, String fiatstr, String fiatbalstr, boolean tintrow) { TableRow row = (TableRow) LayoutInflater.from(getActivity()).inflate(R.layout.transaction_table_row, table, false);//w ww . j a va 2 s .c om row.setTag(hash); row.setOnClickListener(new OnClickListener() { @Override public void onClick(View view) { // Dispatch to the transaction viewer. String hash = (String) view.getTag(); Intent intent = new Intent(getActivity(), ViewTransactionActivity.class); intent.putExtra("hash", hash); startActivity(intent); } }); { TextView tv = (TextView) row.findViewById(R.id.row_date); tv.setText(datestr); } { TextView tv = (TextView) row.findViewById(R.id.row_time); tv.setText(timestr); } { TextView tv = (TextView) row.findViewById(R.id.row_confidence); tv.setText(confstr); } { TextView tv = (TextView) row.findViewById(R.id.row_btc_balance); tv.setText(btcbalstr); } { TextView tv = (TextView) row.findViewById(R.id.row_btc); tv.setText(btcstr); } { TextView tv = (TextView) row.findViewById(R.id.row_fiat_balance); tv.setText(fiatbalstr); } { TextView tv = (TextView) row.findViewById(R.id.row_fiat); tv.setText(fiatstr); } if (tintrow) row.setBackgroundColor(Color.parseColor("#ccffcc")); table.addView(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); row.setId(index);/*from www.j a v a2 s. c om*/ { 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.example.parkhere.seeker.SeekerProfileVehicleFragment.java
public void addVehicle(final Vehicle vehicle) { Retrofit retrofit = new Retrofit.Builder().baseUrl(Constants.BASE_URL) .addConverterFactory(GsonConverterFactory.create()).build(); RequestInterface requestInterface = retrofit.create(RequestInterface.class); ServerRequest request = new ServerRequest(); request.setOperation(Constants.ADD_VEHICLE_OPERATION); request.setUser(user);/*from w ww. j a v a 2 s. c o m*/ request.setVehicle(vehicle); Call<ServerResponse> response = requestInterface.operation(request); response.enqueue(new Callback<ServerResponse>() { @Override public void onResponse(Call<ServerResponse> call, retrofit2.Response<ServerResponse> response) { ServerResponse resp = response.body(); if (resp.getResult().equals(Constants.SUCCESS)) { TableRow tr = new TableRow(myContext); tr.setLayoutParams(new TableRow.LayoutParams(TableRow.LayoutParams.FILL_PARENT, TableRow.LayoutParams.WRAP_CONTENT)); tr.setTag(tag); tag++; tr.setClickable(true); tr.setOnClickListener(clickListener); TextView v_make = new TextView(myContext); v_make.setText(vehicle.getMake()); v_make.setLayoutParams(new TableRow.LayoutParams(300, 150)); tr.addView(v_make); TextView v_model = new TextView(myContext); v_model.setText(vehicle.getModel()); v_model.setLayoutParams(new TableRow.LayoutParams(TableRow.LayoutParams.WRAP_CONTENT, TableRow.LayoutParams.WRAP_CONTENT)); tr.addView(v_model); TextView v_license = new TextView(myContext); v_license.setText(vehicle.getLicensePlate()); v_license.setLayoutParams(new TableRow.LayoutParams(TableRow.LayoutParams.WRAP_CONTENT, TableRow.LayoutParams.WRAP_CONTENT)); tr.addView(v_license); tl.addView(tr, new TableLayout.LayoutParams(TableLayout.LayoutParams.FILL_PARENT, TableLayout.LayoutParams.WRAP_CONTENT)); Vehicle[] arr = new Vehicle[vehicles.length + 1]; for (int i = 0; i < vehicles.length; i++) { arr[i] = vehicles[i]; } arr[vehicles.length] = vehicle; vehicles = arr; } Snackbar.make(rootView, resp.getMessage(), Snackbar.LENGTH_LONG).show(); } @Override public void onFailure(Call<ServerResponse> call, Throwable t) { Snackbar.make(rootView, t.getLocalizedMessage(), Snackbar.LENGTH_LONG).show(); } }); }
From source file:com.example.parkhere.seeker.SeekerProfileVehicleFragment.java
public void getCurrInfo() { tag = 1;//from w w w . j a va 2 s .c o m Retrofit retrofit = new Retrofit.Builder().baseUrl(Constants.BASE_URL) .addConverterFactory(GsonConverterFactory.create()).build(); RequestInterface requestInterface = retrofit.create(RequestInterface.class); ServerRequest request = new ServerRequest(); request.setOperation(Constants.GET_SEEKER_PROFILE_OPERATION); request.setUser(user); Call<ServerResponse> response = requestInterface.operation(request); response.enqueue(new Callback<ServerResponse>() { @Override public void onResponse(Call<ServerResponse> call, retrofit2.Response<ServerResponse> response) { ServerResponse resp = response.body(); if (resp.getResult().equals(Constants.SUCCESS)) { vehicles = resp.getVehicles(); TableRow tr_head = new TableRow(myContext); tr_head.setBackgroundColor(Color.GRAY); tr_head.setLayoutParams(new TableRow.LayoutParams(TableRow.LayoutParams.FILL_PARENT, TableRow.LayoutParams.WRAP_CONTENT)); TextView make = new TextView(myContext); make.setText("MAKE"); make.setTextColor(Color.WHITE); make.setPadding(5, 5, 5, 5); tr_head.addView(make); TextView model = new TextView(myContext); model.setText("MODEL"); model.setTextColor(Color.WHITE); model.setPadding(5, 5, 5, 5); tr_head.addView(model); final TextView license = new TextView(myContext); license.setText("LICENSE PLATE"); license.setTextColor(Color.WHITE); license.setPadding(5, 5, 5, 5); tr_head.addView(license); tl.addView(tr_head, new TableLayout.LayoutParams(TableLayout.LayoutParams.FILL_PARENT, TableLayout.LayoutParams.WRAP_CONTENT)); for (int i = 0; i < vehicles.length; i++) { if (vehicles[i].getDeletedWithHistory() == 1) { continue; } TableRow tr = new TableRow(myContext); tr.setLayoutParams(new TableRow.LayoutParams(TableRow.LayoutParams.FILL_PARENT, TableRow.LayoutParams.WRAP_CONTENT)); tr.setTag(tag); tag++; tr.setClickable(true); tr.setOnClickListener(clickListener); TextView v_make = new TextView(myContext); v_make.setText(vehicles[i].getMake()); v_make.setLayoutParams(new TableRow.LayoutParams(300, 150)); tr.addView(v_make); TextView v_model = new TextView(myContext); v_model.setText(vehicles[i].getModel()); v_model.setLayoutParams(new TableRow.LayoutParams(TableRow.LayoutParams.WRAP_CONTENT, TableRow.LayoutParams.WRAP_CONTENT)); tr.addView(v_model); TextView v_license = new TextView(myContext); v_license.setText(vehicles[i].getLicensePlate()); v_license.setLayoutParams(new TableRow.LayoutParams(TableRow.LayoutParams.WRAP_CONTENT, TableRow.LayoutParams.WRAP_CONTENT)); tr.addView(v_license); tl.addView(tr, new TableLayout.LayoutParams(TableLayout.LayoutParams.FILL_PARENT, TableLayout.LayoutParams.WRAP_CONTENT)); } } } @Override public void onFailure(Call<ServerResponse> call, Throwable t) { Snackbar.make(rootView, t.getLocalizedMessage(), Snackbar.LENGTH_LONG).show(); } }); }
From source file:com.landenlabs.all_devtool.TextFragment.java
private void fillLayout() { m_tableLayout.removeAllViews();/* ww w .ja v a 2s . c om*/ m_textInfoList.clear(); int minSP = 8; int maxSP = 20; int stepSP = 2; int[] colors = new int[] { 0xffe0e0e0, 0xffffe0e0, 0xffe0ffe0, 0xffe0e0ff }; TableLayout.LayoutParams tableLP = new TableLayout.LayoutParams(TableLayout.LayoutParams.MATCH_PARENT, TableLayout.LayoutParams.WRAP_CONTENT); TableRow.LayoutParams rowLP = new TableRow.LayoutParams(TableRow.LayoutParams.WRAP_CONTENT, TableRow.LayoutParams.MATCH_PARENT); TextView textView; TableRow tableRow; int textColor = 0xff000000; for (int tfIdx = 0; tfIdx < TextInfo.getCount(); tfIdx++) { Typeface typeface = TextInfo.getTypeface(tfIdx); String typefaceStr = TextInfo.getTypefaceStr(tfIdx); textView = new TextView(m_context); textView.setBackgroundColor(Utils.blend(colors[tfIdx], 0x20000000)); textView.setText(typefaceStr); textView.setGravity(Gravity.CENTER); textView.setTextColor(textColor); m_tableLayout.addView(textView, tableLP); for (int sizeSP = minSP; sizeSP <= maxSP; sizeSP += stepSP) { tableRow = new TableRow(m_context); tableRow.setBackgroundColor(colors[tfIdx]); tableRow.setTag(Integer.valueOf(m_textInfoList.size())); m_textInfoList.add(new TextInfo(sizeSP, tfIdx)); tableRow.setClickable(true); tableRow.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { int idx = (Integer) v.getTag(); showTextDialog(m_textInfoList, idx); } }); textView = new TextView(m_context); textView.setText(String.valueOf(sizeSP) + "sp "); textView.setBackgroundColor(0x20000000); textView.setPadding(8, 0, 8, 0); textView.setGravity(Gravity.CENTER); textView.setTextColor(textColor); tableRow.addView(textView, rowLP); textView = new TextView(m_context); textView.setText("Normal"); textView.setTextSize(TypedValue.COMPLEX_UNIT_SP, sizeSP); textView.setTypeface(typeface, Typeface.NORMAL); textView.setGravity(Gravity.CENTER); textView.setTextColor(textColor); tableRow.addView(textView, rowLP); textView = new TextView(m_context); textView.setText("Bold"); textView.setTextSize(TypedValue.COMPLEX_UNIT_SP, sizeSP); textView.setTypeface(typeface, Typeface.BOLD); textView.setPadding(8, 0, 8, 0); textView.setGravity(Gravity.CENTER); textView.setTextColor(textColor); tableRow.addView(textView, rowLP); textView = new TextView(m_context); textView.setText("Italic"); textView.setTextSize(TypedValue.COMPLEX_UNIT_SP, sizeSP); textView.setTypeface(typeface, Typeface.ITALIC); textView.setGravity(Gravity.CENTER); textView.setTextColor(textColor); tableRow.addView(textView, rowLP); m_tableLayout.addView(tableRow, tableLP); } } }