List of usage examples for android.widget TableRow getChildCount
public int getChildCount()
From source file:com.cybrosys.currency.CurrencyMain.java
public void onStart() { super.onStart(); getActivity().getWindow().setFlags(WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM, WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM); linlaHeaderProgress = (LinearLayout) getView().findViewById(R.id.linlaHeaderProgress); imgvHead = (ImageView) getView().findViewById(R.id.imageHead); txtvHead = (TextView) getView().findViewById(R.id.textHead); lstvMainlistView = (ListView) getView().findViewById(R.id.listview); etxtText = (EditText) getView().findViewById(R.id.editText1); slide = (SlidingDrawer) getView().findViewById(R.id.SlidingDrawer); TableLayout tablePad = (TableLayout) getView().findViewById(R.id.tablone); int inPadCount = tablePad.getChildCount(); for (int i = 0; i < inPadCount; i++) { View v = tablePad.getChildAt(i); if (v instanceof TableRow) { TableRow row = (TableRow) v; int rowCount = row.getChildCount(); for (int r = 0; r < rowCount; r++) { View v2 = row.getChildAt(r); if (v2 instanceof Button) { Button b = (Button) v2; b.setOnClickListener(buttonpad); } else if (v2 instanceof TextView) { TextView txtv = (TextView) v2; txtv.setOnClickListener(null); }/*from w ww . j ava 2 s. co m*/ } } } isFlag2 = true; Settings = getActivity().getSharedPreferences(strPREFERNAME, 0); for (int inI = 0; inI <= 5; inI++) { if (Settings.getString("val" + inI, "").equals("") && Settings.getString("CrnCode" + inI, "").equals("") && Settings.getString("flag" + inI, "").equals("")) { isFlag2 = false; } } if (isFlag2 == true) { Sharepreferences(); } else { CustomListView(); if (isConnection() == true) { } else { isFlag2 = true; isFlag = true; Toast.makeText(getActivity(), "No Internet Conection", Toast.LENGTH_LONG).show(); } } SharedPreferences prefs = PalmCalcActivity.ctx.getSharedPreferences("UpdateTime", 0); lastUpdateTime = prefs.getLong("lastUpdateTime", 0); if ((lastUpdateTime) <= System.currentTimeMillis()) { lastUpdateTime = System.currentTimeMillis(); SharedPreferences.Editor editors = prefs.edit(); editors.putLong("lastUpdateTime", lastUpdateTime); editors.commit(); if (isConnection() == true) { new BackProsess().execute(getActivity()); } } etxtText.addTextChangedListener(textwach); aList = new ArrayList<HashMap<String, String>>(); for (int InI = 0; InI < 5; InI++) { hm = new HashMap<String, String>(); hm.put("flag", Integer.toString(fltFlags[InI])); if (InI != 5) { hm.put("cur", strCrnCode[InI].substring(0, 3)); } else { hm.put("cur", strCrnCode[InI]); } aList.add(hm); } txtvHead.setText(strCrnCode[5]); imgvHead.setImageResource(fltFlags[5]); adapter = new ListAdapter1(getActivity(), aList); lstvMainlistView.setAdapter(adapter); lstvMainlistView.setOnItemClickListener(ListsingleClick); lstvMainlistView.setOnItemLongClickListener(ListLongClick); Decimalpoint(); View vwMain = (View) getActivity().findViewById(R.id.idCurrencyMain); vwMain.setOnTouchListener(new View.OnTouchListener() { @Override public boolean onTouch(View v, MotionEvent event) { slide.close(); return true; } }); etxtText.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { if (!slide.isOpened()) { slide.open(); } } }); if (!Settings.getString("Input", "").equals("")) { calculation(Double.parseDouble(Settings.getString("Input", ""))); etxtText.setText(""); etxtText.setText(Settings.getString("Input", "")); } else { etxtText.setText(Settings.getString("Input", "1")); } }
From source file:com.github.akinaru.rfdroid.activity.BtDevicesActivity.java
public void altTableRow(int alt_row) { int childViewCount = tablelayout.getChildCount(); for (int i = 0; i < childViewCount; i++) { TableRow row = (TableRow) tablelayout.getChildAt(i); for (int j = 0; j < row.getChildCount(); j++) { TextView tv = (TextView) row.getChildAt(j); if (i % alt_row != 0) { tv.setBackground(getResources().getDrawable(R.drawable.alt_row_color)); } else { tv.setBackground(getResources().getDrawable(R.drawable.row_color)); }/* www. j a v a 2s .co m*/ } } }
From source file:com.mifos.mifosxdroid.online.generatecollectionsheet.GenerateCollectionSheetFragment.java
private void submitProductiveSheet() { ProductiveCollectionSheetPayload payload = new ProductiveCollectionSheetPayload(); payload.setCalendarId(calendarId);/*from w w w . j a va2s . c o m*/ payload.setTransactionDate(tvMeetingDate.getText().toString()); for (int i = 0; i < tableProductive.getChildCount(); i++) { //In the tableRows which depicts the details of that client. //Loop through all the view of this TableRows. TableRow row = (TableRow) tableProductive.getChildAt(i); for (int j = 0; j < row.getChildCount(); j++) { //In a particular TableRow //Loop through the views and check if it's LinearLayout //because the required views - EditTexts are there only. View v = row.getChildAt(j); if (v instanceof LinearLayout) { //So, we got into the container containing the EditTexts //Now, extract the values and the loanId associated to this //particular TextView which was set as its Tag. for (int k = 0; k < ((LinearLayout) v).getChildCount(); k++) { EditText et = (EditText) ((LinearLayout) v).getChildAt(k); String[] typeId = et.getTag().toString().split(":"); //Switch on basis if whether it's LOAN or SAVING switch (typeId[0]) { case TYPE_LOAN: int loanId = Integer.parseInt(typeId[1]); Double amount = Double.parseDouble(et.getText().toString()); payload.getBulkRepaymentTransactions() .add(new BulkRepaymentTransactions(loanId, amount)); break; //Saving products are NOT shown in ProductiveSheet. //So, not processing them. } } } } } //Payload with all the items is ready. Now, hit the endpoint and submit it. presenter.submitProductiveSheet(productiveCenterId, payload); }
From source file:ru.adios.budgeter.widgets.DataTableLayout.java
public void disableUserOrdering() { orderResolver = Optional.empty(); if (getChildCount() > 0) { final TableRow columnsRow = (TableRow) getChildAt(2); for (int i = 0; i < columnsRow.getChildCount(); i++) { final View childAt = columnsRow.getChildAt(i); if (childAt.isSelected()) { childAt.setSelected(false); childAt.invalidate();// w ww . java2s.co m break; } } } }
From source file:ru.adios.budgeter.widgets.DataTableLayout.java
private void setOrderByInternal(OrderBy orderBy, boolean doReloadIfNeeded) { checkState(!orderResolver.isPresent() || orderBy != null, "User ordering enabled, cannot set no ordering at all"); if ((this.orderBy.isPresent() && !this.orderBy.get().equals(orderBy)) || (!this.orderBy.isPresent() && orderBy != null)) { if (orderResolver.isPresent() && columnsRow.isPresent()) { final TableRow[] colsRow = columnsRow.get(); outer: for (final TableRow r : colsRow) { for (int j = 0; j < r.getChildCount(); j++) { final TextView col = (TextView) r.getChildAt(j); if (col.getText().toString() .equals(orderResolver.get().byField(orderBy.field).orElse(null))) { if (!col.isSelected()) { selectOrderByColumn(col); }//from www . j a v a 2 s . co m break outer; } } } } this.orderBy = Optional.ofNullable(orderBy); if (tablePopulated && doReloadIfNeeded) { clearContents(); loadTableProcedures(); } } }
From source file:ru.adios.budgeter.widgets.DataTableLayout.java
public void enableUserOrdering(OrderResolver orderResolver) { checkArgument(orderResolver != null, "orderResolver is null"); this.orderResolver = Optional.of(orderResolver); if (getChildCount() > 0) { final TableRow columnsRow = (TableRow) getChildAt(2); for (int i = 0; i < columnsRow.getChildCount(); i++) { final TextView col = (TextView) columnsRow.getChildAt(i); final String text = col.getText().toString(); if (!orderBy.isPresent()) { final Optional<OrderBy> possibleOrder = orderResolver.byColumnName(text, Order.DESC); if (!possibleOrder.isPresent()) { continue; }/*www .jav a 2 s.c o m*/ orderBy = Optional.of(possibleOrder.get()); selectOrderByColumn(col); if (tablePopulated) { clearContents(); loadTableProcedures(); } return; } if (text.equals(orderResolver.byField(orderBy.get().field).orElse(null))) { if (!col.isSelected()) { selectOrderByColumn(col); col.invalidate(); } break; } } } }
From source file:ru.adios.budgeter.widgets.DataTableLayout.java
private TextView createSpyingColumnForTableRow(String text, final int rowId, final float weight, Context context) {// w w w. ja va 2 s. co m final SpyingTextView view = new SpyingTextView(context); populateColumn(view, context, weight); view.heightCatch = true; view.setHeightRunnable(new Runnable() { @Override public void run() { final TableRow row = (TableRow) getChildAt(rowId); final int childCount = row.getChildCount(); int maxHeight = 0; for (int i = 0; i < childCount; i++) { final TextView childAt = (TextView) row.getChildAt(i); maxHeight = Math.max(maxHeight, childAt.getHeight()); } for (int i = 0; i < childCount; i++) { final TextView childAt = (TextView) row.getChildAt(i); childAt.setLayoutParams( new TableRow.LayoutParams(TableRow.LayoutParams.WRAP_CONTENT, maxHeight, weight)); } invalidate(); } }); view.setText(text); return view; }
From source file:com.mifos.mifosxdroid.online.generatecollectionsheet.GenerateCollectionSheetFragment.java
private void submitCollectionSheet() { CollectionSheetPayload payload = new CollectionSheetPayload(); payload.setCalendarId(calendarId);// w w w. j a va 2 s . c o m payload.setTransactionDate(tvMeetingDate.getText().toString()); payload.setActualDisbursementDate(tvMeetingDate.getText().toString()); for (int i = 0; i < tableProductive.getChildCount(); i++) { //In the tableRows which depicts the details of that client. //Loop through all the view of this TableRows. TableRow row = (TableRow) tableProductive.getChildAt(i); for (int j = 0; j < row.getChildCount(); j++) { //In a particular TableRow //Loop through the views and check if it's LinearLayout //because the required views - EditTexts are there only. View v = row.getChildAt(j); if (v instanceof LinearLayout) { //So, we got into the container containing the EditTexts //Now, extract the values and the loanId associated to this //particular TextView which was set as its Tag. for (int k = 0; k < ((LinearLayout) v).getChildCount(); k++) { EditText et = (EditText) ((LinearLayout) v).getChildAt(k); String[] typeId = et.getTag().toString().split(":"); //Switch on basis if whether it's LOAN or SAVING switch (typeId[0]) { case TYPE_LOAN: int loanId = Integer.parseInt(typeId[1]); Double amount = Double.parseDouble(et.getText().toString()); payload.getBulkRepaymentTransactions() .add(new BulkRepaymentTransactions(loanId, amount)); break; case TYPE_SAVING: //Add to Savings int savingsId = Integer.parseInt(typeId[1]); String amountSaving = et.getText().toString(); payload.getBulkSavingsDueTransactions() .add(new BulkSavingsDueTransaction(savingsId, amountSaving)); break; } } } else if (v instanceof Spinner) { //Attendance Spinner spinner = (Spinner) v; int clientId = (int) spinner.getTag(); int attendanceTypeId = attendanceTypeOptions.get(spinner.getSelectedItem().toString()); payload.getClientsAttendance().add(new ClientsAttendance(clientId, attendanceTypeId)); } } } //Check if Additional details are there if (tableAdditional != null && tableAdditional.getChildCount() > 0) { for (int i = 0; i < 6; i++) { TableRow row = (TableRow) tableAdditional.getChildAt(i); View v = row.getChildAt(1); if (v instanceof Spinner) { int paymentId = additionalPaymentTypeMap.get(((Spinner) v).getSelectedItem().toString()); if (paymentId != -1) { payload.setPaymentTypeId(paymentId); } } else if (v instanceof EditText) { String value = ((EditText) v).getText().toString(); if (!value.equals("")) { switch (i) { case 1: payload.setAccountNumber(value); break; case 2: payload.setCheckNumber(value); break; case 3: payload.setRoutingCode(value); break; case 4: payload.setReceiptNumber(value); break; case 5: payload.setBankNumber(value); break; } } } } } //Payload with all the items is ready. Now, hit the endpoint and submit it. presenter.submitCollectionSheet(groupId, payload); }
From source file:com.murrayc.galaxyzoo.app.QuestionFragment.java
private static void insertButtonInRow(final Context context, final TableRow row, final View button) { final TableRow.LayoutParams params = new TableRow.LayoutParams(0, TableRow.LayoutParams.MATCH_PARENT, 1f /* weight */); //Use as little padding as possible at the left and right because the button //will usually get extra space from the TableLayout anyway, //but we want to avoid ugly line-breaks when the text is long (such as in translations). //Space around the inside of the buttons: //When we use smaller dp values, there seems to be no padding at the sides at all, //probably because the edges of the button are actually dependent on the standard background //image for buttons. //2 * standard_margin is nicer, but there is usually more, because the buttons expand //and a too-small margin is better than splitting a word across lines. final int padding = UiUtils.getPxForDpResource(context, R.dimen.small_margin); button.setPadding(padding, button.getPaddingTop(), padding, padding); if (row.getChildCount() > 0) { //Space between the buttons: final int margin = UiUtils.getPxForDpResource(context, R.dimen.tiny_gap); params.setMargins(margin, 0, 0, 0); // When using the standard background drawable (not our custom background color // which replaces it) This reduces the space caused by the standard background drawable, // but negative margins are unmaintainable voodoo: // params.setMargins(-4, 0, -4, 0); }/*w ww. j a va 2 s . c o m*/ row.addView(button, params); }
From source file:de.tobiasbielefeld.solitaire.ui.manual.ManualGames.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View view = inflater.inflate(R.layout.fragment_manual_games, container, false); ((Manual) getActivity()).setGamePageShown(false); layout1 = (ScrollView) view.findViewById(R.id.manual_games_layout_selection); scrollView = (ScrollView) view.findViewById(R.id.manual_games_scrollView); textName = (TextView) view.findViewById(R.id.manual_games_name); textStructure = (TextView) view.findViewById(R.id.manual_games_structure); textObjective = (TextView) view.findViewById(R.id.manual_games_objective); textRules = (TextView) view.findViewById(R.id.manual_games_rules); textScoring = (TextView) view.findViewById(R.id.manual_games_scoring); textBonus = (TextView) view.findViewById(R.id.manual_games_bonus); layout1.setVisibility(View.VISIBLE); scrollView.setVisibility(View.GONE); //if the manual is called from the in game menu, show the corresponding game rule page if (getArguments() != null && getArguments().containsKey(GAME)) { loadGameText(getArguments().getString(GAME)); }/*from ww w . j a va2 s . c o m*/ //load the table String[] gameList = lg.getDefaultGameNameList(getResources()); TableRow row = new TableRow(getContext()); TableLayout tableLayout = (TableLayout) view.findViewById(R.id.manual_games_container); TypedValue typedValue = new TypedValue(); getContext().getTheme().resolveAttribute(android.R.attr.selectableItemBackground, typedValue, true); TableRow.LayoutParams params = new TableRow.LayoutParams(0, TableRow.LayoutParams.WRAP_CONTENT); params.weight = 1; //add each button for (int i = 0; i < lg.getGameCount(); i++) { Button entry = new Button(getContext()); if (i % COLUMNS == 0) { row = new TableRow(getContext()); tableLayout.addView(row); } entry.setBackgroundResource(typedValue.resourceId); entry.setEllipsize(TextUtils.TruncateAt.END); entry.setMaxLines(1); entry.setLayoutParams(params); entry.setText(gameList[i]); entry.setOnClickListener(this); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) { entry.setAllCaps(false); } row.addView(entry); } //add some dummies to the last row, if necessary while (row.getChildCount() < COLUMNS) { FrameLayout dummy = new FrameLayout(getContext()); dummy.setLayoutParams(params); row.addView(dummy); } return view; }