本文整理汇总了Java中android.support.design.widget.BottomSheetDialog类的典型用法代码示例。如果您正苦于以下问题:Java BottomSheetDialog类的具体用法?Java BottomSheetDialog怎么用?Java BottomSheetDialog使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
BottomSheetDialog类属于android.support.design.widget包,在下文中一共展示了BottomSheetDialog类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: configureTransitionTime
import android.support.design.widget.BottomSheetDialog; //导入依赖的package包/类
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();
}
示例2: initDialog
import android.support.design.widget.BottomSheetDialog; //导入依赖的package包/类
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();
}
示例3: onClick
import android.support.design.widget.BottomSheetDialog; //导入依赖的package包/类
@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;
}
}
示例4: onClick
import android.support.design.widget.BottomSheetDialog; //导入依赖的package包/类
@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;
}
}
示例5: initBottomSheetDialog2
import android.support.design.widget.BottomSheetDialog; //导入依赖的package包/类
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();
}
示例6: BottomSheetMenu
import android.support.design.widget.BottomSheetDialog; //导入依赖的package包/类
@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);
}
}
});
}
示例7: createBottomSheetDialog
import android.support.design.widget.BottomSheetDialog; //导入依赖的package包/类
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();
}
示例8: showBSDialog
import android.support.design.widget.BottomSheetDialog; //导入依赖的package包/类
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();
}
示例9: create
import android.support.design.widget.BottomSheetDialog; //导入依赖的package包/类
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;
}
示例10: YBottomSheetDialogView
import android.support.design.widget.BottomSheetDialog; //导入依赖的package包/类
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();
}
示例11: setupBottomSheetDialog
import android.support.design.widget.BottomSheetDialog; //导入依赖的package包/类
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();
}
示例12: createBottomSheetDialog
import android.support.design.widget.BottomSheetDialog; //导入依赖的package包/类
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();
}
}
示例13: onViewCreated
import android.support.design.widget.BottomSheetDialog; //导入依赖的package包/类
@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();
}
示例14: showThreadListSettingsDialog
import android.support.design.widget.BottomSheetDialog; //导入依赖的package包/类
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();
}
示例15: onCreateDialog
import android.support.design.widget.BottomSheetDialog; //导入依赖的package包/类
@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;
}