Closed blonsky95 closed 4 years ago
make code analagous to exerciseviewer fragment
in ProfileFragment think how to do the whole friends thing I need a fragment to display friends, and send requests, and a fragment to display incoming friend request packages like the others so, one button for incoming requests, and one button to see current friends
Ok so for communication - interfaces can help out with a couple things such as parameters, but everything is more organised if in viewmodel and if using observers
So there will be one mutablelivedata Int, which specifies fragment type, home activity will observe this as well as the packages, and when the type changes it can load the fragment with the parameters it needs (the packages) with the newInstance method, like in sharetofriends, and then implement the interface analogously for onRequestAccepted depending on the type
Fragment is all ready, now in homeactivity need to implement the itnerface so it can add everything thats accepted, and update the package online too, bit of view model copying pasting
Ok so things to do:
Get allExes, alldays and all friends asynchronously from their daos - this is fine because these are not being called immediately after homeactivity is open - but when the social button is tapped in each fragment - actually this is a problem because when they are updated - say i receive a new exe 2 times, it would insert 2 times because the allexes var doesnt get updated, because its not livedata, so might have to use observers for all of them hehe and just pass to viewmodel!
use allExes to check if already existing exercise
do the dialog, could make it livedata, and when triggered it passes a dialog with the interface to call the methods of the mainviewmodel already implemented
OK so: In exercises and motnhviewer, the social button is updated by the observer. When clicked it triggers a fragment display PackageReceiver which based on the argument will display a list of received days, exercises or friends.
In here all you do is accept, which will update the state of the firebase object + insert the item and do its corresponding checks.
However in Friends, we also need to be able to add friends, accepting is easy. There will be another icon for friends which when pressed opens friends displayer fragment - this displays the friends - and has a button to make friend request - lets make it an edit text and a plus button.
Things to do this considered:
When sending you need:
When accepting/rejecting (receiving) you need:
So current issue is that when you get the transfer packages from gson it needs to know the type
Ok so navigation is more or less sorted:
Horizontal fragment navigation doesnt add to backstack, so back button ignores any fragment navigation (ideally ill change this so back is home)
Vertical fragment display - when a vertical is displayed, if you change tab, it dissapears through popbackstack
ok much better - need to reinitialise variables for packages at some point - recheck what causes packages to not be reset correctly
Also make sure there is no navigation back to not fragments from activities like exe creator and stuff
get rid of unused activities/viewmodels
home, exercise viewer, month viewer, store and profile will be fragments
share to friends will be fragment, and when receiving something it will also display a fragment with info of what it is and from who
figure out the architechture to make all of that work well together