Search in sources :

Example 56 with CardView

use of android.support.v7.widget.CardView in project bitcoin-wallet by bitcoin-wallet.

the class RequestCoinsFragment method onCreateView.

@Override
public View onCreateView(final LayoutInflater inflater, final ViewGroup container, final Bundle savedInstanceState) {
    final View view = inflater.inflate(R.layout.request_coins_fragment, container, false);
    qrView = (ImageView) view.findViewById(R.id.request_coins_qr);
    final CardView qrCardView = (CardView) view.findViewById(R.id.request_coins_qr_card);
    qrCardView.setCardBackgroundColor(Color.WHITE);
    qrCardView.setPreventCornerOverlap(false);
    qrCardView.setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(final View v) {
            BitmapFragment.show(getFragmentManager(), qrCodeBitmap.getBitmap());
        }
    });
    final CurrencyAmountView btcAmountView = (CurrencyAmountView) view.findViewById(R.id.request_coins_amount_btc);
    btcAmountView.setCurrencySymbol(config.getFormat().code());
    btcAmountView.setInputFormat(config.getMaxPrecisionFormat());
    btcAmountView.setHintFormat(config.getFormat());
    final CurrencyAmountView localAmountView = (CurrencyAmountView) view.findViewById(R.id.request_coins_amount_local);
    localAmountView.setInputFormat(Constants.LOCAL_FORMAT);
    localAmountView.setHintFormat(Constants.LOCAL_FORMAT);
    amountCalculatorLink = new CurrencyCalculatorLink(btcAmountView, localAmountView);
    acceptBluetoothPaymentView = (CheckBox) view.findViewById(R.id.request_coins_accept_bluetooth_payment);
    acceptBluetoothPaymentView.setVisibility(bluetoothAdapter != null ? View.VISIBLE : View.GONE);
    acceptBluetoothPaymentView.setChecked(bluetoothAdapter != null && bluetoothAdapter.isEnabled());
    acceptBluetoothPaymentView.setOnCheckedChangeListener(new OnCheckedChangeListener() {

        @Override
        public void onCheckedChanged(final CompoundButton buttonView, final boolean isChecked) {
            if (bluetoothAdapter != null && isChecked) {
                if (bluetoothAdapter.isEnabled()) {
                    maybeStartBluetoothListening();
                } else {
                    // ask for permission to enable bluetooth
                    startActivityForResult(new Intent(BluetoothAdapter.ACTION_REQUEST_ENABLE), REQUEST_CODE_ENABLE_BLUETOOTH);
                }
            } else {
                stopBluetoothListening();
            }
            updateView();
        }
    });
    initiateRequestView = (TextView) view.findViewById(R.id.request_coins_fragment_initiate_request);
    return view;
}
Also used : OnCheckedChangeListener(android.widget.CompoundButton.OnCheckedChangeListener) CardView(android.support.v7.widget.CardView) OnClickListener(android.view.View.OnClickListener) Intent(android.content.Intent) ImageView(android.widget.ImageView) View(android.view.View) CardView(android.support.v7.widget.CardView) TextView(android.widget.TextView) CompoundButton(android.widget.CompoundButton)

Example 57 with CardView

use of android.support.v7.widget.CardView in project zype-android by zype.

