Search in sources :

Example 11 with BottomSheetBehavior

use of android.support.design.widget.BottomSheetBehavior in project LeafPic by HoraApps.

the class SelectAlbumBottomSheet method setupDialog.

@Override
public void setupDialog(Dialog dialog, int style) {
    super.setupDialog(dialog, style);
    View contentView = View.inflate(getContext(), R.layout.select_folder_bottom_sheet, null);
    theme = new ThemeHelper(getContext());
    RecyclerView mRecyclerView = (RecyclerView) contentView.findViewById(R.id.folders);
    mRecyclerView.setLayoutManager(new GridLayoutManager(getContext(), 1));
    adapter = new BottomSheetAlbumsAdapter();
    mRecyclerView.setAdapter(adapter);
    exploreModePanel = (LinearLayout) contentView.findViewById(R.id.explore_mode_panel);
    currentFolderPath = (TextView) contentView.findViewById(R.id.bottom_sheet_sub_title);
    imgExploreMode = (IconicsImageView) contentView.findViewById(R.id.toggle_hidden_icon);
    imgExploreMode.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            toggleExplorerMode(!exploreMode);
        }
    });
    toggleExplorerMode(false);
    /**
     *SET UP THEME*
     */
    theme.setColorScrollBarDrawable(ContextCompat.getDrawable(dialog.getContext(), R.drawable.ic_scrollbar));
    contentView.findViewById(R.id.ll_bottom_sheet_title).setBackgroundColor(theme.getPrimaryColor());
    contentView.findViewById(R.id.ll_select_folder).setBackgroundColor(theme.getCardBackgroundColor());
    ((TextView) contentView.findViewById(R.id.bottom_sheet_title)).setText(title);
    ((IconicsImageView) contentView.findViewById(R.id.create_new_folder)).setColor(theme.getIconColor());
    ((TextView) contentView.findViewById(R.id.create_new_folder_text)).setTextColor(theme.getSubTextColor());
    ((IconicsImageView) contentView.findViewById(R.id.done)).setColor(theme.getIconColor());
    contentView.findViewById(R.id.done).setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View view) {
            selectAlbumInterface.folderSelected(currentFolderPath.getText().toString());
        }
    });
    contentView.findViewById(R.id.ll_create_new_folder).setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View view) {
            final EditText editText = new EditText(getContext());
            AlertDialog.Builder builder = new AlertDialog.Builder(getActivity(), theme.getDialogStyle());
            AlertDialogsHelper.getInsertTextDialog(((ThemedActivity) getActivity()), builder, editText, R.string.new_folder);
            builder.setPositiveButton(R.string.ok_action, new DialogInterface.OnClickListener() {

                @Override
                public void onClick(DialogInterface dialogInterface, int i) {
                    File folderPath = new File(currentFolderPath.getText().toString() + File.separator + editText.getText().toString());
                    if (folderPath.mkdir())
                        displayContentFolder(folderPath);
                }
            });
            builder.show();
        }
    });
    dialog.setContentView(contentView);
    CoordinatorLayout.LayoutParams layoutParams = (CoordinatorLayout.LayoutParams) ((View) contentView.getParent()).getLayoutParams();
    CoordinatorLayout.Behavior behavior = layoutParams.getBehavior();
    if (behavior != null && behavior instanceof BottomSheetBehavior) {
        ((BottomSheetBehavior) behavior).setBottomSheetCallback(mBottomSheetBehaviorCallback);
    }
    adapter.notifyDataSetChanged();
}
Also used : EditText(android.widget.EditText) AlertDialog(android.support.v7.app.AlertDialog) ThemeHelper(org.horaapps.leafpic.util.ThemeHelper) DialogInterface(android.content.DialogInterface) View(android.view.View) RecyclerView(android.support.v7.widget.RecyclerView) TextView(android.widget.TextView) IconicsImageView(com.mikepenz.iconics.view.IconicsImageView) IconicsImageView(com.mikepenz.iconics.view.IconicsImageView) CoordinatorLayout(android.support.design.widget.CoordinatorLayout) BottomSheetBehavior(android.support.design.widget.BottomSheetBehavior) GridLayoutManager(android.support.v7.widget.GridLayoutManager) RecyclerView(android.support.v7.widget.RecyclerView) TextView(android.widget.TextView) File(java.io.File)

Example 12 with BottomSheetBehavior

use of android.support.design.widget.BottomSheetBehavior in project CircularReveal by ozodrukh.

the class MainActivity method onCreate.

