Java Code Examples for android.widget.TableRow#findViewById()

The following examples show how to use android.widget.TableRow#findViewById() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ReplayStepFragment.java    From SoloPi with Apache License 2.0 6 votes vote down vote up
ResultItemViewHolder(View v) {
    super(v);
    mActionName = (TextView) v.findViewById(R.id.text_case_result_step_title);
    mActionParam = (TextView) v.findViewById(R.id.text_case_result_step_param);
    mPrepareActions = (TextView) v.findViewById(R.id.text_case_result_step_prepare);
    mStatus = (TextView) v.findViewById(R.id.text_case_result_step_status);


    mParamRow = (TableRow) v.findViewById(R.id.row_case_result_step_param);
    mPrepareRow = (TableRow) v.findViewById(R.id.row_case_result_step_prepare);
    mNodeRow = (TableRow) v.findViewById(R.id.row_case_result_step_node);
    mCaptureRow = (TableRow) v.findViewById(R.id.row_case_result_step_capture);

    mTargetNode = mNodeRow.findViewById(R.id.text_case_result_step_target_node);
    mFindNode = mNodeRow.findViewById(R.id.text_case_result_step_find_node);

    mTargetCapture = (ImageView) mCaptureRow.findViewById(R.id.img_case_result_target);
    mFindCapture = (ImageView) mCaptureRow.findViewById(R.id.img_case_result_find);

    mTargetNode.setOnClickListener(this);
    mFindNode.setOnClickListener(this);
    mTargetCapture.setOnClickListener(this);
    mFindCapture.setOnClickListener(this);
}
 
Example 2
Source File: ListItemExtensions.java    From Android-WYSIWYG-Editor with Apache License 2.0 6 votes vote down vote up
public CustomEditText setFocusToSpecific(CustomEditText customEditText) {
    TableRow tableRow = (TableRow) customEditText.getParent();
    TableLayout tableLayout = (TableLayout) tableRow.getParent();
    int indexOnTable = tableLayout.indexOfChild(tableRow);
    if (indexOnTable == 0) {
        //what if index is 0, get the previous on edittext
    }
    TableRow prevRow = (TableRow) tableLayout.getChildAt(indexOnTable - 1);
    if (prevRow != null) {
        CustomEditText editText = (CustomEditText) tableRow.findViewById(R.id.txtText);
        if (editText.requestFocus()) {
            editText.setSelection(editText.getText().length());
        }
        return editText;
    }
    return null;
}
 
Example 3
Source File: CharadesResultsAdapter.java    From gdk-charades-sample with Apache License 2.0 6 votes vote down vote up
/**
 * Inflates and returns a tabular layout that can hold five phrases.
 * <p>
 * This method only inflates the views and sets the tag of the root view to be an array of
 * {@link PhraseViewHolder} objects. The caller should pass this view, or a recycled view if
 * it has one, to {@link #updatePhraseListView(View,int)} in order to populate it with data.
 */
private View inflatePhraseListView(ViewGroup parent) {
    TableLayout table =
            (TableLayout) mLayoutInflater.inflate(R.layout.card_results_phrase_list, parent);

    // Add five phrases to the card, or fewer if it is the last card and the total number of
    // phrases is not an even multiple of PHRASES_PER_CARD.
    PhraseViewHolder[] holders = new PhraseViewHolder[PHRASES_PER_CARD];
    for (int i = 0; i < PHRASES_PER_CARD; i++) {
        TableRow row = (TableRow) mLayoutInflater.inflate(R.layout.table_row_result, null);
        table.addView(row);

        PhraseViewHolder holder = new PhraseViewHolder();
        holder.imageView = (ImageView) row.findViewById(R.id.image);
        holder.phraseView = (TextView) row.findViewById(R.id.phrase);
        holders[i] = holder;
    }
    table.setTag(holders);
    return table;
}
 
Example 4
Source File: RadioSectionFragment.java    From satstat with GNU General Public License v3.0 6 votes vote down vote up
protected void showCellCdma(CellTowerCdma cellTower) {
	TableRow row = (TableRow) mainActivity.getLayoutInflater().inflate(R.layout.ril_cdma_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,new TableLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT));
}
 
Example 5
Source File: ListItemExtensions.java    From Android-WYSIWYG-Editor with Apache License 2.0 5 votes vote down vote up
private void rearrangeColumns(TableLayout _table) {
    //TODO, make sure that if OL, all the items are ordered numerically
    for (int i = 0; i < _table.getChildCount(); i++) {
        TableRow tableRow = (TableRow) _table.getChildAt(i);
        TextView _bullet = (TextView) tableRow.findViewById(R.id.lblOrder);
        _bullet.setText(String.valueOf(i + 1) + ".");
    }
}
 
