Discussion Forums  >  Grunts, Groans, Complaints

Replies: 9    Views: 191

AlanMac
Aspiring developer
Profile
Posts: 2612
Reg: Mar 05, 2012
Esher, UK
37,120
06/27/13 12:52 PM (10 years ago)

json in themes

A while back David announced this feature http://www.buzztouch.com/forum/thread.php?tid=E0D9B2EB46F55C1621C0061. Since then, I'm a bit more aware of json than I was back then and I've recently started using this feature. I learned the hard way that you have to be careful not to get your json over-written by editng and saving a theme option. I now make make manual text file copies of my json theme all the time, just in case. My real issue is that when I copy json settings out of a plugin and drop it into a theme, some settings work and some don't. I don't think I sm doing anything wrong - am I? Is it that plugins need to support this in some way and some don't?
 
tb
buzztouch Evangelist
Profile
Posts: 2050
Reg: Nov 03, 2011
Oxford
32,300
like
06/27/13 12:56 PM (10 years ago)
Not related, but do you want to attend the Oxford meetup this Tuesday? https://www.buzztouch.com/forum/thread.php?fid=7B0ECD8E30BA101A4348AAD&tid=7B0ECD8E30BA101A4348AAD
 
SmugWimp
Smugger than thou...
Profile
Posts: 6316
Reg: Nov 07, 2012
Tamuning, GU
81,410
like
06/27/13 01:30 PM (10 years ago)
I know when I created the SmugMsgLoc I didn't accommodate very many 'options'. Background color was about the only thing I recall... If the plugin doesn't accommodate the option, the values won't matter for 'that' plugin. perhaps for others... Good point to bring up though; if a plugin has a certain 'style' it should accommodate basic size, color, etcetera of the elements that make up the screen. I'll keep it in mind. Cheers! -- Smug
 
Stobe
buzztouch Evangelist
Profile
Posts: 1527
Reg: Mar 04, 2011
Fredericksburg,...
24,670
like
06/27/13 03:42 PM (10 years ago)
Yes, AlanMac. Some plugins are written to take advantage of the advanced theme, and some are not. To give you a quick history of why... (since I was the one who came up with the concept) Back in the v1.5 days, you could save a lot of options in the theme options since there was only 1 list menu, 1 button menu, etc. Now that there are more options for menu plugins, some have added the support for the theme lookup, and some probably didn't know it was possible. With that in mind, the basic "theme" options are much more limited than before. That's why I wanted a way to sideload some JSON into the theme block of the config.txt. Its possible to add the theme lookup to any plugin, as long as you're willing to spend a little time researching it and adding it in. Or you can request the plugin developer put it into their next update. -Chris
 
SmugWimp
Smugger than thou...
Profile
Posts: 6316
Reg: Nov 07, 2012
Tamuning, GU
81,410
like
06/27/13 05:01 PM (10 years ago)
Stobe/Chris, Could you name an example of a plugin that uses the 'theme lookup' code so I could incorporate it in my future endeavors and present updates? Cheers! -- Smug
 
Stobe
buzztouch Evangelist
Profile
Posts: 1527
Reg: Mar 04, 2011
Fredericksburg,...
24,670
like
06/27/13 05:21 PM (10 years ago)
In the BT_strings.m file, you'll find a method called getStyleValueForScreen Here's the description: This method returns a value pulled from the app's global theme or from the passed in screen if the that screen set a matching "over-ride" value You'll find it used in most of the BT default plugins, and also my iPad Story Page plugin. Hope that helps. Its pretty easy to utilize since it basically looks in the global theme for a JSON parameter, and then looks at the JSON for the actual screen (which will override it). This way, you can set the menulist color scheme once, if you have a ton of list menus that need to look the same, etc. Only problem is you'll want to make sure your JSON string is unique, so you don't create a conflict. ex. don't use something like cell_bg_color, instead use smug_cell_bg_color
 
chris1
Code is Art
Profile
Posts: 3862
Reg: Aug 10, 2012
Austin, TX
50,120
like
06/27/13 06:32 PM (10 years ago)
Hmm - I haven't considered global themes much in my plugins. But Stobe makes a good point about why we should probably use getStyleValueForScreen instead of getJsonPropertyValue when grabbing a screen's parent item properties. It may be something not really related to themes at all, but it doesn't hurt to use the theme method instead of the standard one.
 
AlanMac
Aspiring developer
Profile
Posts: 2612
Reg: Mar 05, 2012
Esher, UK
37,120
like
06/28/13 01:48 AM (10 years ago)
Thanks for the feedback guys. I think the theme concept is powerful; it just seems that plug-in developers are not as aware of how to use and standardise on this approach. Maybe it could be on one of the testing check-lists? It could really help speed up app development if more plugins supported this concept. Cheers, Alan
 
Stobe
buzztouch Evangelist
Profile
Posts: 1527
Reg: Mar 04, 2011
Fredericksburg,...
24,670
like
06/28/13 02:05 AM (10 years ago)
Yeah. And I think the even better approach would be for us to allow a plugin developer to supply us a "block" of variables for each plugin to be included in the themes page. (basically, an expandable section dedicated to each plugin that supports theming.) Another feature for our to-do list, lol.
 
AlanMac
Aspiring developer
Profile
Posts: 2612
Reg: Mar 05, 2012
Esher, UK
37,120
like
07/09/13 04:11 AM (10 years ago)
Just made an Android version of an IOS app. I found out that the menu settings I had manually put in a theme that worked for IOS didn't work for Android. I had to go around each menu and set the font sizes, row heights, backgrounds etc manually. Sigh...
 

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.