1 // Copyright 2013 The Flutter 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 io.flutter.app; 6 7 import android.content.ComponentCallbacks2; 8 import android.content.Intent; 9 import android.os.Bundle; 10 import io.flutter.plugin.common.PluginRegistry.ActivityResultListener; 11 import io.flutter.plugin.common.PluginRegistry.RequestPermissionsResultListener; 12 13 /** 14 * A collection of Android {@code Activity} methods that are relevant to the 15 * core operation of Flutter applications. 16 * 17 * <p>Application authors that use an activity other than 18 * {@link FlutterActivity} should forward all events herein from their activity 19 * to an instance of {@link FlutterActivityDelegate} in order to wire the 20 * activity up to the Flutter framework. This forwarding is already provided in 21 * {@code FlutterActivity}.</p> 22 */ 23 public interface FlutterActivityEvents 24 extends ComponentCallbacks2, 25 ActivityResultListener, 26 RequestPermissionsResultListener { 27 /** 28 * @see android.app.Activity#onCreate(android.os.Bundle) 29 */ onCreate(Bundle savedInstanceState)30 void onCreate(Bundle savedInstanceState); 31 32 /** 33 * @see android.app.Activity#onNewIntent(Intent) 34 */ onNewIntent(Intent intent)35 void onNewIntent(Intent intent); 36 37 /** 38 * @see android.app.Activity#onPause() 39 */ onPause()40 void onPause(); 41 42 /** 43 * @see android.app.Activity#onStart() 44 */ onStart()45 void onStart(); 46 47 /** 48 * @see android.app.Activity#onResume() 49 */ onResume()50 void onResume(); 51 52 /** 53 * @see android.app.Activity#onPostResume() 54 */ onPostResume()55 void onPostResume(); 56 57 /** 58 * @see android.app.Activity#onDestroy() 59 */ onDestroy()60 void onDestroy(); 61 62 /** 63 * @see android.app.Activity#onStop() 64 */ onStop()65 void onStop(); 66 67 /** 68 * Invoked when the activity has detected the user's press of the back key. 69 * 70 * @return {@code true} if the listener handled the event; {@code false} 71 * to let the activity continue with its default back button handling. 72 * @see android.app.Activity#onBackPressed() 73 */ onBackPressed()74 boolean onBackPressed(); 75 76 /** 77 * @see android.app.Activity#onUserLeaveHint() 78 */ onUserLeaveHint()79 void onUserLeaveHint(); 80 } 81