Skip to content

Files

Latest commit

c8835c9 · Nov 2, 2015

History

History
48 lines (34 loc) · 2.28 KB

Exercise_3_2_How_activities_and_fragments_live.md

File metadata and controls

48 lines (34 loc) · 2.28 KB

Objectives:

  • Learn how the lifecycle of fragment and activity works.
  • Learn how to handle configuration change(rotation, keyboard hidden...)

Requirements:

Default portrait layout

default_layout_por.png

Default landscape layout

default_layout_land.png

Gaming portrait layout

gaming_layout_por.png

Gaming landscape layout

gaming_layout_land.png

  • The UI contains 2 parts: game part and the high score part.

  • The count should be updated when user presses TAP button.

  • TAP button should be disabled until user presses START.

  • After press START, START button is disabled while TAP button is enabled.

  • After 10sec, the TAP button will be disabled and the result will be updated in the high score panel.

  • The highscore panel should be implemented inside TapCountResultFragment a fragment.

  • If user rotates the phone(or press HOME):

    • While a game is playing (clock is ticking) then that game should be paused and START button becomes RESUME button. After user presses RESUME, the game will continue.
    • If a game has stopped then the last tap count should be preserved.
  • Highscore list must be preserved even if user rotates the phone (or presses HOME).

References:

Bonus:

  • Log all activities and fragments lifecycle event to see how everything works.
  • What is setRetainInstance() and how does it affect the fragment lifecycle.