use of android.support.design.widget.BottomSheetDialog in project T-MVP by north2016.
the class TMVPFragment method onCreateDialog.
@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());
dialog.getWindow().addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
imPay = (ImageView) view.findViewById(R.id.im_pay);
return dialog;
}
use of android.support.design.widget.BottomSheetDialog in project Rocket.Chat.Android by RocketChat.
the class MessageOptionsDialogFragment method setUpDialog.
private void setUpDialog(final BottomSheetDialog bottomSheetDialog, String messageId) {
RocketChatCache cache = new RocketChatCache(bottomSheetDialog.getContext());
String hostname = cache.getSelectedServerHostname();
EditMessageInteractor editMessageInteractor = getEditMessageInteractor(hostname);
MessageRepository messageRepository = new RealmMessageRepository(hostname);
Disposable disposable = messageRepository.getById(messageId).flatMap(it -> {
if (!it.isPresent()) {
return Single.just(Pair.<Message, Boolean>create(null, false));
}
Message message = it.get();
return Single.zip(Single.just(message), editMessageInteractor.isAllowed(message), Pair::create);
}).subscribeOn(AndroidSchedulers.from(BackgroundLooper.get())).observeOn(AndroidSchedulers.mainThread()).subscribe(pair -> {
if (pair.second) {
bottomSheetDialog.findViewById(R.id.message_options_info).setVisibility(View.GONE);
View editView = bottomSheetDialog.findViewById(R.id.message_options_edit_action);
editView.setVisibility(View.VISIBLE);
editView.setOnClickListener(view -> internalListener.onEdit(pair.first));
} else {
((TextView) bottomSheetDialog.findViewById(R.id.message_options_info)).setText(R.string.message_options_no_permissions_info);
}
}, throwable -> {
((TextView) bottomSheetDialog.findViewById(R.id.message_options_info)).setText(R.string.message_options_no_message_info);
Logger.report(throwable);
});
compositeDisposable.add(disposable);
}
use of android.support.design.widget.BottomSheetDialog in project Robot-Scouter by SUPERCILEX.
the class ScoutTemplateSheet method onShow.
@Override
public void onShow(DialogInterface dialog) {
BottomSheetDialog d = (BottomSheetDialog) dialog;
FrameLayout bottomSheet = (FrameLayout) d.findViewById(android.support.design.R.id.design_bottom_sheet);
int parentHeight = getActivity().findViewById(android.R.id.content).getHeight();
BottomSheetBehavior.from(bottomSheet).setPeekHeight(parentHeight);
}
use of android.support.design.widget.BottomSheetDialog in project Robot-Scouter by SUPERCILEX.
the class ScoutTemplateSheet method onCreateDialog.
@NonNull
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
Dialog dialog = new BottomSheetDialog(getContext()) {
@Override
public void onBackPressed() {
if (mFam.isOpened()) {
mFam.close(true);
} else {
super.onBackPressed();
}
}
};
dialog.setOnShowListener(this);
return dialog;
}
use of android.support.design.widget.BottomSheetDialog in project DiscreteScrollView by yarolegovich.
the class DiscreteScrollViewOptions method configureTransitionTime.
public static void configureTransitionTime(DiscreteScrollView scrollView) {
final BottomSheetDialog bsd = new BottomSheetDialog(scrollView.getContext());
final TransitionTimeChangeListener timeChangeListener = new TransitionTimeChangeListener(scrollView);
bsd.setContentView(R.layout.dialog_transition_time);
defaultPrefs().registerOnSharedPreferenceChangeListener(timeChangeListener);
bsd.setOnDismissListener(new DialogInterface.OnDismissListener() {
@Override
public void onDismiss(DialogInterface dialog) {
defaultPrefs().unregisterOnSharedPreferenceChangeListener(timeChangeListener);
}
});
bsd.findViewById(R.id.dialog_btn_dismiss).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
bsd.dismiss();
}
});
bsd.show();
}
Aggregations