2014년 12월 9일 화요일

Creating a book


I've been playing with various app creation tools, but I can't seem to find a decent and easy system for what I want to do. I have a word file that contains notes for a course that I teach. What I'd like to do is create some kind of textbook type app for my students. When I enter the text from the document as a label I then can't edit the paragraphs. Would this be better suited to a text box that isn't enabled? Would that also scroll down the page if there was too much information to be displayed at once?

--
It all depends upon who you want to edit the paragraphs.  You probably want to edit the paragraphs yourself, but not allow your students to edit them.

You have many choices, but the first two that come to mind is that you edit the document in word, and make any changes along the way that you want.  Then, whenever the app loads, it reads in the current iteration of the Word doc if it's newer, and then populate a TinyDB with the chapters.  When a student wants to look at, for example, Chapter 2, load it froomthe TinyDB and put it into the label.  If you want formatting, you can use a webviewer, and display the text as HTML, with formatting etc.

See this post by Steve: How to Create App Books by Appinventor?

--
A comprehensive tutorial has been written showing how to do this.   MIT has had it for three months.  The tutorial is called Treasure Island...an eReader.

Direct your question to Josh   jshe...@mit.edu  and he might be able to tell you when that tutorial will be available on MIT's pages.


In the meantime, you best solution is to create an html file of you 'book,'   load the html as a resource and then uses the example provide by Taifun about how to use a WebViewer  to   read the html.

--
Thank you for your reply!

I'll have a play and see what happens. At the very least I now have an idea of where to start. I think webviewer is a better plan than labels as there are tables and images to display as well as just text.

Thank you again for the help,

--
Pardon a dumb question -

How is making this an app any better than just distributing .doc or .pdf files
via your school's web server or thru Google Docs?

If the students have devices to run an app, they have devices
that can run a PDF reader or Google Docs to edit .doc files.

--
Good question! It's partially as a test run for other, more advanced, things. At the moment it comprises of notes for veterinary anaesthesia, but we are planning to add things like drug calculators, equipment check videos, and links to other resources in the future. We are also planning to release it for vets out in practice to use at some point as well, once we have tested it on the students first.

--
Thank Taifun! 

--
hey Rob, if you dont need images or anything special (just use plain text), you could try to use tinywebdb to create a web database where you can create the book. tinywebdb uses a tag and value system where the tag could be the chapter or heading name and the value is the content. if you want like a table of content, you can use a list viewer to show the tags. if you need the data to be persistent, you can combine the tinywebdb with a tinydb so if they are not online, they can still see the info.

basically, this method would allow you to add data to a tinywebdb server that you can edit anytime and would update the data in the app anytime the user goes on the internet.

--
Thank you all for your suggestions. I have created an ebook using this model (i.e individual html page for each chapter and list picker to navigate through chapters) and it works perfect.

But i need inputs on two questions:

i) is it possible to directly search within various chapters (i.e html pages) based on keyword 

ii) can the user add bookmark or save favourite chapters for reading again in the future.

--
A draft version of the Treasure Island eReader tutorial is  here: http://appinventorforfun.wordpress.com/  .    The 'finished' version has been with MIT for months...ask Josh for a copy  by emailing him at   jsheldon@mit.edu   and requesting the Treasure Island links.

------------------------------------------------------------------
@ Raviteja    Regarding 1:   perhaps.  You might be able to do this with the Activity.Starter as an html is viewed on AI2 essentially as a web page.  Try some things, let us know what works?

Regarding 2:   Add a feature to record the current chapter link in a list then save it persistently in a TinyDB.

Lists
Sajal' example: List Blocks On App Inventor

List of Lists


TinyDB
ABG's example Build Your Own DB - Part 1 demonstrates filtering


--
Thank you for your suggestions Steve.

--
A draft version of the Treasure Island eReader tutorial is  here: http://appinventorforfun.wordpress.com/.    
@SteveJG: who is the author of that tutorial?
There is some redundancy in the blocks, which could be simplified, e.g. the link to the html files or the listpicker.afterpicking event...

--
@Taifun     Josh at MIT probably knows.  Why not ask him?
Yes, I noticed in the tutorial there was some redundancy by design.   I bet this could be streamlined but it appeared the author wanted to give users options perhaps and keep the coding simple?

--
keeping the code simple means to avoid redundancy imho...

--
What suggestion you have given to Rob, I am exactly applying in my app. I would like to know how to " yoe u can combine the tinywebdb with a tinydb so if they are not online, they can still see the info.". 

Appreciate your immediate help.

