FolioReader-Android icon indicating copy to clipboard operation
FolioReader-Android copied to clipboard

how save the ReadLocator?

Open pppppbbbbb opened this issue 6 years ago • 15 comments

@Override public void saveReadLocator(ReadLocator readLocator) { Log.i(LOG_TAG, "-> saveReadLocator -> " + readLocator.toJson());

    /*ReadLocator has toJson() method which gives JSON in following format - 
    {
        bookId : string,
        href : string,
        created : integer,
        locations : {
            cfi : string
        }
    }
    You can save this last read position in your local or remote db*/
}

this fun don't run

pppppbbbbb avatar Sep 24 '19 08:09 pppppbbbbb

"Uncaught ReferenceError: DOMRect is not defined", source: file:///android_asset/js/Bridge.js (865)

pppppbbbbb avatar Sep 24 '19 09:09 pppppbbbbb

return new DOMRect(rectJson.x, rectJson.y, rectJson.width, rectJson.height);

pppppbbbbb avatar Sep 24 '19 09:09 pppppbbbbb

function constructDOMRect(rectJsonString) { var rectJson = JSON.parse(rectJsonString); var drect = {top:rectJson.y, right:rectJson.x+rectJson.width, bottom:rectJson.y+rectJson.height,left:rectJson.x}; return drect; }

I rewrite this fun can save ReadLocator;

pppppbbbbb avatar Sep 25 '19 01:09 pppppbbbbb

How were you able to fix it?

IngeniumNovum avatar Jan 20 '20 15:01 IngeniumNovum

How were you able to fix it?

rewrite JS function constructDOMRect(rectJsonString) {}

pppppbbbbb avatar Jan 20 '20 15:01 pppppbbbbb

do you have a sample code you can send me?

assets/Bridge.js --->rewrited

function constructDOMRect(rectJsonString) { var rectJson = JSON.parse(rectJsonString); var drect = {top:rectJson.y, right:rectJson.x+rectJson.width, bottom:rectJson.y+rectJson.height,left:rectJson.x}; return drect; }

pppppbbbbb avatar Jan 20 '20 15:01 pppppbbbbb

Thanks. Much appreciated.

IngeniumNovum avatar Jan 20 '20 16:01 IngeniumNovum

Thanks. Much appreciated.

you're welcome , Is the problem solved?

pppppbbbbb avatar Jan 20 '20 16:01 pppppbbbbb

noo, still not working

IngeniumNovum avatar Jan 20 '20 16:01 IngeniumNovum

Still not getting any output from: @Override public void saveReadLocator(ReadLocator readLocator) { Log.i(LOG_TAG, "-> saveReadLocator -> " + readLocator.toJson());

}

IngeniumNovum avatar Jan 20 '20 16:01 IngeniumNovum

What I have done so far:

  1. Created a file known as Bridge.js in the assets folder.(this is because I have included the Folio Reader Library in my gradle file)
  2. Copied the original Bridge.js from the FolioReader Library
  3. Made the change you had suggested.

Still getting zero output form the method: @override public void saveReadLocator(ReadLocator readLocator) { Log.i(LOG_TAG, "-> saveReadLocator -> " + readLocator.toJson());

}

IngeniumNovum avatar Jan 20 '20 16:01 IngeniumNovum

can you give me your email? I'll send you the FolioReader lib. but I change something. The lib is used locally. src/folioreaderlib

pppppbbbbb avatar Jan 20 '20 16:01 pppppbbbbb

can you give me your email? I'll send you the FolioReader lib. but I change something. The lib is used locally. src/folioreaderlib.

can you help me too, I'm stuck, cant get it to work :(

y-ziane avatar Jan 03 '21 02:01 y-ziane

can you give me your email? I'll send you the FolioReader lib. but I change something. The lib is used locally. src/folioreaderlib.

can you help me too, I'm stuck, cant get it to work :(

find the .js file rewirte this funtion

function constructDOMRect(rectJsonString) { var rectJson = JSON.parse(rectJsonString); var drect = {top:rectJson.y, right:rectJson.x+rectJson.width, bottom:rectJson.y+rectJson.height,left:rectJson.x}; return drect; }

pppppbbbbb avatar Jan 04 '21 03:01 pppppbbbbb

can you give me your email? I'll send you the FolioReader lib. but I change something. The lib is used locally. src/folioreaderlib.

can you help me too, I'm stuck, cant get it to work :(

source: file:///android_asset/js/Bridge.js (865)

pppppbbbbb avatar Jan 04 '21 03:01 pppppbbbbb