Android Tutorial [B4X] [B4XPages] Pleroma / Mastodon Client

Erel

B4X founder
Staff member
Licensed User
Longtime User
V1.07 released:
  • Timelines stack. Currently only tags are handled internally.
  • Account dialog displayed when clicking on an avatar.
  • WebView dialog displayed when clicking on an external link (@users will also show in this dialog until implemented properly).
  • Back button.
  • Crash reports in B4i.
  • Many more small improvements.

 

AnandGupta

Expert
Licensed User
Longtime User
For now it only does one thing, it shows the public feed. Some of the media types ,such as videos, are still not supported.
I think, this should be Some of the media types ,such as videos, are still not supported.

This is becoming one of the best example to study for B4XPages and Cross Platform, not to mention download from net and lazy loading

Regards,

Anand
 

Erel

B4X founder
Staff member
Licensed User
Longtime User
v1.08



Many improvements including:
  • Support for users and mentioned users links.
  • The "account view" is displayed in a dialog when the avatar is clicked and as the first message when the user link is clicked.
  • URLs are underlined when the user touches them (remember that there is no WebView here).
  • Round avatars. Based on: https://www.b4x.com/android/forum/threads/b4x-round-clipping-panel.120961/#post-756162
  • Custom emojies - inline images. This is done with BCTextEngine views feature.
  • Outline for images placeholders.
 

Erel

B4X founder
Staff member
Licensed User
Longtime User
v1.09





  • The parsed html is converted to text runs directly. Previously the html was first converted to BBCode. This improves the performance and also allows more customization.
  • The left drawer shows the navigation history.
  • Clicking on "reply to" or on the time label opens the thread view in a dialog.
  • Jpeg orientation attribute is respected (relevant to B4A).
  • Many small improvements and bug fixes.
Source code is now on github: https://github.com/AnywhereSoftware/B4X-Pleroma
 

Erel

B4X founder
Staff member
Licensed User
Longtime User
The best way to describe this app is with "turtles all the way down":



The remote feed is downloaded with OkHttpUtils2.
It is parsed with MiniHtmlParser.
The parsed html is converted to text runs with HtmlToRuns class.
The text runs are sent to BCTextEngine which first makes all its measurements and prepares the rich text to be drawn.
When the item becomes visible, the text is drawn with BitmapCreator (this is done internally in BCTextEngine).
BitmapCreator makes drawings by mutating an internal buffer of bytes. You cannot go much lower than this
 

AnandGupta

Expert
Licensed User
Longtime User
Downloaded latest from Github.
Got error log, in opening
B4XMainPage - 107: Cannot access private member: extrawidth

I checked and I have B4XDrawer 1.53.

Commenting the line, works Ok. So, may be we need new B4XDrawer version where it is not private.

Regards,

Anand
 

omarruben

Active Member
Licensed User
Longtime User
OHHHH my God!!!! tech advances so fast... thank you for the hard work!!!!
 

asales

Expert
Licensed User
Longtime User
If it crashes then post the logs.
B4X:
*** Service (starter) Create ***
** Service (starter) Start **
** Activity (main) Create, isFirst = true **
Version:1.10
** Activity (main) Resume **
*** Service (httputils2service) Create ***
** Service (httputils2service) Start **
textutils_parsestatus (java line: 809)
java.lang.RuntimeException: Cannot parse: null as boolean
    at anywheresoftware.b4a.BA.parseBoolean(BA.java:629)
    at anywheresoftware.b4a.BA.ObjectToBoolean(BA.java:699)
    at b4a.pleroma.textutils._parsestatus(textutils.java:809)
    at b4a.pleroma.pleromafeed._fillstatuses(pleromafeed.java:548)
    at b4a.pleroma.pleromafeed._parsetimelines(pleromafeed.java:647)
    at b4a.pleroma.pleromafeed$ResumableSub_DownloadTimelines.resume(pleromafeed.java:434)
    at anywheresoftware.b4a.BA.checkAndRunWaitForEvent(BA.java:267)
    at anywheresoftware.b4a.BA.raiseEvent2(BA.java:207)
    at anywheresoftware.b4a.keywords.Common$11.run(Common.java:1178)
    at android.os.Handler.handleCallback(Handler.java:751)
    at android.os.Handler.dispatchMessage(Handler.java:95)
    at android.os.Looper.loop(Looper.java:154)
    at android.app.ActivityThread.main(ActivityThread.java:6123)
    at java.lang.reflect.Method.invoke(Native Method)
    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:867)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:757)
Moto G4 - Android 7.0
 

Johan Hormaza

Well-Known Member
Licensed User
Longtime User
Now I have this problem on Android. What will it be?
--------- beginning of crash
--------- beginning of system
--------- beginning of main
*** Service (starter) Create ***
** Service (starter) Start **
** Activity (main) Create, isFirst = true **
Version:1.10
** Activity (main) Resume **
*** Service (httputils2service) Create ***
** Service (httputils2service) Start **
textutils_parsestatus (java line: 809)
java.lang.RuntimeException: Cannot parse: null as boolean
at anywheresoftware.b4a.BA.parseBoolean(BA.java:629)
at anywheresoftware.b4a.BA.ObjectToBoolean(BA.java:699)
at b4a.pleroma.textutils._parsestatus(textutils.java:809)
at b4a.pleroma.pleromafeed._fillstatuses(pleromafeed.java:548)
at b4a.pleroma.pleromafeed._parsetimelines(pleromafeed.java:647)
at b4a.pleroma.pleromafeed$ResumableSub_DownloadTimelines.resume(pleromafeed.java:434)
at anywheresoftware.b4a.BA.checkAndRunWaitForEvent(BA.java:267)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:207)
at anywheresoftware.b4a.keywords.Common$11.run(Common.java:1178)
at android.os.Handler.handleCallback(Handler.java:873)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:201)
at android.app.ActivityThread.main(ActivityThread.java:6864)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:547)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:873)
 

asales

Expert
Licensed User
Longtime User
Anyway, I've released v1.11. Can you try it and see if it fixes the issue?
Works fine. No crash.

Did it happen immediately when you opened the app?
In the previous version (1.10) I see the first screen with the "Made with ♥ in B4X" and the crash happens after this.
If I disable the internet connection, I see the first screen, but there is no crash (and course not load the feed).
 
Cookies are required to use this site. You must accept them to continue using the site. Learn more…