Search in sources :

Example 1 with BottomSheetDialog

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;
}
Also used : BottomSheetDialog(android.support.design.widget.BottomSheetDialog) ImageView(android.widget.ImageView) View(android.view.View)

Example 2 with BottomSheetDialog

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);
}
Also used : CompositeDisposable(io.reactivex.disposables.CompositeDisposable) Disposable(io.reactivex.disposables.Disposable) MessageRepository(chat.rocket.core.repositories.MessageRepository) BottomSheetDialog(android.support.design.widget.BottomSheetDialog) RealmPublicSettingRepository(chat.rocket.persistence.realm.repositories.RealmPublicSettingRepository) Bundle(android.os.Bundle) UserRepository(chat.rocket.core.repositories.UserRepository) RocketChatCache(chat.rocket.android.RocketChatCache) RoomRepository(chat.rocket.core.repositories.RoomRepository) Dialog(android.app.Dialog) NonNull(android.support.annotation.NonNull) Single(io.reactivex.Single) AndroidSchedulers(io.reactivex.android.schedulers.AndroidSchedulers) RealmRoomRoleRepository(chat.rocket.persistence.realm.repositories.RealmRoomRoleRepository) PermissionRepository(chat.rocket.core.repositories.PermissionRepository) PublicSettingRepository(chat.rocket.core.repositories.PublicSettingRepository) PermissionInteractor(chat.rocket.core.interactors.PermissionInteractor) View(android.view.View) RoomRoleRepository(chat.rocket.core.repositories.RoomRoleRepository) R(chat.rocket.android.R) RealmRoomRepository(chat.rocket.persistence.realm.repositories.RealmRoomRepository) BottomSheetDialogFragment(android.support.design.widget.BottomSheetDialogFragment) DialogInterface(android.content.DialogInterface) Logger(chat.rocket.android.helper.Logger) EditMessageInteractor(chat.rocket.core.interactors.EditMessageInteractor) Message(chat.rocket.core.models.Message) RealmMessageRepository(chat.rocket.persistence.realm.repositories.RealmMessageRepository) CompositeDisposable(io.reactivex.disposables.CompositeDisposable) Disposable(io.reactivex.disposables.Disposable) TextView(android.widget.TextView) Pair(android.support.v4.util.Pair) RealmUserRepository(chat.rocket.persistence.realm.repositories.RealmUserRepository) BackgroundLooper(chat.rocket.android.BackgroundLooper) RealmPermissionRepository(chat.rocket.persistence.realm.repositories.RealmPermissionRepository) Message(chat.rocket.core.models.Message) EditMessageInteractor(chat.rocket.core.interactors.EditMessageInteractor) RocketChatCache(chat.rocket.android.RocketChatCache) MessageRepository(chat.rocket.core.repositories.MessageRepository) RealmMessageRepository(chat.rocket.persistence.realm.repositories.RealmMessageRepository) RealmMessageRepository(chat.rocket.persistence.realm.repositories.RealmMessageRepository) TextView(android.widget.TextView) View(android.view.View) TextView(android.widget.TextView)

Example 3 with BottomSheetDialog

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);
}
Also used : BottomSheetDialog(android.support.design.widget.BottomSheetDialog) FrameLayout(android.widget.FrameLayout)

Example 4 with BottomSheetDialog

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;
}
Also used : BottomSheetDialog(android.support.design.widget.BottomSheetDialog) BottomSheetDialog(android.support.design.widget.BottomSheetDialog) Dialog(android.app.Dialog) NonNull(android.support.annotation.NonNull)

Example 5 with BottomSheetDialog

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();
}
Also used : BottomSheetDialog(android.support.design.widget.BottomSheetDialog) DialogInterface(android.content.DialogInterface) DiscreteScrollView(com.yarolegovich.discretescrollview.DiscreteScrollView) View(android.view.View)

Aggregations

BottomSheetDialog (android.support.design.widget.BottomSheetDialog)6 NonNull (android.support.annotation.NonNull)3 View (android.view.View)3 Dialog (android.app.Dialog)2 DialogInterface (android.content.DialogInterface)2 Bundle (android.os.Bundle)2 TextView (android.widget.TextView)2 BottomSheetDialogFragment (android.support.design.widget.BottomSheetDialogFragment)1 Pair (android.support.v4.util.Pair)1 FrameLayout (android.widget.FrameLayout)1 ImageView (android.widget.ImageView)1 BackgroundLooper (chat.rocket.android.BackgroundLooper)1 R (chat.rocket.android.R)1 RocketChatCache (chat.rocket.android.RocketChatCache)1 Logger (chat.rocket.android.helper.Logger)1 EditMessageInteractor (chat.rocket.core.interactors.EditMessageInteractor)1 PermissionInteractor (chat.rocket.core.interactors.PermissionInteractor)1 Message (chat.rocket.core.models.Message)1 MessageRepository (chat.rocket.core.repositories.MessageRepository)1 PermissionRepository (chat.rocket.core.repositories.PermissionRepository)1