@@ -92,6 +92,58 @@ void setImmersiveSticky() {
9292 PopupWindow _popupWindow ;
9393 TextView _label ;
9494
95+ public void showUI ()
96+ {
97+ if ( _popupWindow != null )
98+ return ;
99+
100+ _activity = this ;
101+
102+ this .runOnUiThread (new Runnable () {
103+ @ Override
104+ public void run () {
105+ LayoutInflater layoutInflater
106+ = (LayoutInflater )getBaseContext ()
107+ .getSystemService (LAYOUT_INFLATER_SERVICE );
108+ if (layoutInflater != null ) {
109+ View popupView = layoutInflater .inflate (R .layout .widgets , null );
110+ _popupWindow = new PopupWindow (
111+ popupView ,
112+ LayoutParams .WRAP_CONTENT ,
113+ LayoutParams .WRAP_CONTENT );
114+
115+ LinearLayout mainLayout = new LinearLayout (_activity );
116+ MarginLayoutParams params = new MarginLayoutParams (LayoutParams .WRAP_CONTENT ,
117+ LayoutParams .WRAP_CONTENT );
118+ params .setMargins (0 , 0 , 0 , 0 );
119+ _activity .setContentView (mainLayout , params );
120+
121+ // Show our UI over NativeActivity window
122+ _popupWindow .showAtLocation (mainLayout , Gravity .TOP | Gravity .START , 10 , 10 );
123+ _popupWindow .update ();
124+
125+ _label = popupView .findViewById (R .id .textViewFPS );
126+ } else {
127+ throw new IllegalStateException ("Cannot get layout service!" );
128+ }
129+
130+ }});
131+ }
132+
133+ public void updateFPS (final float fFPS )
134+ {
135+ if ( _label == null )
136+ return ;
137+
138+ _activity = this ;
139+ this .runOnUiThread (new Runnable () {
140+ @ Override
141+ public void run () {
142+ _label .setText (String .format (Locale .getDefault (),"%2.2f FPS" , fFPS ));
143+
144+ }});
145+ }
146+
95147 protected void onPause () {
96148 super .onPause ();
97149 if (_popupWindow != null ) {
0 commit comments