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;
}
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;
}
Aggregations