anitab-org / mentorship-android

Mentorship System is an application that matches women in tech to mentor each other, on career development, through 1:1 relations during a certain period of time. This is the Android application of this project.
https://github.com/anitab-org/mentorship-android/raw/apk/app-debug.apk
GNU General Public License v3.0
164 stars 379 forks source link

Feature: Adding Back stack for maintaining the order of visited destinations. #670

Open inaseem opened 4 years ago

inaseem commented 4 years ago

Is your feature request related to a problem? Please describe. When I open the app Home is selected by default. Then I select the Navigation items in some random order ex. Home -> Profile -> Requests -> Members -> Relation. So when I press back button it should replace the fragments in the order Relation -> Members -> Requests -> Profile -> Home and then exit. But now it always moves to Home when back or up is pressed.

Describe the solution you'd like We can maintain a back stack that contains the destinations you've visited. The first destination of the app is placed on the stack when the user opens the app. Each call to the replaceFragment() method can put another destination on top of the stack. Tapping Back or Up will pop the top most Item from stack and replace it.

Describe alternatives you've considered

Additional context

@isabelcosta @foongminwong Can I work on this?

AminullahTajMuhammad commented 4 years ago

@naseemali925 I works fine on my Device.

inaseem commented 4 years ago

@AminullahTajMuhammad I tested the code also and as of now there is no back stack maintained. I don't know how you are testing this. 😕

Could you please attach a GIF to show if this works fine on your device?

inaseem commented 4 years ago

@isabelcosta @foongminwong I would love your response on this feature. Can I work on this feature?

inaseem commented 4 years ago

@isabelcosta @foongminwong I would love your response on this. :smile:

isabelcosta commented 4 years ago

Not sure if it makes sense within the main screen that contains the fragments, bottom options. I feel that back button in that context should lead to closing/move to background the app. @m-murad @foongminwong @annabauza any thoughts on this?

m-murad commented 4 years ago

The back button should

  1. Exit the app if you are on the HomeFragment.
  2. Take you directly to the HomeFragment if you are on some other fragment.

What I think is not right with approach that the author of issue is suggesting - Imagine a user has been using the app for 15mins and has visited all the fragments multiple times (let's say 100), now to exit the app user should press the back button 100 times.

mtreacy002 commented 4 years ago

Hi all. I agree with @m-murad that a 'Home' button (which we already have as Home icon on bottom left of navbar)should bring us back to the Homepage of the application. But in terms of the '<' or 'Back' button that will bring us back to the previous screen, I agree that this function is needed coz it could be useful for if the user change their mind and just want to go one step backward. However, I don't think it's necessary to add the '<' button from within the app. Coz I'm sure the Android Native '<' button is available for user to do just that (going back one step).

inaseem commented 4 years ago

Thank you @isabelcosta @m-murad @mtreacy002 for your comments. @m-murad you are correct to say that if a user keeps on navigating and switches too many times/around 100 times then it would be a trouble to go to Home as it would require too many Back/UP events.

Possible Solution(s)

  1. We can pop items from the BackStack until the top of the Stack matches the selected Navigation Items entry.

Explanation for Solution 1

Let the flow be Home > Profile > Members > Requests > Profile > Home

Pseudo Code

if ( Pressed Item already in Stack ) {
//Pop all items uptil the entry item matches to the Navigation Item Selected
 while ( Stack.peek()!=Pressed Item ) {
   Stack.pop();
 }
} else {
 Stack.push(Pressed Item);
}

Dry Run For The Flow Above Select = Home => Stack.push(Home);Home <-Stack Select = Profile => Stack.push(Profile);Home > Profile Select = Members => Stack.push(Members);Home > Profile > Members Select = Requests => Stack.push(Requests);Home > Profile > Members > Requests Select = Profile => { Stack.pop(Requests); Stack.push(Members); }Home > Profile Select = Home => { Stack.pop(Profile); }Home NOTE: At Home the back functions the same way.

Let me know if you have any suggestions or improvements.

inaseem commented 4 years ago

@isabelcosta @m-murad Could you please take a look and give your feedback.

Sommie09 commented 4 years ago

Hello @anna4j could I get a review of what this issue is about?

Sommie09 commented 4 years ago

Hello @anna4j