Skip to content

Commit

Permalink
Keep screen on while in tracker
Browse files Browse the repository at this point in the history
  • Loading branch information
North101 committed May 5, 2018
1 parent f3ce171 commit 11a1ec9
Showing 1 changed file with 13 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import android.support.v7.widget.Toolbar
import android.view.Menu
import android.view.MenuInflater
import android.view.MenuItem
import android.view.WindowManager
import net.north101.android.ghplayertracker.data.Card
import net.north101.android.ghplayertracker.data.Character
import net.north101.android.ghplayertracker.livedata.SummonLiveData
Expand Down Expand Up @@ -65,6 +66,18 @@ open class TrackerFragment : Fragment() {
super.onSaveInstanceState(state)
}

override fun onResume() {
super.onResume()

activity?.window?.addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON)
}

override fun onPause() {
activity?.window?.clearFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON)

super.onPause()
}

@AfterViews
internal fun afterViews() {
(activity as AppCompatActivity).setSupportActionBar(toolbar)
Expand Down

0 comments on commit 11a1ec9

Please sign in to comment.