--
Perhaps write the contents of the TinyWebDB to a csv file;  read the csv file with the File component on the Android and import that csv file into a TinyDB on the device.  Synchronization will be a problem (if you change the contents of the TinyDB, it will not appear in the TinyWebDB unless you write the code to do so.  If you want the TinyWebDB to be the 'master' database, every time you use the Android, you will probably want to update the TinyDB to the latest contents of the TinyWebDB.     There is no easy way to synchronize the two.

The next time, it would be better to post your question as a new post bipin.  This thread is primarily about 'creating a book'. not dealing with databases.

Hope this helps.

--
Thanks @Steve...

--
I'd studied the Treasure Island tutorial and currently creating a book app (with 30 over chapters). I'm using a Content html page to navigate between chapters and also include link to the Content html in individual html chapters.
I'm planning to add a feature that will automatically save the last chapter that's being read by a user and when it is launched the next time (in the case the book app was killed or the phone power off), it'll open the last read chapter.
Your suggestion No. 2 above seem to be able to fit my requirement. However, when I tapped on a link in my Content html, I wasn't able to get the new url from Webviewer. Would you be able to elaborate on how to record the current url in webviewer.
I attached here a copy of the draft version of my book app aia for your comment.


--
I am not sure exactly what you want to do.  You  might want to use the  WebViewerViewString    described by Taifun here http://puravidaapps.com/snippets.php#2webviewstring .
webviewstring.aia

How does the new property Webviewer.WebViewString work?

Since each chapter is an html file, when someone reads a chapter you will probably want to save the currenturl to a TinyDb as they switch between chapters (you would probably have to use a button outside of the WebViewer the user would have to activate or perhaps can do it with code using a Clock event),   then when you need the url of the last chapter, call the saved value with the WebViewer .
You  have to save the  WebViewer.CurrentUrl   ?    and use it as a pointer.   You do not really want to save a copy of the current url but if you did  actually save a copy, you would do it with the File control.

Returning to the last url (chapter) viewed should not be hard if you use a button or a clock event,  You asked " how to record the current url in webviewer."   To do that, I imagine you would probably need an html that you can modify with the File control .. AI does not have an object that allows you to automatically write an html  (you are currently just reading the ones you have in storage)  so you would have to have some text in which you can insert the current url.    You may have a problem ..files in assets cannot be modified, so if you have an additional url that keeps track of the chapter, the tracking url will have to be stored on the SD card (or the card emulator).   If you can figure out how to write to the external url, you would write the currenturl to the url you can modify and use the WebViewer to read that.    I do not know if that can be done where the rewritable url can be accessed .

Did that help?   Try some blocks to see what is possible.   You have the basic switching between chapters and that is working.

--
Don't know if that fits in your case, but it was mentioned by several users in this forum that the webviewer.getcurrenturl block is always late and in most usecases holds the previous url rather than the current.

--
Thank you for your input. I'd try out the webviewstring and the only way I can make it capture the last url is to add a button to put the webviewstring into a variable (which I can later write it into TinyDB). I couldn't figure out how I can dynamically capture the last url (embeded as script in each html), as the user move from one html to the next one, without the user pressing a button to save the url as bookmark.
You mentioned about using Clock event to trigger the saving of currenturl into TinyDB. Do you have any example that you can share?

Also, after seeing Tonl's input, I found out that webviewer.currenturl is able to show the current url, if I use a button to put it into a variable or label (see the blocks i made below). So I can use either the webviewstring or webview.currenturl to record the url as bookmark into TinyDB using a button.

--
To use a Clock component:

Set the Clock.Interval to the number of ms you want to use to check which url the users is currently viewing.    60000 ms is one minute.
In the event handler you could put the name of the currentURL into the TinyDB

call TinyDB.StoreValue    tag  currentURL    value   urlNumber4        or somethingsimilar  

Another way to do it would be to use the File component and save as a text file the value.

When the user restarts the app, use the TinyDB.GetValue to retrieve the currentURL tag   or the txt file (if you used the File control).

You might want to also have a global variable Boolean (true/false) that tracks whether the user wants to save automatically the current page ...You can set that up with perhaps a check box and in the Clock, only set it off if that value is true and to disable the Clock if that value if false.  Then the user has the option of tracking and saving the current url.    You will have to try some blocks.

There may not be a perfect way to save the current url.  

--
I got it working by using Clock event and TinyDB. Thank you very very much for your input and guidance.
I tested with an apk build and got the book app starts with the last read html when I fresh launched the book app again.

When I started to build this book app, I never thought that App Inventor will get me this far, and it's so much easier.

Once again, a big THANK YOU to you.

--

댓글 없음:

댓글 쓰기