Support changing and remembering theme

Make forge-m-base a Maven project
This commit is contained in:
drdev
2014-03-06 05:23:17 +00:00
parent 6219d036cc
commit 3a4cb788c7
11 changed files with 103 additions and 488 deletions

1
.gitattributes vendored
View File

@@ -16000,6 +16000,7 @@ forge-m-android/src/com/forge/Main.java -text
forge-m-base/.classpath -text
forge-m-base/.project -text
forge-m-base/.settings/org.eclipse.jdt.core.prefs -text
forge-m-base/.settings/org.eclipse.m2e.core.prefs -text
forge-m-base/libs/gdx-freetype.jar -text
forge-m-base/libs/gdx-sources.jar -text
forge-m-base/libs/gdx.jar -text

View File

@@ -1,12 +1,26 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="src"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7"/>
<classpathentry kind="src" output="target/classes" path="src">
<attributes>
<attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry exported="true" kind="lib" path="libs/gdx.jar" sourcepath="libs/gdx-sources.jar"/>
<classpathentry kind="lib" path="libs/gdx-freetype.jar"/>
<classpathentry combineaccessrules="false" kind="src" path="/forge-ai"/>
<classpathentry combineaccessrules="false" kind="src" path="/forge-core"/>
<classpathentry combineaccessrules="false" kind="src" path="/forge-game"/>
<classpathentry combineaccessrules="false" kind="src" path="/forge-net"/>
<classpathentry kind="output" path="bin"/>
<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="output" path="target/classes"/>
</classpath>

View File

@@ -10,8 +10,14 @@
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.m2e.core.maven2Builder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.m2e.core.maven2Nature</nature>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
</projectDescription>

View File

@@ -8,4 +8,5 @@ org.eclipse.jdt.core.compiler.debug.localVariable=generate
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
org.eclipse.jdt.core.compiler.source=1.7

View File

@@ -0,0 +1,4 @@
activeProfiles=
eclipse.preferences.version=1
resolveWorkspaceProjects=true
version=1

View File

