Browse Source

提交内容:扩展ipu自定义浏览器

wangyujuan 8 years ago
parent
commit
71c50d68df

+ 1 - 1
wade-mobile-common/.classpath

@ -1,8 +1,8 @@
1 1
<?xml version="1.0" encoding="UTF-8"?>
2 2
<classpath>
3 3
	<classpathentry kind="src" path="gen"/>
4
	<classpathentry kind="con" path="com.android.ide.eclipse.adt.ANDROID_FRAMEWORK"/>
5 4
	<classpathentry exported="true" kind="con" path="com.android.ide.eclipse.adt.DEPENDENCIES"/>
6 5
	<classpathentry exported="true" kind="con" path="com.android.ide.eclipse.adt.LIBRARIES"/>
6
	<classpathentry kind="con" path="com.android.ide.eclipse.adt.ANDROID_FRAMEWORK"/>
7 7
	<classpathentry kind="output" path="bin/classes"/>
8 8
</classpath>

+ 1 - 1
wade-mobile-common/project.properties

@ -11,5 +11,5 @@
11 11
#proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt
12 12
13 13
# Project target.
14
target=android-22
14
target=android-19
15 15
android.library=true

+ 77 - 0
wade-mobile-common/res/layout/browser.xml

@ -0,0 +1,77 @@
1
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
2
    xmlns:tools="http://schemas.android.com/tools"
3
    android:layout_width="fill_parent"
4
    android:layout_height="fill_parent"
5
    android:background="#ffffff"
6
    android:orientation="vertical" >
7

8
    <LinearLayout
9
        android:layout_width="fill_parent"
10
        android:layout_height="wrap_content"
11
        android:orientation="vertical" >
12

13
        <LinearLayout
14
            android:id="@+id/layout"
15
            android:layout_width="fill_parent"
16
            android:layout_height="wrap_content"
17
            android:orientation="horizontal"
18
            android:visibility="gone" >
19

20
            <EditText
21
                android:id="@+id/et_url"
22
                android:layout_width="0dp"
23
                android:layout_height="wrap_content"
24
                android:layout_weight="1"
25
                android:inputType="textUri"
26
                android:singleLine="true" />
27

28
            <Button
29
                android:id="@+id/btn_visit"
30
                android:layout_width="wrap_content"
31
                android:layout_height="wrap_content"
32
                android:text="@string/visit" />
33
        </LinearLayout>
34

35
        <LinearLayout
36
            android:id="@+id/ll_btn"
37
            android:layout_width="fill_parent"
38
            android:layout_height="wrap_content"
39
            android:gravity="center_horizontal"
40
            android:orientation="horizontal" >
41

42
            <Button
43
                android:id="@+id/btn_home"
44
                android:layout_width="wrap_content"
45
                android:layout_height="wrap_content"
46
                android:layout_weight="1"
47
                android:text="@string/home" />
48

49
            <Button
50
                android:id="@+id/btn_left"
51
                android:layout_width="wrap_content"
52
                android:layout_height="wrap_content"
53
                android:layout_weight="1"
54
                android:text="@string/left" />
55

56
            <Button
57
                android:id="@+id/btn_right"
58
                android:layout_width="wrap_content"
59
                android:layout_height="wrap_content"
60
                android:layout_weight="1"
61
                android:text="@string/right" />
62

63
            <Button
64
                android:id="@+id/btn_exit"
65
                android:layout_width="wrap_content"
66
                android:layout_height="wrap_content"
67
                android:layout_weight="1"
68
                android:text="@string/exit" />
69
        </LinearLayout>
70

71
        <WebView
72
            android:id="@+id/web"
73
            android:layout_width="fill_parent"
74
            android:layout_height="fill_parent" />
75
    </LinearLayout>
76

77
</LinearLayout>

+ 8 - 0
wade-mobile-common/res/values/strings_browser.xml

@ -0,0 +1,8 @@
1
<?xml version="1.0" encoding="utf-8"?>
2
<resources>
3
    <string name="home">主页</string>
4
    <string name="left">后退</string>
5
    <string name="right">前进</string>
6
    <string name="exit">退出</string>
7
    <string name="visit">访问</string>
8
</resources>

+ 35 - 0
wade-mobile-func/src/com/wade/mobile/func/MobileBrowser.java

@ -0,0 +1,35 @@
1
package com.wade.mobile.func;
2

3
import org.json.JSONArray;
4

5
import android.content.Intent;
6
import android.os.Bundle;
7

8
import com.wade.mobile.common.browser.BrowserActivity;
9
import com.wade.mobile.frame.IWadeMobile;
10
import com.wade.mobile.frame.plugin.Plugin;
11

12
/**
13
 * 打开浏览器插件
14
 * @author wangyujuan
15
 *
16
 */
17
public class MobileBrowser extends Plugin {
18
	
19
	private int BROWSER = 90004;
20

21
	public MobileBrowser(IWadeMobile wademobile) {
22
		super(wademobile);
23
	}
24

25
	public void openIpuBrowser(JSONArray param) throws Exception {
26
		String url = param.getString(0);
27
		String hasTitle = param.getString(1);
28
		Intent intent = new Intent(context, BrowserActivity.class);
29
	    Bundle bundle=new Bundle();
30
	    bundle.putString("url", url);
31
	    bundle.putString("hasTitle", hasTitle);
32
	    intent.putExtras(bundle);
33
	    startActivityForResult(intent, BROWSER);
34
	}
35
}