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

📄 splashcanvas.java.svn-base

📁 类似QQ的功能
💻 SVN-BASE
📖 第 1 页 / 共 2 页
字号:
/******************************************************************************* Jimm - Mobile Messaging - J2ME ICQ clone Copyright (C) 2003-08  Jimm Project This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA. ******************************************************************************** File: src/jimm/SplashCanvas.java Version: ###VERSION###  Date: ###DATE### Author(s): Manuel Linsmayer, Andreas Rossbacher *******************************************************************************/package jimm;//#sijapp cond.if target is "SIEMENS2"#//# import java.io.IOException;//#sijapp cond.end#import jimm.comm.Util;import jimm.comm.Icq;import jimm.comm.Action;import jimm.util.ResourceBundle;import javax.microedition.lcdui.*;import java.util.Timer;import DrawControls.TextList;import DrawControls.VirtualList;//#sijapp cond.if target is "RIM"#//# import net.rim.device.api.system.LED;//#sijapp cond.end#public class SplashCanvas extends Canvas implements CommandListener{	static private SplashCanvas _this;	public final static Command 		cancelCommand = new Command(ResourceBundle.getString("cancel"), Jimm.cmdBack, 1);	//Timer for repaint	static private Timer t1, t2;	// Image object, holds the splash image	private static Image imgSplash;		private static Image imgClientIcon;	//#sijapp cond.if target is "SIEMENS2"#	//#	private static final String BATT_IMG = "/batt.png";	//#	private static Image battImg = null;	//#		//#	private static Image getBattImg() 	//#	{	//#		if( battImg == null )	//#		{	//#			try	//#			{	//#				battImg = Image.createImage(SplashCanvas.BATT_IMG);	//#			}	//#			catch(IOException e){}	//#		}	//#		return battImg;	//#	}	//#sijapp cond.end#	// Font used to display the logo (if image is not available)	private static Font logoFont = Font.getFont(Font.FACE_SYSTEM,			Font.STYLE_BOLD, Font.SIZE_LARGE);	// Font (and font height in pixels) used to display informational messages	private static Font font = Font.getFont(Font.FACE_SYSTEM, Font.STYLE_PLAIN,			Font.SIZE_SMALL);	private static int fontHeight = font.getHeight();	// Initializer block	static	{		try { imgClientIcon = Image.createImage("/icon.png"); }   catch (Exception e) {}	}		static private Image getSplashImage()	{		if (imgSplash == null)			try { imgSplash = Image.createImage("/logo.png"); }   catch (Exception e) {}		return imgSplash;	}	/*****************************************************************************/	// Message to display beneath the splash image	static private String message;	// Last error code message	static private String lastErrCode;	// Progress in percent	static private int progress; // = 0	// True if keylock has been enabled	static private boolean isLocked;	// isError occured while connection	static private boolean errFlag;	// Number of available messages	static private int availableMessages;	// Time since last key # pressed 	static private long poundPressTime;	// Should the keylock message be drawn to the screen?	static protected boolean showKeylock;	static private Image statusImage = null;	// Constructor	public SplashCanvas(String message)	{		_this = this;//#sijapp cond.if target is "MIDP2"#		setFullScreenMode(Jimm.getPhoneVendor() != Jimm.PHONE_SONYERICSSON);//#sijapp cond.elseif target is "MOTOROLA" | target is "SIEMENS2"#		setFullScreenMode(true);//#sijapp cond.end#		setMessage(message);		showKeylock = false;	}	// Constructor, blank message	public SplashCanvas()	{		this(null);	}	// Returns the informational message	static public synchronized String getMessage()	{		return (message);	}	// Sets the informational message	static public synchronized void setLastErrCode(String errcode)	{		SplashCanvas.lastErrCode = (errcode != null) ? new String(errcode) : null;		_this.repaint();	}	// Sets the error flag	static public synchronized void setErrFlag(boolean errF)	{		SplashCanvas.errFlag = errF;		SplashCanvas._this.repaint();	}	// Sets the informational message	static public synchronized void setMessage(String message)	{		SplashCanvas.message = new String(message);		SplashCanvas._this.repaint();	}	public static synchronized void setStatusToDraw(Image statusImage)	{		if (statusImage == null)		{			StatusInfo statInfo = JimmUI.findStatus(StatusInfo.TYPE_STATUS, Icq.getCurrentStatus());			if (statInfo != null) statusImage = statInfo.getImage(); 		}		SplashCanvas.statusImage = statusImage;	}	// Returns the current progress in percent	static public synchronized int getProgress()	{		return (progress);	}	static public void show()	{		if (t2 != null)		{			t2.cancel();			t2 = null;		}		Jimm.display.setCurrent(_this);				Jimm.aaUserActivity();	}	static public void addCmd(Command cmd)	{		_this.addCommand(cmd);	}	static public void removeCmd(Command cmd)	{		_this.removeCommand(cmd);	}	static public void setCmdListener(CommandListener l)	{		_this.setCommandListener(l);	}	static public void Repaint()	{		_this.repaint();	}	// Sets the current progress in percent (and request screen refresh)	static public synchronized void setProgress(int progress)	{		if (SplashCanvas.progress == progress) return;		VirtualList.setMpbPercent(progress);		SplashCanvas.progress = progress;		_this.repaint();		_this.serviceRepaints();	}	// Enable keylock	static public synchronized void lock()	{		SplashCanvas._this.removeCommand(SplashCanvas.cancelCommand);		if (isLocked) return;		isLocked = true;		Jimm.setBkltOn(false);		setProgress(0);		setMessage(ResourceBundle.getString("keylock_enabled"));		setStatusToDraw(null);				Jimm.display.setCurrent(_this);		Jimm.setBkltOff();		if (Options.getBoolean(Options.OPTION_DISPLAY_DATE))		{			(t2 = new Timer()).schedule(new TimerTasks(					TimerTasks.SC_AUTO_REPAINT), 20000, 20000);		}		//#sijapp cond.if target="MOTOROLA"#		Jimm.display.flashBacklight(1000*Options.getInt(Options.OPTION_LIGHT_TIMEOUT));//#sijapp cond.end #					}	// Disable keylock	static public synchronized void unlock(boolean showContactList)	{		if (!isLocked)			return;		isLocked = false;		availableMessages = 0;		//#sijapp cond.if target is "RIM"#		//#        LED.setState(LED.STATE_OFF);		//  #sijapp cond.end#		//  #sijapp cond.if target is "MOTOROLA"#		//#		if (Options.getBoolean(Options.OPTION_LIGHT_MANUAL)) Jimm.setBkltOn(true);		//  #sijapp cond.end#		if (Options.getBoolean(Options.OPTION_DISPLAY_DATE) && (t2 != null))			t2.cancel();		if (_this.isShown()) JimmUI.backToLastScreen();	}	// Is the screen locked?	static public boolean locked()	{		return (isLocked);	}	protected void hideNotify()	{		imgSplash = null;//		resetLastTask();	}	// Called when message has been received	static public synchronized void messageAvailable()	{		if (isLocked)		{			++availableMessages;			//#sijapp cond.if target is "RIM"#			//#	        LED.setConfiguration(500, 250, LED.BRIGHTNESS_50);			//#	        LED.setState(LED.STATE_BLINKING);			//#sijapp cond.end#			_this.repaint();		}	}	// Called when a key is pressed

⌨️ 快捷键说明

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