Search in sources :

Example 6 with AppBarLayout

use of com.google.android.material.appbar.AppBarLayout 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)

Example 7 with AppBarLayout

use of com.google.android.material.appbar.AppBarLayout in project android by nextcloud.

the class FileDisplayActivity method resetHeaderScrollingState.

private void resetHeaderScrollingState() {
    CoordinatorLayout.LayoutParams params = (CoordinatorLayout.LayoutParams) findViewById(R.id.root_layout).getLayoutParams();
    params.setBehavior(new AppBarLayout.ScrollingViewBehavior());
    AppBarLayout appBarLayout = findViewById(R.id.appbar);
    if (appBarLayout != null) {
        appBarLayout.setExpanded(true);
    }
}
Also used : CoordinatorLayout(androidx.coordinatorlayout.widget.CoordinatorLayout) AppBarLayout(com.google.android.material.appbar.AppBarLayout)

Example 8 with AppBarLayout

use of com.google.android.material.appbar.AppBarLayout in project android_packages_apps_Settings by omnirom.

the class FloatingAppBarScrollingViewBehaviorTest method setAppBarLayoutTransparent_backgroundDefaultAsWhite_shouldBeTransparent.

@Test
public void setAppBarLayoutTransparent_backgroundDefaultAsWhite_shouldBeTransparent() {
    mContext.setTheme(R.style.Theme_Settings_Home);
    final AppBarLayout appBarLayout = new AppBarLayout(mContext);
    appBarLayout.setBackgroundColor(Color.WHITE);
    mScrollingViewBehavior.setAppBarLayoutTransparent(appBarLayout);
    assertThat(((ColorDrawable) appBarLayout.getBackground()).getColor()).isEqualTo(Color.TRANSPARENT);
}
Also used : ColorDrawable(android.graphics.drawable.ColorDrawable) AppBarLayout(com.google.android.material.appbar.AppBarLayout) Test(org.junit.Test)

Example 9 with AppBarLayout

use of com.google.android.material.appbar.AppBarLayout in project AmazeFileManager by TeamAmaze.

the class MainActivity method initialiseViews.

