If you think the Android project slider listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
Java Source Code
package de.devisnik.android.sliding;
/*www.java2s.com*/import android.content.res.Resources;
publicclass SpeedFactory {
privatestaticclass Speed implements ISpeed {
privatefinalint itsScrambleDuration;
privatefinalint itsShiftDuration;
privatefinalint itsWaitAfterSolved;
Speed(int scrambleDuration, int shiftDuration, int waitAfterSolved) {
itsScrambleDuration = scrambleDuration;
itsShiftDuration = shiftDuration;
itsWaitAfterSolved = waitAfterSolved;
}
@Override
publicint getScrambleDuration() {
return itsScrambleDuration;
}
@Override
publicint getShiftDuration() {
return itsShiftDuration;
}
@Override
publicint getWaitAfterSolved() {
return itsWaitAfterSolved;
}
}
privatestaticfinal ISpeed SLOWEST = new Speed(1800, 900, 10000);
privatestaticfinal ISpeed SLOW = new Speed(1200, 600, 10000);
privatestaticfinal ISpeed NORMAL = new Speed(800, 400, 8000);
privatestaticfinal ISpeed FAST = new Speed(500, 250, 5000);
privatestaticfinal ISpeed FASTEST = new Speed(400, 200, 4000);
privatefinal Resources itsResources;
public SpeedFactory(Resources resources) {
itsResources = resources;
}
private String getString(int key) {
return itsResources.getString(key);
}
public ISpeed getSpeed(String value) {
if (getString(R.string.frame_speed_fastest_key).equals(value))
return FASTEST;
if (getString(R.string.frame_speed_fast_key).equals(value))
return FAST;
if (getString(R.string.frame_speed_normal_key).equals(value))
return NORMAL;
if (getString(R.string.frame_speed_slow_key).equals(value))
return SLOW;
if (getString(R.string.frame_speed_slowest_key).equals(value))
return SLOWEST;
return NORMAL;
}
}