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

📄 handset.java

📁 最强手机阅读器Anyview3.0版的界面代码
💻 JAVA
字号:
package com.ismyway.fairyui;

import javax.microedition.lcdui.AlertType;
import javax.microedition.lcdui.Display;
import javax.microedition.midlet.MIDlet;

/**
 * This class provides access to the MIDlet's environment.
 * @author Glen Cordrey
 */
public class Handset {
	private static MIDlet MY_MIDLET;
	private static Display DISPLAY;
	private static byte backlight = 0;
	public static byte SONYERICSSON = 1;
	public static byte NOKIA = 2;
	public static byte MOTO = 2;
	public static byte OTHERS = 10;

	public static byte PLATFORM = 0;
	private static boolean suppertDeviceControl = false;

	private Handset() {

	}

	public static void setMIDlet(MIDlet midlet) {
		MY_MIDLET = midlet;
		DISPLAY = Display.getDisplay(midlet);

		try {
			Class.forName("com.nokia.mid.ui.DeviceControl");
			suppertDeviceControl = true;
		} catch (ClassNotFoundException _ex) {
			suppertDeviceControl = false;
		}

		try {
			if (System.getProperty("microedition.platform").toLowerCase().indexOf("sony") > -1) {
				backlight = 5;
				PLATFORM = SONYERICSSON;
				return;
			}
		} catch (Exception e) {

		}

		try {
			Class.forName("com.motorola.funlight.FunLight");
			PLATFORM = MOTO;
			backlight = 1;
			return;
		} catch (ClassNotFoundException _ex) {
		}
		try {
			Class.forName("com.nokia.mid.ui.DeviceControl");
			PLATFORM = NOKIA;
			backlight = 2;
			return;
		} catch (ClassNotFoundException _ex) {
			PLATFORM = OTHERS;
			backlight = 5;
		}
	}

	public static MIDlet getMIDlet() {
		return MY_MIDLET;
	}

	public static Display getDisplay() {
		return DISPLAY;
	}

	public static void beep() {
		if (DISPLAY != null) {
			AlertType.WARNING.playSound(DISPLAY);
		}
	}

	public static void platformRequest(String url) {
		if (null != MY_MIDLET) {
			try {
				MY_MIDLET.platformRequest(url);
			} catch (Exception e) {
				e.printStackTrace();
			}
		}
	}

	public static String getAppProperty(String key) {
		if (null != MY_MIDLET) {
			try {
				return MY_MIDLET.getAppProperty(key);
			} catch (Exception e) {
				e.printStackTrace();
			}
		}
		return "";
	}

	public static void flashBacklight(int duration) {
		switch (backlight) {
		case 1:
			break;
		case 2:
			break;
		case 3:
			break;
		case 4:
			break;
		case 5:
			Handset.getDisplay().flashBacklight(duration);
			break;
		}
	}

	public static void setLight(int value) {
	}

	public static boolean suppertDeviceControl() {
		return suppertDeviceControl;
	}
}

⌨️ 快捷键说明

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