mirror of
https://github.com/geometer/FBReaderJ.git
synced 2025-10-06 03:50:19 +02:00
code cleanup (fit coding standards + small fixes)
This commit is contained in:
parent
927037a3e8
commit
b0ef1d911e
5 changed files with 13 additions and 18 deletions
|
@ -22,7 +22,7 @@ public interface Api {
|
||||||
// book information for current book
|
// book information for current book
|
||||||
String getBookLanguage() throws ApiException;
|
String getBookLanguage() throws ApiException;
|
||||||
String getBookTitle() throws ApiException;
|
String getBookTitle() throws ApiException;
|
||||||
//List<String> getBookAuthors() throws ApiException;
|
List<String> getBookAuthors() throws ApiException;
|
||||||
List<String> getBookTags() throws ApiException;
|
List<String> getBookTags() throws ApiException;
|
||||||
String getBookFilePath() throws ApiException;
|
String getBookFilePath() throws ApiException;
|
||||||
String getBookHash() throws ApiException;
|
String getBookHash() throws ApiException;
|
||||||
|
@ -38,6 +38,7 @@ public interface Api {
|
||||||
String getBookHash(long id) throws ApiException;
|
String getBookHash(long id) throws ApiException;
|
||||||
String getBookUniqueId(long id) throws ApiException;
|
String getBookUniqueId(long id) throws ApiException;
|
||||||
Date getBookLastTurningTime(long id) throws ApiException;
|
Date getBookLastTurningTime(long id) throws ApiException;
|
||||||
|
float getBookProgress() throws ApiException;
|
||||||
|
|
||||||
//long findBookIdByUniqueId(String uniqueId) throws ApiException;
|
//long findBookIdByUniqueId(String uniqueId) throws ApiException;
|
||||||
//long findBookIdByFilePath(String uniqueId) throws ApiException;
|
//long findBookIdByFilePath(String uniqueId) throws ApiException;
|
||||||
|
|
|
@ -219,6 +219,7 @@ public abstract class ApiObject implements Parcelable {
|
||||||
static ApiObject envelope(float value) {
|
static ApiObject envelope(float value) {
|
||||||
return new Float(value);
|
return new Float(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
static ApiObject envelope(boolean value) {
|
static ApiObject envelope(boolean value) {
|
||||||
return new Boolean(value);
|
return new Boolean(value);
|
||||||
}
|
}
|
||||||
|
|
|
@ -352,24 +352,21 @@ public class ApiServerImplementation extends ApiInterface.Stub implements Api, A
|
||||||
if (book == null) {
|
if (book == null) {
|
||||||
return -1.0f;
|
return -1.0f;
|
||||||
}
|
}
|
||||||
RationalNumber progress=book.getProgress();
|
final RationalNumber progress = book.getProgress();
|
||||||
return progress.toFloat();
|
return progress != null ? progress.toFloat() : -1.0f;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<String> getBookAuthors() {
|
public List<String> getBookAuthors() {
|
||||||
final Book book=getReader().getCurrentBook();
|
final Book book = getReader().getCurrentBook();
|
||||||
if (book == null) {
|
if (book == null) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
List<Author> authors=book.getAuthors();
|
final List<Author> authors = book.authors();
|
||||||
if (authors == null) {
|
final List<String> authorNames = new ArrayList<String>(authors.size());
|
||||||
return Collections.emptyList();
|
for (Author a : authors) {
|
||||||
|
authorNames.add(a.DisplayName);
|
||||||
}
|
}
|
||||||
List<String> result=new LinkedList<String>();
|
return authorNames;
|
||||||
for (Author author:authors) {
|
|
||||||
result.add(author.DisplayName);
|
|
||||||
}
|
|
||||||
return result;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getBookFilePath() {
|
public String getBookFilePath() {
|
||||||
|
|
|
@ -60,10 +60,6 @@ public abstract class AbstractBook extends TitledEntity<AbstractBook> {
|
||||||
|
|
||||||
public abstract String getPath();
|
public abstract String getPath();
|
||||||
|
|
||||||
public List<Author> getAuthors() {
|
|
||||||
return myAuthors!=null ? myAuthors: null;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void updateFrom(AbstractBook book) {
|
public void updateFrom(AbstractBook book) {
|
||||||
if (book == null || myId != book.myId) {
|
if (book == null || myId != book.myId) {
|
||||||
return;
|
return;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue