Subversion Repository Public Repository

litesoft

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
package org.litesoft.droid;

import org.apache.cordova.*;
import android.content.res.AssetManager;
import android.os.Bundle;

public class PhoneGapActivity extends DroidGap
{
    /**
     * Called when the activity is first created.
     */
    @Override
    public void onCreate( Bundle savedInstanceState )
    {
        super.onCreate( savedInstanceState );

        loadUrl( "file:///android_asset/www/" + findIndexHtml( getValue("language", "en") ) );
	}

	private String getValue( String key, String defaultValue )
	{
		return getSharedPreferences( getApplicationInfo().packageName, MODE_PRIVATE ).getString( key, defaultValue );
    }

    private String findIndexHtml( String language )
    {
        AssetManager assetManager = getAssets();
        try
        {
            String[] files = assetManager.list( "www" );
            if ( files != null )
            {
                String toFind = "index-" + language + ".html";
                for ( String file : files )
                {
                    if ( toFind.equals( file ) )
                    {
                        return file;
                    }
                }
            }
        }
        catch ( Exception e )
        {
            // Fall Thru
        }
        return "index.html";
    }
}

Commits for litesoft/trunk/Java/ScarPlus/androidSupport/overwrite/src/org/litesoft/droid/PhoneGapActivity.java

Diff revisions: vs.
Revision Author Commited Message
950 Diff Diff GeorgeS picture GeorgeS Thu 19 Jun, 2014 17:57:04 +0000

New Lines

729 Diff Diff GeorgeS picture GeorgeS Sun 17 Jun, 2012 17:17:32 +0000
693 GeorgeS picture GeorgeS Mon 28 May, 2012 01:46:55 +0000