the class PlaylistFragment method onCreateView.

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    Logger.d("onCreateView");
    super.onCreateView(inflater, container, savedInstanceState);
    View view = inflater.inflate(R.layout.fragment_playlist, container, false);
    mListView = (ListView) view.findViewById(R.id.list_playlist);
    mListView.setOnItemClickListener(this);
    mListView.setEmptyView(view.findViewById(R.id.empty));
    mAdapter = new PlaylistCursorAdapter(getActivity(), PlaylistCursorAdapter.FLAG_REGISTER_CONTENT_OBSERVER, null, mOnLoginListener);
    mListView.setAdapter(mAdapter);
    mTvEmpty = (TextView) view.findViewById(R.id.empty);
    // listPlaylists = (RecyclerView) view.findViewById(R.id.listPlaylists);
    // adapter = new PlaylistAdapter();
    // adapter.setCursorAdapter(mAdapter);
    // listPlaylists.setAdapter(adapter);
    // final EditText searchField = (EditText) view.findViewById(R.id.search_field);
    // searchField.setOnKeyListener(new View.OnKeyListener() {
    // 
    // @Override
    // public boolean onKey(View v, int keyCode, KeyEvent event) {
    // if (event.getAction() == KeyEvent.ACTION_DOWN && event.getKeyCode() == KeyEvent.KEYCODE_ENTER) {
    // mListener.onSearch(searchField.getText().toString());
    // searchField.setText(null);
    // //                    if (SettingsProvider.getInstance().isLogined()) {
    // //                        mListener.onSearch(searchFiled.getText().toString());
    // //                    } else {
    // //                        mOnLoginListener.onRequestLogin();
    // //                    }
    // return true;
    // }
    // 
    // return false;
    // }
    // });
    // searchField.setOnEditorActionListener(new TextView.OnEditorActionListener() {
    // @Override
    // public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
    // if (actionId == EditorInfo.IME_ACTION_SEARCH) {
    // mListener.onSearch(searchField.getText().toString());
    // searchField.setText(null);
    // //                    if (SettingsProvider.getInstance().isLogined()) {
    // //                        mListener.onSearch(searchFiled.getText().toString());
    // //                    } else {
    // //                        mOnLoginListener.onRequestLogin();
    // //                    }
    // return true;
    // }
    // return false;
    // }
    // });
    // final Animation animationSearchShow = AnimationUtils.loadAnimation(getActivity(), R.anim.search_show);
    // int startRadius = 0;
    // int endRadius = (int) Math.hypot(searchField.getWidth(), searchField.getHeight());
    // Animator anim = ViewAnimationUtils.createCircularReveal(searchField, x, y, startRadius, endRadius);
    // 
    layoutSearch = (CardView) view.findViewById(R.id.layoutSearch);
    viewSearch = (SearchView) view.findViewById(R.id.viewSearch);
    viewSearch.setOnQueryTextListener(new SearchView.OnQueryTextListener() {

        @Override
        public boolean onQueryTextSubmit(String query) {
            mListener.onSearch(query);
            return false;
        }

        @Override
        public boolean onQueryTextChange(String newText) {
            return false;
        }
    });
    viewSearch.setOnCloseListener(new SearchView.OnCloseListener() {

        @Override
        public boolean onClose() {
            hideSearch();
            return true;
        }
    });
    viewSearch.setIconified(false);
    viewSearch.setFocusable(true);
    layoutSearch.setVisibility(View.INVISIBLE);
    buttonSearch = (FloatingActionButton) view.findViewById(R.id.buttonSearch);
    buttonSearch.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            int cx = (layoutSearch.getLeft() + layoutSearch.getRight());
            int cy = layoutSearch.getTop();
            int radius = Math.max(layoutSearch.getWidth(), layoutSearch.getHeight());
            Animator animator = ViewAnimationUtils.createCircularReveal(layoutSearch, cx, cy, 0, radius);
            animator.setInterpolator(new AccelerateDecelerateInterpolator());
            animator.setDuration(400);
            animator.addListener(new Animator.AnimatorListener() {

                @Override
                public void onAnimationStart(Animator animator) {
                }

                @Override
                public void onAnimationEnd(Animator animator) {
                    onShowSearch();
                }

                @Override
                public void onAnimationCancel(Animator animator) {
                }

                @Override
                public void onAnimationRepeat(Animator animator) {
                }
            });
            // Prepare reverse animation to hide search bar later
            animatorSearchReverse = ViewAnimationUtils.createCircularReveal(layoutSearch, cx, cy, radius, 0);
            animatorSearchReverse.setInterpolator(new AccelerateDecelerateInterpolator());
            animatorSearchReverse.setDuration(400);
            animatorSearchReverse.addListener(new Animator.AnimatorListener() {

                @Override
                public void onAnimationStart(Animator animation) {
                }

                @Override
                public void onAnimationEnd(Animator animation) {
                    layoutSearch.setVisibility(View.INVISIBLE);
                    buttonSearch.show();
                }

                @Override
                public void onAnimationCancel(Animator animation) {
                }

                @Override
                public void onAnimationRepeat(Animator animation) {
                }
            });
            layoutSearch.setVisibility(View.VISIBLE);
            animator.start();
            buttonSearch.hide();
        }
    });
    return view;
}
Also used : Animator(android.animation.Animator) SearchView(android.support.v7.widget.SearchView) AccelerateDecelerateInterpolator(android.view.animation.AccelerateDecelerateInterpolator) SearchView(android.support.v7.widget.SearchView) View(android.view.View) AdapterView(android.widget.AdapterView) CardView(android.support.v7.widget.CardView) TextView(android.widget.TextView) ListView(android.widget.ListView)

Aggregations

CardView (android.support.v7.widget.CardView)49 View (android.view.View)44 TextView (android.widget.TextView)41 AlertDialog (android.support.v7.app.AlertDialog)24 ImageView (android.widget.ImageView)19 RecyclerView (android.support.v7.widget.RecyclerView)18 DialogInterface (android.content.DialogInterface)16 ScrollView (android.widget.ScrollView)14 IconicsImageView (com.mikepenz.iconics.view.IconicsImageView)8 Intent (android.content.Intent)6 LinearLayoutManager (android.support.v7.widget.LinearLayoutManager)5 OnScrollListener (android.support.v7.widget.RecyclerView.OnScrollListener)5 EditText (android.widget.EditText)5 RadioGroup (android.widget.RadioGroup)5 SeekBar (android.widget.SeekBar)5 SystemServicesProxy (com.android.systemui.recents.misc.SystemServicesProxy)5 Task (com.android.systemui.recents.model.Task)5 LineColorPicker (uz.shift.colorpicker.LineColorPicker)5 SwitchCompat (android.support.v7.widget.SwitchCompat)4 CompoundButton (android.widget.CompoundButton)4