| 1 | // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 | // Use of this source code is governed by a BSD-style license that can be |
| 3 | // found in the LICENSE file. |
| 4 | |
| 5 | package org.chromium.base; |
| 6 | |
| 7 | import android.app.Activity; |
| 8 | import android.os.Bundle; |
| 9 | |
| 10 | // All Chromium main activities should extend this class. This allows various sub-systems to |
| 11 | // properly react to activity state changes. |
| 12 | public class ChromiumActivity extends Activity { |
| 13 | |
| 14 | @Override |
| 15 | protected void onCreate(Bundle savedInstance) { |
| 16 | super.onCreate(savedInstance); |
| 17 | ActivityStatus.onStateChange(this, ActivityStatus.CREATED); |
| 18 | } |
| 19 | |
| 20 | @Override |
| 21 | protected void onStart() { |
| 22 | super.onStart(); |
| 23 | ActivityStatus.onStateChange(this, ActivityStatus.STARTED); |
| 24 | } |
| 25 | |
| 26 | @Override |
| 27 | protected void onResume() { |
| 28 | super.onResume(); |
| 29 | ActivityStatus.onStateChange(this, ActivityStatus.RESUMED); |
| 30 | } |
| 31 | |
| 32 | @Override |
| 33 | protected void onPause() { |
| 34 | ActivityStatus.onStateChange(this, ActivityStatus.PAUSED); |
| 35 | super.onPause(); |
| 36 | } |
| 37 | |
| 38 | @Override |
| 39 | protected void onStop() { |
| 40 | ActivityStatus.onStateChange(this, ActivityStatus.STOPPED); |
| 41 | super.onStop(); |
| 42 | } |
| 43 | |
| 44 | @Override |
| 45 | protected void onDestroy() { |
| 46 | ActivityStatus.onStateChange(this, ActivityStatus.DESTROYED); |
| 47 | super.onDestroy(); |
| 48 | } |
| 49 | } |