在Android程序中嵌套Flash动画。这次按照上次的内容做个扩展,做个简易的flash播放器。
前提条件如上一节所说,需要Android2.2平台和安装flash的插件。
先看工程图和效果图:
工程源码:
view plaincopy to clipboardprint?
·········10········20········30········40········50········60········70········80········90········100·······110·······120·······130·······140·······15001.package com.geolo.android.flash;
02.import com.geolo.android.FileBrowser;
03.import com.geolo.android.R;
04.import android.app.Activity;
05.import android.app.AlertDialog;
06.import android.app.ProgressDialog;
07.import android.content.DialogInterface;
08.import android.content.Intent;
09.import android.os.Bundle;
10.import android.os.Handler;
11.import android.os.Message;
12.import android.util.Log;
13.import android.view.KeyEvent;
14.import android.view.View;
15.import android.webkit.WebChromeClient;
16.import android.webkit.WebSettings.PluginState;
17.import android.webkit.WebView;
18.import android.widget.Button;
19.import android.widget.FrameLayout;
20.import android.widget.ProgressBar;
21.public class FlashActivity extends Activity{
22. private WebView mWebView;
23. private Button playButton,pauseButton,rewindButton,exitButton,fileButton;
24. private ProgressBar mProgressBarHorizontal;
25. private final static int PROGRESSBARSIZE = 0x0000;
26. private final static int FLASH_START = 0x0001;
27. private String flashName ;
28. private boolean stopThread = false;
29. private ProgressDialog mProgressDialog;
30. @Override
31. public void onCreate(Bundle savedInstanceState) {
32. super.onCreate(savedInstanceState);
33. setContentView(R.layout.main);
34. mProgressDialog = new ProgressDialog(this);
35. mProgressDialog.setMessage("Flash动画正在加载,请稍等......");
36. mProgressDialog.show();
37. Intent intent = this.getIntent();
38. String fileName = intent.getStringExtra("fileName");
39. if(fileName != null && !fileName.equals("")){
40. flashName = "file://"+fileName;
41. //flashName = "javascript:setFlashPath(flashName)";
42. }else{
43. flashName = "file:///android_asset/sample/flash.swf";
44. }
45. Log.d(this.getClass().getName(), flashName);
46. mWebView = (WebView)findViewById(R.id.webView01);
47. mProgressBarHorizontal = (ProgressBar)findViewById(R.id.progress_horizontal);
48. this.setProgress(mProgressBarHorizontal.getProgress() * 100);
49. //this.setSecondaryProgress(mProgressBarHorizontal.getSecondaryProgress() * 100);
50. playButton = (Button)findViewById(R.id.playButton);
51. pauseButton = (Button)findViewById(R.id.pauseButton);
52. rewindButton = (Button)findViewById(R.id.rewindButton);
53. exitButton = (Button)findViewById(R.id.exitButton);
54. fileButton = (Button)findViewById(R.id.fileButton);
55. playButton.setOnClickListener(buttonListener);
56. pauseButton.setOnClickListener(buttonListener);
57. rewindButton.setOnClickListener(buttonListener);
58. exitButton.setOnClickListener(buttonListener);
59. fileButton.setOnClickListener(buttonListener);
60. mWebView.getSettings().setJavaScriptEnabled(true);
61. //mWebView.getSettings().setPluginsEnabled(true);
62. mWebView.getSettings().setPluginState(PluginState.ON);
63. mWebView.setWebChromeClient(new WebChromeClient());
64. mWebView.addJavascriptInterface(new CallJava(), "CallJava");
65. mWebView.loadUrl("file:///android_asset/sample/index.html");
66. //mWebView.loadUrl("javascript:setFlashPath('"+flashName+"')");
67. startThread();
68. }
69. Button.OnClickListener buttonListener = new Button.OnClickListener() {
70. @Override
71. public void onClick(View v) {
72. int buttonID = v.getId();
73. switch (buttonID) {
74. case R.id.playButton:
75. mWebView.loadUrl("javascript:Play()");
76. showFlashProgress(5);
77. break;
78. case R.id.pauseButton:
79. mWebView.loadUrl("javascript:Pause()");
80. break;
81. case R.id.rewindButton:
82. //mWebView.loadUrl(flashName);
83. try {
84. mWebView.loadUrl("about:blank");
85. mWebView.loadUrl("file:///android_asset/sample/index.html");
86. Thread.sleep(1000);
87. mWebView.loadUrl("javascript:setFlashPath('"+flashName+"')");
88. } catch (InterruptedException e) {
89. Log.e(this.getClass().getName(), "Flash Rewind error: ", e);
90. }
91. break;
92. case R.id.fileButton:
93. Intent intent = new Intent();
94. intent.setClass(FlashActivity.this, FileBrowser.class);
95. startActivity(intent);
96. stopThread = true;
97. FlashActivity.this.finish();
98. break;
99. case R.id.exitButton:
100. quitDialog();
101. break;
102. default:
103. break;
104. }
105. }
106. };
107. public void showFlashProgress(float progressSize){
108. int size = (int)progressSize;
109. //Toast.makeText(this, size+"", Toast.LENGTH_SHORT).show();
110. mProgressBarHorizontal.setProgress(size);
111. }
112. private void quitDialog(){
113. new AlertDialog.Builder(this)
114. .setMessage("没胆就不要退出")
115. .setPositiveButton("比你有胆", new AlertDialog.OnClickListener() {
116. @Override
117. public void onClick(DialogInterface dialog, int which) {
118. stopThread = true;
119. FlashActivity.this.finish();
120. }
121. })
122. .setNegativeButton("怕你了", null)
123. .show();
124. }
125. @Override
126. public boolean onKeyDown(int keyCode, KeyEvent event) {
127. switch (keyCode) {
128. case KeyEvent.KEYCODE_BACK:
129. quitDialog();
130. break;
131. default:
132. break;
133. }
134. return false;
135. }
136. @Override
137. protected void onPause(){
138. super.onPause();
139. mWebView.pauseTimers();
140. if(isFinishing()){
141. mWebView.loadUrl("about:blank");
142. setContentView(new FrameLayout(this));
143. }
144. }
145. @Override
146. protected void onResume(){
147. super.onResume();
148. mWebView.resumeTimers();
149. }
150. private final class CallJava{
151. public void consoleFlashProgress(float progressSize){
152. showFlashProgress(progressSize);
153. }
154. }
155. private void startThread(){
156. //通过线程来改变ProgressBar的值
157. new Thread(new Runnable() {
158. @Override
159. public void run() {
160. try {
161. Thread.sleep(2000);
162. Message message = new Message();
163. message.what = FlashActivity.FLASH_START;
164. FlashActivity.this.myMessageHandler.sendMessage(message);
165. } catch (InterruptedException e1) {
166. Thread.currentThread().interrupt();
167. }
168.
169. while(!stopThread && !Thread.currentThread().isInterrupted()){
170. try {
171. Thread.sleep(2000);
172. Message message2 = new Message();
173. message2.what = FlashActivity.PROGRESSBARSIZE;
174. FlashActivity.this.myMessageHandler.sendMessage(message2);
175. } catch (Exception e) {
176. Thread.currentThread().interrupt();
177. }
178. }
179. }
180. }).start();
181. }
182. Handler myMessageHandler = new Handler() {
183. @Override
184. public void handleMessage(Message msg) {
185. switch (msg.what) {
186. case FlashActivity.PROGRESSBARSIZE:
187. mWebView.loadUrl("javascript:showcount()");
188. break;
189. case FlashActivity.FLASH_START:
190. mWebView.loadUrl("javascript:setFlashPath('"+flashName+"')");
191. Log.d(this.getClass().getName(),"Start flash : "+flashName);
192. mProgressDialog.dismiss();
193. break;
194. default:
195. break;
196. }
197. super.handleMessage(msg);
198. }
199. };
200.}
package com.geolo.android.flash;
import com.geolo.android.FileBrowser;
import com.geolo.android.R;
import android.app.Activity;
import android.app.AlertDialog;
import android.app.ProgressDialog;
import android.content.DialogInterface;
import android.content.Intent;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.util.Log;
import android.view.KeyEvent;
import android.view.View;
import android.webkit.WebChromeClient;
import android.webkit.WebSettings.PluginState;
import android.webkit.WebView;
import android.widget.Button;
import android.widget.FrameLayout;
import android.widget.ProgressBar;
public class FlashActivity extends Activity{
private WebView mWebView;
private Button playButton,pauseButton,rewindButton,exitButton,fileButton;
private ProgressBar mProgressBarHorizontal;
private final static int PROGRESSBARSIZE = 0x0000;
private final static int FLASH_START = 0x0001;
private String flashName ;
private boolean stopThread = false;
private ProgressDialog mProgressDialog;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
mProgressDialog = new ProgressDialog(this);
mProgressDialog.setMessage("Flash动画正在加载,请稍等......");
mProgressDialog.show();
Intent intent = this.getIntent();
String fileName = intent.getStringExtra("fileName");
if(fileName != null && !fileName.equals("")){
flashName = "file://"+fileName;
//flashName = "javascript:setFlashPath(flashName)";
}else{
flashName = "file:///android_asset/sample/flash.swf";
}
Log.d(this.getClass().getName(), flashName);
mWebView = (WebView)findViewById(R.id.webView01);
mProgressBarHorizontal = (ProgressBar)findViewById(R.id.progress_horizontal);
this.setProgress(mProgressBarHorizontal.getProgress() * 100);
//this.setSecondaryProgress(mProgressBarHorizontal.getSecondaryProgress() * 100);
playButton = (Button)findViewById(R.id.playButton);
pauseButton = (Button)findViewById(R.id.pauseButton);
rewindButton = (Button)findViewById(R.id.rewindButton);
exitButton = (Button)findViewById(R.id.exitButton);
fileButton = (Button)findViewById(R.id.fileButton);
playButton.setOnClickListener(buttonListener);
pauseButton.setOnClickListener(buttonListener);
rewindButton.setOnClickListener(buttonListener);
exitButton.setOnClickListener(buttonListener);
fileButton.setOnClickListener(buttonListener);
mWebView.getSettings().setJavaScriptEnabled(true);
//mWebView.getSettings().setPluginsEnabled(true);
mWebView.getSettings().setPluginState(PluginState.ON);
mWebView.setWebChromeClient(new WebChromeClient());
mWebView.addJavascriptInterface(new CallJava(), "CallJava");
mWebView.loadUrl("file:///android_asset/sample/index.html");
//mWebView.loadUrl("javascript:setFlashPath('"+flashName+"')");
startThread();
}
Button.OnClickListener buttonListener = new Button.OnClickListener() {
@Override
public void onClick(View v) {
int buttonID = v.getId();
switch (buttonID) {
case R.id.playButton:
mWebView.loadUrl("javascript:Play()");
showFlashProgress(5);
break;
case R.id.pauseButton:
mWebView.loadUrl("javascript:Pause()");
break;
case R.id.rewindButton:
//mWebView.loadUrl(flashName);
try {
mWebView.loadUrl("about:blank");
mWebView.loadUrl("file:///android_asset/sample/index.html");
Thread.sleep(1000);
mWebView.loadUrl("javascript:setFlashPath('"+flashName+"')");
} catch (InterruptedException e) {
Log.e(this.getClass().getName(), "Flash Rewind error: ", e);
}
break;
case R.id.fileButton:
Intent intent = new Intent();
intent.setClass(FlashActivity.this, FileBrowser.class);
startActivity(intent);
stopThread = true;
FlashActivity.this.finish();
break;
case R.id.exitButton:
quitDialog();
break;
default:
break;
}
}
};
public void showFlashProgress(float progressSize){
int size = (int)progressSize;
//Toast.makeText(this, size+"", Toast.LENGTH_SHORT).show();
mProgressBarHorizontal.setProgress(size);
}
private void quitDialog(){
new AlertDialog.Builder(this)
.setMessage("没胆就不要退出")
.setPositiveButton("比你有胆", new AlertDialog.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
stopThread = true;
FlashActivity.this.finish();
}
})
.setNegativeButton("怕你了", null)
.show();
}
@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
switch (keyCode) {
case KeyEvent.KEYCODE_BACK:
quitDialog();
break;
default:
break;
}
return false;
}
@Override
protected void onPause(){
super.onPause();
mWebView.pauseTimers();
if(isFinishing()){
mWebView.loadUrl("about:blank");
setContentView(new FrameLayout(this));
}
}
@Override
protected void onResume(){
super.onResume();
mWebView.resumeTimers();
}
private final class CallJava{
public void consoleFlashProgress(float progressSize){
showFlashProgress(progressSize);
}
}
private void startThread(){
//通过线程来改变ProgressBar的值
new Thread(new Runnable() {
@Override
public void run() {
try {
Thread.sleep(2000);
Message message = new Message();
message.what = FlashActivity.FLASH_START;
FlashActivity.this.myMessageHandler.sendMessage(message);
} catch (InterruptedException e1) {
Thread.currentThread().interrupt();
}
while(!stopThread && !Thread.currentThread().isInterrupted()){
try {
Thread.sleep(2000);
Message message2 = new Message();
message2.what = FlashActivity.PROGRESSBARSIZE;
FlashActivity.this.myMessageHandler.sendMessage(message2);
} catch (Exception e) {
Thread.currentThread().interrupt();
}
}
}
}).start();
}
Handler myMessageHandler = new Handler() {
@Override
public void handleMessage(Message msg) {
switch (msg.what) {
case FlashActivity.PROGRESSBARSIZE:
mWebView.loadUrl("javascript:showcount()");
break;
case FlashActivity.FLASH_START:
mWebView.loadUrl("javascript:setFlashPath('"+flashName+"')");
Log.d(this.getClass().getName(),"Start flash : "+flashName);
mProgressDialog.dismiss();
break;
default:
break;
}
super.handleMessage(msg);
}
};
}
view plaincopy to clipboardprint?
01.package com.geolo.android;
02.import java.io.File;
03.import java.util.List;
04.import android.content.Context;
05.import android.view.View;
06.import android.view.ViewGroup;
07.import android.widget.ArrayAdapter;
08.import android.widget.TextView;
09.public class FileListAdapter extends ArrayAdapter<File>{
10.
11. public FileListAdapter(Context context, int Resource,List<File> objects) {
12. super(context,Resource,objects);
13. }
14. @Override
15. public View getView(int position, View convertView, ViewGroup parent) {
16. TextView view = (TextView)super.getView(position, convertView, parent);
17. File file = getItem(position);
18. if (position == 0){
19. view.setText("当前目录:/root" + file.getAbsolutePath());
20. }else if (position == 1 && !isRoot()){
21. view.setText("返回上一个目录");
22. }else{
23. view.setText(file.getName());
24. }
25. return view;
26. }
27.
28. public boolean isRoot() {
29. return getItem(0).getParent() == null;
30. }
31.}
package com.geolo.android;
import java.io.File;
import java.util.List;
import android.content.Context;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.TextView;
public class FileListAdapter extends ArrayAdapter<File>{
public FileListAdapter(Context context, int Resource,List<File> objects) {
super(context,Resource,objects);
}
@Override
public View getView(int position, View convertView, ViewGroup parent) {
TextView view = (TextView)super.getView(position, convertView, parent);
File file = getItem(position);
if (position == 0){
view.setText("当前目录:/root" + file.getAbsolutePath());
}else if (position == 1 && !isRoot()){
view.setText("返回上一个目录");
}else{
view.setText(file.getName());
}
return view;
}
public boolean isRoot() {
return getItem(0).getParent() == null;
}
}
view plaincopy to clipboardprint?
01.package com.geolo.android;
02.import java.io.File;
03.import java.io.FileFilter;
04.import java.util.ArrayList;
05.import java.util.List;
06.import com.geolo.android.flash.FlashActivity;
07.import android.app.ListActivity;
08.import android.content.Intent;
09.import android.net.Uri;
10.import android.os.Bundle;
11.import android.view.KeyEvent;
12.import android.view.View;
13.import android.widget.ListView;
14.public class FileBrowser extends ListActivity {
15. private static final FileFilter FILTER = new FileFilter() {
16. public boolean accept(File f) {
17. //return f.isDirectory() || f.getName().matches("^.*?//.(jpg|png|bmp|gif)$");
18. return true;
19. }
20. };
21. private FileListAdapter fileList;
22. public void onCreate(Bundle icicle) {
23. super.onCreate(icicle);
24. File sdcard = android.os.Environment.getExternalStorageDirectory();
25. fill(sdcard);
26. }
27. public boolean onKeyDown(int keyCode, KeyEvent event) {
28. if (keyCode == KeyEvent.KEYCODE_BACK && !fileList.isRoot()) {
29. fill(fileList.getItem(1));
30. Intent intent = new Intent();
31. intent.setClass(FileBrowser.this, FlashActivity.class);
32. startActivity(intent);
33. //return true;
34. }
35. return super.onKeyDown(keyCode, event);
36. }
37.
38. private void fill(File folder) {
39. List<File> files = new ArrayList<File>();
40. files.add(folder);
41. if (folder.getParentFile() != null){
42. files.add(folder.getParentFile());
43. }
44. for (File file : folder.listFiles(FILTER)) {
45. files.add(file);
46. }
47. fileList = new FileListAdapter(this, android.R.layout.simple_list_item_1, files);
48. setListAdapter(fileList);
49. }
50.
51. @Override
52. protected void onListItemClick(ListView l, View v, int position, long id) {
53. File file = fileList.getItem(position);
54. Intent intent = new Intent();
55. intent.setAction(android.content.Intent.ACTION_VIEW);
56. if (file.isDirectory()){
57. fill(file);
58. }else if(file.getName().matches("^.*?//.(jpg|png|bmp|gif)$")){
59. intent.setDataAndType(Uri.fromFile(file), "image/*");
60. startActivity(intent);
61. }else if(file.getName().matches("^.*?//.(swf)$")){
62. intent.setClass(FileBrowser.this, FlashActivity.class);
63. intent.putExtra("fileName", file.getAbsolutePath().replace("/mnt", ""));
64. startActivity(intent);
65. FileBrowser.this.finish();
66. }
67. }
68.}
package com.geolo.android;
import java.io.File;
import java.io.FileFilter;
import java.util.ArrayList;
import java.util.List;
import com.geolo.android.flash.FlashActivity;
import android.app.ListActivity;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.view.KeyEvent;
import android.view.View;
import android.widget.ListView;
public class FileBrowser extends ListActivity {
private static final FileFilter FILTER = new FileFilter() {
public boolean accept(File f) {
//return f.isDirectory() || f.getName().matches("^.*?//.(jpg|png|bmp|gif)$");
return true;
}
};
private FileListAdapter fileList;
public void onCreate(Bundle icicle) {
super.onCreate(icicle);
File sdcard = android.os.Environment.getExternalStorageDirectory();
fill(sdcard);
}
public boolean onKeyDown(int keyCode, KeyEvent event) {
if (keyCode == KeyEvent.KEYCODE_BACK && !fileList.isRoot()) {
fill(fileList.getItem(1));
Intent intent = new Intent();
intent.setClass(FileBrowser.this, FlashActivity.class);
startActivity(intent);
//return true;
}
return super.onKeyDown(keyCode, event);
}
private void fill(File folder) {
List<File> files = new ArrayList<File>();
files.add(folder);
if (folder.getParentFile() != null){
files.add(folder.getParentFile());
}
for (File file : folder.listFiles(FILTER)) {
files.add(file);
}
fileList = new FileListAdapter(this, android.R.layout.simple_list_item_1, files);
setListAdapter(fileList);
}
@Override
protected void onListItemClick(ListView l, View v, int position, long id) {
File file = fileList.getItem(position);
Intent intent = new Intent();
intent.setAction(android.content.Intent.ACTION_VIEW);
if (file.isDirectory()){
fill(file);
}else if(file.getName().matches("^.*?//.(jpg|png|bmp|gif)$")){
intent.setDataAndType(Uri.fromFile(file), "image/*");
startActivity(intent);
}else if(file.getName().matches("^.*?//.(swf)$")){
intent.setClass(FileBrowser.this, FlashActivity.class);
intent.putExtra("fileName", file.getAbsolutePath().replace("/mnt", ""));
startActivity(intent);
FileBrowser.this.finish();
}
}
}
view plaincopy to clipboardprint?
01.<mce:script src="play.js" mce_src="play.js"></mce:script>
02.<table border="0" cellpadding="0" cellspacing="1" bgcolor="#000000">
03. <tr>
04. <td>
05. <object id="movie" classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000"
06. codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0"
07. align="middle">
08. <param name="movie" value="about:blank" />
09. <param name="quality" value="high" />
10. </object>
11. </td>
12. </tr>
13.</table>
14.
15.
16. <!-- <a href="javascript:CallJava.consoleFlashProgress(3)" mce_href="javascript:CallJava.consoleFlashProgress(3)">add Progress</a>
17. <a href="#" mce_href="#" onClick="loadSWF('','testFlash.swf','800','480')">TestButton</a> -->
18. <p id="geolo"></p>
19.<mce:script type="text/javascript"><!--
20. //loadSWF("testFlash.swf","800","480"); //loadSWF("flash地址","宽度","高度")
21. function setFlashPath(filePath){
22. var path = filePath;
23. loadSWF(path,"800","480"); //loadSWF("flash地址","宽度","高度")
24. //geolo.innerText = "abc: " + filePath.toString();
25. }
26.// --></mce:script>
27.
<mce:script src="play.js" mce_src="play.js"></mce:script>
<table border="0" cellpadding="0" cellspacing="1" bgcolor="#000000">
<tr>
<td>
<object id="movie" classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000"
codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0"
align="middle">
<param name="movie" value="about:blank" />
<param name="quality" value="high" />
</object>
</td>
</tr>
</table>
<!-- <a href="javascript:CallJava.consoleFlashProgress(3)" mce_href="javascript:CallJava.consoleFlashProgress(3)">add Progress</a>
<a href="#" mce_href="#" onClick="loadSWF('','testFlash.swf','800','480')">TestButton</a> -->
<p id="geolo"></p>
<mce:script type="text/javascript"><!--
//loadSWF("testFlash.swf","800","480"); //loadSWF("flash地址","宽度","高度")
function setFlashPath(filePath){
var path = filePath;
loadSWF(path,"800","480"); //loadSWF("flash地址","宽度","高度")
//geolo.innerText = "abc: " + filePath.toString();
}
// --></mce:script>
view plaincopy to clipboardprint?
01.var total;//定义flash影片总桢数
02.var frame_number;//定义flash影片当前桢数
03.//以下是滚动条图片拖动程序
04.var dragapproved=false;
05.var z,x,y
06.//动态显示播放影片的当前桢/总桢数(进度条显示)
07.function showcount(){
08. //已测可用CallJava.consoleFlashProgress(5);
09. total = movie.TotalFrames;
10. frame_number=movie.CurrentFrame();
11. frame_number++;
12. var progressSize = 100*(frame_number/movie.TotalFrames());
13. CallJava.consoleFlashProgress(progressSize);
14.}
15.//播放影片
16.function Play(){
17. movie.Play();
18.}
19.//暂停播放
20.function Pause(){
21. movie.StopPlay();
22.}
23.//开始载入flash影片
24.function loadSWF(fsrc,fwidth,fheight){
25. movie.LoadMovie(0, fsrc);
26. movie.width=fwidth;
27. movie.height=fheight;
28. frame_number=movie.CurrentFrame();
29.}
var total;//定义flash影片总桢数
var frame_number;//定义flash影片当前桢数
//以下是滚动条图片拖动程序
var dragapproved=false;
var z,x,y
//动态显示播放影片的当前桢/总桢数(进度条显示)
function showcount(){
//已测可用CallJava.consoleFlashProgress(5);
total = movie.TotalFrames;
frame_number=movie.CurrentFrame();
frame_number++;
var progressSize = 100*(frame_number/movie.TotalFrames());
CallJava.consoleFlashProgress(progressSize);
}
//播放影片
function Play(){
movie.Play();
}
//暂停播放
function Pause(){
movie.StopPlay();
}
//开始载入flash影片
function loadSWF(fsrc,fwidth,fheight){
movie.LoadMovie(0, fsrc);
movie.width=fwidth;
movie.height=fheight;
frame_number=movie.CurrentFrame();
}
main.xml
view plaincopy to clipboardprint?
01.<?xml version="1.0" encoding="utf-8"?>
02.<!-- autor:geolo 声明:版权所有,违者必究 -->
03.<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
04. android:orientation="vertical" android:layout_width="fill_parent"
05. android:layout_height="fill_parent">
06. <WebView android:id="@+id/webView01" android:layout_width="wrap_content"
07. android:layout_height="wrap_content" />
08. <ProgressBar android:id="@+id/progress_horizontal"
09. style="?android:attr/progressBarStyleHorizontal" android:layout_width="fill_parent"
10. android:layout_height="wrap_content" android:max="100"
11. android:progress="0" android:secondaryProgress="0" />
12. <LinearLayout android:orientation="horizontal"
13. android:layout_width="fill_parent" android:layout_height="wrap_content">
14. <Button android:id="@+id/playButton" android:layout_width="wrap_content"
15. android:layout_height="wrap_content" android:text="播放" />
16. <Button android:id="@+id/pauseButton" android:layout_width="wrap_content"
17. android:layout_height="wrap_content" android:text="暂停" />
18. <Button android:id="@+id/rewindButton" android:layout_width="wrap_content"
19. android:layout_height="wrap_content" android:text="重播" />
20. <Button android:id="@+id/fileButton" android:layout_width="wrap_content"
21. android:layout_height="wrap_content" android:text="打开文件" />
22. <Button android:id="@+id/exitButton" android:layout_width="wrap_content"
23. android:layout_height="wrap_content" android:text="退出" />
24. </LinearLayout>
25.</LinearLayout>
<?xml version="1.0" encoding="utf-8"?>
<!-- autor:geolo 声明:版权所有,违者必究 -->
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical" android:layout_width="fill_parent"
android:layout_height="fill_parent">
<WebView android:id="@+id/webView01" android:layout_width="wrap_content"
android:layout_height="wrap_content" />
<ProgressBar android:id="@+id/progress_horizontal"
style="?android:attr/progressBarStyleHorizontal" android:layout_width="fill_parent"
android:layout_height="wrap_content" android:max="100"
android:progress="0" android:secondaryProgress="0" />
<LinearLayout android:orientation="horizontal"
android:layout_width="fill_parent" android:layout_height="wrap_content">
<Button android:id="@+id/playButton" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:text="播放" />
<Button android:id="@+id/pauseButton" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:text="暂停" />
<Button android:id="@+id/rewindButton" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:text="重播" />
<Button android:id="@+id/fileButton" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:text="打开文件" />
<Button android:id="@+id/exitButton" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:text="退出" />
</LinearLayout>
</LinearLayout>
view plaincopy to clipboardprint?
01.<?xml version="1.0" encoding="utf-8"?>
02.<manifest xmlns:android="http://schemas.android.com/apk/res/android"
03. package="com.geolo.android" android:versionCode="1"
04. android:versionName="1.0">
05. <application android:icon="@drawable/icon" android:label="@string/app_name">
06. <activity android:name=".flash.FlashActivity" android:label="@string/app_name"
07. android:screenOrientation="landscape"
08. android:theme="@android:style/Theme.NoTitleBar.Fullscreen">
09. <intent-filter>
10. <action android:name="android.intent.action.MAIN" />
11. <category android:name="android.intent.category.LAUNCHER" />
12. </intent-filter>
13. </activity>
14. <activity android:name=".FileBrowser" />
15. </application>
16. <supports-screens android:resizeable="true"
17. android:smallScreens="true" android:largeScreens="true"
18. android:normalScreens="true" android:anyDensity="true"></supports-screens>
19.</manifest>
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.geolo.android" android:versionCode="1"
android:versionName="1.0">
<application android:icon="@drawable/icon" android:label="@string/app_name">
<activity android:name=".flash.FlashActivity" android:label="@string/app_name"
android:screenOrientation="landscape"
android:theme="@android:style/Theme.NoTitleBar.Fullscreen">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name=".FileBrowser" />
</application>
<supports-screens android:resizeable="true"
android:smallScreens="true" android:largeScreens="true"
android:normalScreens="true" android:anyDensity="true"></supports-screens>
</manifest>
工程打包资源下载:http://download.csdn.net/source/2926306