blonsky95 / DigiCoachAndroid

0 stars 0 forks source link

0.14.1.1 User can save and download cloud back up for multiple devices #64

Closed blonsky95 closed 4 years ago

blonsky95 commented 4 years ago

c5ac3155-a5b8-4a08-9269-41b4b707c77e

So add a button in Exercise Viewer that takes you here - is this going to be activity or a fragment? I think the ExerciseViewerViewModel has the functions to do backup stuff so I would like to reuse it.

blonsky95 commented 4 years ago

Wait for days to be sendable between users, aka also stored online

blonsky95 commented 4 years ago

So, because the fragment can call methods from parent activity, and thus the exerciseViewerViewModel instance, I will use a fragment, look up example/video on how to do fragment stuff

  1. Create fragment and the intent to start it, or whatever to display it - adding a frame layout and programatically using a fragment transaction (you get it from fragment manager, and you can use it to customize animations and shit) + also used the fragment manager back task, by adding the animation/fragment placement in the backtask, when you call popbacktask its like going onbackPressed(). Also in the transaction you put parameters for fadein, fadeout, popfadein, popfadeout - DONE
  2. do fragment UI like in the picture - DONE
  3. think how to store the days and exes in db - DONE
  4. implement that - DONE
  5. test it - so far working - but there is some issues with transfers
  6. golden
  7. make custom animations to slide up instead of fade
blonsky95 commented 4 years ago

In Store add a home button on the top bar like every other role

blonsky95 commented 4 years ago

To update the last online backup text, I needed an observer so I added the profile view model to the back up fragment. It is observing the time value, which is being observed through firestore through a snapshot too. (Observing an observer lol).

The Profile is observing the loading boolean in the repository so when user presses upload or download the dialog pops up. dialog pops up in the activity, not the fragment, as the fragment can be undisplayed or whatever. Thanks to the interface being built in the activity and not the fragment, it can call the isloading from the same viewmodel instance so easier to handle.

Next - test if I can do something from fragment to viewmodel and if the activity sharing the isntance gets it - answer is NO, view models are instantiated multiple times, so i created the profilefragmentviewmodel with only one method so it doesnt have to load all the other shite. However if this is the case it makes more sense that the upload and download functions & logic are contained in the Profile activity and in its view model instead of the more UI specific fragment

the fragment only uses the viewmodel to observe, actually a snapshot of the time of last upload to update the text. The progress dialog that shows is actually being displayed in the activity, and being observed, so its in the activityviewmodel

next next = animation for fragment to slide up

blonsky95 commented 4 years ago

Animation should be done - test and see - if works commit everything

blonsky95 commented 4 years ago

Finito! Made a little modification to onBackPressed on Profile, as it closes the fragment, so it also switches the isFragmentOpen boolean to false