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();
}
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);
}
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();
}
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);
}
}
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);
}
Aggregations