GithubHelp home page GithubHelp logo

trendyol / medusa Goto Github PK

View Code? Open in Web Editor NEW
484.0 51.0 63.0 660 KB

Android fragment stack controller

License: Other

Java 5.76% Kotlin 94.24%
android fragmentmanager fragment stack navigation bottombar tab kotlin

medusa's Introduction

Fragment manager for your Single Activity - Multi Fragment app.

License

Medusa is smart enough to handle fragment attachment/detachment or hiding/showing fragment. No more memory handling. No more fragment stack logic.

Why?

Single activity and Multi Fragment structure is a new trend and reasonable to choose. Most of the popular apps like Instagram, Youtube, Spotify etc. are using Single Activity with bottom bar and controlling multiple fragments in that single activity.

In our Trendyol.com android application, we are also using Single Activity- Multi Fragment UI Structure. Everything seems fine when you decide using Single Activity- Multi Fragment, except fragment stack and controlling them.

It was always hard to manage fragment manager in our application. We are using bottom bar and user have his history in every bottom bar tab. For instance, In Home tab, user can goes 4-5 fragments deep in home tab. And then user switches to the another tab and goes 3-4 fragment in that tab too.

So what happens when user switch back to home fragment? Which fragment should be visible to user? What happens when user starts going back? Which fragments will be visible to user in which order while user is pressing back button? What should happen? Yes this is confusing.

This is why we create Medusa. It is not confusing anymore. Medusa keeps track of fragment history of every tab and you only call start, goBack to navigate your fragments.

Wiki

Check out our wiki!

Setup

dependencies {
    implementation 'com.trendyol:medusa:<latest-version>'
}

Icon Credits

All credits go to Tatiana

License

Copyright 2018-2023 Trendyol.com

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

   http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

medusa's People

Contributors

ahmad-mousavi avatar bilgehankalkan avatar bsobe avatar erkutaras avatar iammert avatar ibrahimsn98 avatar mertnyuksel avatar muratcanbur avatar mustafaberkaymutlu avatar savepopulation avatar selimtoksal avatar subhrajyotisen avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

medusa's Issues

Laggy start new fragment

hi.
when i start new fragment is laggy to load animation & go to new fragment.
my animation is very light.
alpha animation.
Do I need to create the fragment before starting ? or not at the same time ?

Support for setMaxLifecycle using AndroidX

When I was trying to detect if my fragment is visible or not, I realized that setUserVisibleHint is deprecated. Instead, we need to use setMaxLifecycle() while commiting a fragment to the transaction. (as documentation is pointed here )

Is there any plan to add this great feature to the medusa?

Shared elements

Hi trendyol team , I am using meduse and I have a problem . Firstly If I want to use Shared element transition between fragments, What should i do in this case ? Should I stop working with medusa ? or Do you have a solution ? I think , If there is a navigation library , It must not restrict other features like Shared elements.

Activity Recreation Issue

On rotation, navigator adds root fragment over existing one. Might be resolved by optionally passing savedInstanceState

Fragment transition

Animations/Transitions are not supported yet. Medusa library can take an animator to switch between fragments.

So Medusa library can take in and out animation from outside and apply these animations when the transaction is committed.

problem with onGoBack of Navigator.OnGoBackListener

The method is not called if there is no change in the first navigation fragment, so if the user does not perform any action that changes the first of the initial fragments, the method is not called, for example not executing the scrolling action until top if necessary.

Commiting without allowing state loss

Commiting with allowing state loss not a proper option every time. So medusa should provide an option to developers committing transactions without allowing satete loss.

Fragment stack logger

Fragment stack is always complicated. This library aims that moves that complication to our Medusa library instead of your codebase. So which means we still need to debugging in Medusa library.

Logging is the perfect way to debug fragment stack. So we really need to create a logging module for Medusa library.

Logger needs to show current fragment stack state on every start/goBack action.

EmptyStackException

Hello guys, i have this problem where by sometimes if i leave the app for a moment and it goes to sleep then i try navigate through the app i get this error :

java.util.EmptyStackException
at com.smartcabspro.user.MainActivity.onBackPressed(:4)

what could be the problem ?

getrootfragment function access modifier

There are 5 tabs in the app. When the user clicks the back button on some of these tabs, I want to raise an alert without looking at the stack and close the application when the user clicks on this alert. How can I do this? An idea came to my mind, but since the getrootfragment function is private, I cannot access this function and control the tab. Would it be a problem to make this private function public?

Feature Request: Destroy All Fragments

I want to change all of the tabs if a user is logged in / made an in app purchase etc.

I created a new rootFragmentProvider and multipleStackNavigator for this purpose, however there should be an option for clearing/removing all of the old fragments. Without this feature, the old ones are still visible after the tab items' change.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.