Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

more API methods

  • Loading branch information...
commit ce1bd674ec6f6684f0bcb39934c73cea27f4be77 1 parent 6175f96
@geometer authored
View
1  TODO.1.5
@@ -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
5 src/org/geometerplus/android/fbreader/api/ApiServerImplementation.java
@@ -447,12 +447,11 @@ public void createZoneMap(String name, int width, int height) {
}
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
26 src/org/geometerplus/fbreader/fbreader/TapZoneMap.java
@@ -27,13 +27,15 @@
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 static TapZoneMap createZoneMap(String name, int width, int height) {
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 @@ private TapZoneMap(String name) {
new Reader().readQuietly(mapFile);
}
+ public boolean isCustom() {
+ return !ourPredefinedMaps.contains(Name);
+ }
+
public int getHeight() {
return myHeight.getValue();
}
Please sign in to comment.
Something went wrong with that request. Please try again.