📄 baselist.java
字号:
package com.yxw.view;
import javax.microedition.lcdui.Command;
import javax.microedition.lcdui.CommandListener;
import javax.microedition.lcdui.Displayable;
import javax.microedition.lcdui.Image;
import javax.microedition.lcdui.List;
import com.yxw.model.PlayList;
import com.yxw.control.*;
public class BaseList extends List implements CommandListener {
private Object[] datas;
private int currentPage=1;
private int totalPage=3;
private boolean isNative=false;
private Command command1;
private Command command2;
public BaseList(String arg0, int arg1, Object[] arg2,boolean isNative) {
super(arg0, arg1);
this.isNative=isNative;
if(arg2!=null){
//String[] fileNames=new String[datas.length];
this.datas=arg2;
for(int i=0;i<datas.length;i++){
//fileNames[i]=((PlayList)datas[i]).getFileName();
this.append(((PlayList)datas[i]).getFileName(), null);
}
}
if(this.isNative){
command1=new Command("删除",Command.SCREEN,1);
command2=new Command("返回",Command.SCREEN,1);
this.addCommand(command1);
this.addCommand(command2);
}else{
command1=new Command("上一页",Command.SCREEN,1);
command2=new Command("下一页",Command.SCREEN,1);
if(this.currentPage>1){
this.addCommand(command1);
}
if(this.currentPage==1){
command1=new Command("返回",Command.SCREEN,1);
this.addCommand(command1);
}
if(this.currentPage<this.totalPage){
this.addCommand(command2);
}
this.setTitle(arg0+"("+this.currentPage+"/"+this.totalPage+")");
}
this.setCommandListener(this);
}
// super(arg0, arg1, arg2, arg3);
// TODO 自动生成构造函数存根
public void commandAction(Command arg0, Displayable arg1) {
// TODO 自动生成方法存根
if(arg0==List.SELECT_COMMAND){
int index=this.getSelectedIndex();
if(this.isNative){
MainMidlet.instance.playerUI=null;
MainMidlet.instance.playerUI=new PlayerUI("",-1,"",index);//启动播放器
//MainMidlet.instance.playerUI.setCurrentFileId(index);
}else{
PlayList pl=(PlayList)this.datas[index];
MainMidlet.instance.playerUI=null;
MainMidlet.instance.playerUI=new PlayerUI(pl.getFileName(),pl.getSize(),pl.getUrl(),0);
System.out.println("播放");
}
MainMidlet.forward(MainMidlet.instance.playerUI);
}
else if(arg0==this.command1){
if(this.isNative){
}else{
MainMidlet.goBack();
}
}else if(arg0==this.command2){
if(this.isNative){
MainMidlet.goBack();
}else{
}
}
}
public int getCurrentPage() {
return currentPage;
}
public void setCurrentPage(int currentPage) {
this.currentPage = currentPage;
}
public Object[] getDatas() {
return datas;
}
public void setDatas(Object[] datas) {
this.datas = datas;
}
public int getTotalPage() {
return totalPage;
}
public void setTotalPage(int totalPage) {
this.totalPage = totalPage;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -