Memory efficient android library for managing individual fragment backstack.

Overview

fragstack : Android library for managing individual fragment backstack.

Android Arsenal API

An Easy to use library for managing individual fragment back stack as Instagram and Youtube does. Easily pluggable with client code, not much code change needed.

To implement, client needs to implement StackableFragment of com.fragstack.contracts package on all fragments who wants to have their own backstack. Client needs to provide a unique name in getFragmentName() method.

Example :

Download via gradle

Step 1. Add the specific repository to your build file:

repositories {
    maven {
        url "https://jitpack.io"
    }
}

Step 2. Add the dependency in your build file (do not forget to specify the correct qualifier, usually "aar"):

dependencies {
    compile 'com.github.abhishesh-srivastava:fragstack:' + $latest.version
}

Integration with BottomBar

If there are 4 tabs in BottomBar and each tab corresponds to different fragment and want to have individual stacks. Client should implement StackableFragment and provide implementation for getFragmentName() and onFragmentScroll() method.

Initialization inside onCreate() method of activity

mFragmentController = new FragmentController(getSupportFragmentManager(), R.id.frame_container, savedInstanceState, null);

here R.id.frame_container corresponds to id's on which fragments view are added/replaced.

To display a fragment, call

    FragmentTransactionOptions fragmentTransactionOptions = new FragmentTransactionOptions.Builder()
    			.setCustomAnimations(android.R.anim.fade_in, android.R.anim.fade_out).build();
    mFragmentController.displayFragment(fragment, fragmentTransactionOptions); // its not necessary to provide FragmentTransactionOptions, pass null if animation, transition or shared element animations are not required

Back Press Handling :

public void onBackPressed() {
    if (!mFragmentController.popBackStackImmediate())
        super.onBackPressed();
}
You might also like...
An Android library that allows you to easily create applications with slide-in menus. You may use it in your Android apps provided that you cite this project and include the license in your app. Thanks!

SlidingMenu (Play Store Demo) SlidingMenu is an Open Source Android library that allows developers to easily create applications with sliding menus li

Android Library for making animated tutorials inside your app
Android Library for making animated tutorials inside your app

##SlidingTutorial Cleveroad introduces Sliding Tutorial Library for Android Hey guys, hope you haven’t started developing a tutorial for your Android

Paging indicator widgets compatible with the ViewPager from the Android Support Library and ActionBarSherlock.
Paging indicator widgets compatible with the ViewPager from the Android Support Library and ActionBarSherlock.

Android ViewPagerIndicator Paging indicator widgets that are compatible with the ViewPager from the Android Support Library to improve discoverability

The flexible, easy to use, all in one drawer library for your Android project. Now brand new with material 2 design.
The flexible, easy to use, all in one drawer library for your Android project. Now brand new with material 2 design.

MaterialDrawer ... the flexible, easy to use, all in one drawer library for your Android project. What's included 🚀 • Setup 🛠️ • Migration Guide 🧬

A flexible, easy to use, unique drawer library for your Android project.
A flexible, easy to use, unique drawer library for your Android project.

Duo Navigation Drawer This Android library provides an easy way to create an alternative navigation drawer for android. Instead of a drawer that slide

Alligator is a modern Android navigation library that will help to organize your navigation code in clean and testable way.

Alligator Alligator is a modern Android navigation library that will help to organize your navigation code in clean and testable way. Features Any app

A sleek, out of the box, easy to understand and use, swipe gesture based Navigational Library for android.
A sleek, out of the box, easy to understand and use, swipe gesture based Navigational Library for android.

Facilis Swipe gesture based navigational library for Android. Watch Demo Video: Getting Started To get this project into your build: Gradle Add it in

A simple navigation library for Android 🗺️

Enro 🗺️ A simple navigation library for Android "The novices’ eyes followed the wriggling path up from the well as it swept a great meandering arc ar

🧛 Fragula is a swipe-to-dismiss extension for navigation component library for Android
🧛 Fragula is a swipe-to-dismiss extension for navigation component library for Android

Fragula is a swipe-to-dismiss extension for navigation component library for Android.