Example 6
Source File: ListItemExtensions.java    From Android-WYSIWYG-Editor with Apache License 2.0 5 votes vote down vote up
public void validateAndRemoveLisNode(View view, EditorControl contentType) {
    /*
     *
     * If the person was on an active ul|li, move him to the previous node
     *
     */
    TableRow _row = (TableRow) view.getParent();
    TableLayout _table = (TableLayout) _row.getParent();
    int indexOnList = _table.indexOfChild(_row);
    _table.removeView(_row);
    if (indexOnList > 0) {
        /**
         * check if the index of the deleted row is <0, if so, move the focus to the previous li
         */
        TableRow focusrow = (TableRow) _table.getChildAt(indexOnList - 1);
        EditText text = (EditText) focusrow.findViewById(R.id.txtText);
        /**
         * Rearrange the nodes
         */
        if (contentType.Type == EditorType.OL_LI) {
            rearrangeColumns(_table);
        }
        if (text.requestFocus()) {
            text.setSelection(text.getText().length());
        }
    } else {
        /**
         * The removed row was first on the list. delete the list, and set the focus to previous element on the editor
         */
        editorCore.removeParent(_table);
    }
}
 
Example 7
Source File: ListItemExtensions.java    From Android-WYSIWYG-Editor with Apache License 2.0 5 votes vote down vote up
public void setFocusToList(View view, int position) {
    TableLayout tableLayout = (TableLayout) view;
    int count = tableLayout.getChildCount();
    if (tableLayout.getChildCount() > 0) {
        TableRow tableRow = (TableRow) tableLayout.getChildAt(position == POSITION_START ? 0 : count - 1);
        if (tableRow != null) {
            EditText editText = (EditText) tableRow.findViewById(R.id.txtText);
            if (editText.requestFocus()) {
                editText.setSelection(editText.getText().length());
            }
        }
    }
}
 
Example 8
Source File: MainActivityTest.java    From Simple-Accounting with GNU General Public License v3.0 5 votes vote down vote up
protected TableRow createNewRow(String credit, String debit) {
    fab.callOnClick();

    TableRow row = (TableRow) table.getChildAt(table.getEditableRow());
    EditText creditEditable = row.findViewById(R.id.editCredit);
    EditText debitEditable = row.findViewById(R.id.editDebit);

    creditEditable.setText(credit);
    debitEditable.setText(debit);

    table.editableRowToView();

    return row;
}
 
Example 9
Source File: RadioSectionFragment.java    From satstat with GNU General Public License v3.0 5 votes vote down vote up
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(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));
}
 
Example 10
Source File: RadioSectionFragment.java    From satstat with GNU General Public License v3.0 5 votes vote down vote up
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 {
		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));
}
 
Example 11
Source File: HighScoresFragment.java    From Simple-Solitaire with GNU General Public License v3.0 4 votes vote down vote up
/**
 * Loads the high score list
 */
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View view = inflater.inflate(R.layout.fragment_statistics_tab2, container, false);

    //if the app got killed while the statistics are open and then the user restarts the app,
    //my helper classes aren't initialized so they can't be used. In this case, simply
    //close the statistics
    try {
        loadData();
    } catch (NullPointerException e) {
        getActivity().finish();
        return view;
    }

    TableLayout tableLayout = view.findViewById(R.id.statisticsTableHighScores);
    TextView textNoEntries = view.findViewById(R.id.statisticsTextNoEntries);

    if (scores.getHighScore(0, 0) != 0) {
        textNoEntries.setVisibility(View.GONE);
    }

    for (int i = 0; i < Scores.MAX_SAVED_SCORES; i++) { //for each entry in highScores, add a new view with it
        if (scores.getHighScore(i, 0) == 0) {        //if the score is zero, don't show it
            continue;
        }

        TableRow row = (TableRow) LayoutInflater.from(getContext()).inflate(R.layout.statistics_scores_row, null);

        TextView textView1 = row.findViewById(R.id.row_cell_1);
        TextView textView2 = row.findViewById(R.id.row_cell_2);
        TextView textView3 = row.findViewById(R.id.row_cell_3);
        TextView textView4 = row.findViewById(R.id.row_cell_4);

        textView1.setText(String.format(Locale.getDefault(), "%s %s", scores.getHighScore(i, 0), dollar));
        long time = scores.getHighScore(i, 1);
        textView2.setText(String.format(Locale.getDefault(), "%02d:%02d:%02d", time / 3600, (time % 3600) / 60, (time % 60)));
        textView3.setText(DateFormat.getDateInstance(DateFormat.SHORT).format(scores.getHighScore(i, 2)));
        textView4.setText(new SimpleDateFormat("HH:mm", Locale.getDefault()).format(scores.getHighScore(i, 2)));

        tableLayout.addView(row);
    }

    return view;
}
 