@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    ButterKnife.bind(this);
    final ViewRevealManager revealManager = new ViewRevealManager();
    final SpringViewAnimatorManager springManager = new SpringViewAnimatorManager();
    springManager.setDampingRatio(SpringForce.DAMPING_RATIO_NO_BOUNCY);
    springManager.setStiffness(SpringForce.STIFFNESS_LOW);
    parent.setViewRevealManager(revealManager);
    settingsView.addSwitch("Enable Spring", false, new CompoundButton.OnCheckedChangeListener() {

        @Override
        public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
            parent.setViewRevealManager(isChecked ? springManager : revealManager);
        }
    });
    settingsView.setAnimatorManager(springManager);
    final BottomSheetBehavior behavior = BottomSheetBehavior.from(settingsView);
    behavior.setPeekHeight(getResources().getDimensionPixelSize(R.dimen.bottom_peek_height));
    behavior.setSkipCollapsed(false);
    behavior.setState(BottomSheetBehavior.STATE_COLLAPSED);
}
Also used : BottomSheetBehavior(android.support.design.widget.BottomSheetBehavior) ViewRevealManager(io.codetail.animation.ViewRevealManager) SpringViewAnimatorManager(io.codetail.animation.SpringViewAnimatorManager) CompoundButton(android.widget.CompoundButton)

Example 13 with BottomSheetBehavior

use of android.support.design.widget.BottomSheetBehavior in project coins-android by bubelov.

the class MapActivity method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    dependencies().inject(this);
    setContentView(R.layout.activity_map);
    ButterKnife.bind(this);
    drawerHeader = navigationView.getHeaderView(0);
    avatar = ButterKnife.findById(drawerHeader, R.id.avatar);
    userName = ButterKnife.findById(drawerHeader, R.id.user_name);
    googleApiClient = new GoogleApiClient.Builder(this).addApi(LocationServices.API).addApi(Auth.GOOGLE_SIGN_IN_API).addConnectionCallbacks(new LocationApiConnectionCallbacks()).enableAutoManage(this, connectionResult -> Toast.makeText(MapActivity.this, connectionResult.getErrorMessage(), Toast.LENGTH_SHORT).show()).build();
    googleApiClient.connect();
    firstLaunch = savedInstanceState == null;
    SupportMapFragment mapFragment = (SupportMapFragment) getSupportFragmentManager().findFragmentById(R.id.map);
    mapFragment.getMapAsync(this);
    bottomSheetBehavior = BottomSheetBehavior.from(placeDetails);
    bottomSheetBehavior.setState(BottomSheetBehavior.STATE_HIDDEN);
    bottomSheetBehavior.setBottomSheetCallback(new BottomSheetBehavior.BottomSheetCallback() {

        @Override
        public void onStateChanged(@NonNull View bottomSheet, int newState) {
            placeDetails.setFullScreen(newState == BottomSheetBehavior.STATE_EXPANDED);
        }

        @Override
        public void onSlide(@NonNull View bottomSheet, float slideOffset) {
            actionButton.setVisibility(slideOffset > 0.5f ? View.GONE : View.VISIBLE);
        }
    });
    new Handler(Looper.getMainLooper()).postDelayed(() -> bottomSheetBehavior.setPeekHeight(placeDetails.getHeaderHeight()), 1000);
    placeDetails.setCallback(new PlaceDetailsView.Callback() {

        @Override
        public void onEditPlaceClick(@NonNull Place place) {
            if (!TextUtils.isEmpty(userRepository.getUserAuthToken())) {
                EditPlaceActivity.Companion.startForResult(MapActivity.this, place.getId(), null, REQUEST_EDIT_PLACE);
            } else {
                signIn();
            }
        }

        @Override
        public void onDismissed() {
            bottomSheetBehavior.setState(BottomSheetBehavior.STATE_COLLAPSED);
        }
    });
    toolbar.setNavigationOnClickListener(v -> drawerLayout.openDrawer(navigationView));
    toolbar.inflateMenu(R.menu.map);
    toolbar.setOnMenuItemClickListener(this);
    navigationView.setNavigationItemSelectedListener(item -> {
        switch(item.getItemId()) {
            case R.id.action_exchange_rates:
                drawerLayout.closeDrawers();
                openExchangeRatesScreen();
                return true;
            case R.id.action_notification_area:
                drawerLayout.closeDrawers();
                openNotificationAreaScreen();
                return true;
            case R.id.action_chat:
                drawerLayout.closeDrawers();
                openChat();
                return true;
            case R.id.action_settings:
                drawerLayout.closeDrawers();
                openSettingsScreen();
                return true;
        }
        return false;
    });
    drawerToggle = new ActionBarDrawerToggle(this, drawerLayout, toolbar, R.string.open, R.string.close);
    drawerLayout.addDrawerListener(drawerToggle);
    updateDrawerHeader();
}
Also used : ActionBarDrawerToggle(android.support.v7.app.ActionBarDrawerToggle) Handler(android.os.Handler) NavigationView(android.support.design.widget.NavigationView) ImageView(android.widget.ImageView) BindView(butterknife.BindView) PlaceDetailsView(com.bubelov.coins.ui.widget.PlaceDetailsView) View(android.view.View) TextView(android.widget.TextView) SupportMapFragment(com.google.android.gms.maps.SupportMapFragment) BottomSheetBehavior(android.support.design.widget.BottomSheetBehavior) PlaceDetailsView(com.bubelov.coins.ui.widget.PlaceDetailsView) Place(com.bubelov.coins.model.Place)

Example 14 with BottomSheetBehavior

use of android.support.design.widget.BottomSheetBehavior in project ring-client-android by savoirfairelinux.

the class AboutBottomSheetDialogFragment method setupDialog.

@Override
public void setupDialog(Dialog dialog, int style) {
    View contentView = View.inflate(getContext(), R.layout.dialog_about, null);
    dialog.setContentView(contentView);
    CoordinatorLayout.LayoutParams params = (CoordinatorLayout.LayoutParams) ((View) contentView.getParent()).getLayoutParams();
    CoordinatorLayout.Behavior behavior = params.getBehavior();
    if (behavior != null && behavior instanceof BottomSheetBehavior) {
        ((BottomSheetBehavior) behavior).setBottomSheetCallback(mCallback);
    }
}
Also used : CoordinatorLayout(android.support.design.widget.CoordinatorLayout) BottomSheetBehavior(android.support.design.widget.BottomSheetBehavior) View(android.view.View)

Example 15 with BottomSheetBehavior

use of android.support.design.widget.BottomSheetBehavior in project CircularReveal by ozodrukh.

the class RadialTransformationActivity method onCreate.

@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_sample_2);
    ButterKnife.bind(this);
    Picasso.with(this).load("http://camp-campbell.com/wp-content/uploads/2014/09/847187872-san-francisco.jpg").resizeDimen(R.dimen.radial_card_width, R.dimen.radial_card_height).centerCrop().into(sanFranciscoView);
    videoView.setOnPreparedListener(new MediaPlayer.OnPreparedListener() {

        @Override
        public void onPrepared(MediaPlayer mp) {
            mp.setLooping(true);
        }
    });
    videoView.setVideoURI(Uri.parse(VIDEO_URL));
    videoView.start();
    final GestureDetector detector = new GestureDetector(this, tapDetector);
    for (int i = 0; i < stack.getChildCount(); i++) {
        View view = stack.getChildAt(i);
        view.setOnTouchListener(new View.OnTouchListener() {

            @Override
            public boolean onTouch(View v, MotionEvent event) {
                return detector.onTouchEvent(event);
            }
        });
    }
    final ViewRevealManager revealManager = new ViewRevealManager();
    final SpringViewAnimatorManager springManager = new SpringViewAnimatorManager();
    springManager.setDampingRatio(SpringForce.DAMPING_RATIO_NO_BOUNCY);
    springManager.setStiffness(SpringForce.STIFFNESS_LOW);
    stack.setViewRevealManager(revealManager);
    settingsView.addSwitch("Enable Spring", false, new CompoundButton.OnCheckedChangeListener() {

        @Override
        public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
            stack.setViewRevealManager(isChecked ? springManager : revealManager);
        }
    });
    settingsView.setAnimatorManager(springManager);
    final BottomSheetBehavior behavior = BottomSheetBehavior.from(settingsView);
    behavior.setPeekHeight(getResources().getDimensionPixelSize(R.dimen.bottom_peek_height));
    behavior.setSkipCollapsed(false);
    behavior.setState(BottomSheetBehavior.STATE_COLLAPSED);
}
Also used : GestureDetector(android.view.GestureDetector) ImageView(android.widget.ImageView) BindView(butterknife.BindView) View(android.view.View) VideoView(android.widget.VideoView) Point(android.graphics.Point) MotionEvent(android.view.MotionEvent) BottomSheetBehavior(android.support.design.widget.BottomSheetBehavior) ViewRevealManager(io.codetail.animation.ViewRevealManager) SpringViewAnimatorManager(io.codetail.animation.SpringViewAnimatorManager) CompoundButton(android.widget.CompoundButton) MediaPlayer(android.media.MediaPlayer)

Aggregations

BottomSheetBehavior (android.support.design.widget.BottomSheetBehavior)17 View (android.view.View)14 CoordinatorLayout (android.support.design.widget.CoordinatorLayout)9 TextView (android.widget.TextView)7 DialogInterface (android.content.DialogInterface)4 ImageView (android.widget.ImageView)4 Dialog (android.app.Dialog)3 RecyclerView (android.support.v7.widget.RecyclerView)3 NestedScrollView (android.support.v4.widget.NestedScrollView)2 AlertDialog (android.support.v7.app.AlertDialog)2 GridLayoutManager (android.support.v7.widget.GridLayoutManager)2 CompoundButton (android.widget.CompoundButton)2 EditText (android.widget.EditText)2 BindView (butterknife.BindView)2 SpringViewAnimatorManager (io.codetail.animation.SpringViewAnimatorManager)2 ViewRevealManager (io.codetail.animation.ViewRevealManager)2 File (java.io.File)2 AlertDialog (android.app.AlertDialog)1 Intent (android.content.Intent)1 Point (android.graphics.Point)1