use of androidx.coordinatorlayout.widget.CoordinatorLayout in project android by owncloud.
the class OCFileListFragment method updateListOfFiles.
private void updateListOfFiles(FileListOption fileListOption) {
boolean justFolders = isShowingJustFolders();
setFooterEnabled(!justFolders);
boolean folderPicker = isPickingAFolder();
mFileListAdapter = new FileListListAdapter(justFolders, fileListOption.isAvailableOffline(), fileListOption.isSharedByLink(), folderPicker, getActivity(), mContainerActivity);
setListAdapter(mFileListAdapter);
mHideFab = !fileListOption.isAllFiles() || folderPicker;
if (mHideFab) {
setFabEnabled(false);
} else {
setFabEnabled(true);
registerFabListeners();
// detect if a mini FAB has ever been clicked
final SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(getActivity());
if (prefs.getLong(KEY_FAB_EVER_CLICKED, 0) > 0) {
miniFabClicked = true;
}
// add labels to the min FABs when none of them has ever been clicked on
if (!miniFabClicked) {
setFabLabels();
} else {
removeFabLabels();
}
}
// Allow or disallow touches with other visible windows
CoordinatorLayout coordinatorLayout = requireActivity().findViewById(R.id.coordinator_layout);
coordinatorLayout.setFilterTouchesWhenObscured(PreferenceUtils.shouldDisallowTouchesWithOtherVisibleWindows(getContext()));
}
use of androidx.coordinatorlayout.widget.CoordinatorLayout in project android by owncloud.
the class CreateFolderDialogFragment method onCreateDialog.
@NonNull
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
mParentFolder = requireArguments().getParcelable(ARG_PARENT_FOLDER);
// Inflate the layout for the dialog
LayoutInflater inflater = requireActivity().getLayoutInflater();
@SuppressLint("InflateParams") View v = inflater.inflate(R.layout.edit_box_dialog, null);
// Allow or disallow touches with other visible windows
v.setFilterTouchesWhenObscured(PreferenceUtils.shouldDisallowTouchesWithOtherVisibleWindows(getContext()));
CoordinatorLayout coordinatorLayout = requireActivity().findViewById(R.id.coordinator_layout);
if (coordinatorLayout != null) {
coordinatorLayout.setFilterTouchesWhenObscured(PreferenceUtils.shouldDisallowTouchesWithOtherVisibleWindows(getContext()));
}
// Setup layout
EditText inputText = v.findViewById(R.id.user_input);
inputText.setText("");
inputText.requestFocus();
// Build the dialog
AlertDialog.Builder builder = new AlertDialog.Builder(requireActivity());
builder.setView(v).setPositiveButton(android.R.string.ok, this).setNegativeButton(android.R.string.cancel, this).setTitle(R.string.uploader_info_dirname);
Dialog d = builder.create();
d.getWindow().setSoftInputMode(LayoutParams.SOFT_INPUT_STATE_VISIBLE);
return d;
}
use of androidx.coordinatorlayout.widget.CoordinatorLayout in project Signal-Android by WhisperSystems.
the class SingleAddressBottomSheet method init.
private void init() {
CoordinatorLayout rootView = (CoordinatorLayout) inflate(getContext(), R.layout.activity_map_bottom_sheet_view, this);
bottomSheetBehavior = BottomSheetBehavior.from(rootView.findViewById(R.id.root_bottom_sheet));
bottomSheetBehavior.setHideable(true);
bottomSheetBehavior.setState(BottomSheetBehavior.STATE_HIDDEN);
bindViews();
}
use of androidx.coordinatorlayout.widget.CoordinatorLayout in project AndroidUtilCode by Blankj.
the class SnackbarUtils method show.
/**
* Show the snackbar.
*
* @param isShowTop True to show the snack bar on the top, false otherwise.
*/
public Snackbar show(boolean isShowTop) {
View view = this.view;
if (view == null)
return null;
if (isShowTop) {
ViewGroup suitableParent = findSuitableParentCopyFromSnackbar(view);
View topSnackBarContainer = suitableParent.findViewWithTag("topSnackBarCoordinatorLayout");
if (topSnackBarContainer == null) {
CoordinatorLayout topSnackBarCoordinatorLayout = new CoordinatorLayout(view.getContext());
topSnackBarCoordinatorLayout.setTag("topSnackBarCoordinatorLayout");
topSnackBarCoordinatorLayout.setRotation(180);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
// bring to front
topSnackBarCoordinatorLayout.setElevation(100);
}
suitableParent.addView(topSnackBarCoordinatorLayout, ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT);
topSnackBarContainer = topSnackBarCoordinatorLayout;
}
view = topSnackBarContainer;
}
if (messageColor != COLOR_DEFAULT) {
SpannableString spannableString = new SpannableString(message);
ForegroundColorSpan colorSpan = new ForegroundColorSpan(messageColor);
spannableString.setSpan(colorSpan, 0, spannableString.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
sWeakSnackbar = new WeakReference<>(Snackbar.make(view, spannableString, duration));
} else {
sWeakSnackbar = new WeakReference<>(Snackbar.make(view, message, duration));
}
final Snackbar snackbar = sWeakSnackbar.get();
final Snackbar.SnackbarLayout snackbarView = (Snackbar.SnackbarLayout) snackbar.getView();
if (isShowTop) {
for (int i = 0; i < snackbarView.getChildCount(); i++) {
View child = snackbarView.getChildAt(i);
child.setRotation(180);
}
}
if (bgResource != -1) {
snackbarView.setBackgroundResource(bgResource);
} else if (bgColor != COLOR_DEFAULT) {
snackbarView.setBackgroundColor(bgColor);
}
if (bottomMargin != 0) {
ViewGroup.MarginLayoutParams params = (ViewGroup.MarginLayoutParams) snackbarView.getLayoutParams();
params.bottomMargin = bottomMargin;
}
if (actionText.length() > 0 && actionListener != null) {
if (actionTextColor != COLOR_DEFAULT) {
snackbar.setActionTextColor(actionTextColor);
}
snackbar.setAction(actionText, actionListener);
}
snackbar.show();
return snackbar;
}
use of androidx.coordinatorlayout.widget.CoordinatorLayout in project IITB-App by wncc.
the class EventFragment method setAppBarOffset.
/**
* Set appbar to have an offset
*/
private void setAppBarOffset(int offsetPx) {
if (getView() == null || getActivity() == null)
return;
AppBarLayout mAppBarLayout = getView().findViewById(R.id.appBar);
CoordinatorLayout mCoordinatorLayour = getView().findViewById(R.id.coordinator);
CoordinatorLayout.LayoutParams params = (CoordinatorLayout.LayoutParams) mAppBarLayout.getLayoutParams();
AppBarLayout.Behavior behavior = (AppBarLayout.Behavior) params.getBehavior();
if (behavior == null)
return;
behavior.onNestedPreScroll(mCoordinatorLayour, mAppBarLayout, null, 0, offsetPx, new int[] { 0, 0 }, 0);
}
Aggregations