Java 类android.support.design.widget.BottomSheetDialog 实例源码

项目:GitHub    文件:DiscreteScrollViewOptions.java   
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();
}
项目:Mix    文件:BottomSheetActivity.java   
private void initDialog() {

        mBottomSheetDialog = new BottomSheetDialog(BottomSheetActivity.this);
        View view = LayoutInflater.from(this).inflate(R.layout.dialog_bottom_sheet, null, false);
        mBottomSheetDialog.setContentView(view);

        RecyclerView recyclerView = (RecyclerView) view.findViewById(R.id.recyclerView);
        recyclerView.setHasFixedSize(true);
        List<String> list = new ArrayList<>();
        for (int i = 0; i < 20; i++) {
            list.add("我是第" + i + "个");
        }
        LinearLayoutManager linearLayoutManager = new LinearLayoutManager(this);
        linearLayoutManager.setSmoothScrollbarEnabled(true);
        recyclerView.setLayoutManager(linearLayoutManager);
        ListRecyclerAdapter adapter = new ListRecyclerAdapter(list);
        recyclerView.setAdapter(adapter);

        setBehaviorCallback();

    }
项目:CoordinatorLayoutExample-master    文件:BottomSheetActivity.java   
@Override
public void onClick(View v) {
    switch (v.getId()) {
        case R.id.btnBehavior:
            int state = behavior.getState();
            if (state == BottomSheetBehavior.STATE_EXPANDED) {
                behavior.setState(BottomSheetBehavior.STATE_COLLAPSED);
            } else if(state == BottomSheetBehavior.STATE_COLLAPSED){
                behavior.setState(BottomSheetBehavior.STATE_HIDDEN);
            }else if(state == BottomSheetBehavior.STATE_HIDDEN){
                behavior.setState(BottomSheetBehavior.STATE_EXPANDED);
            }
            break;
        case R.id.btnDialog:
            BottomSheetDialog bottomSheetDialog = new BottomSheetDialog(this);
            bottomSheetDialog.setContentView(R.layout.include_bottom_sheet_layout);
            bottomSheetDialog.show();
            break;
    }
}
项目:CoordinatorLayoutExample-master    文件:BottomSheetActivity.java   
@Override
public void onClick(View v) {
    switch (v.getId()) {
        case R.id.btnBehavior:
            int state = behavior.getState();
            if (state == BottomSheetBehavior.STATE_EXPANDED) {
                behavior.setState(BottomSheetBehavior.STATE_COLLAPSED);
            } else if(state == BottomSheetBehavior.STATE_COLLAPSED){
                behavior.setState(BottomSheetBehavior.STATE_HIDDEN);
            }else if(state == BottomSheetBehavior.STATE_HIDDEN){
                behavior.setState(BottomSheetBehavior.STATE_EXPANDED);
            }
            break;
        case R.id.btnDialog:
            BottomSheetDialog bottomSheetDialog = new BottomSheetDialog(this);
            bottomSheetDialog.setContentView(R.layout.include_bottom_sheet_layout);
            bottomSheetDialog.show();
            break;
        case R.id.btn_baidumap:
            readyGo(BaiduMapSample.class);
            break;
    }
}
项目:BottomSheetDialogDemo    文件:MainActivity.java   
private void initBottomSheetDialog2() {
    List<String> mList;
    mList = new ArrayList<>();
    for(int i=0; i<20; i++){
        mList.add("item "+i);
    }

    final BottomSheetDialog bottomSheetDialog = new BottomSheetDialog(this);
    //创建recyclerView
    RecyclerView recyclerView = new RecyclerView(this);
    LinearLayoutManager linearLayoutManager = new LinearLayoutManager(this);
    linearLayoutManager.setOrientation(LinearLayoutManager.VERTICAL);
    recyclerView.setLayoutManager(linearLayoutManager);
    RecyclerAdapter recyclerAdapter = new RecyclerAdapter(mList,this);
    recyclerView.setAdapter(recyclerAdapter);
    recyclerAdapter.setOnItemClickListener(new RecyclerAdapter.OnItemClickListener() {
        @Override
        public void onItemClickListener(View item, int position) {
            Toast.makeText(MainActivity.this, "item "+position, Toast.LENGTH_SHORT).show();
            bottomSheetDialog.dismiss();
        }
    });

    bottomSheetDialog.setContentView(recyclerView);
    bottomSheetDialog.show();
}
项目:BottomSheetMenu    文件:BottomSheetMenu.java   
@SuppressLint("InflateParams")
private BottomSheetMenu(@NonNull Context context, BottomSheetMenuListener bottomSheetMenuListener) {
    super(context);
    mIconSize = context.getResources().getDimensionPixelSize(R.dimen.bottom_sheet_menu_item_icon_size);
    mBottomSheetMenuListener = bottomSheetMenuListener;

    setOnShowListener(new DialogInterface.OnShowListener() {
        @Override
        public void onShow(DialogInterface dialog) {
            BottomSheetDialog d = (BottomSheetDialog) dialog;
            FrameLayout bottomSheet = (FrameLayout) d.findViewById(android.support.design.R.id.design_bottom_sheet);

            if (bottomSheet != null) {
                BottomSheetBehavior.from(bottomSheet).setState(BottomSheetBehavior.STATE_EXPANDED);
            }
        }
    });
}
项目:CloudMusicLH    文件:AnchorRadioFragment.java   
private void createBottomSheetDialog() {
    mBottomSheetDialog = new BottomSheetDialog(getActivity());
    View view = LayoutInflater.from(getActivity()).inflate(R.layout.dialog_bottom_sheet, null, false);
    mBottomSheetDialog.setContentView(view);

    RecyclerView recyclerView = (RecyclerView) view.findViewById(R.id.recyclerView);
    recyclerView.setHasFixedSize(true);
    List<String> list = new ArrayList<>();
    /*for (int i = 0; i < 20; i++) {
        list.add("我是第" + i + "个");
    }*/
    list.add("下载视频");
    list.add("打开文件");
    list.add("取消下载");
    list.add("打开知识地图");
    LinearLayoutManager linearLayoutManager = new LinearLayoutManager(getActivity());
    linearLayoutManager.setSmoothScrollbarEnabled(true);
    recyclerView.setLayoutManager(linearLayoutManager);
    ListRecyclerAdapter adapter = new ListRecyclerAdapter(list);
    recyclerView.setAdapter(adapter);

    adapter.setOnItemClickListener(this);
    setBehaviorCallback();
}
项目:AndroidAnimationExercise    文件:BottomSheetDialogActivity.java   
private void showBSDialog() {
    final BottomSheetDialog dialog = new BottomSheetDialog(this);
    View view = LayoutInflater.from(this).inflate(R.layout.dialog_layout, null);
    RecyclerView recyclerView = (RecyclerView) view.findViewById(R.id.bs_rv);
    recyclerView.setLayoutManager(new LinearLayoutManager(this));
    SimpleStringRecyclerViewAdapter adapter = new SimpleStringRecyclerViewAdapter(this);
    adapter.setItemClickListener(new SimpleStringRecyclerViewAdapter.ItemClickListener() {
        @Override
        public void onItemClick(int pos) {
            dialog.dismiss();
            Toast.makeText(BottomSheetDialogActivity.this, "pos--->" + pos, Toast.LENGTH_LONG).show();
        }
    });
    recyclerView.setAdapter(adapter);
    dialog.setContentView(view);
    dialog.show();
}
项目:Stylish-Widget-for-Android    文件:MessageBoxDialog.java   
public BottomSheetDialog create() {
    final MessageBox messageBox = new MessageBox(context);

    messageBox.setMessage(message);

    final BottomSheetDialog dialog = new BottomSheetDialog(context);
    dialog.setContentView(messageBox);

    if (listener==null){
        listener = new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                dialog.hide();
            }
        };
    }
    if (text == null)
        messageBox.setCloseButton(listener);
    else
        messageBox.setActionButton(text, listener);


    return dialog;
}
项目:YGank    文件:YBottomSheetDialogView.java   
public YBottomSheetDialogView(Context context) {
        bottomDialog = new BottomSheetDialog(context);
        View view = LayoutInflater.from(context).inflate(R.layout.sharelayout, null);

        //取消弹出
        view.findViewById(R.id.cancel_share).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                if (bottomClickListener != null) {
                    bottomClickListener.cancleShare();
                }
            }
        });

        RecyclerView mRecyView = (RecyclerView) view.findViewById(R.id.srecyview);
        //水平滚动的RecycleView
//        LinearLayoutManager linearLayoutManager = new LinearLayoutManager(context, LinearLayoutManager.HORIZONTAL, false);
        LinearLayoutManager linearLayoutManager = new GridLayoutManager(context, 5, GridLayoutManager.VERTICAL, false);
        mRecyView.setLayoutManager(linearLayoutManager);
        mRecyView.setAdapter(new MyShareAdapter());
        bottomDialog.setContentView(view);
        bottomDialog.show();
    }
项目:Saude-no-Mapa    文件:RegisterPresenterImpl.java   
private void setupBottomSheetDialog() {
    mBottomSheetDialog = new BottomSheetDialog(mContext);
    View dialogView = LayoutInflater.from(mContext)
            .inflate(R.layout.dialog_bottom_sheet_profile, null);

    RecyclerView avatarRecycler = (RecyclerView) dialogView.findViewById(R.id.avatar_recycler);
    avatarRecycler.setHasFixedSize(true);
    avatarRecycler.setLayoutManager(new GridLayoutManager(mContext, 3, GridLayoutManager.VERTICAL, false));

    avatarRecycler.setAdapter(new AvatarAdapter(mContext, this));

    mBottomSheetDialog.setContentView(dialogView);

    dialogView.measure(View.MeasureSpec.UNSPECIFIED, View.MeasureSpec.UNSPECIFIED);

    BottomSheetBehavior mBehavior = BottomSheetBehavior.from((View) dialogView.getParent());
    mBehavior.setPeekHeight(dialogView.getMeasuredHeight() + 200);

    mBottomSheetDialog.show();
}
项目:Saude-no-Mapa    文件:EditProfilePresenterImpl.java   
private void setupBottomSheetDialog() {
    mBottomSheetDialog = new BottomSheetDialog(mContext);
    View dialogView = LayoutInflater.from(mContext)
            .inflate(R.layout.dialog_bottom_sheet_profile, null);

    RecyclerView avatarRecycler = (RecyclerView) dialogView.findViewById(R.id.avatar_recycler);
    avatarRecycler.setHasFixedSize(true);
    avatarRecycler.setLayoutManager(new GridLayoutManager(mContext, 3, GridLayoutManager.VERTICAL, false));

    avatarRecycler.setAdapter(new AvatarAdapter(mContext, this));

    mBottomSheetDialog.setContentView(dialogView);

    dialogView.measure(View.MeasureSpec.UNSPECIFIED, View.MeasureSpec.UNSPECIFIED);

    BottomSheetBehavior mBehavior = BottomSheetBehavior.from((View) dialogView.getParent());
    mBehavior.setPeekHeight(dialogView.getMeasuredHeight() + 200);

    mBottomSheetDialog.show();
}
项目:CoordinatorLayoutExample    文件:BottomSheetActivity.java   
@Override
public void onClick(View v) {
    switch (v.getId()) {
        case R.id.btnBehavior:
            int state = behavior.getState();
            if (state == BottomSheetBehavior.STATE_EXPANDED) {
                behavior.setState(BottomSheetBehavior.STATE_COLLAPSED);
            } else if(state == BottomSheetBehavior.STATE_COLLAPSED){
                behavior.setState(BottomSheetBehavior.STATE_HIDDEN);
            }else if(state == BottomSheetBehavior.STATE_HIDDEN){
                behavior.setState(BottomSheetBehavior.STATE_EXPANDED);
            }
            break;
        case R.id.btnDialog:
            BottomSheetDialog bottomSheetDialog = new BottomSheetDialog(this);
            bottomSheetDialog.setContentView(R.layout.include_bottom_sheet_layout);
            bottomSheetDialog.show();
            break;
    }
}
项目:CoordinatorLayoutExample    文件:BottomSheetActivity.java   
@Override
public void onClick(View v) {
    switch (v.getId()) {
        case R.id.btnBehavior:
            int state = behavior.getState();
            if (state == BottomSheetBehavior.STATE_EXPANDED) {
                behavior.setState(BottomSheetBehavior.STATE_COLLAPSED);
            } else if(state == BottomSheetBehavior.STATE_COLLAPSED){
                behavior.setState(BottomSheetBehavior.STATE_HIDDEN);
            }else if(state == BottomSheetBehavior.STATE_HIDDEN){
                behavior.setState(BottomSheetBehavior.STATE_EXPANDED);
            }
            break;
        case R.id.btnDialog:
            BottomSheetDialog bottomSheetDialog = new BottomSheetDialog(this);
            bottomSheetDialog.setContentView(R.layout.include_bottom_sheet_layout);
            bottomSheetDialog.show();
            break;
        case R.id.btn_baidumap:
            readyGo(BaiduMapSample.class);
            break;
    }
}
项目:DuDian    文件:DiscussView.java   
private void createBottomSheetDialog(Context context) {
    BottomSheetDialog bottomSheetDialog = new BottomSheetDialog(context);
    mBinding = DiscussViewBinding.inflate(LayoutInflater.from(context), null, false);
    mBinding.setHandler(new Handler());
    View view = mBinding.getRoot();
    bottomSheetDialog.setContentView(view);
    RecyclerView recyclerView = (RecyclerView) view.findViewById(R.id.discuss_view_recyclerview);
    recyclerView.setHasFixedSize(true);
    LinearLayoutManager linearLayoutManager = new LinearLayoutManager(context);
    linearLayoutManager.setSmoothScrollbarEnabled(true);
    recyclerView.setLayoutManager(linearLayoutManager);
    mAdapter = new DiscussAdapter(mCommentsBeenList, mContext);
    recyclerView.setAdapter(mAdapter);

    loadExtraData(mId);

    if (bottomSheetDialog.isShowing()) {
        bottomSheetDialog.dismiss();
    } else {
        bottomSheetDialog.show();
    }
}
项目:FolioReader-Android    文件:ConfigBottomSheetDialogFragment.java   
@Override
public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
    super.onViewCreated(view, savedInstanceState);
    view.getViewTreeObserver().addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() {
        @Override
        public void onGlobalLayout() {
            BottomSheetDialog dialog = (BottomSheetDialog) getDialog();
            FrameLayout bottomSheet = (FrameLayout)
                    dialog.findViewById(android.support.design.R.id.design_bottom_sheet);
            BottomSheetBehavior behavior = BottomSheetBehavior.from(bottomSheet);
            behavior.setState(BottomSheetBehavior.STATE_EXPANDED);
            behavior.setPeekHeight(0);
        }
    });

    mDialogView = view;
    mConfig = AppUtil.getSavedConfig(getActivity());
    initViews();
}
项目:hipda    文件:ThreadListFragment.java   
private void showThreadListSettingsDialog() {
    final LayoutInflater inflater = (LayoutInflater) getActivity().getSystemService(Context.LAYOUT_INFLATER_SERVICE);
    final View view = inflater.inflate(R.layout.dialog_thread_list_settings, null);

    final ValueChagerView valueChagerView = (ValueChagerView) view.findViewById(R.id.value_changer);

    valueChagerView.setCurrentValue(HiSettingsHelper.getInstance().getTitleTextSizeAdj());

    final BottomSheetDialog dialog = new BottomDialog(getActivity());

    valueChagerView.setOnChangeListener(new ValueChagerView.OnChangeListener() {
        @Override
        public void onChange(int currentValue) {
            HiSettingsHelper.getInstance().setTitleTextSizeAdj(currentValue);
            if (mThreadListAdapter != null)
                mThreadListAdapter.notifyDataSetChanged();
        }
    });

    dialog.setContentView(view);
    BottomSheetBehavior mBehavior = BottomSheetBehavior.from((View) view.getParent());
    mBehavior.setState(BottomSheetBehavior.STATE_EXPANDED);
    dialog.show();
}
项目:GitHub    文件:TMVPFragment.java   
@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;
}
项目:GitHub    文件:TMVPFragment.java   
@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;
}
项目:GitHub    文件:MyDialogBuilder.java   
private void buildBottomSheet(ConfigBean bean) {
    final BottomSheetDialog dialog = new BottomSheetDialog(bean.context);
    dialog.setContentView(bean.customView);
    dialog.setCancelable(bean.cancelable);
    dialog.setCanceledOnTouchOutside(bean.outsideTouchable);
    bean.dialog = dialog;
}
项目:GitHub    文件:Buildable.java   
private void buildBottomSheet(BuildBean bean) {
    BottomSheetDialog dialog = new BottomSheetDialog(bean.mContext);
    SheetHolder sheetHolder = new SheetHolder(bean.mContext, false);
    dialog.setContentView(sheetHolder.rootView);
    sheetHolder.assingDatasAndEvents(bean.mContext, bean);
    bean.dialog = dialog;
}
项目:KUtils    文件:Buildable.java   
private void buildBottomSheet(BuildBean bean) {
    BottomSheetDialog dialog = new BottomSheetDialog(bean.mContext);
    SheetHolder sheetHolder = new SheetHolder(bean.mContext);
    dialog.setContentView(sheetHolder.rootView);
    sheetHolder.assingDatasAndEvents(bean.mContext, bean);
    bean.dialog = dialog;
}
项目:editor-sql    文件:SqlTabDatasActivity.java   
private void showSortDialog() {
    mSortDialog = new BottomSheetDialog(this);
    View view = View.inflate(this, R.layout.bottom_menu_content, null);
    RecyclerView itemList = (RecyclerView) view.findViewById(R.id.bottom_list);
    itemList.setLayoutManager(new LinearLayoutManager(this));

    SortTypeAdapter adapter = new SortTypeAdapter(this, columnFields);
    itemList.setAdapter(adapter);

    mSortDialog.setContentView(view);
    mSortDialog.show();
}
项目:editor-sql    文件:SqlCreateTableActivity.java   
private void showSelectColumsDialog(final List<String> tablesName, final TextView selectedTxt, final RelativeLayout cloumnLayout, final TextView fkFieldTitle, final TextView fk_field) {
        View view = View.inflate(this, R.layout.bottom_menu_content, null);
        View dividerLine = view.findViewById(R.id.dividerLine);
        dividerLine.setVisibility(View.VISIBLE);
        final BottomSheetDialog bottomSheetDialog = new BottomSheetDialog(this);
        RecyclerView itemList = (RecyclerView) view.findViewById(R.id.bottom_list);
        itemList.setLayoutManager(new LinearLayoutManager(this));

        SelectTabOrColumnDialog adapter = new SelectTabOrColumnDialog(this, tablesName);
        itemList.setAdapter(adapter);
        adapter.setMyListener(new SelectTabOrColumnDialog.MyListener() {
            @Override
            public void click(int position) {
                bottomSheetDialog.dismiss();
                String selected = tablesName.get(position);
                if (fk_field != null && !selected.equals(mSelectedTab)) {

                    mSelectedTab = selected;
                    fk_field.setText(null);

                    cloumnLayout.setEnabled(true);
                    cloumnLayout.setClickable(true);
//                    fkFieldTitle.setTextColor(getResources().getColor(SkinHandler.getResourceId(SqlCreateTableActivity.this, R.attr.minorText)));
                }
                selectedTxt.setText(selected);
            }
        });


        bottomSheetDialog.setContentView(view);
        bottomSheetDialog.show();
    }
项目:CommonDependence    文件:AndroidShareHelper.java   
public BottomSheetDialog getShareDialog(@NonNull Context context, @LayoutRes int layoutId,
                                        @StyleRes int theme) {
    BottomSheetDialog bottomSheetDialog = new BottomSheetDialog(context, theme);
    View contentView = LayoutInflater.from(context).inflate(layoutId, null, false);
    bottomSheetDialog.setContentView(contentView);
    return bottomSheetDialog;
}
项目:CommonDependence    文件:AndroidShareHelper.java   
/**
 *
 * @param activity
 * @param layoutWithRecyclerView 你可以对Layout里的元素进行设置参数,然后传入进来
 * @param shareIntent
 */
public void shareWithBottomSheets(@NonNull final Activity activity, @NonNull View
        layoutWithRecyclerView, @NonNull final Intent shareIntent) {
    BottomSheetDialog shareDialog = new BottomSheetDialog(activity);
    shareDialog.setContentView(layoutWithRecyclerView);
    handleShareWithBottomSheets(activity, shareDialog, shareIntent);
}
项目:Auto.js    文件:CommunityWebView.java   
private void shouldScriptOptionsDialog(String url) {
    mUrl = url;
    String fileName = DownloadManager.parseFileNameLocally(url);
    mBottomSheetDialog = new BottomSheetDialog(getContext());
    mBottomSheetDialog.setContentView(new OptionListView.Builder(getContext())
            .title(fileName)
            .item(R.id.save, R.drawable.ic_file_download_black_48dp, R.string.text_download)
            .item(R.id.run, R.drawable.ic_play_arrow_white_48dp, R.string.text_run)
            .bindItemClick(this)
            .build());
    mBottomSheetDialog.show();
}
项目:tumbviewer    文件:PostBottomSheet.java   
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
    BottomSheetDialog dialog = (BottomSheetDialog) super.onCreateDialog(savedInstanceState);
    View view = View.inflate(getActivity(), R.layout.bottom_sheet_video_list, null);
    TextView textView = (TextView) view.findViewById(R.id.item_link);
    textView.setText(videoUrl);
    textView.setOnClickListener(this);
    view.findViewById(R.id.item_copy).setOnClickListener(this);
    dialog.setContentView(view);
    behavior = BottomSheetBehavior.from((View) view.getParent());
    return dialog;
}
项目:KTools    文件:KDialogActivity.java   
@OnClick(R.id.btn_bottom_dialog)
public void onBtnBottomDialogClicked() {
    WebView webView = new WebView(this);
    webView.loadUrl("https://github.com/jiangkang/KTools");
    webView.getSettings().setJavaScriptEnabled(true);
    BottomSheetDialog dialog = new BottomSheetDialog(this);
    dialog.setCancelable(true);
    dialog.setContentView(webView);
    dialog.show();
}
项目:MyDemo    文件:MovieDetailActivity.java   
private void showRateDetailDialog() {
    BottomSheetDialog dialog = new BottomSheetDialog(this);
    View view = getLayoutInflater().inflate(R.layout.dialog_rate_detail,null);
    ((TextView)view.findViewById(R.id.tv_rating)).setText(data.getRating().getAverage()+"");
    ((RatingBar)view.findViewById(R.id.rb_rating)).setRating((float) (data.getRating().getAverage()/2.0));
    ((TextView)view.findViewById(R.id.tv_rating_people)).setText(data.getRatings_count()+"人评分");

    DecimalFormat df = new DecimalFormat("#.0");

    int total = data.getRating().getDetails().getStar5()+data.getRating().getDetails().getStar4()+data.getRating().getDetails().getStar3()+data.getRating().getDetails().getStar2()+data.getRating().getDetails().getStar1();
    ((TextView)view.findViewById(R.id.tv_rate_5)).setText(df.format(data.getRating().getDetails().getStar5()/(total*1.0)*100)+"%");
    setWidth(view.findViewById(R.id.pb_5),Float.parseFloat(df.format(data.getRating().getDetails().getStar5()/(total*1.0)*100)));

    ((TextView)view.findViewById(R.id.tv_rate_4)).setText(df.format(data.getRating().getDetails().getStar4()/(total*1.0)*100)+"%");
    setWidth(view.findViewById(R.id.pb_4),Float.parseFloat(df.format(data.getRating().getDetails().getStar4()/(total*1.0)*100)));

    ((TextView)view.findViewById(R.id.tv_rate_3)).setText(df.format(data.getRating().getDetails().getStar3()/(total*1.0)*100)+"%");
    setWidth(view.findViewById(R.id.pb_3),Float.parseFloat(df.format(data.getRating().getDetails().getStar3()/(total*1.0)*100)));

    ((TextView)view.findViewById(R.id.tv_rate_2)).setText(df.format(data.getRating().getDetails().getStar2()/(total*1.0)*100)+"%");
    setWidth(view.findViewById(R.id.pb_2),Float.parseFloat(df.format(data.getRating().getDetails().getStar2()/(total*1.0)*100)));

    ((TextView)view.findViewById(R.id.tv_rate_1)).setText(df.format(data.getRating().getDetails().getStar1()/(total*1.0)*100)+"%");
    setWidth(view.findViewById(R.id.pb_1),Float.parseFloat(df.format(data.getRating().getDetails().getStar1()/(total*1.0)*100)));

    dialog.setContentView(view);
    dialog.show();
}
项目:Pocket-Plays-for-Twitch    文件:StreamFragment.java   
private void setupProfileBottomSheet() {
    View v = LayoutInflater.from(getContext()).inflate(R.layout.stream_profile_preview, null);
    mProfileBottomSheet = new BottomSheetDialog(getContext());
    mProfileBottomSheet.setContentView(v);
    final BottomSheetBehavior behavior = getDefaultBottomSheetBehaviour(v);

    mProfileBottomSheet.setOnDismissListener(new DialogInterface.OnDismissListener() {
        @Override
        public void onDismiss(DialogInterface dialogInterface) {
            behavior.setState(BottomSheetBehavior.STATE_COLLAPSED);
        }
    });

    TextView mNameView = (TextView) mProfileBottomSheet.findViewById(R.id.twitch_name);
    TextView mFollowers = (TextView) mProfileBottomSheet.findViewById(R.id.txt_followers);
    TextView mViewers = (TextView) mProfileBottomSheet.findViewById(R.id.txt_viewers);
    ImageView mFollowButton = (ImageView) mProfileBottomSheet.findViewById(R.id.follow_unfollow_icon);
    ImageView mFullProfileButton = (ImageView) mProfileBottomSheet.findViewById(R.id.full_profile_icon);
    RecyclerView mPanelsRecyclerView = (RecyclerView) mProfileBottomSheet.findViewById(R.id.panel_recyclerview);

    mNameView.setText(mChannelInfo.getDisplayName());
    mFollowers.setText(mChannelInfo.getFollowers() + "");
    mViewers.setText(mChannelInfo.getViews() + "");

    mFullProfileButton.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            mProfileBottomSheet.dismiss();

            final Intent intent = new Intent(getContext(), ChannelActivity.class);
            intent.putExtra(getContext().getResources().getString(R.string.channel_info_intent_object), mChannelInfo);
            intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);

            getContext().startActivity(intent);
        }
    });

    setupFollowButton(mFollowButton);
    setupPanels(mPanelsRecyclerView);
}
项目:SuperNote    文件:NoteMainActivity.java   
@Override
    public void showMoveBottomSheet() {
        final BottomSheetDialog dialog = new BottomSheetDialog(mContext);
//                    获取contentView
        ViewGroup contentView = (ViewGroup) ((ViewGroup) findViewById(android.R.id.content)).getChildAt(0);
        View root = LayoutInflater.from(mContext).inflate(R.layout.bottom_sheet_folder, contentView, false);
        RecyclerView recyclerView = (RecyclerView) root.findViewById(R.id.recycler_bottom_sheet_folder);
        recyclerView.setLayoutManager(new LinearLayoutManager(mContext));
        dialog.setContentView(root);

        recyclerView.setAdapter(getBottomSheetRvAdapter(dialog));

        dialog.show();
    }
项目:SuperNote    文件:NoteMainActivity.java   
private NoteBottomSheetFolderAdapter getBottomSheetRvAdapter(final BottomSheetDialog dialog) {
    final NoteBottomSheetFolderAdapter folderAdapter = new NoteBottomSheetFolderAdapter();
    folderAdapter.setNewData(mPresenter.getFolderDataList());
    folderAdapter.setOnItemClickListener(new BaseQuickAdapter.OnItemClickListener() {
        @Override
        public void onItemClick(BaseQuickAdapter adapter, View view, int position) {
            NoteFolder folder = folderAdapter.getData().get(position);
            mPresenter.moveNotesToFolder(folder);
            dialog.cancel();
        }
    });
    return folderAdapter;
}
项目:android-study    文件:BottomSheetBehaviorActivity.java   
private void showBottomSheetDialog() {
  BottomSheetDialog dialog = new BottomSheetDialog(this);
  View view = LayoutInflater.from(this).inflate(R.layout.bottom_sheet_list, null);
  RecyclerView recyclerView = (RecyclerView) view.findViewById(R.id.list);
  recyclerView.setLayoutManager(new LinearLayoutManager(this));
  recyclerView.setAdapter(new CoordinatorAdapter(this, mTitles));
  dialog.setContentView(view);
  dialog.show();
}
项目:BottomSheetDialogDemo    文件:FullSheetDialogFragment.java   
@Override
public Dialog onCreateDialog(@Nullable Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    BottomSheetDialog dialog = (BottomSheetDialog) super.onCreateDialog(savedInstanceState);
    View view = View.inflate(getContext(), R.layout.dialog_bottom_sheet1, null);
    dialog.setContentView(view);
    mBehavior = BottomSheetBehavior.from((View) view.getParent());
    return dialog;
}
项目:BottomSheetDialogDemo    文件:ShareRecyclerViewAdapter.java   
public ShareRecyclerViewAdapter(Activity activity, BottomSheetDialog dialog) {
    this.activity = activity;
    this.dialog = dialog;
    list = getShareAppList();
    if (list == null) {
        return;
    }
    for (int i = 0; i < list.size(); i++) {
        Log.e("11111", list.get(i).toString());
    }

}
项目:KUtils-master    文件:Buildable.java   
private void buildBottomSheet(BuildBean bean) {
    BottomSheetDialog dialog = new BottomSheetDialog(bean.mContext);
    SheetHolder sheetHolder = new SheetHolder(bean.mContext);
    dialog.setContentView(sheetHolder.rootView);
    sheetHolder.assingDatasAndEvents(bean.mContext, bean);
    bean.dialog = dialog;
}
项目:trust-wallet-android    文件:TransactionsActivity.java   
private void openExchangeDialog() {
    Wallet wallet = viewModel.defaultWallet().getValue();
    if (wallet == null) {
        Toast.makeText(this, getString(R.string.error_wallet_not_selected), Toast.LENGTH_SHORT)
                .show();
    } else {
        BottomSheetDialog dialog = new BottomSheetDialog(this);
        DepositView view = new DepositView(this, wallet);
        view.setOnDepositClickListener(this::onDepositClick);
        dialog.setContentView(view);
        dialog.show();
        this.dialog = dialog;
    }
}
项目:trust-wallet-android    文件:WalletsActivity.java   
private void onAddWallet() {
    AddWalletView addWalletView = new AddWalletView(this);
    addWalletView.setOnNewWalletClickListener(this);
    addWalletView.setOnImportWalletClickListener(this);
    dialog = new BottomSheetDialog(this);
    dialog.setContentView(addWalletView);
    dialog.setCancelable(true);
    dialog.setCanceledOnTouchOutside(true);
    dialog.show();
}
项目:PlayAndroid    文件:TestFullScreenBottomSheetDialogFragment.java   
@NonNull
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
    BottomSheetDialog dialog = (BottomSheetDialog) super.onCreateDialog(savedInstanceState);
    View view = View.inflate(getContext(), R.layout.test_bottom_sheet_dialog, null);
    dialog.setContentView(view);
    mBehavior = BottomSheetBehavior.from((View) view.getParent());
    mBehavior.setSkipCollapsed(true);

    return dialog;
}