Flutter Engine
The Flutter Engine
Public Member Functions | Static Package Functions | List of all members
org.skia.viewer.ViewerApplication Class Reference
Inheritance diagram for org.skia.viewer.ViewerApplication:

Public Member Functions

void onCreate ()
 
void onTerminate ()
 
long getNativeHandle ()
 
void setViewerActivity (ViewerActivity viewerActivity)
 
void setTitle (String title)
 
void setState (String stateJsonStr)
 

Static Package Functions

 [static initializer]
 

Detailed Description

Definition at line 13 of file ViewerApplication.java.

Member Function Documentation

◆ [static initializer]()

org.skia.viewer.ViewerApplication.[static initializer]
inlinestaticpackage

◆ getNativeHandle()

long org.skia.viewer.ViewerApplication.getNativeHandle ( )
inline

Definition at line 40 of file ViewerApplication.java.

40 {
41 return mNativeHandle;
42 }

◆ onCreate()

void org.skia.viewer.ViewerApplication.onCreate ( )
inline

Definition at line 26 of file ViewerApplication.java.

26 {
27 super.onCreate();
28 mNativeHandle = createNativeApp(this.getResources().getAssets());
29 }

◆ onTerminate()

void org.skia.viewer.ViewerApplication.onTerminate ( )
inline

Definition at line 32 of file ViewerApplication.java.

32 {
33 if (mNativeHandle != 0) {
34 destroyNativeApp(mNativeHandle);
35 mNativeHandle = 0;
36 }
37 super.onTerminate();
38 }

◆ setState()

void org.skia.viewer.ViewerApplication.setState ( String  stateJsonStr)
inline

Definition at line 73 of file ViewerApplication.java.

73 {
74 // We have to store this state because ViewerActivity may be destroyed while the native app
75 // is still running. When a new ViewerActivity is created, we'll pass the state to it.
76 mStateJsonStr = stateJsonStr;
77 if (mViewerActivity != null) {
78 mViewerActivity.runOnUiThread(new Runnable() {
79 @Override
80 public void run() {
81 mViewerActivity.setState(mStateJsonStr);
82 }
83 });
84 }
85 }
void setState(String stateJson)
def run(cmd)
Definition: run.py:14

◆ setTitle()

void org.skia.viewer.ViewerApplication.setTitle ( String  title)
inline

Definition at line 58 of file ViewerApplication.java.

58 {
59 mTitle = title; // Similar to mStateJsonStr, we have to store this.
60 if (mTitle.startsWith("Viewer: ")) { // Quick hack to shorten the title
61 mTitle = mTitle.replaceFirst("Viewer: ", "");
62 }
63 if (mViewerActivity != null) {
64 mViewerActivity.runOnUiThread(new Runnable() {
65 @Override
66 public void run() {
67 mViewerActivity.setTitle(mTitle);
68 }
69 });
70 }
71 }

◆ setViewerActivity()

void org.skia.viewer.ViewerApplication.setViewerActivity ( ViewerActivity  viewerActivity)
inline

Definition at line 44 of file ViewerApplication.java.

44 {
45 mViewerActivity = viewerActivity;
46 // Note that viewerActivity might be null (called by onDestroy)
47 if (mViewerActivity != null) {
48 // A new ViewerActivity is created; initialize its state and title
49 if (mStateJsonStr != null) {
50 mViewerActivity.setState(mStateJsonStr);
51 }
52 if (mTitle != null) {
53 mViewerActivity.setTitle(mTitle);
54 }
55 }
56 }

The documentation for this class was generated from the following file: