1 // Copyright 2011 Google Inc. All Rights Reserved.
\r
3 // Licensed under the Apache License, Version 2.0 (the "License");
\r
4 // you may not use this file except in compliance with the License.
\r
5 // You may obtain a copy of the License at
\r
7 // http://www.apache.org/licenses/LICENSE-2.0
\r
9 // Unless required by applicable law or agreed to in writing, software
\r
10 // distributed under the License is distributed on an "AS IS" BASIS,
\r
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
\r
12 // See the License for the specific language governing permissions and
\r
13 // limitations under the License.
\r
15 package com.hughes.android.dictionary;
\r
17 import android.app.Activity;
\r
18 import android.content.Intent;
\r
19 import android.os.Bundle;
\r
20 import android.view.View;
\r
21 import android.view.View.OnClickListener;
\r
22 import android.webkit.WebView;
\r
23 import android.widget.Button;
\r
25 import com.hughes.util.StringUtil;
\r
27 public final class HtmlDisplayActivity extends Activity {
\r
29 static final String HTML_RES = "html_res";
\r
31 public static Intent getHelpLaunchIntent() {
\r
32 final Intent intent = new Intent();
\r
33 intent.setClassName(HtmlDisplayActivity.class.getPackage().getName(), HtmlDisplayActivity.class.getName());
\r
34 intent.putExtra(HTML_RES, R.raw.help);
\r
38 public static Intent getWhatsNewLaunchIntent() {
\r
39 final Intent intent = new Intent();
\r
40 intent.setClassName(HtmlDisplayActivity.class.getPackage().getName(), HtmlDisplayActivity.class.getName());
\r
41 intent.putExtra(HTML_RES, R.raw.whats_new);
\r
45 /** Called when the activity is first created. */
\r
47 public void onCreate(final Bundle savedInstanceState) {
\r
48 setTheme(((DictionaryApplication)getApplication()).getSelectedTheme().themeId);
\r
50 super.onCreate(savedInstanceState);
\r
51 setContentView(R.layout.help_activity);
\r
52 final int htmlRes = getIntent().getIntExtra(HTML_RES, -1);
\r
53 final String html = StringUtil.readToString(getResources().openRawResource(htmlRes));
\r
54 final WebView webView = (WebView) findViewById(R.id.webView);
\r
55 webView.loadData(html, "text/html", "utf-8");
\r
57 final Button okButton = (Button) findViewById(R.id.okButton);
\r
58 okButton.setOnClickListener(new OnClickListener() {
\r
60 public void onClick(View v) {
\r