void initialiseViews() {
    appbar = new AppBar(this, getPrefs(), queue -> {
        if (!queue.isEmpty()) {
            mainActivityHelper.search(getPrefs(), queue);
        }
    });
    appBarLayout = getAppbar().getAppbarLayout();
    setSupportActionBar(getAppbar().getToolbar());
    drawer = new Drawer(this);
    indicator_layout = findViewById(R.id.indicator_layout);
    getSupportActionBar().setDisplayShowTitleEnabled(false);
    fabBgView = findViewById(R.id.fabs_overlay_layout);
    switch(getAppTheme().getSimpleTheme()) {
        case DARK:
            fabBgView.setBackgroundResource(R.drawable.fab_shadow_dark);
            break;
        case BLACK:
            fabBgView.setBackgroundResource(R.drawable.fab_shadow_black);
            break;
    }
    fabBgView.setOnClickListener(view -> {
        if (getAppbar().getSearchView().isEnabled())
            getAppbar().getSearchView().hideSearchView();
    });
    drawer.setDrawerHeaderBackground();
}
Also used : CursorLoader(androidx.loader.content.CursorLoader) AppBar(com.amaze.filemanager.ui.views.appbar.AppBar) MOVE(com.amaze.filemanager.file_operations.filesystem.OperationTypeKt.MOVE) Bundle(android.os.Bundle) SingletonUsbOtg(com.amaze.filemanager.file_operations.filesystem.usb.SingletonUsbOtg) NonNull(androidx.annotation.NonNull) ARG_ADDRESS(com.amaze.filemanager.ui.dialogs.SftpConnectDialog.ARG_ADDRESS) Completable(io.reactivex.Completable) Uri(android.net.Uri) ColorDrawable(android.graphics.drawable.ColorDrawable) CloudEntry(com.amaze.filemanager.database.models.explorer.CloudEntry) SDK_INT(android.os.Build.VERSION.SDK_INT) ARG_KEYPAIR_NAME(com.amaze.filemanager.ui.dialogs.SftpConnectDialog.ARG_KEYPAIR_NAME) StorageDirectoryParcelable(com.amaze.filemanager.adapters.data.StorageDirectoryParcelable) UNDEFINED(com.amaze.filemanager.file_operations.filesystem.OperationTypeKt.UNDEFINED) PREFERENCE_NEED_TO_SET_HOME(com.amaze.filemanager.ui.fragments.preference_fragments.PreferencesConstants.PREFERENCE_NEED_TO_SET_HOME) Handler(android.os.Handler) Shell(eu.chainfire.libsuperuser.Shell) Fragment(androidx.fragment.app.Fragment) Function(androidx.arch.core.util.Function) TargetApi(android.annotation.TargetApi) Log(android.util.Log) M(android.os.Build.VERSION_CODES.M) SAVE_FILE(com.amaze.filemanager.file_operations.filesystem.OperationTypeKt.SAVE_FILE) SshConnectionPool(com.amaze.filemanager.filesystem.ssh.SshConnectionPool) CoordinatorLayout(androidx.coordinatorlayout.widget.CoordinatorLayout) GeneralDialogCreation(com.amaze.filemanager.ui.dialogs.GeneralDialogCreation) N(android.os.Build.VERSION_CODES.N) RENAME(com.amaze.filemanager.file_operations.filesystem.OperationTypeKt.RENAME) CompletableObserver(io.reactivex.CompletableObserver) IntentFilter(android.content.IntentFilter) LogHelper(com.amaze.filemanager.LogHelper) StorageNamingHelper(com.amaze.filemanager.ui.strings.StorageNamingHelper) ARG_USERNAME(com.amaze.filemanager.ui.dialogs.SftpConnectDialog.ARG_USERNAME) FileUtils(com.amaze.filemanager.filesystem.files.FileUtils) NEW_FILE(com.amaze.filemanager.file_operations.filesystem.OperationTypeKt.NEW_FILE) JELLY_BEAN_MR2(android.os.Build.VERSION_CODES.JELLY_BEAN_MR2) IdRes(androidx.annotation.IdRes) StringRes(androidx.annotation.StringRes) JELLY_BEAN_MR1(android.os.Build.VERSION_CODES.JELLY_BEAN_MR1) Nullable(androidx.annotation.Nullable) StorageNaming(com.amaze.filemanager.file_operations.filesystem.StorageNaming) SmbConnectionListener(com.amaze.filemanager.ui.dialogs.SmbConnectDialog.SmbConnectionListener) DELETE(com.amaze.filemanager.file_operations.filesystem.OperationTypeKt.DELETE) R(com.amaze.filemanager.R) AppConfig(com.amaze.filemanager.application.AppConfig) PermissionsActivity(com.amaze.filemanager.ui.activities.superclasses.PermissionsActivity) SftpConnectDialog(com.amaze.filemanager.ui.dialogs.SftpConnectDialog) Environment(android.os.Environment) CompressedExplorerFragment(com.amaze.filemanager.ui.fragments.CompressedExplorerFragment) BaseTransientBottomBar(com.google.android.material.snackbar.BaseTransientBottomBar) CloudLoaderAsyncTask(com.amaze.filemanager.asynchronous.asynctasks.CloudLoaderAsyncTask) CloudSheetFragment(com.amaze.filemanager.ui.fragments.CloudSheetFragment) ArrayList(java.util.ArrayList) TagsHelper(com.amaze.filemanager.TagsHelper) TileService(android.service.quicksettings.TileService) RenameBookmark(com.amaze.filemanager.ui.dialogs.RenameBookmark) StorageVolume(android.os.storage.StorageVolume) MainActivityHelper(com.amaze.filemanager.utils.MainActivityHelper) ARG_PORT(com.amaze.filemanager.ui.dialogs.SftpConnectDialog.ARG_PORT) PreferencesConstants(com.amaze.filemanager.ui.fragments.preference_fragments.PreferencesConstants) MenuInflater(android.view.MenuInflater) SearchWorkerFragment(com.amaze.filemanager.ui.fragments.SearchWorkerFragment) DataUtils(com.amaze.filemanager.utils.DataUtils) PreferenceUtils(com.amaze.filemanager.utils.PreferenceUtils) Toast(android.widget.Toast) Menu(android.view.Menu) TabFragment(com.amaze.filemanager.ui.fragments.TabFragment) Loader(androidx.loader.content.Loader) DeleteTask(com.amaze.filemanager.asynchronous.asynctasks.DeleteTask) StorageManager(android.os.storage.StorageManager) PREFERENCE_COLORED_NAVIGATION(com.amaze.filemanager.ui.fragments.preference_fragments.PreferencesConstants.PREFERENCE_COLORED_NAVIGATION) ARG_NAME(com.amaze.filemanager.ui.dialogs.SftpConnectDialog.ARG_NAME) TextUtils(android.text.TextUtils) File(java.io.File) EXTRACT(com.amaze.filemanager.file_operations.filesystem.OperationTypeKt.EXTRACT) MainActivityActionMode(com.amaze.filemanager.utils.MainActivityActionMode) Utils(com.amaze.filemanager.utils.Utils) FtpServerFragment(com.amaze.filemanager.ui.fragments.FtpServerFragment) ARG_DEFAULT_PATH(com.amaze.filemanager.ui.dialogs.SftpConnectDialog.ARG_DEFAULT_PATH) RingtoneManager(android.media.RingtoneManager) Configuration(android.content.res.Configuration) CloudConnectionCallbacks(com.amaze.filemanager.ui.fragments.CloudSheetFragment.CloudConnectionCallbacks) SaveOnDataUtilsChange(com.amaze.filemanager.asynchronous.SaveOnDataUtilsChange) TabFragmentBottomDragListener(com.amaze.filemanager.ui.drag.TabFragmentBottomDragListener) RequiresApi(androidx.annotation.RequiresApi) KITKAT(android.os.Build.VERSION_CODES.KITKAT) BookSorter(com.amaze.filemanager.utils.BookSorter) SpeedDialView(com.leinardi.android.speeddial.SpeedDialView) DrawableRes(androidx.annotation.DrawableRes) MainFragment(com.amaze.filemanager.ui.fragments.MainFragment) AndroidSchedulers(io.reactivex.android.schedulers.AndroidSchedulers) AppBarLayout(com.google.android.material.appbar.AppBarLayout) LOLLIPOP(android.os.Build.VERSION_CODES.LOLLIPOP) SortHandler(com.amaze.filemanager.database.SortHandler) RootHelper(com.amaze.filemanager.filesystem.RootHelper) Drawer(com.amaze.filemanager.ui.views.drawer.Drawer) CopyService(com.amaze.filemanager.asynchronous.services.CopyService) SpeedDialOverlayLayout(com.leinardi.android.speeddial.SpeedDialOverlayLayout) ContentResolver(android.content.ContentResolver) CloudContract(com.amaze.filemanager.database.CloudContract) ARG_PASSWORD(com.amaze.filemanager.ui.dialogs.SftpConnectDialog.ARG_PASSWORD) PasteHelper(com.amaze.filemanager.filesystem.PasteHelper) View(android.view.View) Schedulers(io.reactivex.schedulers.Schedulers) CustomZoomFocusChange(com.amaze.filemanager.ui.views.CustomZoomFocusChange) UsbManager(android.hardware.usb.UsbManager) SmbConnectDialog(com.amaze.filemanager.ui.dialogs.SmbConnectDialog) OTGUtil(com.amaze.filemanager.utils.OTGUtil) AsyncTask(android.os.AsyncTask) ProcessViewerFragment(com.amaze.filemanager.ui.fragments.ProcessViewerFragment) MakeFileOperation(com.amaze.filemanager.filesystem.MakeFileOperation) FragmentTransaction(androidx.fragment.app.FragmentTransaction) BroadcastReceiver(android.content.BroadcastReceiver) List(java.util.List) CloudRail(com.cloudrail.si.CloudRail) Disposable(io.reactivex.disposables.Disposable) FabWithLabelView(com.leinardi.android.speeddial.FabWithLabelView) CloudHandler(com.amaze.filemanager.database.CloudHandler) Pattern(java.util.regex.Pattern) MaterialDialog(com.afollestad.materialdialogs.MaterialDialog) Snackbar(com.google.android.material.snackbar.Snackbar) KITKAT_WATCH(android.os.Build.VERSION_CODES.KITKAT_WATCH) DecelerateInterpolator(android.view.animation.DecelerateInterpolator) ServiceWatcherUtil(com.amaze.filemanager.asynchronous.management.ServiceWatcherUtil) Context(android.content.Context) KeyEvent(android.view.KeyEvent) HybridFile(com.amaze.filemanager.filesystem.HybridFile) UtilsHandler(com.amaze.filemanager.database.UtilsHandler) COMPRESS(com.amaze.filemanager.file_operations.filesystem.OperationTypeKt.COMPRESS) Intent(android.content.Intent) FolderChooserDialog(com.afollestad.materialdialogs.folderselector.FolderChooserDialog) TabHandler(com.amaze.filemanager.database.TabHandler) LoaderManager(androidx.loader.app.LoaderManager) OpenMode(com.amaze.filemanager.file_operations.filesystem.OpenMode) AppConstants(com.amaze.filemanager.utils.AppConstants) MenuItem(android.view.MenuItem) HybridFileParcelable(com.amaze.filemanager.filesystem.HybridFileParcelable) OperationData(com.amaze.filemanager.database.models.OperationData) UsbOtgRepresentation(com.amaze.filemanager.file_operations.filesystem.usb.UsbOtgRepresentation) COPY(com.amaze.filemanager.file_operations.filesystem.OperationTypeKt.COPY) SystemBarTintManager(com.readystatesoftware.systembartint.SystemBarTintManager) WeakReference(java.lang.ref.WeakReference) Build(android.os.Build) AppsListFragment(com.amaze.filemanager.ui.fragments.AppsListFragment) Cursor(android.database.Cursor) WRITABLE_OR_ON_SDCARD(com.amaze.filemanager.file_operations.filesystem.FolderStateKt.WRITABLE_OR_ON_SDCARD) ExternalSdCardOperation(com.amaze.filemanager.filesystem.ExternalSdCardOperation) PREFERENCE_VIEW(com.amaze.filemanager.ui.fragments.preference_fragments.PreferencesConstants.PREFERENCE_VIEW) ARG_EDIT(com.amaze.filemanager.ui.dialogs.SftpConnectDialog.ARG_EDIT) NEW_FOLDER(com.amaze.filemanager.file_operations.filesystem.OperationTypeKt.NEW_FOLDER) DialogAction(com.afollestad.materialdialogs.DialogAction) REQUEST_CODE_SAF_FTP(com.amaze.filemanager.ui.fragments.FtpServerFragment.REQUEST_CODE_SAF_FTP) BookmarkCallback(com.amaze.filemanager.ui.dialogs.RenameBookmark.BookmarkCallback) ARG_HAS_PASSWORD(com.amaze.filemanager.ui.dialogs.SftpConnectDialog.ARG_HAS_PASSWORD) Color(android.graphics.Color) MoveFiles(com.amaze.filemanager.asynchronous.asynctasks.MoveFiles) SpeedDialActionItem(com.leinardi.android.speeddial.SpeedDialActionItem) BottomSheetDialogFragment(com.google.android.material.bottomsheet.BottomSheetDialogFragment) HandlerThread(android.os.HandlerThread) CloudPluginException(com.amaze.filemanager.file_operations.exceptions.CloudPluginException) Collections(java.util.Collections) Activity(android.app.Activity) PREFERENCE_BOOKMARKS_ADDED(com.amaze.filemanager.ui.fragments.preference_fragments.PreferencesConstants.PREFERENCE_BOOKMARKS_ADDED) FileUtil(com.amaze.filemanager.filesystem.FileUtil) ContentUris(android.content.ContentUris) AppBar(com.amaze.filemanager.ui.views.appbar.AppBar) Drawer(com.amaze.filemanager.ui.views.drawer.Drawer)

