Search in sources :

Example 1 with GridMarginDecoration

use of us.koller.cameraroll.ui.widget.GridMarginDecoration in project Camera-Roll-Android-App by kollerlukas.

the class FileOperationDialogActivity method showFolderSelectorDialog.

public void showFolderSelectorDialog(final File_POJO[] files) {
    View v = LayoutInflater.from(this).inflate(R.layout.file_operation_dialog, (ViewGroup) findViewById(R.id.root_view), false);
    RecyclerView recyclerView = v.findViewById(R.id.recyclerView);
    recyclerView.setLayoutManager(new GridLayoutManager(this, 2));
    recyclerView.addItemDecoration(new GridMarginDecoration((int) getResources().getDimension(R.dimen.album_grid_spacing)));
    final RecyclerViewAdapter recyclerViewAdapter = new RecyclerViewAdapter();
    recyclerView.setAdapter(recyclerViewAdapter);
    final View scrollIndicatorTop = v.findViewById(R.id.scroll_indicator_top);
    final View scrollIndicatorBottom = v.findViewById(R.id.scroll_indicator_bottom);
    recyclerView.addOnScrollListener(new RecyclerView.OnScrollListener() {

        @Override
        public void onScrolled(RecyclerView recyclerView, int dx, int dy) {
            super.onScrolled(recyclerView, dx, dy);
            scrollIndicatorTop.setVisibility(recyclerView.canScrollVertically(-1) ? View.VISIBLE : View.INVISIBLE);
            scrollIndicatorBottom.setVisibility(recyclerView.canScrollVertically(1) ? View.VISIBLE : View.INVISIBLE);
        }
    });
    int stringRes;
    boolean oneItem = files.length == 1;
    if (action.equals(ACTION_COPY)) {
        if (oneItem) {
            stringRes = R.string.copy_item_to;
        } else {
            stringRes = R.string.copy_items_to;
        }
    } else {
        if (oneItem) {
            stringRes = R.string.move_item_to;
        } else {
            stringRes = R.string.move_items_to;
        }
    }
    String title = getString(stringRes, files.length);
    dialog = new AlertDialog.Builder(this, theme.getDialogThemeRes()).setTitle(title).setView(v).setPositiveButton(R.string.ok, new DialogInterface.OnClickListener() {

        @Override
        public void onClick(DialogInterface dialogInterface, int i) {
            onDestroyListener = new OnDestroyListener() {

                @Override
                public void onDestroy() {
                    String path = recyclerViewAdapter.getSelectedPath();
                    if (path != null) {
                        executeAction(files, path);
                    }
                }
            };
        }
    }).setNeutralButton(getString(R.string.new_folder), new DialogInterface.OnClickListener() {

        @Override
        public void onClick(DialogInterface dialogInterface, int i) {
            creatingNewFolder = true;
            createNewFolder(files);
        }
    }).setNegativeButton(R.string.cancel, null).setOnDismissListener(new DialogInterface.OnDismissListener() {

        @Override
        public void onDismiss(DialogInterface dialogInterface) {
            onDialogDismiss();
        }
    }).create();
    dialog.show();
}
Also used : DialogInterface(android.content.DialogInterface) ImageView(android.widget.ImageView) View(android.view.View) RecyclerView(android.support.v7.widget.RecyclerView) TextView(android.widget.TextView) SuppressLint(android.annotation.SuppressLint) GridLayoutManager(android.support.v7.widget.GridLayoutManager) GridMarginDecoration(us.koller.cameraroll.ui.widget.GridMarginDecoration) RecyclerView(android.support.v7.widget.RecyclerView)

Example 2 with GridMarginDecoration

use of us.koller.cameraroll.ui.widget.GridMarginDecoration in project Camera-Roll-Android-App by kollerlukas.

