Create a list and set each paragraph to the list as elements
Create your "Importance" list using the index of your paragraph list
Display the output in ONE label (in a scrolling vertical arrangement). Set the label to HTMLFormat.
Iterate over your paragraph and importance lists applying each paragraph in turn. If importance is required for a paragraph, apply html/css elements to the paragraph as specified in your file/list.
Use the HTMLContent block to combine the previous content of the label with the next item
You could do something similar to apply inline styles to your importance paragraphs, then create a single html file to display in a webviewer. For this, you may want to consider using an html/css framework such as w3css
I would rather build a HTML stream on the fly, using function procedures to wrap my text with the appropriate html, and text JOINs to build up the html stream, then a Web Viewer to display it (assuming that's still alowed in recent Android versions.)
Here is some sample code based on a trick I stole from TimAI2 to feed a Web Viewer ... webviewer_SVG.aia (3.7 KB)
I think ABG's HTML suggestion is best - the User will use the App to select the preferences, the App can build HTML + CSS pages on demand and display each page in a WebView Component (No Internet Required). HTML (Hypertext Markup Language) and CSS (Cascading Style Sheets) together deliver good text presentation, which is why all websites are based on this combination.
What will be interesting is the actual file(s) size that you have your text in - and if the User has preferences per paragraph, then each paragraph is probably going to need to be a seperate text file.
Do the paragraphs already exist for just the one book or is your App actually intended to be ambidextrous? Just the text files for one book might take you beyond the maximum App size (100mb) - so if there are numerous books, you will need to provide a web-based facility for Users to download from.
To better explain, the "book" is a set of proverbs which can be read sequentially. But some passages are more important than others, hence the filtering. One can read the entire book sequentially, or a filtered version sequentially (either by hiding paragraphs altogether, or using tiny fonts to suggest skipping them, or coloring them light grey, etc.).
Total paragraphs: ~42,000
Words per paragraph: generally 5 to 100
I guestimate the total data size to be something around 5 MB
The book won't change and it seems smart to take advantage of that however possible. For example, I'd like the user to be able to dial up/down (w/ slider or equivalent) the "importance" filtering and see in real time how long the total read would be (as an option the user would tell the app to not show lower importance paragraphs at all). So if the user minimized the filtering to none the total read time would be approximately 140 hours. But the user could see in real time that if he sets maximum filtering that read time could be reduced to a matter of minutes.
So, have only 10 minutes? Just dial down to 10 minutes and read the essence of the whole book. That's the goal here.
I don't want the user to wait for processing. They dial up or down and then start reading. If it weren't for the data size the idea is simple.
I think that with such a number of paragraphs there will always be some waiting time for data processing. Real-time processing as the text scrolls will be too difficult with A2 blocks. Better if you present the problem in some html forum, do it with html and display the result in WebView.
Wish I had an aia, ha ha, not that far yet and I will be slow due to time/expertise challenge. I think the aia you downloaded was from @ABG and I also had the same result, but didn't look into it yet.
I just do not believe that the total size of the data would be around 5MB.
Since you already seem to have the book, you could just take a text file with the whole text and tell us how big it is.
The whole thing sounds like a spreadsheet problem, or rather a database problem, where you would have a table with columns indicating importance, font size, and where the text can be found.
I can't keep up with you guys. I have limited time and am new to all this. BUT, since you asked I did make a sample full file. The "book" is not actually finalized and I'd rather not share at this point. I filled a file with some Latin. I know the book will be very similar in size to what I'm posting here.
I created the simulation file with Excel. The Excel file came to just over 1MB. Then I exported to csv thinking I would share that. The csv file came to over 15MB! Since I would use the csv file with AI, maybe that dooms the project. For what it's worth, the zipped Excel file is 735KB but I'm not allowed to upload Zip files or XLSX files here. So here is the zipped Excel file in Google Drive:
I'll be looking at what you guys are saying in the next couple weeks. I was guessing size based on the Excel size...obviously not a good idea. Wo is me.
Try cutting the 42000 line CSV file into 42 CSV files, each 1000 lines long.
Upload them one by one into the Media folder of a new project, and see if it will build.
you might need to do this on the code.appinventor.mit.edu server.
Before you go too far along the road, invest at least a day doing the free MIT tutorials. It will save you from headaches and hair loss (unfortunately, using App Inventor triggers grey hair no matter what).
Haven't pursued the "large data" problem yet. Had to model the idea first just to get a handle on what the app would be like.
The criteria for "importance" of any paragraph is based on how many times that paragraph is cited--hence the title "Most Cited Constitution." So I modeled the idea, and it is attached. Parts of the code may need improvement and some things are hard-coded. But I'm really liking the app concept. Just may need to use a different tool to create the real product.
I used part of the US constitution as a model. Article I has 10 sections and I treated each section as a paragraph. Total reading time is set to 100 hours which is of course not true, just shows how the slider would work.
In any case, not like you try to do it in your example app.
Try to make a data structure that you can store in a csv file on a Google drive, a mysqli database, a CloudDB, a FireDB or whatever. You can never hope to keep it all in your app, and the users of your app will not be happy to load an elephant in their phone.
Then, instead of using an ActivityStarter and Chrome, use a WebViewer. You have much more control over that, and for reading text from a website it is more than good enough. It will also prevent your app from exiting all the time, as happened to me, which is very annoying.
More explanation here on the forum, but also in your example app is also required. I read all your posts and tried your app, but it stays a mystery to me what you want to achieve. Start with making something user friendly, the rest will follow.