当前位置: 首页>>代码示例>>Java>>正文


Java BottomSheetBehavior类代码示例

本文整理汇总了Java中android.support.design.widget.BottomSheetBehavior的典型用法代码示例。如果您正苦于以下问题:Java BottomSheetBehavior类的具体用法?Java BottomSheetBehavior怎么用?Java BottomSheetBehavior使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


BottomSheetBehavior类属于android.support.design.widget包,在下文中一共展示了BottomSheetBehavior类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: showColegiElectoralData

import android.support.design.widget.BottomSheetBehavior; //导入依赖的package包/类
public void showColegiElectoralData(final ColegiElectoral colegiElectoral) {
    LatLng latLng = new LatLng(colegiElectoral.getLat(), colegiElectoral.getLon());
    CameraUpdate cameraUpdate = CameraUpdateFactory.newLatLngZoom(latLng, 16);
    mGoogleMap.animateCamera(cameraUpdate);

    txtNomLocal.setText(colegiElectoral.getLocal());
    txtAdresa.setText(colegiElectoral.getAdresa());
    txtLocalitat.setText(colegiElectoral.getMunicipi());
    txtDistricte.setText(colegiElectoral.getDistricte() != null ? StringsManager.getString("data_districte", colegiElectoral.getDistricte()) : "");
    txtSeccio.setText(colegiElectoral.getSeccio() != null ? StringsManager.getString("data_seccio", colegiElectoral.getSeccio()) : "");
    txtMesa.setText(colegiElectoral.getMesa() != null ? StringsManager.getString("data_mesa", colegiElectoral.getMesa()) : "");

    icnCalendari.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            addEventToCalendar(colegiElectoral);
        }
    });

    bsb.setState(BottomSheetBehavior.STATE_EXPANDED);
}
 
开发者ID:mosquitolabs,项目名称:referendum_1o_android,代码行数:22,代码来源:VoteFragment.java

示例2: onStateChanged

import android.support.design.widget.BottomSheetBehavior; //导入依赖的package包/类
@Override
public void onStateChanged(@NonNull View bottomSheet, int newState) {
    switch (newState) {
        case BottomSheetBehavior.STATE_HIDDEN: {
            LogUtils.d("Bottom sheet hidden to dismiss");
            dismiss();
            break;
        }
        case BottomSheetBehavior.STATE_EXPANDED: {
            LogUtils.d("expanded");
            break;
        }
        case BottomSheetBehavior.STATE_COLLAPSED: {
            LogUtils.d("collapsed");
            break;
        }

    }

}
 
开发者ID:mengdd,项目名称:TodoRealm,代码行数:21,代码来源:AddListDialogFragment.java

示例3: setupDialog

import android.support.design.widget.BottomSheetBehavior; //导入依赖的package包/类
@Override
public void setupDialog(Dialog dialog, int style) {
    LogUtils.footPrint();
    super.setupDialog(dialog, style);
    View contentView = View.inflate(getContext(), R.layout.fragment_add_list_dialog, 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 bottomSheetBehavior = ((BottomSheetBehavior) behavior);
        bottomSheetBehavior.setBottomSheetCallback(bottomSheetBehaviorCallback);
    }

    ButterKnife.bind(this, contentView);

    Window window = dialog.getWindow();
    if (window != null) {
        window.setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_VISIBLE);
    }

    presenter = new AddListPresenter(TodoRepository.getInstance());
    presenter.attachView(this);
}
 
开发者ID:mengdd,项目名称:TodoRealm,代码行数:25,代码来源:AddListDialogFragment.java

示例4: showInfo

import android.support.design.widget.BottomSheetBehavior; //导入依赖的package包/类
protected void showInfo(String header, String desc, @Nullable Drawable drawable, boolean error) {
    hideKeyboard();
    AppCompatTextView infoHeader = (AppCompatTextView) llBottomSheet.findViewById(R.id.info_header);
    AppCompatTextView infoDesc = (AppCompatTextView) llBottomSheet.findViewById(R.id.info_desc);
    AppCompatImageView infoImg = (AppCompatImageView) llBottomSheet.findViewById(R.id.info_img);
    if (error) {
        llBottomSheet.findViewById(R.id.info_img).setVisibility(View.GONE);
        ((AppCompatButton) findViewById(R.id.ok_dimiss)).setText("Close");
    } else {
        llBottomSheet.findViewById(R.id.info_img).setVisibility(View.VISIBLE);
        ((AppCompatButton) findViewById(R.id.ok_dimiss)).setText("Ok");
    }

    infoHeader.setText(header);
    infoDesc.setText(desc);
    if (drawable != null)
        infoImg.setImageDrawable(drawable);
    bottomSheetBehavior.setState(BottomSheetBehavior.STATE_EXPANDED);
}
 
开发者ID:aksalj,项目名称:africastalking-android,代码行数:20,代码来源:BaseActivity.java

示例5: handleNoResults

import android.support.design.widget.BottomSheetBehavior; //导入依赖的package包/类
private void handleNoResults(CustomCameraUpdate cameraUpdate) {
    mMap.moveCamera(cameraUpdate.getmCameraUpdate());
    mMap.animateCamera(CameraUpdateFactory.zoomTo(15), 2000, null);
    mBottomSheetBehavior.setState(BottomSheetBehavior.STATE_HIDDEN);
    ArrayList<LatLng> list = new ArrayList<LatLng>();
    list.add(new LatLng(39.63108, -7.62451));
    list.add(new LatLng(37.92687, -7.59155));
    list.add(new LatLng(37.92687, -4.52637));
    list.add(new LatLng(40.41768, -4.63623));
    list.add(new LatLng(40.54929, -6.97083));
    list.add(new LatLng(39.63108, -7.62451));
    list.add(new LatLng(37.92687, -7.59155));
    list.add(new LatLng(37.92687, -4.52637));
    String message;
    if (Utils.contains(new LatLng(mLocation.getLatitude(), mLocation.getLongitude()), list)) {
        message = getString(R.string.mtf_radio_busqueda_insuficiente);
        // Snackbar.make(mRootView,message,Snackbar.LENGTH_INDEFINITE).show();
    } else {
        message = getString(R.string.mtf_fuera_de_extremadura);
    }

    mSnackBar = new SnackBarWrapper(getActivity(),message,Snackbar.LENGTH_INDEFINITE);
    mSnackBar.show();

    //Snackbar.make(mRootView, message, Snackbar.LENGTH_INDEFINITE).show();
}
 
开发者ID:cahergil,项目名称:Farmacias,代码行数:27,代码来源:MapTabFragment.java

示例6: onCreate

import android.support.design.widget.BottomSheetBehavior; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_first);
    mRecyclerView = (RecyclerView) findViewById(R.id.recyclerView);
    mRlBottomSheet = (RelativeLayout) findViewById(R.id.rl_bottom_sheet);
    mFrom = BottomSheetBehavior.from(mRlBottomSheet);

    mToolbar = (Toolbar) findViewById(R.id.toolbar);
    // 该属性必须在setSupportActionBar之前 调用
    mToolbar.setTitle("toolBar");
    setSupportActionBar(mToolbar);

    initListener();
    initData();
}
 
开发者ID:zuoni1018,项目名称:CoordinatorLayoutExample-master,代码行数:17,代码来源:ToolBarSampleSnar.java

示例7: onStateChanged

import android.support.design.widget.BottomSheetBehavior; //导入依赖的package包/类
@Override
public void onStateChanged(@NonNull View bottomSheet,
                           @BottomSheetBehavior.State int newState) {
    if (mCallback != null) {
        mCallback.onStateChanged(bottomSheet, newState);
    }

    if (newState == BottomSheetBehavior.STATE_HIDDEN) {
        mBehavior.setBottomSheetCallback(null);
        try {
            BottomSheetMenuDialog.super.dismiss();
        } catch (IllegalArgumentException e) {
            // ignore exception handling
        }

        // User dragged the sheet.
        if (!mClicked && !mRequestDismiss && !mRequestCancel && mOnCancelListener != null) {
            mOnCancelListener.onCancel(BottomSheetMenuDialog.this);
        }
    }
}
 
开发者ID:yuhodev,项目名称:login,代码行数:22,代码来源:BottomSheetMenuDialog.java

示例8: setupViews

import android.support.design.widget.BottomSheetBehavior; //导入依赖的package包/类
private void setupViews() {
    drawer = (DrawerLayout) findViewById(R.id.drawerlayout);
    navview = (NavigationView) findViewById(R.id.navview);
    ActionBarDrawerToggle toggle = new ActionBarDrawerToggle(this, drawer, toolbar, R.string.main_drawer_open, R.string.main_drawer_close);
    //drawer.addDrawerListener(this);
    toggle.syncState();
    navview.setNavigationItemSelectedListener(this);

    View _view = findViewById(R.id.bottom_search_results);
    resultsBottom = BottomSheetBehavior.from(_view);
    resultsBottom.setHideable(true);
    resultsBottom.setState(BottomSheetBehavior.STATE_HIDDEN);
    resultsRv = (RecyclerView) findViewById(R.id.rv_results);
    resultsRv.setLayoutManager(new LinearLayoutManager(MainActivity.this,
            LinearLayoutManager.VERTICAL, false));
    photoIv = (SquareImageView) findViewById(R.id.iv_photo);
    searchFab = (FloatingActionButton) findViewById(R.id.fab_search);
    closeBottomBtn = (AppCompatImageButton) findViewById(R.id.btn_close_bottom);
    indicatorLoadingLayout = (LinearLayout) findViewById(R.id.layout_main_loading);
    indicatorStatusTv = (AppCompatTextView) findViewById(R.id.tv_progress_status);
    AppCompatTextView versionAppTv = navview.getHeaderView(0).findViewById(R.id.tv_header_app_version);
    versionAppTv.setText(C.getAppVersion(MainActivity.this));
}
 