the class MainActivity method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    pick_photos = getIntent().getAction() != null && getIntent().getAction().equals(PICK_PHOTOS);
    boolean allowMultiple = getIntent().getBooleanExtra(Intent.EXTRA_ALLOW_MULTIPLE, false);
    final Settings settings = Settings.getInstance(this);
    hiddenFolders = settings.getHiddenFolders();
    // load media
    albums = MediaProvider.getAlbums();
    if (albums == null) {
        albums = new ArrayList<>();
    }
    if (savedInstanceState == null) {
        refreshPhotos();
    }
    final Toolbar toolbar = findViewById(R.id.toolbar);
    setSupportActionBar(toolbar);
    toolbar.setBackgroundColor(!pick_photos ? toolbarColor : accentColor);
    toolbar.setTitleTextColor(!pick_photos ? textColorPrimary : accentTextColor);
    ActionBar actionBar = getSupportActionBar();
    if (pick_photos) {
        if (actionBar != null) {
            actionBar.setTitle(allowMultiple ? getString(R.string.pick_photos) : getString(R.string.pick_photo));
        }
        toolbar.setActivated(true);
        toolbar.setNavigationIcon(R.drawable.ic_clear_white);
        Drawable navIcon = toolbar.getNavigationIcon();
        if (navIcon != null) {
            navIcon = DrawableCompat.wrap(navIcon);
            DrawableCompat.setTint(navIcon.mutate(), accentTextColor);
            toolbar.setNavigationIcon(navIcon);
        }
        toolbar.setNavigationOnClickListener(new View.OnClickListener() {

            @Override
            public void onClick(View view) {
                finish();
            }
        });
        Util.colorToolbarOverflowMenuIcon(toolbar, accentTextColor);
        if (theme.darkStatusBarIconsInSelectorMode()) {
            Util.setDarkStatusBarIcons(findViewById(R.id.root_view));
        }
    } else {
        if (actionBar != null) {
            actionBar.setTitle(getString(R.string.toolbar_title));
        }
    }
    recyclerView = findViewById(R.id.recyclerView);
    recyclerView.setTag(ParallaxImageView.RECYCLER_VIEW_TAG);
    SelectorModeManager.Callback callback = new SelectorModeManager.SimpleCallback() {

        @Override
        public void onSelectorModeEnter() {
            super.onSelectorModeEnter();
            showAndHideFab(false);
        }

        @Override
        public void onSelectorModeExit() {
            super.onSelectorModeExit();
            showAndHideFab(true);
        }
    };
    int spanCount, spacing;
    if (settings.noFolderMode()) {
        spanCount = settings.getColumnCount(this);
        spacing = (int) getResources().getDimension(R.dimen.album_grid_spacing) / 2;
        recyclerView.addItemDecoration(new GridMarginDecoration(spacing + spacing));
        recyclerViewAdapter = new NoFolderRecyclerViewAdapter(callback, recyclerView, pick_photos).setData(albums);
    } else {
        spanCount = settings.getStyleColumnCount(this, settings.getStyle(this, pick_photos));
        spacing = settings.getStyleGridSpacing(this, settings.getStyle(this, pick_photos));
        recyclerViewAdapter = new MainAdapter(this, pick_photos).setData(albums);
        recyclerViewAdapter.getSelectorManager().addCallback(callback);
    }
    recyclerView.setAdapter(recyclerViewAdapter);
    recyclerView.setLayoutManager(new GridLayoutManager(this, spanCount));
    if (recyclerView instanceof FastScrollerRecyclerView) {
        ((FastScrollerRecyclerView) recyclerView).addOuterGridSpacing(spacing);
    }
    // disable default change animation
    ((SimpleItemAnimator) recyclerView.getItemAnimator()).setSupportsChangeAnimations(false);
    // restore Selector mode, when needed
    if (savedInstanceState != null) {
        SelectorModeManager manager = new SelectorModeManager(savedInstanceState);
        recyclerViewAdapter.setSelectorModeManager(manager);
    }
    recyclerView.addOnScrollListener(new RecyclerView.OnScrollListener() {

        @Override
        public void onScrolled(RecyclerView recyclerView, int dx, int dy) {
            super.onScrolled(recyclerView, dx, dy);
            if (pick_photos) {
                return;
            }
            // hiding toolbar on scroll
            float translationY = toolbar.getTranslationY() - dy;
            if (-translationY > toolbar.getHeight()) {
                translationY = -toolbar.getHeight();
                if (theme.elevatedToolbar()) {
                    toolbar.setActivated(true);
                }
            } else if (translationY > 0) {
                translationY = 0;
                if (theme.elevatedToolbar() && !recyclerView.canScrollVertically(-1)) {
                    toolbar.setActivated(false);
                }
            }
            toolbar.setTranslationY(translationY);
            // animate statusBarIcon color
            boolean selectorModeActive = recyclerViewAdapter.getSelectorManager().isSelectorModeActive();
            if (!selectorModeActive && Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP && theme.isBaseLight()) {
                // only animate statusBar icons color, when not in selectorMode
                float animatedValue = (-translationY) / toolbar.getHeight();
                if (animatedValue > 0.9f) {
                    Util.setLightStatusBarIcons(findViewById(R.id.root_view));
                } else {
                    Util.setDarkStatusBarIcons(findViewById(R.id.root_view));
                }
            }
        }
    });
    final FloatingActionButton fab = findViewById(R.id.fab);
    fab.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View view) {
            fabClicked(view);
        }
    });
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
        Drawable d = ContextCompat.getDrawable(this, R.drawable.ic_camera_lens_avd);
        fab.setImageDrawable(d);
    } else {
        fab.setImageResource(R.drawable.ic_camera_white);
    }
    Drawable d = fab.getDrawable();
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
        d.setTint(accentTextColor);
    } else {
        d = DrawableCompat.wrap(d);
        DrawableCompat.setTint(d.mutate(), accentTextColor);
    }
    fab.setImageDrawable(d);
    if (pick_photos || !settings.getCameraShortcut()) {
        fab.setVisibility(View.GONE);
    }
    // setting window insets manually
    final ViewGroup rootView = findViewById(R.id.root_view);
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT_WATCH) {
        rootView.setOnApplyWindowInsetsListener(new View.OnApplyWindowInsetsListener() {

            @Override
            @RequiresApi(api = Build.VERSION_CODES.KITKAT_WATCH)
            public WindowInsets onApplyWindowInsets(View view, WindowInsets insets) {
                // clear this listener so insets aren't re-applied
                rootView.setOnApplyWindowInsetsListener(null);
                Log.d("MainActivity", "onApplyWindowInsets()" + "[" + insets.getSystemWindowInsetLeft() + ", " + insets.getSystemWindowInsetTop() + ", " + insets.getSystemWindowInsetRight() + ", " + insets.getSystemWindowInsetBottom() + "]");
                toolbar.setPadding(toolbar.getPaddingStart(), toolbar.getPaddingTop() + insets.getSystemWindowInsetTop(), toolbar.getPaddingEnd(), toolbar.getPaddingBottom());
                ViewGroup.MarginLayoutParams toolbarParams = (ViewGroup.MarginLayoutParams) toolbar.getLayoutParams();
                toolbarParams.leftMargin = insets.getSystemWindowInsetLeft();
                toolbarParams.rightMargin = insets.getSystemWindowInsetRight();
                toolbar.setLayoutParams(toolbarParams);
                recyclerView.setPadding(recyclerView.getPaddingStart() + insets.getSystemWindowInsetLeft(), recyclerView.getPaddingTop() + insets.getSystemWindowInsetTop(), recyclerView.getPaddingEnd() + insets.getSystemWindowInsetRight(), recyclerView.getPaddingBottom() + insets.getSystemWindowInsetBottom());
                fab.setTranslationY(-insets.getSystemWindowInsetBottom());
                fab.setTranslationX(-insets.getSystemWindowInsetRight());
                return insets.consumeSystemWindowInsets();
            }
        });
    } else {
        rootView.getViewTreeObserver().addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() {

            @Override
            public void onGlobalLayout() {
                rootView.getViewTreeObserver().removeOnGlobalLayoutListener(this);
                // hacky way of getting window insets on pre-Lollipop
                // somewhat works...
                int[] screenSize = Util.getScreenSize(MainActivity.this);
                int[] windowInsets = new int[] { Math.abs(screenSize[0] - rootView.getLeft()), Math.abs(screenSize[1] - rootView.getTop()), Math.abs(screenSize[2] - rootView.getRight()), Math.abs(screenSize[3] - rootView.getBottom()) };
                toolbar.setPadding(toolbar.getPaddingStart(), toolbar.getPaddingTop() + windowInsets[1], toolbar.getPaddingEnd(), toolbar.getPaddingBottom());
                ViewGroup.MarginLayoutParams toolbarParams = (ViewGroup.MarginLayoutParams) toolbar.getLayoutParams();
                toolbarParams.leftMargin += windowInsets[0];
                toolbarParams.rightMargin += windowInsets[2];
                toolbar.setLayoutParams(toolbarParams);
                recyclerView.setPadding(recyclerView.getPaddingStart() + windowInsets[0], recyclerView.getPaddingTop() + windowInsets[1], recyclerView.getPaddingEnd() + windowInsets[2], recyclerView.getPaddingBottom() + windowInsets[3]);
                fab.setTranslationX(-windowInsets[2]);
                fab.setTranslationY(-windowInsets[3]);
            }
        });
    }
    // needed for transparent statusBar
    setSystemUiFlags();
}
Also used : WindowInsets(android.view.WindowInsets) GridMarginDecoration(us.koller.cameraroll.ui.widget.GridMarginDecoration) NoFolderRecyclerViewAdapter(us.koller.cameraroll.adapter.main.NoFolderRecyclerViewAdapter) FloatingActionButton(android.support.design.widget.FloatingActionButton) FastScrollerRecyclerView(us.koller.cameraroll.ui.widget.FastScrollerRecyclerView) ViewTreeObserver(android.view.ViewTreeObserver) Settings(us.koller.cameraroll.data.Settings) ActionBar(android.support.v7.app.ActionBar) Toolbar(android.support.v7.widget.Toolbar) MainAdapter(us.koller.cameraroll.adapter.main.MainAdapter) SimpleItemAnimator(android.support.v7.widget.SimpleItemAnimator) ViewGroup(android.view.ViewGroup) Drawable(android.graphics.drawable.Drawable) View(android.view.View) FastScrollerRecyclerView(us.koller.cameraroll.ui.widget.FastScrollerRecyclerView) RecyclerView(android.support.v7.widget.RecyclerView) ParallaxImageView(us.koller.cameraroll.ui.widget.ParallaxImageView) GridLayoutManager(android.support.v7.widget.GridLayoutManager) SelectorModeManager(us.koller.cameraroll.adapter.SelectorModeManager) RequiresApi(android.support.annotation.RequiresApi) FastScrollerRecyclerView(us.koller.cameraroll.ui.widget.FastScrollerRecyclerView) RecyclerView(android.support.v7.widget.RecyclerView)