@@ -1,476 +1,32 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<artifactId>forge</artifactId>
<groupId>forge</groupId>
<version>1.5.14-SNAPSHOT</version>
</parent>
<artifactId>forge-m-base</artifactId>
<packaging>jar</packaging>
<name>Forge</name>
<build>
<plugins>
<plugin>
<groupId>com.google.code.maven-svn-revision-number-plugin</groupId>
<artifactId>svn-revision-number-maven-plugin</artifactId>
<executions>
<execution>
<goals>
<goal>revision</goal>
</goals>
</execution>
</executions>
<configuration>
<failOnError>false</failOnError>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
<dependencies>
<dependency>
<groupId>org.apache.ant</groupId>
<artifactId>ant-nodeps</artifactId>
<version>1.8.1</version>
</dependency>
<dependency>
<groupId>com.oracle.appbundler</groupId>
<artifactId>appbundler</artifactId>
<version>1.0</version>
<classifier>ea</classifier>
</dependency>
</dependencies>
<executions>
<execution>
<id>build-version-string</id>
<phase>process-resources</phase>
<goals>
<goal>run</goal>
</goals>
<configuration>
<exportAntProperties>true</exportAntProperties>
<target>
<condition property="fullversionstring" value="${project.version}-r${forge.revision}${forge.specialStatus}" else="${project.version}-r${forge.revision}${forge.specialStatus} (mixed revisions detected; please update from the root directory)">
<contains string="${forge.mixedRevisions}" substring="false" />
</condition>
</target>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>2.4</version>
<configuration>
<archive>
<manifest>
<addDefaultImplementationEntries>true</addDefaultImplementationEntries>
<addDefaultSpecificationEntries>true</addDefaultSpecificationEntries>
</manifest>
<manifestEntries>
<Implementation-Version>${fullversionstring}</Implementation-Version>
</manifestEntries>
</archive>
</configuration>
</plugin>
<plugin>
<groupId>com.google.code.maven-replacer-plugin</groupId>
<artifactId>replacer</artifactId>
<version>1.5.2</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>replace</goal>
</goals>
</execution>
</executions>
<configuration>
<basedir>${basedir}/${configSourceDirectory}</basedir>
<filesToInclude>forge.sh, forge.command</filesToInclude>
<outputBasedir>${project.build.directory}</outputBasedir>
<outputDir>.</outputDir>
<regex>false</regex>
<replacements>
<replacement>
<token>$project.build.finalName$</token>
<value>${project.build.finalName}-jar-with-dependencies.jar</value>
</replacement>
</replacements>
</configuration>
</plugin>
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<configuration>
<attach>false</attach>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
<archive>
<manifest>
<mainClass>forge.view.Main</mainClass>
<addDefaultImplementationEntries>true</addDefaultImplementationEntries>
</manifest>
<manifestEntries>
<Implementation-Version>${fullversionstring}</Implementation-Version>
</manifestEntries>
</archive>
</configuration>
<executions>
<execution>
<id>make-assembly</id>
<!-- this is used for inheritance merges -->
<phase>package</phase>
<!-- bind to the packaging phase -->
<goals>
<goal>single</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<version>1.8</version>
<executions>
<execution>
<id>released-version</id>
<phase>validate</phase>
<goals>
<goal>released-version</goal>
</goals>
</execution>
<execution>
<id>parse-version</id>
<goals>
<goal>parse-version</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>forge</groupId>
<artifactId>forge-core</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>forge</groupId>
<artifactId>forge-game</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>forge</groupId>
<artifactId>forge-ai</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>forge</groupId>
<artifactId>forge-net</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<version>15.0</version>
</dependency>
<!--dependency>
<groupId>com.oracle</groupId>
<artifactId>javafx</artifactId>
<version>2.2</version>
<systemPath>${java.home}/lib/jfxrt.jar</systemPath>
<scope>system</scope>
</dependency-->
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
<version>3.1</version>
</dependency>
</dependencies>
<profiles>
<profile>
<id>windows-linux</id>
<build>
<plugins>
<plugin>
<groupId>com.akathist.maven.plugins.launch4j</groupId>
<artifactId>launch4j-maven-plugin</artifactId>
<version>1.5.2</version>
<executions>
<execution>
<id>l4j-gui</id>
<phase>package</phase>
<goals>
<goal>launch4j</goal>
</goals>
<configuration>
<headerType>gui</headerType>
<outfile>${project.build.directory}/forge.exe</outfile>
<jar>${project.build.finalName}-jar-with-dependencies.jar</jar>
<dontWrapJar>true</dontWrapJar>
<errTitle>forge</errTitle>
<icon>src/main/config/forge.ico</icon>
<classPath>
<mainClass>forge.view.Main</mainClass>
<addDependencies>false</addDependencies>
<preCp>anything</preCp>
</classPath>
<jre>
<minVersion>1.7.0</minVersion>
<maxHeapSize>1024</maxHeapSize>
</jre>
<versionInfo>
<fileVersion>${parsedVersion.majorVersion}.${parsedVersion.minorVersion}.${parsedVersion.incrementalVersion}.0</fileVersion>
<txtFileVersion>${parsedVersion.majorVersion}.${parsedVersion.minorVersion}.${parsedVersion.incrementalVersion}.0</txtFileVersion>
<fileDescription>Forge</fileDescription>
<copyright>Forge</copyright>
<productVersion>${parsedVersion.majorVersion}.${parsedVersion.minorVersion}.${parsedVersion.incrementalVersion}.0</productVersion>
<txtProductVersion>${parsedVersion.majorVersion}.${parsedVersion.minorVersion}.${parsedVersion.incrementalVersion}.0</txtProductVersion>
<productName>Forge</productName>
<internalName>forge</internalName>
<originalFilename>forge.exe</originalFilename>
</versionInfo>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
<version>1.7</version>
<dependencies>
<dependency>
<groupId>org.apache.ant</groupId>
<artifactId>ant-nodeps</artifactId>
<version>1.8.1</version>
</dependency>
</dependencies>
<executions>
<execution>
<id>win-linux-app-bundle</id>
<phase>pre-integration-test</phase>
<configuration>
<target>
<!-- Windows/Linux archive -->
<mkdir dir="${project.build.directory}/${project.build.finalName}" />
<copy todir="${project.build.directory}/${project.build.finalName}">
<fileset dir="${project.build.directory}" includes="forge.sh" />
<fileset dir="${project.build.directory}" includes="forge.command" />
<fileset dir="${basedir}" includes="forge.profile.properties.example" />
<fileset dir="${basedir}" includes="LICENSE.txt" />
<fileset dir="${basedir}" includes="README.txt" />
<fileset dir="${basedir}" includes="CHANGES.txt" />
<fileset dir="${basedir}">
<include name="res/**" />
<exclude name="res/cardsfolder/**" />
</fileset>
<fileset dir="${project.build.directory}" includes="forge.exe" />
<fileset dir="${project.build.directory}" includes="${project.build.finalName}-jar-with-dependencies.jar" />
</copy>
<mkdir dir="${project.build.directory}/${project.build.finalName}/res/cardsfolder" />
<zip destfile="${project.build.directory}/${project.build.finalName}/res/cardsfolder/cardsfolder.zip" basedir="${basedir}/res/cardsfolder" level="1" />
<chmod file="${project.build.directory}/${project.build.finalName}/forge.sh" perm="a+rx" />
<chmod file="${project.build.directory}/${project.build.finalName}/forge.command" perm="a+rx" />
<chmod file="${project.build.directory}/${project.build.finalName}/forge.exe" perm="a+rx" />
<tar destfile="${project.build.directory}/${project.build.finalName}.tar.bz2" compression="bzip2">
<tarfileset filemode="755" dir="${project.build.directory}/${project.build.finalName}">
<include name="forge.sh" />
<include name="forge.command" />
<include name="forge.exe" />
</tarfileset>
<tarfileset dir="${project.build.directory}/${project.build.finalName}">
<include name="**" />
<exclude name="forge.sh" />
<exclude name="forge.command" />
<exclude name="forge.exe" />
</tarfileset>
</tar>
</target>
</configuration>
<goals>
<goal>run</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<version>1.8</version>
<executions>
<execution>
<id>released-version</id>
<phase>validate</phase>
<goals>
<goal>released-version</goal>
</goals>
</execution>
<execution>
<id>parse-version</id>
<goals>
<goal>parse-version</goal>
</goals>
</execution>
<execution>
<id>attach-distribution</id>
<phase>post-integration-test</phase>
<goals>
<goal>attach-artifact</goal>
</goals>
<configuration>
<artifacts>
<artifact>
<file>${project.build.directory}/${project.build.finalName}.tar.bz2</file>
<type>tar.bz2</type>
</artifact>
</artifacts>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
<profile>
<properties>
<license.file.name>"LICENSE.txt"</license.file.name>
<changes.file.name>"CHANGES.txt"</changes.file.name>
<readme.file.name>"README.txt"</readme.file.name>
<forge.file.name>"Forge"</forge.file.name>
<applications.file.name>"Applications"</applications.file.name>
</properties>
<id>osx</id>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
<version>1.7</version>
<dependencies>
<dependency>
<groupId>org.apache.ant</groupId>
<artifactId>ant-nodeps</artifactId>
<version>1.8.1</version>
</dependency>
<dependency>
<groupId>com.oracle.appbundler</groupId>
<artifactId>appbundler</artifactId>
<version>1.0</version>
<classifier>ea</classifier>
</dependency>
</dependencies>
<executions>
<execution>
<id>osx-appbundle</id>
<phase>pre-integration-test</phase>
<configuration>
<target>
<mkdir dir="${project.build.directory}/${project.build.finalName}-osx" />
<copy todir="${project.build.directory}/${project.build.finalName}-osx">
<fileset dir="${basedir}" includes="LICENSE.txt" />
<fileset dir="${basedir}" includes="README.txt" />
<fileset dir="${basedir}" includes="CHANGES.txt" />
</copy>
<mkdir dir="${project.build.directory}/res/cardsfolder" />
<zip destfile="${project.build.directory}/res/cardsfolder/cardsfolder.zip" basedir="${basedir}/res/cardsfolder" level="1" />
<taskdef name="bundleapp" classpathref="maven.runtime.classpath" classname="com.oracle.appbundler.AppBundlerTask" />
<bundleapp outputdirectory="${project.build.directory}/${project.build.finalName}-osx" name="${project.name}" displayname="${project.name}" shortversion="${project.version}" identifier="forge.view.Main" icon="${basedir}/${configSourceDirectory}/Forge.icns" applicationCategory="public.app-category.games" mainclassname="forge.view.Main">
<runtime dir="${env.JAVA_HOME}" />
<classpath file="${project.build.directory}/${project.build.finalName}-jar-with-dependencies.jar" />
<classpath file="${basedir}/res/cardsfolder" />
<classpath file="${project.build.directory}/res/cardsfolder/cardsfolder.zip" />
<classpath file="${basedir}/forge.profile.properties.example" />
<option value="-Dapple.laf.useScreenMenuBar=true" />
<option value="-Dcom.apple.macos.use-file-dialog-packages=true" />
<option value="-Dcom.apple.macos.useScreenMenuBar=true" />
<option value="-Dcom.apple.mrj.application.apple.menu.about.name=Forge" />
<option value="-Dcom.apple.smallTabs=true" />
<option value="-Xmx1024M" />
<option value="-Dapp.dir=$APP_ROOT/Contents/Resources/" />
</bundleapp>
<symlink link="${project.build.directory}/${project.build.finalName}-osx/Applications" resource="/Applications" />
<exec executable="${basedir}/${configSourceDirectory}/create-dmg" failonerror="false">
<arg line="--volname ${project.name}-${project.version} --background ${basedir}/${configSourceDirectory}/backgroundImage.jpg --window-size 700 419 --icon-size 64 --icon ${forge.file.name} 141 283 --icon ${applications.file.name} 452 283 --icon ${changes.file.name} 645 80 --icon ${license.file.name} 645 200 --icon ${readme.file.name} 645 320 ${project.build.directory}/${project.build.finalName}.dmg ${project.build.directory}/${project.build.finalName}-osx" />
</exec>
<tar basedir="${project.build.directory}" includes="${project.build.finalName}.dmg" destfile="${project.build.directory}/${project.build.finalName}-osx.tar.bz2" compression="bzip2" />
<!--<symlink link="${project.build.directory}/${project.build.finalName}-osx/Applications" action="delete" /> -->
<exec executable="rm" failonerror="false">
<arg line="-f ${project.build.directory}/${project.build.finalName}-osx/Applications" />
</exec>
</target>
</configuration>
<goals>
<goal>run</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<version>1.8</version>
<executions>
<execution>
<id>released-version</id>
<phase>validate</phase>
<goals>
<goal>released-version</goal>
</goals>
</execution>
<execution>
<id>parse-version</id>
<goals>
<goal>parse-version</goal>
</goals>
</execution>
<execution>
<id>attach-distribution-osx</id>
<phase>post-integration-test</phase>
<goals>
<goal>attach-artifact</goal>
</goals>
<configuration>
<artifacts>
<artifact>
<file>${project.build.directory}/${project.build.finalName}-osx.tar.bz2
</file>
<type>tar.bz2</type>
<classifier>osx</classifier>
</artifact>
</artifacts>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
<profile>
<id>test-deploy</id>
<distributionManagement>
<repository>
<id>cardforge-repo-local</id>
<url>ftp://localhost/Users/dhudson/releases</url>
</repository>
<snapshotRepository>
<id>cardforge-snapshot-repo-local</id>
<url>ftp://localhost/Users/dhudson/snapshots</url>
</snapshotRepository>
</distributionManagement>
</profile>
</profiles>
</project>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>forge-mobile</groupId>
<artifactId>forge-mobile</artifactId>
<version>1.5.14-SNAPSHOT</version>
<build>
<sourceDirectory>src</sourceDirectory>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version>
<configuration>
<source>1.7</source>
<target>1.7</target>
</configuration>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<version>15.0</version>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
<version>3.1</version>
</dependency>
</dependencies>
</project>

View File

@@ -54,7 +54,6 @@ public class Forge implements ApplicationListener {
shapeRenderer = new ShapeRenderer();
splashScreen = new SplashScreen();
FSkin.loadLight("journeyman", splashScreen);
//load model on background thread (using progress bar to report progress)
new Thread(new Runnable() {

View File

@@ -5,6 +5,8 @@ import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
import org.apache.commons.lang3.text.WordUtils;
import com.badlogic.gdx.Application.ApplicationType;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.files.FileHandle;
@@ -14,8 +16,11 @@ import com.badlogic.gdx.graphics.Texture;
import com.badlogic.gdx.graphics.g2d.TextureRegion;
import forge.assets.FSkinImage.SourceFile;
import forge.model.FModel;
import forge.screens.SplashScreen;
import forge.toolbox.FProgressBar;
import forge.utils.ForgePreferences;
import forge.utils.ForgePreferences.FPref;
public class FSkin {
private static final String
@@ -31,12 +36,12 @@ public class FSkin {
private static boolean loaded = false;
public static void changeSkin(final String skinName) {
/*final ForgePreferences prefs = Singletons.getModel().getPreferences();
final ForgePreferences prefs = FModel.getPreferences();
if (skinName.equals(prefs.getPref(FPref.UI_SKIN))) { return; }
//save skin preference
prefs.setPref(FPref.UI_SKIN, skinName);
prefs.save();*/
prefs.save();
//load skin
loaded = false; //reset this temporarily until end of loadFull()
@@ -58,7 +63,7 @@ public class FSkin {
allSkins = new ArrayList<String>();
ArrayList<String> skinDirectoryNames = getSkinDirectoryNames();
for (int i = 0; i < skinDirectoryNames.size(); i++) {
allSkins.add(skinDirectoryNames.get(i).replace('_', ' '));
allSkins.add(WordUtils.capitalize(skinDirectoryNames.get(i).replace('_', ' ')));
}
Collections.sort(allSkins);
}

View File

@@ -4,9 +4,12 @@ import com.badlogic.gdx.graphics.g2d.TextureRegion;
import com.badlogic.gdx.graphics.g2d.BitmapFont.HAlignment;
import forge.Forge.Graphics;
import forge.assets.FSkin;
import forge.assets.FSkinFont;
import forge.toolbox.FContainer;
import forge.toolbox.FProgressBar;
import forge.utils.ForgePreferences;
import forge.utils.ForgePreferences.FPref;
public class SplashScreen extends FContainer {
private TextureRegion background;
@@ -16,6 +19,9 @@ public class SplashScreen extends FContainer {
public SplashScreen() {
progressBar = new FProgressBar();
progressBar.setDescription("Welcome to Forge");
final ForgePreferences prefs = new ForgePreferences();
FSkin.loadLight(prefs.getPref(FPref.UI_SKIN), this);
}
public FProgressBar getProgressBar() {

View File

@@ -38,7 +38,12 @@ public class SettingsScreen extends FScreen {
lstSettings.addItem(new CustomSelectSetting(FPref.UI_SKIN, "Theme",
"Sets the theme that determines how display components are skinned.",
FSkin.getAllSkins()), 0);
FSkin.getAllSkins()) {
@Override
public void valueChanged(String newValue) {
FSkin.changeSkin(newValue);
}
}, 0);
lstSettings.addItem(new BooleanSetting(FPref.DEV_MODE_ENABLED, "Developer Mode",
"Enables menu with functions for testing during development."), 3);
}
@@ -109,6 +114,11 @@ public class SettingsScreen extends FScreen {
}
}
public void valueChanged(String newValue) {
FModel.getPreferences().setPref(pref, newValue);
FModel.getPreferences().save();
}
@Override
public void select() {
Forge.openScreen(new CustomSelectScreen());
@@ -120,6 +130,19 @@ public class SettingsScreen extends FScreen {
private CustomSelectScreen() {
super(true, "Select " + label.substring(0, label.length() - 1), false);
lstOptions = add(new FList<String>(options));
lstOptions.setListItemRenderer(new FList.DefaultListItemRenderer<String>() {
@Override
public boolean tap(String value, float x, float y, int count) {
valueChanged(value);
Forge.back();
return true;
}
@Override
public void drawValue(Graphics g, String value, FSkinFont font, FSkinColor foreColor, float width, float height) {
super.drawValue(g, value, font, foreColor, width, height);
}
});
}
@Override

View File

@@ -40,7 +40,7 @@ public class FList<E> extends FScrollPane {
private void initialize() {
font = FSkinFont.get(14);
renderer = new DefaultListItemRenderer();
renderer = new DefaultListItemRenderer<E>();
}
public void addGroup(String groupName) {
@@ -196,19 +196,19 @@ public class FList<E> extends FScrollPane {
public abstract void drawValue(Graphics g, V value, FSkinFont font, FSkinColor foreColor, float width, float height);
}
public class DefaultListItemRenderer extends ListItemRenderer<E> {
public static class DefaultListItemRenderer<V> extends ListItemRenderer<V> {
@Override
public float getItemHeight() {
return Utils.AVG_FINGER_HEIGHT;
}
@Override
public boolean tap(E value, float x, float y, int count) {
public boolean tap(V value, float x, float y, int count) {
return false;
}
@Override
public void drawValue(Graphics g, E value, FSkinFont font, FSkinColor color, float width, float height) {
public void drawValue(Graphics g, V value, FSkinFont font, FSkinColor color, float width, float height) {
float x = width * INSETS_FACTOR;
g.drawText(value.toString(), font, color, x, 0, width - 2 * x, height, false, HAlignment.LEFT, true);
}