开发者ID:maddog05,项目名称:whatanime-android,代码行数:24,代码来源:MainActivity.java

示例9: ui

import android.support.design.widget.BottomSheetBehavior; //导入依赖的package包/类
@Override
protected void ui(View rootView) {
    albumArt = (ImageView) rootView.findViewById(R.id.albumArt);
    queuerv = (RecyclerView) rootView.findViewById(R.id.commonrv);
    favButton = (ImageButton) rootView.findViewById(R.id.action_favorite);
    moreMenu = (ImageButton) rootView.findViewById(R.id.menu_button);
    shuffleButton = (ImageView) rootView.findViewById(R.id.shuffle_song);
    repeatButton = (ImageView) rootView.findViewById(R.id.repeat_song);
    playpausebutton = (ImageView) rootView.findViewById(R.id.play_pause_toggle);
    next = (ImageView) rootView.findViewById(R.id.next);
    prev = (ImageView) rootView.findViewById(R.id.prev);
    currentDur = (TextView) rootView.findViewById(R.id.currentDur);
    totalDur = (TextView) rootView.findViewById(R.id.totalDur);
    songArtist = (TextView) rootView.findViewById(R.id.song_artist);
    songTitle = (TextView) rootView.findViewById(R.id.song_title);
    seekbar = (SeekBar) rootView.findViewById(R.id.seekbar);
    lrcView = (TextView) rootView.findViewById(R.id.lyrics);
    bottomsheetLyrics = (FrameLayout) rootView.findViewById(R.id.bottomsheetLyrics);
    bottomSheetBehavior = BottomSheetBehavior.from(bottomsheetLyrics);
    diagonalLayout = (DiagonalLayout) rootView.findViewById(R.id.diagonalLayout);
}
 
开发者ID:RajneeshSingh007,项目名称:MusicX-music-player,代码行数:22,代码来源:Playing3Fragment.java

示例10: onClick

import android.support.design.widget.BottomSheetBehavior; //导入依赖的package包/类
@Override
public void onClick(View v) {
    switch (v.getId()) {
        case R.id.btn_bottom_dialog_control:
            if (mBottomSheetDialog.isShowing()) {
                mBottomSheetDialog.dismiss();
            } else {
                mBottomSheetDialog.show();
            }
            break;
        case R.id.btn_bottom_sheet_control:
            //如果当前是收缩状态,变为延展状态;反之亦然

            if (mBottomSheetBehavior.getState() == BottomSheetBehavior.STATE_COLLAPSED) {
                mBottomSheetBehavior.setState(BottomSheetBehavior.STATE_EXPANDED);
            } else if (mBottomSheetBehavior.getState() == BottomSheetBehavior.STATE_EXPANDED) {
                mBottomSheetBehavior.setState(BottomSheetBehavior.STATE_COLLAPSED);
            }
            break;
        default:
            break;
    }
}
 
开发者ID:Pingsh,项目名称:Mix,代码行数:24,代码来源:BottomSheetActivity.java

示例11: onPostCreate

import android.support.design.widget.BottomSheetBehavior; //导入依赖的package包/类
@Override
protected void onPostCreate(@Nullable Bundle savedInstanceState) {
    super.onPostCreate(savedInstanceState);

    if (savedInstanceState == null) {
        if (imgUri != null) { // 外部APP请求处理
            showImg(imgUri);
            tvAction.setEnabled(imgUri != null);
            return;
        }
        // 面板动画
        viewHintIcon.setAlpha(0);
        bottomSheetBehavior.setState(BottomSheetBehavior.STATE_EXPANDED);
        tvAction.postDelayed(new Runnable() {
            @Override
            public void run() {
                collapsePanel();
            }
        }, 800);
    } else { // 屏幕方向旋转
        imgUri = savedInstanceState.getParcelable("imgUri");
        showImg(imgUri);
        tvAction.setEnabled(imgUri != null);
    }
}
 
开发者ID:by-syk,项目名称:bigjpg-app,代码行数:26,代码来源:MainActivity.java

示例12: onClick

import android.support.design.widget.BottomSheetBehavior; //导入依赖的package包/类
@Override
public void onClick(View view) {
    switch (view.getId()){
        case R.id.theme_selected :
        case R.id.fab:
            // change the state of the bottom sheet
            switch (mBottomSheetBehavior.getState()){
                case BottomSheetBehavior.STATE_HIDDEN :
                    mBottomSheetBehavior.setState(BottomSheetBehavior.STATE_COLLAPSED);
                    break;

                case BottomSheetBehavior.STATE_COLLAPSED :
                    mBottomSheetBehavior.setState(BottomSheetBehavior.STATE_EXPANDED);
                    break;

                case BottomSheetBehavior.STATE_EXPANDED :
                    mBottomSheetBehavior.setState(BottomSheetBehavior.STATE_COLLAPSED);
                    break;
            }
            break;
    }
}
 
开发者ID:pkjvit,项目名称:Android-Multi-Theme-UI,代码行数:23,代码来源:ScrollingActivity.java

示例13: onCreateView

import android.support.design.widget.BottomSheetBehavior; //导入依赖的package包/类
@Nullable @Override public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
    final Context contextThemeWrapper = new ContextThemeWrapper(getContext(), getContext().getTheme());
    LayoutInflater themeAwareInflater = inflater.cloneInContext(contextThemeWrapper);
    View view = themeAwareInflater.inflate(layoutRes(), container, false);
    unbinder = ButterKnife.bind(this, view);
    view.getViewTreeObserver().addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() {
        @Override public void onGlobalLayout() {
            view.getViewTreeObserver().removeOnGlobalLayoutListener(this);
            View parent = getDialog().findViewById(R.id.design_bottom_sheet);
            if (parent != null) {
                bottomSheetBehavior = BottomSheetBehavior.from(parent);
                if (bottomSheetBehavior != null) {
                    bottomSheetBehavior.setBottomSheetCallback(bottomSheetCallback);
                    bottomSheetBehavior.setState(BottomSheetBehavior.STATE_EXPANDED);
                }
            }
        }
    });
    return view;
}
 
开发者ID:duyp,项目名称:mvvm-template,代码行数:21,代码来源:BaseBottomSheetDialog.java

示例14: onCreateDialog

import android.support.design.widget.BottomSheetBehavior; //导入依赖的package包/类
@NonNull
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
    Dialog mSheet = super.onCreateDialog(savedInstanceState);
    View contentView = View.inflate(getContext(), R.layout.bottom_sheet_message, null);
    mSheet.setContentView(contentView);

    unbinder = ButterKnife.bind(this, mSheet);

    CoordinatorLayout.LayoutParams params = (CoordinatorLayout.LayoutParams) ((View) contentView.getParent()).getLayoutParams();
    CoordinatorLayout.Behavior behavior = params.getBehavior();

    if (behavior != null && behavior instanceof BottomSheetBehavior) {
        bottomSheetBehavior = (BottomSheetBehavior) behavior;
        bottomSheetBehavior.setBottomSheetCallback(mBottomSheetBehaviorCallback);
    }

    onPostCreate(this);
    return mSheet;
}
 
开发者ID:wax911,项目名称:anitrend-app,代码行数:21,代码来源:BottomSheetMessage.java

示例15: onStart

import android.support.design.widget.BottomSheetBehavior; //导入依赖的package包/类
@Override
public void onStart() {
    super.onStart();
    mState.setOnClickListener(this);

    if(negative == 0)
        mNegative.setVisibility(View.GONE);
    else {
        mNegative.setOnClickListener(this);
        mNegative.setText(negative);
    }

    if(positive == 0)
        mPositive.setVisibility(View.GONE);
    else {
        mPositive.setOnClickListener(this);
        mPositive.setText(positive);
    }

    mTitle.setText(title);
    mText.setMovementMethod(LinkMovementMethod.getInstance());
    mText.setText(Html.fromHtml(getString(text)));
    if(bottomSheetBehavior.getState() != BottomSheetBehavior.STATE_EXPANDED)
        bottomSheetBehavior.setState(BottomSheetBehavior.STATE_EXPANDED);
}
 
开发者ID:wax911,项目名称:anitrend-app,代码行数:26,代码来源:BottomSheetMessage.java


注:本文中的android.support.design.widget.BottomSheetBehavior类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。