Example 10 with AppBarLayout

use of com.google.android.material.appbar.AppBarLayout in project AntennaPod by AntennaPod.

the class FeedItemlistFragment method onCreateView.

@Nullable
@Override
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
    View root = inflater.inflate(R.layout.feed_item_list_fragment, container, false);
    toolbar = root.findViewById(R.id.toolbar);
    toolbar.inflateMenu(R.menu.feedlist);
    toolbar.setOnMenuItemClickListener(this);
    displayUpArrow = getParentFragmentManager().getBackStackEntryCount() != 0;
    if (savedInstanceState != null) {
        displayUpArrow = savedInstanceState.getBoolean(KEY_UP_ARROW);
    }
    ((MainActivity) getActivity()).setupToolbarToggle(toolbar, displayUpArrow);
    refreshToolbarState();
    recyclerView = root.findViewById(R.id.recyclerView);
    recyclerView.setRecycledViewPool(((MainActivity) getActivity()).getRecycledViewPool());
    progressBar = root.findViewById(R.id.progLoading);
    progressBar.setVisibility(View.VISIBLE);
    txtvTitle = root.findViewById(R.id.txtvTitle);
    txtvAuthor = root.findViewById(R.id.txtvAuthor);
    imgvBackground = root.findViewById(R.id.imgvBackground);
    imgvCover = root.findViewById(R.id.imgvCover);
    butShowInfo = root.findViewById(R.id.butShowInfo);
    butShowSettings = root.findViewById(R.id.butShowSettings);
    txtvInformation = root.findViewById(R.id.txtvInformation);
    txtvFailure = root.findViewById(R.id.txtvFailure);
    txtvUpdatesDisabled = root.findViewById(R.id.txtvUpdatesDisabled);
    header = root.findViewById(R.id.headerContainer);
    AppBarLayout appBar = root.findViewById(R.id.appBar);
    CollapsingToolbarLayout collapsingToolbar = root.findViewById(R.id.collapsing_toolbar);
    ToolbarIconTintManager iconTintManager = new ToolbarIconTintManager(getContext(), toolbar, collapsingToolbar) {

        @Override
        protected void doTint(Context themedContext) {
            toolbar.getMenu().findItem(R.id.sort_items).setIcon(AppCompatResources.getDrawable(themedContext, R.drawable.ic_sort));
            toolbar.getMenu().findItem(R.id.filter_items).setIcon(AppCompatResources.getDrawable(themedContext, R.drawable.ic_filter));
            toolbar.getMenu().findItem(R.id.refresh_item).setIcon(AppCompatResources.getDrawable(themedContext, R.drawable.ic_refresh));
            toolbar.getMenu().findItem(R.id.action_search).setIcon(AppCompatResources.getDrawable(themedContext, R.drawable.ic_search));
        }
    };
    iconTintManager.updateTint();
    appBar.addOnOffsetChangedListener(iconTintManager);
    nextPageLoader = new MoreContentListFooterUtil(root.findViewById(R.id.more_content_list_footer));
    nextPageLoader.setClickListener(() -> {
        if (feed != null) {
            DBTasks.loadNextPageOfFeed(getActivity(), feed, false);
        }
    });
    recyclerView.addOnScrollListener(new RecyclerView.OnScrollListener() {

        @Override
        public void onScrolled(@NonNull RecyclerView view, int deltaX, int deltaY) {
            super.onScrolled(view, deltaX, deltaY);
            boolean hasMorePages = feed != null && feed.isPaged() && feed.getNextPageLink() != null;
            nextPageLoader.getRoot().setVisibility((recyclerView.isScrolledToBottom() && hasMorePages) ? View.VISIBLE : View.GONE);
        }
    });
    EventBus.getDefault().register(this);
    SwipeRefreshLayout swipeRefreshLayout = root.findViewById(R.id.swipeRefresh);
    swipeRefreshLayout.setDistanceToTriggerSync(getResources().getInteger(R.integer.swipe_refresh_distance));
    swipeRefreshLayout.setOnRefreshListener(() -> {
        DBTasks.forceRefreshFeed(requireContext(), feed, true);
        new Handler(Looper.getMainLooper()).postDelayed(() -> swipeRefreshLayout.setRefreshing(false), getResources().getInteger(R.integer.swipe_to_refresh_duration_in_ms));
    });
    loadItems();
    // Init action UI (via a FAB Speed Dial)
    speedDialView = root.findViewById(R.id.fabSD);
    speedDialView.setOverlayLayout(root.findViewById(R.id.fabSDOverlay));
    speedDialView.inflate(R.menu.episodes_apply_action_speeddial);
    speedDialView.setOnChangeListener(new SpeedDialView.OnChangeListener() {

        @Override
        public boolean onMainActionSelected() {
            return false;
        }

        @Override
        public void onToggleChanged(boolean open) {
            if (open && adapter.getSelectedCount() == 0) {
                ((MainActivity) getActivity()).showSnackbarAbovePlayer(R.string.no_items_selected, Snackbar.LENGTH_SHORT);
                speedDialView.close();
            }
        }
    });
    speedDialView.setOnActionSelectedListener(actionItem -> {
        new EpisodeMultiSelectActionHandler(((MainActivity) getActivity()), adapter.getSelectedItems()).handleAction(actionItem.getId());
        adapter.endSelectMode();
        return true;
    });
    return root;
}
Also used : Context(android.content.Context) FeedItemMenuHandler(de.danoeh.antennapod.menuhandler.FeedItemMenuHandler) Handler(android.os.Handler) FeedMenuHandler(de.danoeh.antennapod.menuhandler.FeedMenuHandler) EpisodeMultiSelectActionHandler(de.danoeh.antennapod.fragment.actions.EpisodeMultiSelectActionHandler) EpisodeMultiSelectActionHandler(de.danoeh.antennapod.fragment.actions.EpisodeMultiSelectActionHandler) MainActivity(de.danoeh.antennapod.activity.MainActivity) SpeedDialView(com.leinardi.android.speeddial.SpeedDialView) ImageView(android.widget.ImageView) View(android.view.View) AdapterView(android.widget.AdapterView) RecyclerView(androidx.recyclerview.widget.RecyclerView) TextView(android.widget.TextView) EpisodeItemListRecyclerView(de.danoeh.antennapod.view.EpisodeItemListRecyclerView) IconTextView(com.joanzapata.iconify.widget.IconTextView) MoreContentListFooterUtil(de.danoeh.antennapod.core.util.gui.MoreContentListFooterUtil) SwipeRefreshLayout(androidx.swiperefreshlayout.widget.SwipeRefreshLayout) CollapsingToolbarLayout(com.google.android.material.appbar.CollapsingToolbarLayout) RecyclerView(androidx.recyclerview.widget.RecyclerView) EpisodeItemListRecyclerView(de.danoeh.antennapod.view.EpisodeItemListRecyclerView) AppBarLayout(com.google.android.material.appbar.AppBarLayout) ToolbarIconTintManager(de.danoeh.antennapod.view.ToolbarIconTintManager) SpeedDialView(com.leinardi.android.speeddial.SpeedDialView) Nullable(androidx.annotation.Nullable)

Aggregations

AppBarLayout (com.google.android.material.appbar.AppBarLayout)15 View (android.view.View)5 CoordinatorLayout (androidx.coordinatorlayout.widget.CoordinatorLayout)5 ColorDrawable (android.graphics.drawable.ColorDrawable)4 CollapsingToolbarLayout (com.google.android.material.appbar.CollapsingToolbarLayout)4 Test (org.junit.Test)4 Context (android.content.Context)3 Nullable (androidx.annotation.Nullable)3 Handler (android.os.Handler)2 ViewGroup (android.view.ViewGroup)2 Window (android.view.Window)2 WeakReference (java.lang.ref.WeakReference)2 TargetApi (android.annotation.TargetApi)1 Activity (android.app.Activity)1 BroadcastReceiver (android.content.BroadcastReceiver)1 ContentResolver (android.content.ContentResolver)1 ContentUris (android.content.ContentUris)1 Intent (android.content.Intent)1 IntentFilter (android.content.IntentFilter)1 Configuration (android.content.res.Configuration)1