⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 unicanvas.java

📁 一个图铃下载的小程序
💻 JAVA
📖 第 1 页 / 共 5 页
字号:
				this.titleTimes = 0;
				if (sound != null) {
					sound.close();
				}
				
				//System.gc();
				//link = new LinkThread("", PAGE_RES, 2);
				break;
			case PAGE_SEARCH:
				page = PAGE_MAIN;
				/*
				 * sizeV = 4; sizeH = 4; posV = 1; posH = 0;
				 */
				addCommand(1);
				myDisplay.setCurrent(this);
				break;
			case PAGE_SEND:
				page = PAGE_PREVIEW;
				myDisplay.setCurrent(this);
				break;
			case PAGE_HELP:
				page = PAGE_MAIN;
				/*
				 * sizeV = 4; sizeH = 4; posV = 1; posH = 0;
				 */
				myDisplay.setCurrent(this);
				break;
			case PAGE_ABOUT:
				page = PAGE_MAIN;
				/*
				 * sizeV = 4; sizeH = 4; posV = 1; posH = 0;
				 */
				myDisplay.setCurrent(this);
				break;
			case PAGE_ALERT:
				page = lastPage;
				/*
				 * sizeV = 4; sizeH = 4; posV = 1; posH = 0;
				 */
				//pageState = 1;
				if (page == PAGE_MAIN) {
					addCommand(1);
				} else {
					addCommand(2);
				}
				//myDisplay.setCurrent(this);
				break;
			case PAGE_SET:
				//System.out.println("====setList.getSelectedIndex()===="+setList.getSelectedIndex());
				if (setList.getSelectedIndex() == 0) {
					//setList.setSelectedIndex(0,true);
					setIsOpen(true);
				} else {
					//setList.setSelectedIndex(1,true);
					setIsOpen(false);
				}
				page = PAGE_MAIN;
				/*
				 * sizeV = 4; sizeH = 4; posV = 1; posH = 0;
				 */
				myDisplay.setCurrent(this);
				break;
			case PAGE_WAP:
				this.isStop = true;
				break;
			}
			break;
		}
	}

	protected final void keyReleased(int key) {
	}

	public void keyRepeated(int key) {
		keyPressed(key);
	}

	public void commandAction(Command cmd, Displayable d) {
		isCommand = true;
		ResultBean bean = null;
		//LinkThread link;
		if (cmd == cmdLast) {
			//lastPage = page;
			page = PAGE_LINK;
			myDisplay.setCurrent(this);
			httpUrl = new StringBuffer();
			httpUrl.append(httpServer);
			httpUrl.append(resultBean.getLastUrl());
			prePosH = 1;
			preSizeH = 3;
			glsForm = null;
			link = new LinkThread(httpUrl.toString(), PAGE_PREVIEW, 3);
			link.start();
			//System.out.println("======cmdLast=====");
		} else if (cmd == cmdNext) {
			//lastPage = page;
			page = PAGE_LINK;
			myDisplay.setCurrent(this);
			httpUrl = new StringBuffer();
			httpUrl.append(httpServer);
			httpUrl.append(resultBean.getNextUrl());
			prePosH = 3;
			preSizeH = 3;
			glsForm = null;
			link = new LinkThread(httpUrl.toString(), PAGE_PREVIEW, 3);
			link.start();
			//System.out.println("======cmdNext=====");
		} else if (cmd == cmdExit) {
			this.isStop = true;
		} else if (cmd == cmdOK) {
			switch (page) {
			case PAGE_MAIN://主菜单
				if (posV > 0) {
					addCommand(2);
					lastPage = page;
					page = PAGE_LINK;
					switch (posV) {
					case 1:
						resTitle = "精品推荐";
						mainOperate = 4;
						resPos = 0;
						resPosV = 1;
						httpUrl = new StringBuffer();
						httpUrl.append(httpServer);
						httpUrl.append("resServlet?resPush=2&mobileCode=");
						httpUrl.append(mobileCode);
						httpUrl.append("&curPage=1&pageSize=");
						httpUrl.append(pageSize);
						lastResPage = httpUrl.toString();
						link = new LinkThread(httpUrl.toString(), PAGE_RES, 2);
						link.start();
						break;
					case 2:
						listTitle = "欲望热图";
						mainOperate = 1;
						listPos = 0;
						listPosV = 1;
						httpUrl = new StringBuffer();
						httpUrl.append(httpServer);
						httpUrl
								.append("catalogServlet?catalogType=1&mobileCode=");
						httpUrl.append(mobileCode);
						httpUrl.append("&pageSize=");
						httpUrl.append(pageSize);
						lastListPage = httpUrl.toString();
						link = new LinkThread(httpUrl.toString(), PAGE_LIST, 1);
						link.start();
						break;
					case 3:
						listTitle = "火辣炫铃";
						mainOperate = 2;
						listPos = 0;
						listPosV = 1;
						httpUrl = new StringBuffer();
						httpUrl.append(httpServer);
						httpUrl
								.append("catalogServlet?catalogType=2&mobileCode=");
						httpUrl.append(mobileCode);
						httpUrl.append("&pageSize=");
						httpUrl.append(pageSize);
						lastListPage = httpUrl.toString();
						link = new LinkThread(httpUrl.toString(), PAGE_LIST, 1);
						link.start();
						break;
					case 4:
						listTitle = "绝色图文";
						mainOperate = 3;
						listPos = 0;
						listPosV = 1;
						httpUrl = new StringBuffer();
						httpUrl.append(httpServer);
						httpUrl
								.append("catalogServlet?catalogType=3&mobileCode=");
						httpUrl.append(mobileCode);
						httpUrl.append("&pageSize=");
						httpUrl.append(pageSize);
						lastListPage = httpUrl.toString();
						link = new LinkThread(httpUrl.toString(), PAGE_LIST, 1);
						link.start();
						break;
					}
				}
				if (posH > 0) {
					switch (posH) {
					case 1:
						page = PAGE_SEARCH;
						mainOperate = 5;
						break;
					case 2:
						page = PAGE_SET;
						break;
					case 3:
						page = PAGE_HELP;
						break;
					case 4:
						page = PAGE_ABOUT;
						break;
					}
				}
				break;
			case PAGE_LIST:
				resPos = 0;
				resPosV = 1;
				lastPage = page;
				page = PAGE_LINK;
				bean = (ResultBean) listVector
						.elementAt(listPosV + listPos - 1);
				resTitle = bean.getName();
				httpUrl = new StringBuffer();
				httpUrl.append(httpServer);
				httpUrl.append(bean.getUrl());
				link = new LinkThread(httpUrl.toString(), PAGE_RES, 2);
				link.start();
				this.showTimes = 0;
				this.titleTimes = 0;
				break;
			case PAGE_RES:
				bean = (ResultBean) resVector.elementAt(resPosV + resPos - 1);
				lastPage = page;
				page = PAGE_LINK;
				if (bean.getType() != 4 && bean.getType() != 5) {
					if (bean.getType() != 3) {
						preSizeH = 3;
						prePosH = 3;
					} else {
						preSizeH = 3;
						prePosH = 3;
					}
					pageState = 1;
					httpUrl = new StringBuffer();
					httpUrl.append(httpServer);
					httpUrl.append(bean.getUrl());
					link = new LinkThread(httpUrl.toString(), PAGE_PREVIEW, 3);
					link.start();
				} else {
					if (bean.getType() == 4) {
						httpUrl = new StringBuffer();
						httpUrl.append(httpServer);
						httpUrl.append(bean.getUrl());
						resPos = 0;
						resPosV = 1;
						link = new LinkThread(httpUrl.toString(), PAGE_RES, 2);
						link.start();
					}
				}
				this.showTimes = 0;
				this.titleTimes = 0;
				break;
			case PAGE_PREVIEW:
				if (resultBean.getType() != 3) {

					if (prePosH == 3) {
						//lastPage = page;
						page = PAGE_LINK;
						if (sound != null) {
							sound.close();
						}
						httpUrl = new StringBuffer();
						httpUrl.append(httpServer);
						httpUrl.append(resultBean.getNextUrl());
						prePosH = 3;
						//pageState = 1;
						link = new LinkThread(httpUrl.toString(), PAGE_PREVIEW,
								3);
						link.start();
					}
					if (prePosH == 1) {
						//lastPage = page;
						page = PAGE_LINK;
						if (sound != null) {
							sound.close();
						}
						httpUrl = new StringBuffer();
						httpUrl.append(httpServer);
						httpUrl.append(resultBean.getLastUrl());
						prePosH = 1;
						//pageState = 1;
						link = new LinkThread(httpUrl.toString(), PAGE_PREVIEW,
								3);
						link.start();
					}
					if (prePosH == 2) {
						lastPage = page;
						if (sound != null) {
							sound.stop();
						}
						page = PAGE_SEND;
						System.gc();
					}
					preSizeH = 3;
				} /*
				   * else { preSizeH = 2; prePosH = 2; }
				   */
				pageState = 1;
				this.titleTimes = 0;
				break;
			case PAGE_SEARCH:
				lastPage = page;
				page = PAGE_LINK;
				//mainOperate = 5;
				resPos = 0;
				resPosV = 1;
				addCommand(2);
				resTitle = "搜索结果";
				httpUrl = new StringBuffer();
				httpUrl.append(httpServer);
				httpUrl.append("resServlet?mobileCode=");
				httpUrl.append(mobileCode);
				httpUrl.append("&curPage=1&pageSize=");
				httpUrl.append(pageSize);
				//httpUrl.append("&resName=");
				//System.out.println("====searchText.getString()==1=="+searchText.getString());
				//httpUrl.append(encoding(searchText.getString()));
				//System.out.println("====searchText.getString()==2=="+encoding(searchText.getString()));
				//httpUrl.append(searchText.getString());
				lastResPage = httpUrl.toString();

				myDisplay.setCurrent(this);
				link = new LinkThread(httpUrl.toString(), PAGE_RES, 2);
				link.start();
				break;
			/*
			 * case PAGE_SET:
			 * //System.out.println("====setList.getSelectedIndex()===="+setList.getSelectedIndex());
			 * if (setList.getSelectedIndex() == 0) {
			 * //setList.setSelectedIndex(0,true); setIsOpen(true); } else {
			 * //setList.setSelectedIndex(1,true); setIsOpen(false); } page =
			 * PAGE_MAIN;
			 * 
			 * sizeV = 4; sizeH = 4; posV = 1; posH = 0;
			 * 
			 * myDisplay.setCurrent(this); break;
			 */
			case PAGE_SEND:
				//lastPage = page;
				if (sendText.getString().length() != 11
						|| !sendText.getString().substring(0, 2).equals("13")
						|| Integer.parseInt(sendText.getString()
								.substring(2, 3)) < 4) {
					lastPage = page;
					alertStr = "请检查你的手机号";
					addCommand(3);
					myDisplay.setCurrent(this);
					page = PAGE_ALERT;
				} else {
					page = PAGE_LINK;
					httpUrl = new StringBuffer();
					httpUrl.append(httpServer);
					httpUrl.append("sendServlet?mobileID=");
					httpUrl.append(sendText.getString());
					httpUrl.append("&itemUrl=");
					httpUrl.append(resultBean.getFileName());
					httpUrl.append("&resID=");
					httpUrl.append(resultBean.getResID());
					httpUrl.append("&mobileCode="+mobileCode);
					//httpUrl.append(resultBean.g)
					myDisplay.setCurrent(this);
					link = new LinkThread(httpUrl.toString(), PAGE_PREVIEW, 4);
					link.start();
				}
				break;
			case PAGE_PAUSE:
				page = PAGE_PREVIEW;
				break;
			}
		} else if (cmd == cmdBack) {
			//System.out.println("=======cmdBack=====");
			switch (page) {
			case PAGE_LIST:
				page = PAGE_MAIN;
				addCommand(1);
				this.showTimes = 0;
				this.titleTimes = 0;
				/*
				 * sizeV = 4; sizeH = 4; posV = 1; posH = 0;
				 */
				break;
			case PAGE_RES:
				//System.out.println("=======mainOperate======"+mainOperate);
				if (mainOperate == 4) {
					page = PAGE_MAIN;
					addCommand(1);
					/*
					 * sizeV = 4; sizeH = 4; posV = 1; posH = 0;
					 */
				} else if (mainOperate == 5) {
					page = PAGE_SEARCH;
				} else {
					page = PAGE_LIST;
					//					sizeV = 7;
					//posV = 1;
					//link = new LinkThread(lastListPage, PAGE_LIST, 1);
				}
				this.showTimes = 0;
				this.titleTimes = 0;
				break;
			case PAGE_PREVIEW:
			case PAGE_PAUSE:
				page = PAGE_RES;
				//sizeV = 7;
				//posV = 1;
				if (resultBean.getType() == 3) {
					myDisplay.setCurrent(this);
					addCommand(2);
					glsForm = null;
				}
				this.titleTimes = 0;
				if (sound != null) {
					sound.close();
				}
				
				//System.gc();
				//link = new LinkThread("", PAGE_RES, 2);
				break;
			case PAGE_SEARCH:
				page = PAGE_MAIN;
				/*
				 * sizeV = 4; sizeH = 4; posV = 1; posH = 0;
				 */
				addCommand(1);
				myDisplay.setCurrent(this);
				break;
			case PAGE_SEND:
				page = PAGE_PREVIEW;
				myDisplay.setCurrent(this);
				break;
			case PAGE_HELP:
				page = PAGE_MAIN;
				/*
				 * sizeV = 4; sizeH = 4; posV = 1; posH = 0;
				 */
				myDisplay.setCurrent(this);
				break;
			case PAGE_ABOUT:
				page = PAGE_MAIN;
				/*
				 * sizeV = 4; sizeH = 4; posV = 1; posH = 0;
				 */
				myDisplay.setCurrent(this);
				break;
			case PAGE_ALERT:
				page = lastPage;
				/*

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -