當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。