@@ -56,10 +56,10 @@ public class PythonActivity extends Activity implements Runnable {
5656 private File mPath = null ;
5757 private File mScript ;
5858
59- boolean _isPaused = false ;
60-
59+ boolean _isPaused = false ;
60+
6161 private static final String DB_INITIALIZED = "db_initialized" ;
62-
62+
6363 boolean isMain = false ;
6464
6565 public final static int PY_NOTI_FLAG = 123400 ;
@@ -115,19 +115,19 @@ protected void onCreate(Bundle savedInstanceState) {
115115 // Otherwise, we use the public data, if we have it, or the
116116 // private data if we do not.
117117 String act = getIntent ().getStringExtra (EXTRA_CONTENT_URL1 );
118-
118+
119119 boolean fullscreen = false ;
120120 if (act !=null && act .equals ("execute" )) {
121121 mPath = new File (getIntent ().getStringExtra (EXTRA_CONTENT_URL2 ));
122-
122+
123123 File f = new File (mPath , "main.py" );
124124 if (f .exists ()) {
125125 if (FileHelper .getFileContents (f .toString ()).contains ("#qpy:fullscreen" )) {
126126 fullscreen = true ;
127127 }
128128 }
129-
130-
129+
130+
131131 Project p = Project .scanDirectory (mPath );
132132
133133 if (p != null ) {
@@ -136,7 +136,7 @@ protected void onCreate(Bundle savedInstanceState) {
136136 } else {
137137 setRequestedOrientation (ActivityInfo .SCREEN_ORIENTATION_PORTRAIT );
138138 }
139-
139+
140140 if ( p .fullscreen ) {
141141 fullscreen = true ;
142142 }
@@ -146,7 +146,7 @@ protected void onCreate(Bundle savedInstanceState) {
146146 String fn = getIntent ().getStringExtra (EXTRA_CONTENT_URL2 );
147147 if (fn == null ) {
148148 isMain = true ;
149-
149+
150150 fn = "/sdcard/qpython/launcher.py" ;
151151 }
152152 mScript = new File (fn );
@@ -156,13 +156,13 @@ protected void onCreate(Bundle savedInstanceState) {
156156
157157 }
158158 mPath = mScript .getParentFile ();
159-
159+
160160 if (FileHelper .getFileContents (mScript .toString ()).contains ("#qpy:fullscreen" )) {
161161 fullscreen = true ;
162162 }
163163 //Log.d(TAG, "mscript:"+mScript+"-mPath"+mPath);
164164 }
165-
165+
166166 //
167167 if (fullscreen ) {
168168 getWindow ().setFlags (WindowManager .LayoutParams .FLAG_FULLSCREEN ,
@@ -178,14 +178,14 @@ protected void onCreate(Bundle savedInstanceState) {
178178 // pass
179179 }
180180
181-
181+
182182 updateNotification (mPath .toString ());
183183
184184 //Log.d("PythonActivity", "mPath:"+mPath.toString());
185185 // go to fullscreen mode
186186 requestWindowFeature (Window .FEATURE_NO_TITLE );
187187 String full = getIntent ().getStringExtra (EXTRA_CONTENT_URL3 );
188-
188+
189189 File logFile = new File (mPath , ".run.log" );
190190 if (logFile .exists ()) {
191191 logFile .delete ();
@@ -207,7 +207,7 @@ protected void onCreate(Bundle savedInstanceState) {
207207 }
208208 }
209209 }
210-
210+
211211 /*try {
212212 this.mInfo = this.getPackageManager().getApplicationInfo(
213213 this.getPackageName(), PackageManager.GET_META_DATA);
@@ -217,42 +217,42 @@ protected void onCreate(Bundle savedInstanceState) {
217217 WindowManager.LayoutParams.FLAG_FULLSCREEN);
218218 }
219219 } catch (PackageManager.NameNotFoundException e) {
220-
220+
221221 }*/
222222 //
223-
223+
224224// if (isMain) { //
225225// Intent intent = new Intent();
226226// intent.setClassName(PythonActivity.this, "com.hipipal.sl4alib.PyScriptService");
227227// this.bindService(intent, connection, BIND_AUTO_CREATE);
228228// }
229-
230-
229+
230+
231231 Log .d (TAG , "[RUN param:" +externalStorage .getAbsolutePath ().toString ()+"-" +mPath .getAbsolutePath ().toString ()+"-" +s +"]" );
232232 mView = new SDLSurfaceView (
233233 this ,
234234 mPath .getAbsolutePath ().toString (),
235235 s ,
236236 externalStorage .getAbsolutePath ().toString ()
237237 );
238-
238+
239239 IntentFilter filter = new IntentFilter (".PythonActivity" );
240240 registerReceiver (mReceiver , filter );
241241
242242 startPyScreen ();
243243 }
244-
244+
245245 private ServiceConnection connection = new ServiceConnection () {
246246 @ Override
247- public void onServiceConnected (ComponentName name , IBinder service ) {
248- //if (!CONF.DEBUG)
247+ public void onServiceConnected (ComponentName name , IBinder service ) {
248+ //if (!CONF.DEBUG)
249249 Log .d (TAG , "onServiceConnected" );
250250 //binded = true;
251251 }
252252
253253 @ Override
254254 public void onServiceDisconnected (ComponentName name ) {
255- //if (!CONF.DEBUG)
255+ //if (!CONF.DEBUG)
256256 Log .d (TAG , "onServiceDisconnected" );
257257 //binded = false;
258258 }
@@ -264,15 +264,15 @@ public void startPyScreen() {
264264 // Start showing an SDLSurfaceView.
265265 Hardware .view = mView ;
266266 setContentView (mView );
267-
267+
268268 // Force the background window color if asked
269269 /*if ( this.mInfo.metaData.containsKey("android.background_color") ) {
270270 getWindow().getDecorView().setBackgroundColor(
271271 this.mInfo.metaData.getInt("android.background_color"));
272272 }*/
273273
274274 }
275-
275+
276276 /**
277277 * Show an error using a toast. (Only makes sense from non-UI
278278 * threads.)
@@ -310,7 +310,7 @@ public void recursiveDelete(File f) {
310310 * the .apk is necessary. If it is, the zip file is unpacked.
311311 */
312312 public void unpackDataInPyAct (final String resource , File target ) {
313-
313+
314314 // The version of data in memory and on disk.
315315 String data_version = resourceManager .getString (resource + "_version" );
316316 String disk_version = "0" ;
@@ -378,7 +378,7 @@ public void unpackDataInPyAct(final String resource, File target) {
378378 Log .d (TAG , "NO MEDIA EXTRACTED" );
379379 }
380380 }
381-
381+
382382 public static void loadLibrary (File libPath ) {
383383 System .loadLibrary ("sdl" );
384384 System .loadLibrary ("sdl_image" );
@@ -410,7 +410,7 @@ public static void loadLibrary(File libPath) {
410410 } catch (UnsatisfiedLinkError e ) {
411411 Log .d ("PythonActivity" , "Exception occured when loading python modules:" +e .getLocalizedMessage ());
412412 }
413-
413+
414414 try {
415415 System .load (libPath + "/lib/python2.7/lib-dynload/_imaging.so" );
416416 System .load (libPath + "/lib/python2.7/lib-dynload/_imagingft.so" );
@@ -447,7 +447,7 @@ protected void onPause() {
447447 mView .onPause ();
448448 }
449449 }
450-
450+
451451 @ Override
452452 protected void onResume () {
453453 super .onResume ();
@@ -511,7 +511,7 @@ public void onDestroy() {
511511 mView = null ;
512512 }
513513 //Log.i(TAG, "on destroy (exit1)");
514-
514+
515515 //this.finish();
516516 // 发送通知给对应的activity
517517 String code ;
@@ -526,23 +526,23 @@ public void onDestroy() {
526526 if (!noexit .exists () && !code .contains ("#qpy:noend" )) {
527527 Intent intent1 = new Intent (".MIndexAct" );
528528 sendBroadcast (intent1 );
529-
529+
530530 Intent intent2 = new Intent (".UProfileAct" );
531531 sendBroadcast (intent2 );
532-
532+
533533 updateNotification (mPath .toString ());
534534
535535 } else {
536536 updateNotification (mPath .toString ());
537537 }
538-
538+
539539 try {
540540 super .onDestroy ();
541541 } catch (Exception e ) {
542-
542+
543543 }
544544 }
545-
545+
546546 public static void start_service (String serviceTitle , String serviceDescription ,
547547 String pythonServiceArgument ) {
548548 Intent serviceIntent = new Intent (PythonActivity .mActivity , PythonService .class );
@@ -556,7 +556,7 @@ public static void start_service(String serviceTitle, String serviceDescription,
556556 serviceIntent .putExtra ("serviceDescription" , serviceDescription );
557557 serviceIntent .putExtra ("pythonServiceArgument" , pythonServiceArgument );
558558 PythonActivity .mActivity .startService (serviceIntent );
559- }
559+ }
560560 public static void stop_service () {
561561 Intent serviceIntent = new Intent (PythonActivity .mActivity , PythonService .class );
562562 PythonActivity .mActivity .stopService (serviceIntent );
@@ -634,16 +634,16 @@ protected void onActivityResult(int requestCode, int resultCode, Intent intent)
634634 }
635635
636636
637- ////////////////
637+ ////////////////
638638 protected final BroadcastReceiver mReceiver = new BroadcastReceiver () {
639639 @ Override
640640 public void onReceive (Context context , Intent intent ) {
641641 Log .d (TAG , "mReceiver" );
642642 startPyScreen ();
643643 }
644644 };
645-
646-
645+
646+
647647 protected void updateNotification (String scriptFile ) {
648648 String script = scriptFile .substring (scriptFile .lastIndexOf ("/" )+1 );
649649 String logFile = scriptFile +"/.run.log" ;
0 commit comments