1
0
Fork 0
mirror of https://github.com/geometer/FBReaderJ.git synced 2025-10-04 18:29:23 +02:00

more API methods

This commit is contained in:
Nikolay Pultsin 2012-05-23 06:12:42 +01:00
parent 6175f96a8f
commit ce1bd674ec
3 changed files with 24 additions and 8 deletions

View file

@ -5,7 +5,6 @@ litres: author photos
1.5.*:
* Advanced settings plugin does not run
* Autogeneration for ApiMethods & ApiImplementations
* Footnotes on the same page
* Chinese books (mail from Eric)

View file

@ -447,12 +447,11 @@ public class ApiServerImplementation extends ApiInterface.Stub implements Api, A
}
public boolean isZoneMapCustom(String name) throws ApiException {
// TODO: implement
return false;
return TapZoneMap.zoneMap(name).isCustom();
}
public void deleteZoneMap(String name) throws ApiException {
// TODO: implement
TapZoneMap.deleteZoneMap(name);
}
public String getTapZoneAction(String name, int h, int v, boolean singleTap) {

View file

@ -27,13 +27,15 @@ import org.geometerplus.zlibrary.core.filesystem.ZLFile;
import org.geometerplus.zlibrary.core.options.*;
public class TapZoneMap {
private static final List<String> ourPredefinedMaps = new LinkedList<String>();
private static final ZLStringListOption ourMapsOption;
static {
final List<String> lst = new LinkedList<String>();
// TODO: list files from default/tapzones
lst.add("left_to_right");
lst.add("up");
ourMapsOption = new ZLStringListOption("TapZones", "List", lst, "\000");
ourPredefinedMaps.add("right_to_left");
ourPredefinedMaps.add("left_to_right");
ourPredefinedMaps.add("down");
ourPredefinedMaps.add("up");
ourMapsOption = new ZLStringListOption("TapZones", "List", ourPredefinedMaps, "\000");
}
private static final Map<String,TapZoneMap> ourMaps = new HashMap<String,TapZoneMap>();
@ -64,6 +66,18 @@ public class TapZoneMap {
return map;
}
public static void deleteZoneMap(String name) {
if (ourPredefinedMaps.contains(name)) {
return;
}
ourMaps.remove(name);
final List<String> lst = new LinkedList<String>(ourMapsOption.getValue());
lst.remove(name);
ourMapsOption.setValue(lst);
}
public static enum Tap {
singleTap,
singleNotDoubleTap,
@ -88,6 +102,10 @@ public class TapZoneMap {
new Reader().readQuietly(mapFile);
}
public boolean isCustom() {
return !ourPredefinedMaps.contains(Name);
}
public int getHeight() {
return myHeight.getValue();
}