listing13-11_fullscreenpreprocessor.java_complete

来自「着几乎所有智能机厂商都将有自己配套的App Store,甚至并非智能手机制造商的」· JAVA_COMPLETE 代码 · 共 42 行

JAVA_COMPLETE
42
字号
package com.apress.preprocess;

import de.enough.polish.Device;
import de.enough.polish.preprocess.CustomPreprocessor;
import de.enough.polish.util.StringList;

public class FullScreenPreprocessor extends CustomPreprocessor {
	private boolean doProcessClass;
	private String fullScreenClass;

	public FullScreenPreprocessor() {
		super();
	}

	public void notifyDevice( Device device, boolean usesPolishGui ) {
		super.notifyDevice( device, usesPolishGui );	
		this.fullScreenClass = device.getCapability( "polish.classes.fullscreen" );
		this.doProcessClass = ( this.fullScreenClass != null );
	}

	public void notifyPolishPackageStart() {
		super.notifyPolishPackageStart();
		this.doProcessClass = false;
	}

	public void processClass( StringList lines, String className ) {
		if ( !this.doProcessClass ) {
			return;
		}
		while ( lines.next() ) {
			String line = lines.getCurrent();
			int extendsIndex = line.indexOf( "extends Canvas" );
			if ( extendsIndex != -1 ) {
				line = line.substring( 0, extendsIndex )
					+ "extends " + this.fullScreenClass
					+ line.substring( extendsIndex + "extends Canvas".length() );
				lines.setCurrent( line );
			}
		}
	}
}

⌨️ 快捷键说明

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