Java Code Examples for android.support.design.widget.BottomSheetDialog#setContentView()
The following examples show how to use
android.support.design.widget.BottomSheetDialog#setContentView() .
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: MainActivity.java From AndroidWallet with GNU General Public License v3.0 | 7 votes |
private void showAccountNotExistDialog(BaseInvokeModel baseInvokeModel, BaseInfo baseInfo) { bottomSheetDialog = new BottomSheetDialog(MainActivity.this); DialogAuthorAccountNotExistBinding binding = DataBindingUtil.inflate(LayoutInflater.from(Utils.getContext()), R.layout.dialog_author_account_not_exist, null, false); bottomSheetDialog.setContentView(binding.getRoot()); // 设置dialog 完全显示 View parent = (View) binding.getRoot().getParent(); BottomSheetBehavior behavior = BottomSheetBehavior.from(parent); binding.getRoot().measure(0, 0); behavior.setPeekHeight(binding.getRoot().getMeasuredHeight()); CoordinatorLayout.LayoutParams params = (CoordinatorLayout.LayoutParams) parent.getLayoutParams(); params.gravity = Gravity.TOP | Gravity.CENTER_HORIZONTAL; parent.setLayoutParams(params); bottomSheetDialog.setCanceledOnTouchOutside(false); final ConfrimDialogViewModel confrimDialogViewModel = new ConfrimDialogViewModel(getApplication()); confrimDialogViewModel.setBaseInfo(baseInvokeModel, baseInfo); binding.setViewModel(confrimDialogViewModel); bottomSheetDialog.show(); }
Example 2
Source File: BottomSheetActivity.java From CoordinatorLayoutExample with Apache License 2.0 | 6 votes |
@Override public void onClick(View v) { switch (v.getId()) { case R.id.btnBehavior: int state = behavior.getState(); if (state == BottomSheetBehavior.STATE_EXPANDED) { behavior.setState(BottomSheetBehavior.STATE_COLLAPSED); } else if(state == BottomSheetBehavior.STATE_COLLAPSED){ behavior.setState(BottomSheetBehavior.STATE_HIDDEN); }else if(state == BottomSheetBehavior.STATE_HIDDEN){ behavior.setState(BottomSheetBehavior.STATE_EXPANDED); } break; case R.id.btnDialog: BottomSheetDialog bottomSheetDialog = new BottomSheetDialog(this); bottomSheetDialog.setContentView(R.layout.include_bottom_sheet_layout); bottomSheetDialog.show(); break; case R.id.btn_baidumap: readyGo(BaiduMapSample.class); break; } }
Example 3
Source File: RegisterPresenterImpl.java From Saude-no-Mapa with MIT License | 6 votes |
private void setupBottomSheetDialog() { mBottomSheetDialog = new BottomSheetDialog(mContext); View dialogView = LayoutInflater.from(mContext) .inflate(R.layout.dialog_bottom_sheet_profile, null); RecyclerView avatarRecycler = (RecyclerView) dialogView.findViewById(R.id.avatar_recycler); avatarRecycler.setHasFixedSize(true); avatarRecycler.setLayoutManager(new GridLayoutManager(mContext, 3, GridLayoutManager.VERTICAL, false)); avatarRecycler.setAdapter(new AvatarAdapter(mContext, this)); mBottomSheetDialog.setContentView(dialogView); dialogView.measure(View.MeasureSpec.UNSPECIFIED, View.MeasureSpec.UNSPECIFIED); BottomSheetBehavior mBehavior = BottomSheetBehavior.from((View) dialogView.getParent()); mBehavior.setPeekHeight(dialogView.getMeasuredHeight() + 200); mBottomSheetDialog.show(); }
Example 4
Source File: EditProfilePresenterImpl.java From Saude-no-Mapa with MIT License | 6 votes |
private void setupBottomSheetDialog() { mBottomSheetDialog = new BottomSheetDialog(mContext); View dialogView = LayoutInflater.from(mContext) .inflate(R.layout.dialog_bottom_sheet_profile, null); RecyclerView avatarRecycler = (RecyclerView) dialogView.findViewById(R.id.avatar_recycler); avatarRecycler.setHasFixedSize(true); avatarRecycler.setLayoutManager(new GridLayoutManager(mContext, 3, GridLayoutManager.VERTICAL, false)); avatarRecycler.setAdapter(new AvatarAdapter(mContext, this)); mBottomSheetDialog.setContentView(dialogView); dialogView.measure(View.MeasureSpec.UNSPECIFIED, View.MeasureSpec.UNSPECIFIED); BottomSheetBehavior mBehavior = BottomSheetBehavior.from((View) dialogView.getParent()); mBehavior.setPeekHeight(dialogView.getMeasuredHeight() + 200); mBottomSheetDialog.show(); }
Example 5
Source File: MyDialogBuilder.java From DialogUtil with Apache License 2.0 | 5 votes |
private void buildBottomSheet(ConfigBean bean) { final BottomSheetDialog dialog = new BottomSheetDialog(bean.context); Tool.removeFromParent(bean.customView); dialog.setContentView(bean.customView); bean.forceWidthPercent = 1.0f; dialog.setCancelable(bean.cancelable); dialog.setCanceledOnTouchOutside(bean.outsideTouchable); bean.dialog = dialog; }
Example 6
Source File: GankViewActivity.java From FlipGank with Apache License 2.0 | 5 votes |
@OnClick(R.id.more) void showMore(View view) { BottomSheetDialog bottomSheetDialog = new BottomSheetDialog(this); GankBottom gankBottom = (GankBottom) LayoutInflater.from(this).inflate(R.layout.bottom_sheet, null, false); gankBottom.bind(mGankItem, null); bottomSheetDialog.setContentView( gankBottom); bottomSheetDialog.show(); }
Example 7
Source File: MyBottomSheetDialogFragment.java From AndroidSamples with Apache License 2.0 | 5 votes |
@Override public Dialog onCreateDialog(Bundle savedInstanceState) { BottomSheetDialog dialog = (BottomSheetDialog) super.onCreateDialog(savedInstanceState); View view = View.inflate(getContext(), R.layout.dialog_bottom_sheet, null); dialog.setContentView(view); mBehavior = BottomSheetBehavior.from((View) view.getParent()); return dialog; }
Example 8
Source File: NoteMainActivity.java From SuperNote with GNU General Public License v3.0 | 5 votes |
@Override public void showMoveBottomSheet() { final BottomSheetDialog dialog = new BottomSheetDialog(mContext); // 获取contentView ViewGroup contentView = (ViewGroup) ((ViewGroup) findViewById(android.R.id.content)).getChildAt(0); View root = LayoutInflater.from(mContext).inflate(R.layout.bottom_sheet_folder, contentView, false); RecyclerView recyclerView = (RecyclerView) root.findViewById(R.id.recycler_bottom_sheet_folder); recyclerView.setLayoutManager(new LinearLayoutManager(mContext)); dialog.setContentView(root); recyclerView.setAdapter(getBottomSheetRvAdapter(dialog)); dialog.show(); }
Example 9
Source File: DialogViewBuilder.java From DialogUtil with Apache License 2.0 | 5 votes |
private void buildBottomSheet(ConfigBean bean) { final BottomSheetDialog dialog = new BottomSheetDialog(bean.context); Tool.removeFromParent(bean.customView); dialog.setContentView(bean.customView); bean.forceWidthPercent = 1.0f; dialog.setCancelable(bean.cancelable); dialog.setCanceledOnTouchOutside(bean.outsideTouchable); bean.dialog = dialog; }
Example 10
Source File: TagSettings.java From com.ruuvi.station with BSD 3-Clause "New" or "Revised" License | 5 votes |
private void showImageSourceSheet() { final BottomSheetDialog sheetDialog = new BottomSheetDialog(this); ListView listView = new ListView(this); String[] menu = { getResources().getString(R.string.camera), getResources().getString(R.string.gallery) }; listView.setAdapter(new ArrayAdapter<>(this, android.R.layout.simple_list_item_1, menu)); listView.setOnItemClickListener(new AdapterView.OnItemClickListener() { @Override public void onItemClick(AdapterView<?> parent, View view, int position, long id) { switch (position) { case 0: dispatchTakePictureIntent(); break; case 1: getImageFromGallery(); break; } sheetDialog.dismiss(); } }); sheetDialog.setContentView(listView); sheetDialog.show(); }
Example 11
Source File: WalletsActivity.java From trust-wallet-android-source with GNU General Public License v3.0 | 5 votes |
private void onAddWallet() { AddWalletView addWalletView = new AddWalletView(this); addWalletView.setOnNewWalletClickListener(this); addWalletView.setOnImportWalletClickListener(this); dialog = new BottomSheetDialog(this); dialog.setContentView(addWalletView); dialog.setCancelable(true); dialog.setCanceledOnTouchOutside(true); dialog.show(); }
Example 12
Source File: WalletsActivity.java From alpha-wallet-android with MIT License | 5 votes |
private void onAddWallet() { AddWalletView addWalletView = new AddWalletView(this); addWalletView.setOnNewWalletClickListener(this); addWalletView.setOnImportWalletClickListener(this); addWalletView.setOnWatchWalletClickListener(this); addWalletView.setOnCloseActionListener(this); dialog = new BottomSheetDialog(this); dialog.setContentView(addWalletView); dialog.setCancelable(true); dialog.setCanceledOnTouchOutside(true); BottomSheetBehavior behavior = BottomSheetBehavior.from((View) addWalletView.getParent()); dialog.setOnShowListener(dialog -> behavior.setPeekHeight(addWalletView.getHeight())); dialog.show(); }
Example 13
Source File: OrderSheet.java From in-app-payments-android-quickstart with Apache License 2.0 | 5 votes |
public void show(Activity activity) { showing = true; BottomSheetDialog dialog = new BottomSheetDialog(activity); View sheetView = LayoutInflater.from(activity).inflate(R.layout.sheet_order, null); View closeButton = sheetView.findViewById(R.id.close_sheet_button); View payWithCardButton = sheetView.findViewById(R.id.pay_with_card_button); payWithCardButton.setOnClickListener(v -> { dialog.dismiss(); showing = false; onPayWithCardClickListener.run(); }); payWithGoogleButton = sheetView.findViewById(R.id.pay_with_google_button); payWithGoogleButton.setEnabled(payWithGoogleButtonEnabled); payWithGoogleButton.setOnClickListener(v -> { dialog.dismiss(); showing = false; onPayWithGoogleClickListener.run(); }); closeButton.setOnClickListener(v -> dialog.dismiss()); dialog.setContentView(sheetView); BottomSheetBehavior behavior = BottomSheetBehavior.from((View) sheetView.getParent()); dialog.setOnShowListener(dialogInterface -> behavior.setPeekHeight(sheetView.getHeight())); dialog.setOnCancelListener(dialog1 -> showing = false); dialog.setCancelable(true); dialog.show(); }
Example 14
Source File: WalletsActivity.java From ETHWallet with GNU General Public License v3.0 | 5 votes |
private void onAddWallet() { AddWalletView addWalletView = new AddWalletView(this); addWalletView.setOnNewWalletClickListener(this); addWalletView.setOnImportWalletClickListener(this); dialog = new BottomSheetDialog(this); dialog.setContentView(addWalletView); dialog.setCancelable(true); dialog.setCanceledOnTouchOutside(true); dialog.show(); }
Example 15
Source File: BottomSheetLogView.java From bleYan with GNU General Public License v2.0 | 5 votes |
/** * @param context */ public BottomSheetLogView(Context context, List<String> logInfoList) { mDialog = new BottomSheetDialog(context); View view = LayoutInflater.from(context).inflate(R.layout.bottom_sheet_log_recycler_view, null); RecyclerView recyclerView = (RecyclerView) view.findViewById(R.id.bottom_sheet_recycler_view); recyclerView.setLayoutManager(new LinearLayoutManager(context)); mAdapter = new BleLogAdapter(logInfoList); recyclerView.setAdapter(mAdapter); mDialog.setContentView(view); mDialog.show(); }
Example 16
Source File: BottomSheetDialogView.java From MaterialHome with Apache License 2.0 | 5 votes |
public BottomSheetDialogView(Context context) { this.mContext = context; dialog = new BottomSheetDialog(context, R.style.MyBottomSheetDialogTheme); View view = LayoutInflater.from(context).inflate(R.layout.bottom_sheet_layout, null); iv_icon = (ImageView) view.findViewById(R.id.iv_icon); tv_title = (TextView) view.findViewById(R.id.tv_title); recyclerView = (RecyclerView) view.findViewById(R.id.bottom_sheet_recycler_view); dialog.setContentView(view); this.dialog.dismiss(); }
Example 17
Source File: BottomSheetActivity.java From AndroidSamples with Apache License 2.0 | 4 votes |
private void bootomSheetDialog() { BottomSheetDialog dialog = new BottomSheetDialog(BottomSheetActivity.this); View view = getLayoutInflater().inflate(R.layout.dialog_bottom_sheet, null); dialog.setContentView(view); dialog.show(); }
Example 18
Source File: EstablishmentPresenterImpl.java From Saude-no-Mapa with MIT License | 4 votes |
private void showFilterBottomSheetDialog() { mIsFiltered = false; BottomSheetDialog bottomSheetDialog = new BottomSheetDialog(mContext); View dialogView = LayoutInflater.from(mContext).inflate(R.layout.dialog_bottom_sheet_filter, null); FilterViews bottomViews = new FilterViews(); ButterKnife.bind(bottomViews, dialogView); mCurrentFilterTitle = bottomViews.filterTitle; updateCurrentFilterTitle(); bottomViews.redeAtendimentoSpinner.setAdapter(getRedeAtendimentoAdapter()); bottomViews.categoriaSpinner.setAdapter(getCategoriaSpinner()); RxAdapterView.itemSelections(bottomViews.redeAtendimentoSpinner).subscribe(integer -> { doFilter(bottomViews); }); RxAdapterView.itemSelections(bottomViews.categoriaSpinner).subscribe(integer -> { doFilter(bottomViews); }); RxCompoundButton.checkedChanges(bottomViews.vinculoSusCheckbox).subscribe(isChecked -> { doFilter(bottomViews); }); RxCompoundButton.checkedChanges(bottomViews.atendimentoUrgencialCheckbox).subscribe(isChecked -> { doFilter(bottomViews); }); RxCompoundButton.checkedChanges(bottomViews.atendimentoAmbulatorialCheckbox).subscribe(isChecked -> { doFilter(bottomViews); }); RxCompoundButton.checkedChanges(bottomViews.centroCirurgicoCheckbox).subscribe(isChecked -> { doFilter(bottomViews); }); RxCompoundButton.checkedChanges(bottomViews.obstetraCheckbox).subscribe(isChecked -> { doFilter(bottomViews); }); RxCompoundButton.checkedChanges(bottomViews.neoNatalCheckbox).subscribe(isChecked -> { doFilter(bottomViews); }); RxCompoundButton.checkedChanges(bottomViews.dialiseCheckbox).subscribe(isChecked -> { doFilter(bottomViews); }); bottomViews.filterButton.setOnClickListener(view -> { mIsFiltered = true; mInteractor.clearMarkers(mMap); showMapPins(mFilteredEstablishmentList); mInteractor.animateCameraToAllEstablishments(mMap); bottomSheetDialog.dismiss(); }); bottomSheetDialog.setContentView(dialogView); bottomSheetDialog.getWindow().findViewById(R.id.design_bottom_sheet) .setBackgroundResource(R.color.default_dialog_background); dialogView.measure(View.MeasureSpec.UNSPECIFIED, View.MeasureSpec.UNSPECIFIED); BottomSheetBehavior mBehavior = BottomSheetBehavior.from((View) dialogView.getParent()); mBehavior.setPeekHeight((int) (mView.getMapContainerHeight() + 400)); bottomSheetDialog.setOnDismissListener(dialogInterface -> { if (!mIsFiltered) { mFilteredEstablishmentList.clear(); mFilteredEstablishmentList.addAll(mEstablishmentList); } }); bottomSheetDialog.show(); }
Example 19
Source File: EmergencyPresenterImpl.java From Saude-no-Mapa with MIT License | 4 votes |
private void showEstablishmentBottomDialog(Establishment establishment) { if (establishment == null) { return; } BottomSheetDialog bottomSheetDialog = new BottomSheetDialog(mContext); View dialogView = LayoutInflater.from(mContext).inflate(R.layout.dialog_bottom_sheet_marker, null); MarkerViews bottomViews = new MarkerViews(); ButterKnife.bind(bottomViews, dialogView); mRatingView = bottomViews.ratingView; mRatingView.setIndicator(true); mEstablishmentProgress = bottomViews.establishmentProgress; mEstablishmentProgress.setVisibility(View.VISIBLE); bottomViews.establishmentTitle.setText(GenericUtil.capitalize(establishment.getNomeFantasia().toLowerCase())); bottomViews.descricaoCompletaText.setText(GenericUtil.capitalize(establishment.getDescricaoCompleta().toLowerCase())); bottomViews.enderecoText.setText(mInteractor.getAddressText(establishment.getLogradouro(), establishment.getNumero(), establishment.getBairro(), establishment.getCidade(), establishment.getUf(), establishment.getCep())); if (TextUtils.isEmpty(establishment.getTelefone())) { bottomViews.phoneLayout.setVisibility(View.GONE); } else { bottomViews.phoneText.setText(establishment.getTelefone()); } bottomViews.turnoAtendimento.setText(establishment.getTurnoAtendimento()); bottomViews.tipoUnidadeText.setText(GenericUtil.capitalize(establishment.getTipoUnidade().toLowerCase())); bottomViews.redeAtendimentoText.setText(GenericUtil.capitalize(establishment.getEsferaAdministrativa().toLowerCase())); bottomViews.vinculoSusText.setText(GenericUtil.capitalize(establishment.getVinculoSus().toLowerCase())); bottomViews.fluxoClientelaText.setText(mInteractor.getFluxoClientelaText(establishment.getFluxoClientela())); bottomViews.cnpjText.setText(establishment.getCnpj()); bottomViews.servicesText.setText(mInteractor.getServicesText(establishment)); bottomViews.enderecoText.setOnClickListener(view -> { showGoToAddressDialog(establishment.getLatitude(), establishment.getLongitude()); }); bottomViews.phoneText.setOnClickListener(v -> { showCallToPhoneDialog(establishment.getTelefone()); }); if (mInteractor.isEstablishmentLiked(Long.valueOf(establishment.getCodUnidade()))) { bottomViews.likeImage.setImageDrawable(ContextCompat.getDrawable(mContext, R.drawable.ic_like_filled)); } bottomViews.groupImage.setOnClickListener(v -> { Intent intent = new Intent(mContext, GroupActivity.class); intent.putExtra(ESTABLISHMENT_INTENT_KEY, establishment.getNomeFantasia()); mView.goToActivity(intent); }); isLiked = mInteractor.isEstablishmentLiked(Long.valueOf(establishment.getCodUnidade())); bottomViews.likeImage.setOnClickListener(v -> { mEstablishmentProgress.setVisibility(View.VISIBLE); if (isLiked) { mSubscription.add(mInteractor.requestDisLikeEstablishment(establishment.getCodUnidade()) .observeOn(AndroidSchedulers.mainThread()) .onErrorReturn(throwable -> null) .subscribe(responseBodyResponse -> { mEstablishmentProgress.setVisibility(View.GONE); if (responseBodyResponse != null && responseBodyResponse.isSuccessful()) { isLiked = false; mInteractor.removeDislikedContentCode(); bottomViews.likeImage.setImageDrawable(ContextCompat.getDrawable(mContext, R.drawable.ic_like_empty)); } else { mView.showToast(mContext.getString(R.string.http_error_generic)); } })); } else { requestLikeEstablishment(Long.valueOf(establishment.getCodUnidade()), bottomViews.likeImage); } }); bottomSheetDialog.setContentView(dialogView); bottomSheetDialog.getWindow().findViewById(R.id.design_bottom_sheet) .setBackgroundResource(R.color.default_dialog_background); bottomViews.mainInfoCard.measure(View.MeasureSpec.UNSPECIFIED, View.MeasureSpec.UNSPECIFIED); BottomSheetBehavior mBehavior = BottomSheetBehavior.from((View) dialogView.getParent()); mBehavior.setPeekHeight(bottomViews.mainInfoCard.getMeasuredHeight() + 115); bottomSheetDialog.setOnDismissListener(dialogInterface -> { lastOpenned.hideInfoWindow(); }); bottomSheetDialog.show(); }
Example 20
Source File: Buildable.java From KUtils-master with Apache License 2.0 | 4 votes |
private void buildCustomBottomAlert(BuildBean bean) { BottomSheetDialog dialog = new BottomSheetDialog(bean.mContext); dialog.setContentView(bean.customView); bean.dialog = dialog; }