mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2025-01-29 08:34:37 +01:00
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:
parent
bf33bd4a0f
commit
676fd73fc0
2 changed files with 57 additions and 0 deletions
15
xwords4/android/XWords4/res/layout/dict_browse.xml
Normal file
15
xwords4/android/XWords4/res/layout/dict_browse.xml
Normal 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>
|
|
@ -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 ) );
|
||||
}
|
||||
}
|
Loading…
Add table
Reference in a new issue