Example 12
Source File: RecentScoresFragment.java    From Simple-Solitaire with GNU General Public License v3.0 4 votes vote down vote up
/**
 * Loads the high score list
 */
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View view = inflater.inflate(R.layout.fragment_statistics_tab3, container, false);

    //if the app got killed while the statistics are open and then the user restarts the app,
    //my helper classes aren't initialized so they can't be used. In this case, simply
    //close the statistics
    try {
        loadData();
    } catch (NullPointerException e) {
        getActivity().finish();
        return view;
    }

    TableLayout tableLayout = view.findViewById(R.id.statisticsTableHighScores);
    TextView textNoEntries = view.findViewById(R.id.statisticsTextNoEntries);

    if (scores.getRecentScore(0, 2) != 0) {
        textNoEntries.setVisibility(View.GONE);
    }

    for (int i = 0; i < Scores.MAX_SAVED_SCORES; i++) { //for each entry in highScores, add a new view with it
        if (scores.getRecentScore(i, 2) == 0) {      //if the score is zero, don't show it
            continue;
        }

        TableRow row = (TableRow) LayoutInflater.from(getContext())
                .inflate(R.layout.statistics_scores_row, null);

        TextView textView1 = row.findViewById(R.id.row_cell_1);
        TextView textView2 = row.findViewById(R.id.row_cell_2);
        TextView textView3 = row.findViewById(R.id.row_cell_3);
        TextView textView4 = row.findViewById(R.id.row_cell_4);

        textView1.setText(String.format(Locale.getDefault(), "%s %s", scores.getRecentScore(i, 0), dollar));
        long time = scores.getRecentScore(i, 1);
        textView2.setText(String.format(Locale.getDefault(), "%02d:%02d:%02d", time / 3600, (time % 3600) / 60, (time % 60)));
        textView3.setText(DateFormat.getDateInstance(DateFormat.SHORT).format(scores.getRecentScore(i, 2)));
        textView4.setText(new SimpleDateFormat("HH:mm", Locale.getDefault()).format(scores.getRecentScore(i, 2)));

        tableLayout.addView(row);
    }

    return view;
}
 
Example 13
Source File: MonsterStatusFragment.java    From MonsterHunter4UDatabase with MIT License 4 votes vote down vote up
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
                         Bundle savedInstanceState) {

    // Inflate the layout for this fragment
    View view = inflater.inflate(R.layout.fragment_monster_status, container, false);

    mStatusTable = (TableLayout) view.findViewById(R.id.statusTable);

    ArrayList<MonsterStatus> statuses =
            DataManager.get(getActivity()).queryMonsterStatus(getArguments().getLong(ARG_MONSTER_ID));

    MonsterStatus currentStatus = null;
    String status, initial, increase, max, duration, damage;
    String imageFile;

    for(int i = 0; i < statuses.size(); i++) {
        TableRow wdRow = (TableRow) inflater.inflate(
                R.layout.fragment_monster_status_listitem, mStatusTable, false);

        currentStatus = statuses.get(i);

        // Get our strings and our views
        status = currentStatus.getStatus();
        initial = Long.toString(currentStatus.getInitial());
        increase = Long.toString(currentStatus.getIncrease());
        max = Long.toString(currentStatus.getMax());
        duration = Long.toString(currentStatus.getDuration());
        damage = Long.toString(currentStatus.getDamage());

        ImageView statusImage = (ImageView) wdRow.findViewById(R.id.statusImage);
        TextView initialView = (TextView) wdRow.findViewById(R.id.initial);
        TextView increaseView = (TextView) wdRow.findViewById(R.id.increase);
        TextView maxView = (TextView) wdRow.findViewById(R.id.max);
        TextView durationView = (TextView) wdRow.findViewById(R.id.duration);
        TextView damageView = (TextView) wdRow.findViewById(R.id.damage);

        // Check which image to load
        boolean image = true;
        imageFile = "icons_monster_info/";
        switch (status)
        {
            case "Poison":
                imageFile = imageFile + "Poison.png";
                break;
            case "Sleep":
                imageFile = imageFile + "Sleep.png";
                break;
            case "Para":
                imageFile = imageFile + "Paralysis.png";
                break;
            case "KO":
                imageFile = imageFile + "Stun.png";
                break;
            case "Exhaust":
                //statusView.setText(status);
                imageFile = imageFile + "exhaust.png";
                break;
            case "Blast":
                imageFile = imageFile + "Blastblight.png";
                break;
            case "Jump":
                //statusView.setText(status);
                imageFile = imageFile + "jump.png";
                break;
            case "Mount":
                //statusView.setText(status);
                imageFile = imageFile + "mount.png";
                break;
        }

        // initialize our views
        initialView.setText(initial);
        increaseView.setText(increase);
        maxView.setText(max);
        durationView.setText(duration);
        damageView.setText(damage);

        if (image) {
            Drawable draw = null;
            try {
                draw = Drawable.createFromStream(
                        getActivity().getAssets().open(imageFile), null);
            } catch (IOException e) {
                e.printStackTrace();
            }
            android.view.ViewGroup.LayoutParams layoutParams = statusImage.getLayoutParams();
            statusImage.setLayoutParams(layoutParams);

            statusImage.setImageDrawable(draw);
        }

        mStatusTable.addView(wdRow);
    }

    return view;
}