View Single Post
Old 02-08-2020, 09:29 PM   #20
Peripathetic composes epic poetry in binary.Peripathetic composes epic poetry in binary.Peripathetic composes epic poetry in binary.Peripathetic composes epic poetry in binary.Peripathetic composes epic poetry in binary.Peripathetic composes epic poetry in binary.Peripathetic composes epic poetry in binary.Peripathetic composes epic poetry in binary.Peripathetic composes epic poetry in binary.Peripathetic composes epic poetry in binary.Peripathetic composes epic poetry in binary.
Posts: 38
Karma: 90402
Join Date: Feb 2019
Device: Tolino Shine 3
Modifying EPubProd by Decompiling It

For the following modifications, the APK has to be decompiled with Apktool, and recompiled back again when done.

Remove Store from Home Screen

The home screen layout is specified in the XML file res/layout/home_activity.xml, and the store content is in its "bottom part." To hide it we will change the height of this part to 1 pixel:

<FrameLayout android:id="@id/home_activity_app_area_bottom_part" android:layout_width="fill_parent" android:layout_height="315.0dip1px" android:layout_alignParentBottom="true">

While it can be removed completely, it is a bit tedious, so for now I settled for the path of least resistance. The result is practically the same, as none of it can be seen any longer.

Eventually, more book covers could be added to the home screen to take advantage of the freed up space but their number is hardcoded too, so it's not a trivial change.

Adjust Translation Strings

Most of the text messages displayed by the app are contained in the files:
  • res/values/strings.xml
  • res/values-XX/strings.xml
Where XX is the ISO 639-1 language code, for example en for English, de for German, etc. The path without any code is the default one. If the same labels are defined for the language your device is set to, they take precedence.

The only thing I did with these files was to capitalize all instances of "tolino." I can imagine someone might want to change "To my books" / "My books" to "Library" or something like that. This is the place to make any such changes.

And of course the app can be translated to another language this way too.

Note that you can see these strings.xml files for a lot of languages but this is just because a library used by the app (ABC Search Bar) supports all of them. It doesn't mean the Tolino app includes for example a hidden Albanian (sq-rAL) translation. If you look at the size of these files, they are much smaller than what a complete translation would have to be. Any missing strings are replaced from the from the default file under res/values.

Use the Refresh Button to Rescan for Updated Books

The Tolino app book database is supposed to get updated every time the mass storage device is unmounted. A side effect of switching to MTP mode is, since that no longer happens, the database does not get updated at all and new books do not show in the app.

The app has a refresh button in the library view but whatever it is supposed to do, it doesn't work unless logged in: it will only show a pop-up dialog otherwise. Let's make this button simply rescan the user data for new books.

The code that runs when the button is clicked is in smali/de/telekom/epub/ui/activities/BasicContentActivity$MainMenuButtonClickListener.s mali. In the source I decompiled it starts at line 131 but it will be different depending on the application version and parameters passed to Apktool (I use -b or --no-debug-info).

Here is the relevant part, and how to modify it:

iget-object v3, p0, Lde/telekom/epub/ui/activities/BasicContentActivity$MainMenuButtonClickListener;->this$0:Lde/telekom/epub/ui/activities/BasicContentActivity;

iget-boolean v3, v3, Lde/telekom/epub/ui/activities/BasicContentActivity;->isConfigLoaded:Z

if-eqz v3, :cond_4

iget-object v3, p0, Lde/telekom/epub/ui/activities/BasicContentActivity$MainMenuButtonClickListener;->this$0:Lde/telekom/epub/ui/activities/BasicContentActivity;

invoke-virtual {v3}, Lde/telekom/epub/ui/activities/BasicContentActivity;->startCloudSync()V

invoke-static {}, Lde/telekom/epub/application/Globals;->getApplicationContext()Landroid/content/Context;

move-result-object v0

new-instance v1, Landroid/content/Intent;

const-class v2, Lde/telekom/epub/ui/activities/AddLocalFilesActivity;

invoke-direct {v1, v0, v2}, Landroid/content/Intent;-><init>(Landroid/content/Context;Ljava/lang/Class;)V

const/high16 v2, 0x10000000

invoke-virtual {v1, v2}, Landroid/content/Intent;->setFlags(I)Landroid/content/Intent;

invoke-virtual {v0, v1}, Landroid/content/Context;->startActivity(Landroid/content/Intent;)V

goto :goto_0

The new code is more or less equivalent to running the following command, which can also be used to refresh the library:

adb shell am start -n de.telekom.epub/.ui.activities.AddLocalFilesActivity

The same code could also be made to run every time a USB device is unmounted.

Remove the Bookmark Icon

In the reader app, a bookmark icon is shown on every page to indicate the place that can be tapped to add a bookmark, which I find unnecessary and distracting. To get rid of it:
  • Replace the file res/drawable-nodpi-v4/dogear_image_passive.png with a fully transparent PNG image to hide the icon when RMSDK is being used (this can be done even without Apktool)
  • To remove the icon when Readium is being used, in the file res/values/strings.xml, edit the entry for ic_dogear to read:
    <string name="ic_dogear"></string>
The place can still be tapped to add a bookmark, and the icon will still be shown on bookmarked pages.

Last edited by Peripathetic; 02-09-2020 at 12:36 PM. Reason: Added section: Remove the Bookmark Icon
Peripathetic is offline   Reply With Quote