Activity for downloading dicts with nothing but a WebView in it.

Works, but not cleanly.  Still need to get the path to
/sdcard/downloads programatically, and to exit cleanly back to parent
Activity.
This commit is contained in:
ehouse 2010-01-25 02:23:04 +00:00
parent bf33bd4a0f
commit 676fd73fc0
2 changed files with 57 additions and 0 deletions

View file

@ -0,0 +1,15 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:paddingLeft="8dp"
android:paddingRight="8dp">
<WebView android:id="@+id/dict_web_view"
android:layout_height="fill_parent"
android:layout_width="fill_parent"
/>
</LinearLayout>

View file

@ -0,0 +1,42 @@
/* -*- compile-command: "cd ../../../../../; ant reinstall"; -*- */
package org.eehouse.android.xw4;
import android.app.Activity;
import android.app.ListActivity;
import android.webkit.WebView;
import android.os.Bundle;
import android.webkit.DownloadListener;
import org.eehouse.android.xw4.jni.*;
public class DictActivity extends Activity {
private WebView m_webview;
@Override
public void onCreate( Bundle savedInstanceState )
{
super.onCreate( savedInstanceState );
setContentView( R.layout.dict_browse );
m_webview = (WebView)findViewById( R.id.dict_web_view );
m_webview.setDownloadListener( new DownloadListener() {
public void onDownloadStart( String url, String userAgent,
String contentDisposition,
String mimetype,
long contentLength) {
Utils.logf( "url: " + url );
Utils.logf( "userAgent: " + userAgent );
Utils.logf( "contentDisposition: " + contentDisposition );
Utils.logf( "mimetype: " + mimetype );
Utils.logf( "contentLength: " + contentLength );
}
} );
m_webview.loadUrl( getString( R.string.dict_url ) );
}
}