Discussion Forums  >  Plugins, Customizing, Source Code

Replies: 5    Views: 89

sarahk
Code is Art
Profile
Posts: 153
Reg: Jul 16, 2014
Auckland
10,230
08/20/18 12:03 AM (2 months ago)

WB_screen_menuImage isn't displaying correctly or handling taps

Hi

I haven't made any changes to my config file and my apps been ticking over nicely for years but the .apk needs to be updated in the playstore so...

My homescreen is a Menu with Image and they link to Cr_html_pro objects.

I've got a "medium" header image and it's partly truncated, the menu items don't have a white background and when they're clicked the app can't find the associated screen.

Screenshots from the same device. Errors & screens are identical on the Buzztouch emulator and Huawai phone

Old: https://photos.app.goo.gl/bX3zK4HsAm9iZxSk8
New: https://photos.app.goo.gl/9jJYhoT46NNBSQ4R8v

I've added a debug line into the menu with image tap event

W/ZZ: WB_screen_menuImage:parseScreenData{"itemId":"NZPIFMENU59290","itemType":"Cr_html_pro","loadScreenWithItemId":"NZPIFEVENT59290","titleText":"North End Meeting- Having trouble renting for 2019?","descriptionText":"Otago 22nd Aug"}
WB_screen_menuImage:handleItemTap loads screen with itemId: "NZPIFEVENT59290"
I/ZZ_BT_contentProvider: query(content://com.androidscanner.database.BT_contentProvider/bt_screens/NZPIFEVENT59290) matching to index:101
buildExpandedSelection:INDEX_BT_ITEM_ID:NZPIFEVENT59290
I/ZZ_SelectionBuilder: query(columns=[_id, itemId, itemNickname, itemType, hasChildItems, jsonVars, orderIndex, parentItemGuid], distinct=false) SelectionBuilder[table=bt_screens, selection=(itemId=?), selectionArgs=[NZPIFEVENT59290]projectionMap = {} ]
W/ZZ: WB_screen_menuImage:handleItemTap ERROR. No screen is connected to this item?



What's my next debugging step?
 
SmugWimp
Smugger than thou...
Profile
Posts: 6316
Reg: Nov 07, 2012
Tamuning, GU
81,410
like
08/20/18 05:20 AM (2 months ago)
What does your json config file look like? When it says 'no screen is connected to this item' it generally means that it doesn't know how to hand off the menu item to the desired screen; either the screen doesn't exist, the class doesn't exist, or something has changed.

Is there a screen with an ID of "NZPIFEVENT59290" ? That's not something BT created as an ID; that's something that was created or named elsewhere. Unless you're doing some kind of dynamic screen creation (which would utilize loadScreenObject instead of loadScreenWithItemID), I'm a little leery of that part.

So what to do would be basically get the menu item, find the next screen ID, and confirm it exists in the configuration. Then ensure that the class exists in the project.

Cheers!

-- Smug
 
sarahk
Code is Art
Profile
Posts: 153
Reg: Jul 16, 2014
Auckland
10,230
like
08/20/18 04:01 PM (2 months ago)
Hi Smug!

My config is generated by a cms - I love how that's possible - and as each screen is added to the menu it's added to the list of screens too. That code has been stable for years.

Source: hxxps://pimms. nzpif. org.nz/events/scanAppConfig

So the menu has

{
"itemId": "NZPIFMENU59270",
"itemType": "Cr_html_pro",
"loadScreenWithItemId": "NZPIFEVENT59270",
"titleText": "Test Event",
"descriptionText": "Training 2nd Nov"
}

and the screens have:

{
"itemId": "NZPIFEVENT59270",
"itemNickname": "Test Event",
"navBarTitleText": "Test Event",
"dataURL": "https://pimms.nzpif.org.nz/events/scanhistory/[deviceId]/59270/",
"itemType": "Cr_html_pro",
"childItems": [],
"forceRefresh": "1",
"showBrowserBarRefresh": "1",
"dataDetectorType": "0",
"preventAllScrolling": "0",
"hideHorizontalScrollBar": "1",
"showBrowserBarLaunchInNativeApp": "0",
"contextMenuNickname": "global",
"contextMenuItemId": "58C020F1205B8A38FC3B466"
}
 
SmugWimp
Smugger than thou...
Profile
Posts: 6316
Reg: Nov 07, 2012
Tamuning, GU
81,410
like
08/21/18 10:45 AM (2 months ago)
How odd. From all outward appearances, it looks like it should work.

Have you used the debugger before? If not, google the xcode debugger, and learn how to 'step' through code as it executes.

What you'll end up doing is running the app line by line, and you have an opportunity to look at variables, and peek at values and such to ensure that it works the way you think.

set it up so the app runs normal, but stops when the menu is tapped, so that you can directly follow the flow and see where the problem directly occurs. We can see that it has an error (No screen) but because we know the screen *is* there, we want to look closer at the error point and find out if it has the wrong screen, no screen, did it lose the ID, etc...

Because the config files look right, and because the code 'used' to work, I can only suspect that something became deprecated somewhere. But until we look closer we won't know.

Hope this helps, but feel free to query further.

Cheers!

-- Smug
 
sarahk
Code is Art
Profile
Posts: 153
Reg: Jul 16, 2014
Auckland
10,230
like
08/21/18 08:08 PM (2 months ago)
Ok, I think I have this sussed.

The android package's file: WB_screen_menuImage.java has an onCreateView method and it seems that the calls to BT_strings.getStyleValueForScreen is passing the wrong strings.

for example if I go into the control panel and edit my screen the sample config at the bottom of the page shows "listBackgroundColor" but the java asks for "listRowBackgroundColor".

I can fix that - but that doesn't help the next person, and I'll need to remember the changes for my other app, or if I download this again.

What is the right way to feed code changes back into the buzztouch system?
 
SmugWimp
Smugger than thou...
Profile
Posts: 6316
Reg: Nov 07, 2012
Tamuning, GU
81,410
like
08/21/18 11:09 PM (2 months ago)
I wish it were more of a 'Github' style, where we could either contribute as authorized individuals, or at least fork it with our own customizations, but that said I don't think that's where the business model is at.

For the moment, to keep from upsetting anyone, 'when' I publish errata, I try and isolate it to methods in a class, so that I don't paste an entire class in the forum.

Or you can send them to Kristen or David, and hope they get included in the next iteration.

For sure send a copy to me, cause it'll save me additional time fixing the same thing.

But with respect to 'my own' system, the core BT projects are pretty similar, so I try to keep a 'universal' project updated with the latest code, and when I create projects, I replace classes with my updated versions. Of course, I haven't messed with mobile apps in a couple of years, so my whole catalog needs an overhaul, lol!

Cheers!

-- Smug

edit: the "WB_screen_menuImage" plugin belongs to Susan Metoxen. If you send her the updated code, or at least make her aware, she can update the plugin on her 'master' and submit a new version to the powers that be.
 

Login + Screen Name Required to Post

pointerLogin to participate so you can start earning points. Once you're logged in (and have a screen name entered in your profile), you can subscribe to topics, follow users, and start learning how to make apps like the pros.