Comments
  • v2.0.0 not found

    v2.0.0 not found

    When I import this as suggested, using v2.0.0 I get the following:

    Execution failed for task ':app:checkTstDebugAarMetadata'.
    > Could not resolve all files for configuration ':app:tstDebugRuntimeClasspath'.
       > Could not find com.github.abhishesh-srivastava:fragstack:v2.0.0.
         Searched in the following locations:
           - https://dl.google.com/dl/android/maven2/com/github/abhishesh-srivastava/fragstack/v2.0.0/fragstack-v2.0.0.pom
           - https://jcenter.bintray.com/com/github/abhishesh-srivastava/fragstack/v2.0.0/fragstack-v2.0.0.pom
           - https://repo.maven.apache.org/maven2/com/github/abhishesh-srivastava/fragstack/v2.0.0/fragstack-v2.0.0.pom
           - https://jitpack.io/com/github/abhishesh-srivastava/fragstack/v2.0.0/fragstack-v2.0.0.pom
         Required by:
             project :app
    
    Possible solution:
     - Declare repository providing the artifact, see the documentation at https://docs.gradle.org/current/userguide/declaring_repositories.html
    
    

    However, using implementation 'com.github.abhishesh-srivastava:fragstack:1.1.0' seems to work

    opened by Fifteen15Studios 1
  • mFragmentController doesn't persist through screen rotation

    mFragmentController doesn't persist through screen rotation

    After following the instructions given on how to use this, mFragmentController is recreated when a screen rotation happens, and therefore the stack of fragments is lost. I tired to handle this myself, in the onSaveInstanceState method, but the FragmentController class does not extend Serializable so it cannot be saved.

    The only solution that I can think of is to make it a static variable, and then check if the variable is null before assigning it in the onCreate method, but that didn't seem to work either.

    opened by Fifteen15Studios 1
Releases(2.0.1)
Owner
Abhishesh
Software developer
Abhishesh
[ACTIVE] Simple Stack, a backstack library / navigation framework for simpler navigation and state management (for fragments, views, or whatevers).

Simple Stack Why do I want this? To make navigation to another screen as simple as backstack.goTo(SomeScreen()), and going back as simple as backstack

Gabor Varadi 1.3k Jan 2, 2023
A small navigation library for Jetpack Compose with state saving, backstack and animations support.

A small navigation library for Jetpack Compose with state saving, backstack and animations support.

Xinto 5 Dec 27, 2022
An Android library for managing multiple stacks of fragments

FragNav Android library for managing multiple stacks of fragments (e.g., Bottom Navigation , Navigation Drawer). This library does NOT include the UI

Nic Capdevila 1.5k Jan 6, 2023
AndroidBriefActions - Android library for sending and observing non persistent actions such as showing a message; nice readable way to call navigation actions from ViewModel or Activity/Fragment.

implementation "com.vladmarkovic.briefactions:briefactions:$briefActionsVersion" Benefits Why use brief-actions library pattern: Prevent short-term ac

null 2 Dec 22, 2022
An efficient TabLayout library implemented with RecyclerView.

RecyclerTabLayout An efficient TabLayout library implemented with RecyclerView. Features Efficient when having many tabs Easy setup with ViewPager (sa

Shinichi Nishimura 1.3k Dec 9, 2022
Android Navigation Fragment Share Element Example: Use Share Element Transition with recyclerView Item and ViewPager2 Item.

Android-Navigation-Fragment-Share-Element-Example 说明 Android 使用Navigation导航切换Fragment中使用共享元素过渡动画的例子:将在listFragment的RecyclerView的Item共享元素过渡到pagerFragme

null 3 Sep 28, 2022
Use Fragment like Activity

Fragivity : Use Fragment like Activity English | 中文文档 Fragivity is a library used to build APP with "Single Activity + Multi-Fragments" Architecture R

fundroid 278 Nov 22, 2022
Tugas Fragment Codelab Navigation Pemrograman Mobile

AndroidTrivia - starter code Starter code for Android Kotlin Fundamentals codelab 3.1: Create and add a fragment. Introduction The AndroidTrivia app a

null 0 Nov 3, 2021
An efficient TabLayout implemented in Jetpack Compose 🚀

MagicTabLayout An efficient TabLayout library implemented in Jetpack Compose ?? Anatomy MagicTabLayout tabIndicatorColor (Optional, default value: blu

Geovani Amaral 2 Aug 26, 2022
🎉 [Android Library] A light-weight library to easily make beautiful Navigation Bar with ton of 🎨 customization option.

Bubble Navigation ?? A light-weight library to easily make beautiful Navigation Bars with a ton of ?? customization options. Demos FloatingTopBarActiv

Gaurav Kumar 1.7k Dec 31, 2022