Example usage for android.widget TableLayout addView

List of usage examples for android.widget TableLayout addView

Introduction

In this page you can find the example usage for android.widget TableLayout addView.

Prototype

@Override
public void addView(View child) 

Source Link

Usage

From source file:org.mklab.mikity.android.editor.GroupEditor.java

private void createAnimationRotationBoxes(TableLayout parameters) {
    this.rotationXsource = new AnimationParameterInputBox(getContext(), this, this);
    parameters.addView(this.rotationXsource);
    this.rotationXsource.setName(R.string.rotation_wrt_x_axis);
    this.rotationXsource.setValue1("0"); //$NON-NLS-1$
    this.rotationXsource.setValue2("0"); //$NON-NLS-1$

    this.rotationYsource = new AnimationParameterInputBox(getContext(), this, this);
    parameters.addView(this.rotationYsource);
    this.rotationYsource.setName(R.string.rotation_wrt_y_axis);
    this.rotationYsource.setValue1("0"); //$NON-NLS-1$
    this.rotationYsource.setValue2("0"); //$NON-NLS-1$

    this.rotationZsource = new AnimationParameterInputBox(getContext(), this, this);
    parameters.addView(this.rotationZsource);
    this.rotationZsource.setName(R.string.rotation_wrt_z_axis);
    this.rotationZsource.setValue1("0"); //$NON-NLS-1$
    this.rotationZsource.setValue2("0"); //$NON-NLS-1$
}

From source file:org.mklab.mikity.android.editor.GroupEditor.java

private void createAnimationTranslationBoxes(TableLayout parameters) {
    this.translationXsource = new AnimationParameterInputBox(getContext(), this, this);
    parameters.addView(this.translationXsource);
    this.translationXsource.setName(R.string.translation_to_x_axis);
    this.translationXsource.setValue1("0"); //$NON-NLS-1$
    this.translationXsource.setValue2("0"); //$NON-NLS-1$

    this.translationYsource = new AnimationParameterInputBox(getContext(), this, this);
    parameters.addView(this.translationYsource);
    this.translationYsource.setName(R.string.translation_to_y_axis);
    this.translationYsource.setValue1("0"); //$NON-NLS-1$
    this.translationYsource.setValue2("0"); //$NON-NLS-1$

    this.translationZsource = new AnimationParameterInputBox(getContext(), this, this);
    parameters.addView(this.translationZsource);
    this.translationZsource.setName(R.string.translation_to_z_axis);
    this.translationZsource.setValue1("0"); //$NON-NLS-1$
    this.translationZsource.setValue2("0"); //$NON-NLS-1$
}

From source file:com.bonsai.btcreceive.TransactionsFragment.java

private void addTransactionHeader(TableLayout table) {
    TableRow row = (TableRow) LayoutInflater.from(getActivity()).inflate(R.layout.transaction_table_header,
            table, false);//from ww  w .java2 s. co m

    TextView tv = (TextView) row.findViewById(R.id.header_btc);
    tv.setText(BaseWalletActivity.getBTCFmt().unitStr());

    table.addView(row);
}

From source file:com.chess.genesis.dialog.GamePoolDialog.java

@Override
public void onCreate(final Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setTitle("Game Pool Info");
    setBodyView(R.layout.dialog_gamepool);
    setButtonTxt(R.id.cancel, "Close");

    final TableLayout table = (TableLayout) findViewById(R.id.layout01);
    final LayoutParams layout = (TableRow.LayoutParams) findViewById(R.id.left).getLayoutParams();

    for (final PoolDataItem item : data) {
        final TableRow row = new TableRow(context);

        TextView txt = new TextView(context);
        txt.setLayoutParams(layout);/*from   www. j  a  v a 2 s  . co  m*/
        txt.setText(item.gametype);
        row.addView(txt);

        txt = new TextView(context);
        txt.setText(item.time);
        row.addView(txt);

        table.addView(row);
    }
}

From source file:com.bonsai.wallet32.MainActivity.java

private void addBalanceHeader(TableLayout table) {
    TableRow row = (TableRow) LayoutInflater.from(this).inflate(R.layout.balance_table_header, table, false);

    TextView tv = (TextView) row.findViewById(R.id.header_btc);
    tv.setText(mBTCFmt.unitStr());// w ww  .jav a2 s .  co  m

    table.addView(row);
}

From source file:nl.openkvk.MainActivity.java

private void print(TableLayout tl, String l, String v) {
    if (v != null) {
        TextView v1 = new TextView(this);
        v1.setText(l);/*from   w w w  . j  a v  a  2s .c o  m*/
        TextView v2 = new TextView(this);
        v2.setText(v.toString());
        TableRow tr = new TableRow(this);
        tr.addView(v1);
        tr.addView(new TextView(this));
        tr.addView(v2);
        tl.addView(tr);
    }
}

From source file:com.df.app.carsWaiting.CarsWaitingListActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_cars_waiting);

    swipeListView = (SwipeListView) findViewById(R.id.carsWaitingList);

    data = new ArrayList<CarsWaitingItem>();

    adapter = new CarsWaitingListAdapter(this, data, new CarsWaitingListAdapter.OnAction() {
        @Override//w  w  w . ja v a 2s  .  co  m
        public void onEditPressed(int position) {
            swipeListView.openAnimate(position);
        }

        @Override
        public void onModifyProcedure(int positon) {
            CarsWaitingItem item = data.get(positon);
            Intent intent = new Intent(CarsWaitingListActivity.this, InputProceduresActivity.class);
            intent.putExtra("carId", item.getCarId());
            startActivity(intent);
        }

        @Override
        public void onDeleteCar(final int position) {
            View view1 = getLayoutInflater().inflate(R.layout.popup_layout, null);
            TableLayout contentArea = (TableLayout) view1.findViewById(R.id.contentArea);
            TextView content = new TextView(view1.getContext());
            content.setText(R.string.confirmDeleteCar);
            content.setTextSize(20f);
            contentArea.addView(content);

            setTextView(view1, R.id.title, getResources().getString(R.string.alert));

            AlertDialog dialog = new AlertDialog.Builder(CarsWaitingListActivity.this).setView(view1)
                    .setPositiveButton(R.string.ok, new DialogInterface.OnClickListener() {
                        @Override
                        public void onClick(DialogInterface dialogInterface, int i) {
                            CarsWaitingItem item = data.get(position);
                            deleteCar(item.getCarId());
                        }
                    }).setNegativeButton(R.string.cancel, null).create();

            dialog.show();
        }
    });

    swipeListView.setChoiceMode(ListView.CHOICE_MODE_SINGLE);
    swipeListView.setSwipeListViewListener(new BaseSwipeListViewListener() {
        @Override
        public void onClickFrontView(int position) {
            getCarDetail(data.get(position).getCarId(), CarCheckActivity.class);
        }

        @Override
        public void onDismiss(int[] reverseSortedPositions) {
            for (int position : reverseSortedPositions) {
                data.remove(position);
            }
            adapter.notifyDataSetChanged();
        }

        @Override
        public void onStartOpen(int position, int action, boolean right) {
            swipeListView.closeOpenedItems();
        }
    });

    swipeListView.setSwipeMode(SwipeListView.SWIPE_MODE_LEFT);
    swipeListView.setSwipeActionLeft(SwipeListView.SWIPE_ACTION_REVEAL);
    swipeListView.setLongClickable(false);
    swipeListView.setSwipeOpenOnLongPress(false);
    swipeListView.setOffsetLeft(620);
    swipeListView.setAnimationTime(300);
    swipeListView.setAdapter(adapter);

    footerView = ((LayoutInflater) this.getSystemService(Context.LAYOUT_INFLATER_SERVICE))
            .inflate(R.layout.footer, null, false);

    swipeListView.addFooterView(footerView);

    Button homeButton = (Button) findViewById(R.id.buttonHome);
    homeButton.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            finish();
        }
    });

    Button loadMoreButton = (Button) findViewById(R.id.loadMore);
    loadMoreButton.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            refresh(false);
        }
    });

    Button refreshButton = (Button) findViewById(R.id.buttonRefresh);
    refreshButton.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            refresh(true);
        }
    });

    refresh(true);
}

From source file:nl.tompeerdeman.ahd.highsore.HighScoreFragment.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View root = (TableLayout) inflater.inflate(R.layout.fragment_highscore, container, false);

    TableLayout rootTable = (TableLayout) root.findViewById(R.id.highscoreTableLayout);

    TableRow row;/*  w ww .  j a  va2 s  .  c  o  m*/
    TextView tView;

    row = (TableRow) inflater.inflate(R.layout.tablerow, rootTable, false);

    tView = (TextView) row.findViewById(R.id.table_word);
    tView.setText("Word");

    tView = (TextView) row.findViewById(R.id.table_badguesses);
    tView.setText("Bad guesses");

    tView = (TextView) row.findViewById(R.id.table_time);
    tView.setText("Time");

    rootTable.addView(row);

    highScoresModel.ensureLoaded();
    List<HighScoreEntry> entries;
    switch (type) {
    case 0:
        entries = highScoresModel.getHighScoresEvil();
        break;
    case 1:
        entries = highScoresModel.getHighScoresNormal();
        break;
    case 2:
        entries = highScoresModel.getHighScoresAll();
        break;
    default:
        entries = Collections.emptyList();
    }

    for (HighScoreEntry entry : entries) {
        row = (TableRow) inflater.inflate(R.layout.tablerow, rootTable, false);

        tView = (TextView) row.findViewById(R.id.table_word);
        tView.setText(entry.getWord());

        tView = (TextView) row.findViewById(R.id.table_badguesses);
        tView.setText(String.valueOf(entry.getBadGuesses()));

        tView = (TextView) row.findViewById(R.id.table_time);
        tView.setText(TIME_FORMAT.format(new Date(entry.getTime())));

        rootTable.addView(row);
    }

    if (entries.size() == 0) {
        row = (TableRow) inflater.inflate(R.layout.tablerow, rootTable, false);

        tView = (TextView) row.findViewById(R.id.table_word);
        tView.setText("No entries");

        rootTable.addView(row);
    }

    return root;
}

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());/*  ww w .j  a  va 2 s .  co m*/

    table.addView(row);
}

From source file:com.df.kia.carsWaiting.CarsWaitingListActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_cars_waiting);

    swipeListView = (SwipeListView) findViewById(R.id.carsWaitingList);

    data = new ArrayList<CarsWaitingItem>();

    adapter = new CarsWaitingListAdapter(this, data, new CarsWaitingListAdapter.OnAction() {
        @Override//from  w  w  w.  j  a v a  2  s . com
        public void onEditPressed(int position) {
            swipeListView.openAnimate(position);
        }

        @Override
        public void onModifyProcedure(int positon) {
            CarsWaitingItem item = data.get(positon);
            Intent intent = new Intent(CarsWaitingListActivity.this, InputProceduresActivity.class);
            intent.putExtra("carId", item.getCarId());
            startActivity(intent);
        }

        @Override
        public void onDeleteCar(final int position) {
            View view1 = getLayoutInflater().inflate(R.layout.popup_layout, null);
            TableLayout contentArea = (TableLayout) view1.findViewById(R.id.contentArea);
            TextView content = new TextView(view1.getContext());
            content.setText(R.string.confirmDeleteCar);
            content.setTextSize(20f);
            contentArea.addView(content);

            setTextView(view1, R.id.title, getResources().getString(R.string.alert));

            AlertDialog dialog = new AlertDialog.Builder(CarsWaitingListActivity.this).setView(view1)
                    .setPositiveButton(R.string.ok, new DialogInterface.OnClickListener() {
                        @Override
                        public void onClick(DialogInterface dialogInterface, int i) {
                            CarsWaitingItem item = data.get(position);
                            deleteCar(item.getCarId());
                        }
                    }).setNegativeButton(R.string.cancel, null).create();

            dialog.show();
        }
    });

    swipeListView.setChoiceMode(ListView.CHOICE_MODE_SINGLE);
    swipeListView.setSwipeListViewListener(new BaseSwipeListViewListener() {
        @Override
        public void onClickFrontView(int position) {
            getCarDetail(data.get(position).getCarId(), CarCheckActivity.class);
        }

        @Override
        public void onDismiss(int[] reverseSortedPositions) {
            for (int position : reverseSortedPositions) {
                data.remove(position);
            }
            adapter.notifyDataSetChanged();
        }

        @Override
        public void onStartOpen(int position, int action, boolean right) {
            swipeListView.closeOpenedItems();
            lastPos = position;
        }
    });

    swipeListView.setSwipeMode(SwipeListView.SWIPE_MODE_LEFT);
    swipeListView.setSwipeActionLeft(SwipeListView.SWIPE_ACTION_REVEAL);
    swipeListView.setLongClickable(false);
    swipeListView.setSwipeOpenOnLongPress(false);
    swipeListView.setOffsetLeft(620);
    swipeListView.setAnimationTime(300);
    swipeListView.setAdapter(adapter);

    footerView = ((LayoutInflater) this.getSystemService(Context.LAYOUT_INFLATER_SERVICE))
            .inflate(R.layout.footer, null, false);

    swipeListView.addFooterView(footerView);

    Button homeButton = (Button) findViewById(R.id.buttonHome);
    homeButton.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            finish();
        }
    });

    Button loadMoreButton = (Button) findViewById(R.id.loadMore);
    loadMoreButton.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            refresh();
        }
    });

    Button refreshButton = (Button) findViewById(R.id.buttonRefresh);
    refreshButton.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            startNumber = 1;
            data.clear();
            adapter.notifyDataSetChanged();

            swipeListView.closeOpenedItems();

            refresh();
        }
    });

    refresh();
}