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

preferences API (stub implementation)

This commit is contained in:
Nikolay Pultsin 2011-06-23 18:26:01 +01:00
parent eb46450995
commit 47fc0d3be1
4 changed files with 168 additions and 34 deletions

View file

@ -133,14 +133,42 @@ public class ApiClientImplementation implements ServiceConnection, Api, ApiMetho
private static final ApiObject[] EMPTY_PARAMETERS = new ApiObject[0];
private static ApiObject[] envelope(String value) {
return new ApiObject[] { ApiObject.envelope(value) };
}
private static ApiObject[] envelope(int value) {
return new ApiObject[] { ApiObject.envelope(value) };
}
// information about fbreader
public String getFBReaderVersion() throws ApiException {
return requestString(GET_FBREADER_VERSION, EMPTY_PARAMETERS);
}
// preferences information
public List<String> getOptionGroups() throws ApiException {
return requestStringList(GET_OPTION_GROUPS, EMPTY_PARAMETERS);
}
public List<String> getOptionNames(String group) throws ApiException {
return requestStringList(GET_OPTION_NAMES, envelope(group));
}
public String getOptionValue(String group, String name) throws ApiException {
return requestString(
GET_OPTION_VALUE,
new ApiObject[] { ApiObject.envelope(group), ApiObject.envelope(name) }
);
}
public void setOptionValue(String group, String name, String value) throws ApiException {
request(
SET_OPTION_VALUE,
new ApiObject[] { ApiObject.envelope(group), ApiObject.envelope(name), ApiObject.envelope(value) }
);
}
public String getBookLanguage() throws ApiException {
return requestString(GET_BOOK_LANGUAGE, EMPTY_PARAMETERS);
}
@ -154,7 +182,7 @@ public class ApiClientImplementation implements ServiceConnection, Api, ApiMetho
}
public String getBookFileName() throws ApiException {
return requestString(GET_BOOK_FILENAME, EMPTY_PARAMETERS);
return requestString(GET_BOOK_FILE_NAME, EMPTY_PARAMETERS);
}
public TextPosition getPageStart() throws ApiException {