Example 3 with GridMarginDecoration

use of us.koller.cameraroll.ui.widget.GridMarginDecoration in project Camera-Roll-Android-App by kollerlukas.

the class AlbumActivity method onCreate.

@Override
protected void onCreate(@Nullable final Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_album);
    pick_photos = getIntent().getAction() != null && getIntent().getAction().equals(MainActivity.PICK_PHOTOS);
    allowMultiple = getIntent().getBooleanExtra(Intent.EXTRA_ALLOW_MULTIPLE, false);
    MediaProvider.checkPermission(this);
    setExitSharedElementCallback(mCallback);
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
        getWindow().setEnterTransition(new TransitionSet().setOrdering(TransitionSet.ORDERING_TOGETHER).addTransition(new Slide(Gravity.BOTTOM)).addTransition(new Fade()).setInterpolator(new AccelerateDecelerateInterpolator()));
        getWindow().setReturnTransition(new TransitionSet().setOrdering(TransitionSet.ORDERING_TOGETHER).addTransition(new Slide(Gravity.BOTTOM)).addTransition(new Fade()).setInterpolator(new AccelerateDecelerateInterpolator()));
    }
    final ViewGroup swipeBackView = findViewById(R.id.swipeBackView);
    if (swipeBackView instanceof SwipeBackCoordinatorLayout) {
        ((SwipeBackCoordinatorLayout) swipeBackView).setOnSwipeListener(this);
    }
    final Toolbar toolbar = findViewById(R.id.toolbar);
    setSupportActionBar(toolbar);
    final ActionBar actionBar = getSupportActionBar();
    if (!pick_photos) {
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
            AnimatedVectorDrawable drawable = (AnimatedVectorDrawable) ContextCompat.getDrawable(AlbumActivity.this, R.drawable.back_to_cancel_avd);
            // mutating avd to reset it
            drawable.mutate();
            toolbar.setNavigationIcon(drawable);
        } else {
            toolbar.setNavigationIcon(R.drawable.ic_arrow_back_white);
        }
        Drawable navIcon = toolbar.getNavigationIcon();
        if (navIcon != null) {
            navIcon = DrawableCompat.wrap(navIcon);
            DrawableCompat.setTint(navIcon.mutate(), textColorSecondary);
            toolbar.setNavigationIcon(navIcon);
        }
    } else {
        if (actionBar != null) {
            actionBar.setTitle(allowMultiple ? getString(R.string.pick_photos) : getString(R.string.pick_photo));
        }
        toolbar.setNavigationIcon(R.drawable.ic_clear_white);
        Drawable navIcon = toolbar.getNavigationIcon();
        if (navIcon != null) {
            navIcon = DrawableCompat.wrap(navIcon);
            DrawableCompat.setTint(navIcon.mutate(), accentTextColor);
            toolbar.setNavigationIcon(navIcon);
        }
        Util.setDarkStatusBarIcons(findViewById(R.id.root_view));
        Util.colorToolbarOverflowMenuIcon(toolbar, accentTextColor);
    }
    toolbar.setNavigationOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View view) {
            if (recyclerViewAdapter != null && recyclerViewAdapter.isSelectorModeActive()) {
                recyclerViewAdapter.cancelSelectorMode(null);
            } else {
                onBackPressed();
            }
        }
    });
    recyclerView = findViewById(R.id.recyclerView);
    final int columnCount = Settings.getInstance(this).getColumnCount(this);
    GridLayoutManager gridLayoutManager = new GridLayoutManager(this, columnCount);
    recyclerView.setLayoutManager(gridLayoutManager);
    recyclerViewAdapter = new AlbumAdapter(this, recyclerView, album, pick_photos);
    recyclerView.setAdapter(recyclerViewAdapter);
    float albumGridSpacing = getResources().getDimension(R.dimen.album_grid_spacing);
    ((FastScrollerRecyclerView) recyclerView).addOuterGridSpacing((int) (albumGridSpacing / 2));
    recyclerView.addItemDecoration(new GridMarginDecoration((int) albumGridSpacing));
    if (savedInstanceState != null && savedInstanceState.containsKey(RECYCLER_VIEW_SCROLL_STATE)) {
        recyclerView.getLayoutManager().onRestoreInstanceState(savedInstanceState.getParcelable(RECYCLER_VIEW_SCROLL_STATE));
    }
    recyclerView.addOnScrollListener(new RecyclerView.OnScrollListener() {

        // private float scrollY = 0.0f;
        @Override
        public void onScrolled(RecyclerView recyclerView, int dx, int dy) {
            super.onScrolled(recyclerView, dx, dy);
            if (recyclerViewAdapter.isSelectorModeActive() || pick_photos) {
                return;
            }
            float translationY = toolbar.getTranslationY() - dy;
            if (-translationY > toolbar.getHeight()) {
                translationY = -toolbar.getHeight();
                if (theme.elevatedToolbar()) {
                    toolbar.setActivated(true);
                }
            } else if (translationY > 0) {
                translationY = 0;
                if (theme.elevatedToolbar() && !recyclerView.canScrollVertically(-1)) {
                    toolbar.setActivated(false);
                }
            }
            toolbar.setTranslationY(translationY);
            // animate statusBarIcon color
            if (theme.darkStatusBarIcons()) {
                float animatedValue = (-translationY) / toolbar.getHeight();
                if (animatedValue > 0.9f) {
                    Util.setLightStatusBarIcons(findViewById(R.id.root_view));
                } else {
                    Util.setDarkStatusBarIcons(findViewById(R.id.root_view));
                }
            }
        }
    });
    final FloatingActionButton fab = findViewById(R.id.fab);
    if (!pick_photos) {
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
            Drawable d = ContextCompat.getDrawable(this, R.drawable.ic_delete_avd);
            fab.setImageDrawable(d);
        } else {
            fab.setImageResource(R.drawable.ic_delete_white);
        }
    } else {
        fab.setImageResource(R.drawable.ic_send_white);
    }
    Drawable d = fab.getDrawable();
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
        d.setTint(accentTextColor);
    } else {
        d = DrawableCompat.wrap(d);
        DrawableCompat.setTint(d.mutate(), accentTextColor);
    }
    fab.setImageDrawable(d);
    fab.setScaleX(0.0f);
    fab.setScaleY(0.0f);
    final ViewGroup rootView = findViewById(R.id.root_view);
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT_WATCH) {
        rootView.setOnApplyWindowInsetsListener(new View.OnApplyWindowInsetsListener() {

            @Override
            @RequiresApi(api = Build.VERSION_CODES.KITKAT_WATCH)
            public WindowInsets onApplyWindowInsets(View view, WindowInsets insets) {
                toolbar.setPadding(toolbar.getPaddingStart(), toolbar.getPaddingTop() + insets.getSystemWindowInsetTop(), toolbar.getPaddingEnd(), toolbar.getPaddingBottom());
                ViewGroup.MarginLayoutParams toolbarParams = (ViewGroup.MarginLayoutParams) toolbar.getLayoutParams();
                toolbarParams.leftMargin += insets.getSystemWindowInsetLeft();
                toolbarParams.rightMargin += insets.getSystemWindowInsetRight();
                toolbar.setLayoutParams(toolbarParams);
                recyclerView.setPadding(recyclerView.getPaddingStart() + insets.getSystemWindowInsetLeft(), recyclerView.getPaddingTop() + insets.getSystemWindowInsetTop(), recyclerView.getPaddingEnd() + insets.getSystemWindowInsetRight(), recyclerView.getPaddingBottom() + insets.getSystemWindowInsetBottom());
                fab.setTranslationY(-insets.getSystemWindowInsetBottom());
                fab.setTranslationX(-insets.getSystemWindowInsetRight());
                rootView.setOnApplyWindowInsetsListener(null);
                return insets.consumeSystemWindowInsets();
            }
        });
    } else {
        rootView.getViewTreeObserver().addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() {

            @Override
            public void onGlobalLayout() {
                // hacky way of getting window insets on pre-Lollipop
                // somewhat works...
                int[] screenSize = Util.getScreenSize(AlbumActivity.this);
                int[] windowInsets = new int[] { Math.abs(screenSize[0] - rootView.getLeft()), Math.abs(screenSize[1] - rootView.getTop()), Math.abs(screenSize[2] - rootView.getRight()), Math.abs(screenSize[3] - rootView.getBottom()) };
                toolbar.setPadding(toolbar.getPaddingStart(), toolbar.getPaddingTop() + windowInsets[1], toolbar.getPaddingEnd(), toolbar.getPaddingBottom());
                ViewGroup.MarginLayoutParams toolbarParams = (ViewGroup.MarginLayoutParams) toolbar.getLayoutParams();
                toolbarParams.leftMargin += windowInsets[0];
                toolbarParams.rightMargin += windowInsets[2];
                toolbar.setLayoutParams(toolbarParams);
                recyclerView.setPadding(recyclerView.getPaddingStart() + windowInsets[0], recyclerView.getPaddingTop() + windowInsets[1], recyclerView.getPaddingEnd() + windowInsets[2], recyclerView.getPaddingBottom() + windowInsets[3]);
                recyclerView.scrollToPosition(0);
                fab.setTranslationX(-windowInsets[2]);
                fab.setTranslationY(-windowInsets[3]);
                rootView.getViewTreeObserver().removeOnGlobalLayoutListener(this);
            }
        });
    }
    // onNewIntent(getIntent());
    // needed for transparent statusBar
    setSystemUiFlags();
    // load album
    String path;
    if (savedInstanceState != null && savedInstanceState.containsKey(ALBUM_PATH)) {
        path = savedInstanceState.getString(ALBUM_PATH);
    } else {
        path = getIntent().getStringExtra(ALBUM_PATH);
    }
    MediaProvider.loadAlbum(this, path, new MediaProvider.OnAlbumLoadedCallback() {

        @Override
        public void onAlbumLoaded(Album album) {
            AlbumActivity.this.album = album;
            AlbumActivity.this.onAlbumLoaded(savedInstanceState);
        }
    });
}
Also used : VirtualAlbum(us.koller.cameraroll.data.models.VirtualAlbum) Album(us.koller.cameraroll.data.models.Album) WindowInsets(android.view.WindowInsets) TransitionSet(android.transition.TransitionSet) Slide(android.transition.Slide) SwipeBackCoordinatorLayout(us.koller.cameraroll.ui.widget.SwipeBackCoordinatorLayout) GridMarginDecoration(us.koller.cameraroll.ui.widget.GridMarginDecoration) AccelerateDecelerateInterpolator(android.view.animation.AccelerateDecelerateInterpolator) FloatingActionButton(android.support.design.widget.FloatingActionButton) FastScrollerRecyclerView(us.koller.cameraroll.ui.widget.FastScrollerRecyclerView) ViewTreeObserver(android.view.ViewTreeObserver) ActionBar(android.support.v7.app.ActionBar) Toolbar(android.support.v7.widget.Toolbar) ViewGroup(android.view.ViewGroup) ColorDrawable(android.graphics.drawable.ColorDrawable) Drawable(android.graphics.drawable.Drawable) AnimatedVectorDrawable(android.graphics.drawable.AnimatedVectorDrawable) View(android.view.View) FastScrollerRecyclerView(us.koller.cameraroll.ui.widget.FastScrollerRecyclerView) RecyclerView(android.support.v7.widget.RecyclerView) AnimatedVectorDrawable(android.graphics.drawable.AnimatedVectorDrawable) GridLayoutManager(android.support.v7.widget.GridLayoutManager) MediaProvider(us.koller.cameraroll.data.provider.MediaProvider) RequiresApi(android.support.annotation.RequiresApi) FastScrollerRecyclerView(us.koller.cameraroll.ui.widget.FastScrollerRecyclerView) RecyclerView(android.support.v7.widget.RecyclerView) ColorFade(us.koller.cameraroll.util.animators.ColorFade) Fade(android.transition.Fade) AlbumAdapter(us.koller.cameraroll.adapter.album.AlbumAdapter)

Aggregations

GridLayoutManager (android.support.v7.widget.GridLayoutManager)3 RecyclerView (android.support.v7.widget.RecyclerView)3 View (android.view.View)3 GridMarginDecoration (us.koller.cameraroll.ui.widget.GridMarginDecoration)3 Drawable (android.graphics.drawable.Drawable)2 RequiresApi (android.support.annotation.RequiresApi)2 FloatingActionButton (android.support.design.widget.FloatingActionButton)2 ActionBar (android.support.v7.app.ActionBar)2 Toolbar (android.support.v7.widget.Toolbar)2 ViewGroup (android.view.ViewGroup)2 ViewTreeObserver (android.view.ViewTreeObserver)2 WindowInsets (android.view.WindowInsets)2 FastScrollerRecyclerView (us.koller.cameraroll.ui.widget.FastScrollerRecyclerView)2 SuppressLint (android.annotation.SuppressLint)1 DialogInterface (android.content.DialogInterface)1 AnimatedVectorDrawable (android.graphics.drawable.AnimatedVectorDrawable)1 ColorDrawable (android.graphics.drawable.ColorDrawable)1 SimpleItemAnimator (android.support.v7.widget.SimpleItemAnimator)1 Fade (android.transition.Fade)1 Slide (android.transition.Slide)1