Search in sources :

Example 1 with CoordinatorLayout

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()));
}
Also used : CoordinatorLayout(androidx.coordinatorlayout.widget.CoordinatorLayout) SharedPreferences(android.content.SharedPreferences) FileListListAdapter(com.owncloud.android.ui.adapter.FileListListAdapter)

Example 2 with CoordinatorLayout

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;
}
Also used : CoordinatorLayout(androidx.coordinatorlayout.widget.CoordinatorLayout) EditText(android.widget.EditText) AlertDialog(androidx.appcompat.app.AlertDialog) AlertDialog(androidx.appcompat.app.AlertDialog) Dialog(android.app.Dialog) LayoutInflater(android.view.LayoutInflater) SuppressLint(android.annotation.SuppressLint) TextView(android.widget.TextView) View(android.view.View) NonNull(androidx.annotation.NonNull)

Example 3 with CoordinatorLayout

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();
}
Also used : CoordinatorLayout(androidx.coordinatorlayout.widget.CoordinatorLayout)

Example 4 with CoordinatorLayout

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;
}
Also used : CoordinatorLayout(androidx.coordinatorlayout.widget.CoordinatorLayout) SpannableString(android.text.SpannableString) ForegroundColorSpan(android.text.style.ForegroundColorSpan) ViewGroup(android.view.ViewGroup) View(android.view.View) Snackbar(com.google.android.material.snackbar.Snackbar)

Example 5 with CoordinatorLayout

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);
}
Also used : CoordinatorLayout(androidx.coordinatorlayout.widget.CoordinatorLayout) AppBarLayout(com.google.android.material.appbar.AppBarLayout)

Aggregations

CoordinatorLayout (androidx.coordinatorlayout.widget.CoordinatorLayout)11 View (android.view.View)4 FrameLayout (android.widget.FrameLayout)4 Options (com.reactnativenavigation.options.Options)3 ChildControllersRegistry (com.reactnativenavigation.viewcontrollers.child.ChildControllersRegistry)3 ViewGroup (android.view.ViewGroup)2 ViewParent (android.view.ViewParent)2 SimpleViewController (com.reactnativenavigation.mocks.SimpleViewController)2 SuppressLint (android.annotation.SuppressLint)1 Activity (android.app.Activity)1 Dialog (android.app.Dialog)1 SharedPreferences (android.content.SharedPreferences)1 SpannableString (android.text.SpannableString)1 ForegroundColorSpan (android.text.style.ForegroundColorSpan)1 LayoutInflater (android.view.LayoutInflater)1 EditText (android.widget.EditText)1 TextView (android.widget.TextView)1 NonNull (androidx.annotation.NonNull)1 AlertDialog (androidx.appcompat.app.AlertDialog)1 AppBarLayout (com.google.android.material.appbar.AppBarLayout)1