Subversion Repository Public Repository

litesoft

Diff Revisions 949 vs 950 for /trunk/Java/ScarPlus/androidSupport/overwrite/src/org/litesoft/droid/PhoneGapActivity.java

Diff revisions: vs.
  @@ -1,49 +1,49 @@
1 - package org.litesoft.droid;
2 -
3 - import org.apache.cordova.*;
4 - import android.content.res.AssetManager;
5 - import android.os.Bundle;
6 -
7 - public class PhoneGapActivity extends DroidGap
8 - {
9 - /**
10 - * Called when the activity is first created.
11 - */
12 - @Override
13 - public void onCreate( Bundle savedInstanceState )
14 - {
15 - super.onCreate( savedInstanceState );
16 -
17 - loadUrl( "file:///android_asset/www/" + findIndexHtml( getValue("language", "en") ) );
18 - }
19 -
20 - private String getValue( String key, String defaultValue )
21 - {
22 - return getSharedPreferences( getApplicationInfo().packageName, MODE_PRIVATE ).getString( key, defaultValue );
23 - }
24 -
25 - private String findIndexHtml( String language )
26 - {
27 - AssetManager assetManager = getAssets();
28 - try
29 - {
30 - String[] files = assetManager.list( "www" );
31 - if ( files != null )
32 - {
33 - String toFind = "index-" + language + ".html";
34 - for ( String file : files )
35 - {
36 - if ( toFind.equals( file ) )
37 - {
38 - return file;
39 - }
40 - }
41 - }
42 - }
43 - catch ( Exception e )
44 - {
45 - // Fall Thru
46 - }
47 - return "index.html";
48 - }
49 - }
1 + package org.litesoft.droid;
2 +
3 + import org.apache.cordova.*;
4 + import android.content.res.AssetManager;
5 + import android.os.Bundle;
6 +
7 + public class PhoneGapActivity extends DroidGap
8 + {
9 + /**
10 + * Called when the activity is first created.
11 + */
12 + @Override
13 + public void onCreate( Bundle savedInstanceState )
14 + {
15 + super.onCreate( savedInstanceState );
16 +
17 + loadUrl( "file:///android_asset/www/" + findIndexHtml( getValue("language", "en") ) );
18 + }
19 +
20 + private String getValue( String key, String defaultValue )
21 + {
22 + return getSharedPreferences( getApplicationInfo().packageName, MODE_PRIVATE ).getString( key, defaultValue );
23 + }
24 +
25 + private String findIndexHtml( String language )
26 + {
27 + AssetManager assetManager = getAssets();
28 + try
29 + {
30 + String[] files = assetManager.list( "www" );
31 + if ( files != null )
32 + {
33 + String toFind = "index-" + language + ".html";
34 + for ( String file : files )
35 + {
36 + if ( toFind.equals( file ) )
37 + {
38 + return file;
39 + }
40 + }
41 + }
42 + }
43 + catch ( Exception e )
44 + {
45 + // Fall Thru
46 + }
47 + return "index.html";
48 + }
49 + }