Java Code Examples for android.support.v7.widget.GridLayout#Spec

The following examples show how to use android.support.v7.widget.GridLayout#Spec . 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: NumberPadTimePickerBottomSheetComponent.java    From NumberPadTimePicker with Apache License 2.0 6 votes vote down vote up
@Override
public void run() {
    switch (mBackspaceLocation) {
        case LOCATION_HEADER:
            break;
        case LOCATION_FOOTER:
            ((ViewGroup) mHeader).removeView(mBackspace);
            // The row of the cell in which the backspace key should go.
            // This specifies the row index, which spans one increment,
            // and indicates the cell should be filled along the row
            // (horizontal) axis.
            final GridLayout.Spec rowSpec = GridLayout.spec(
                    mNumberPad.getRowCount() - 1, GridLayout.FILL);
            // The column of the cell in which the backspace key should go.
            // This specifies the column index, which spans one increment,
            // and indicates the cell should be filled along the column
            // (vertical) axis.
            final GridLayout.Spec columnSpec = GridLayout.spec(
                    mNumberPad.getColumnCount() - 1, GridLayout.FILL);
            mNumberPad.addView(mBackspace, new GridLayout.LayoutParams(
                    rowSpec, columnSpec));
            break;
    }
}
 
Example 2
Source File: NumberPadTimePickerBottomSheetComponent.java    From BottomSheetPickers with Apache License 2.0 6 votes vote down vote up
@Override
public void run() {
    switch (mBackspaceLocation) {
        case LOCATION_HEADER:
            break;
        case LOCATION_FOOTER:
            ((ViewGroup) mHeader).removeView(mBackspace);
            // The row of the cell in which the backspace key should go.
            // This specifies the row index, which spans one increment,
            // and indicates the cell should be filled along the row
            // (horizontal) axis.
            final GridLayout.Spec rowSpec = GridLayout.spec(
                    mNumberPad.getRowCount() - 1, GridLayout.FILL);
            // The column of the cell in which the backspace key should go.
            // This specifies the column index, which spans one increment,
            // and indicates the cell should be filled along the column
            // (vertical) axis.
            final GridLayout.Spec columnSpec = GridLayout.spec(
                    mNumberPad.getColumnCount() - 1, GridLayout.FILL);
            mNumberPad.addView(mBackspace, new GridLayout.LayoutParams(
                    rowSpec, columnSpec));
            break;
    }
}
 
Example 3
Source File: Exchanger.java    From GreenBits with GNU General Public License v3.0 4 votes vote down vote up
Exchanger(final Context context, final GaService service, final View mView, final boolean isBuyPage, final OnCalculateCommissionFinishListener listener) {
    mContext = context;
    mService = service;
    mIsBuyPage = isBuyPage;
    mOnCalculateCommissionFinishListener = listener;

    mAmountFiatWithCommission = UI.find(mView, R.id.amountFiatWithCommission);
    mAmountBtcWithCommission = UI.find(mView, R.id.amountBtcWithCommission);

    final FontAwesomeTextView bitcoinUnitText = UI.find(mView, R.id.sendBitcoinUnitText2);
    UI.setCoinText(mService, bitcoinUnitText, null, null);

    final String currency = mService.getFiatCurrency();

    final FontAwesomeTextView fiatView = UI.find(mView, R.id.commissionFiatIcon);
    AmountFields.changeFiatIcon(fiatView, currency);

    if (mService.isElements()) {
        bitcoinUnitText.setText(String.format("%s ", mService.getAssetSymbol()));
        UI.hide(UI.find(mView, R.id.commissionFiatColumn));
    }

    mAmountFiatEdit = UI.find(mView, R.id.sendAmountFiatEditText);
    mAmountBtcEdit = UI.find(mView, R.id.sendAmountEditText);
    final String btnsValue = service.cfg().getString("exchanger_fiat_btns", "");
    if (!btnsValue.isEmpty()) {
        final String[] btnsValueArray = btnsValue.split(" ");
        final GridLayout gridLayout = UI.find(mView, R.id.gridLayout);
        for (final String value : btnsValueArray) {
            final Button btn = new Button(mContext);
            btn.setText(String.format("%s %s", value, currency));
            final GridLayout.Spec spec = GridLayout.spec(GridLayout.UNDEFINED, 1f);
            final GridLayout.LayoutParams param = new GridLayout.LayoutParams(spec, spec);
            btn.setLayoutParams(param);
            btn.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(final View view) {
                    mAmountFiatEdit.setText(value);
                    if (mService.isElements())
                        mAmountBtcEdit.setText(value);
                }
            });
            gridLayout.addView(btn);
        }
    }
}