New feature: better support for modern Android themes

Discussion in 'Android Questions' started by Erel, Sep 11, 2012.

  1. Erel

    Erel Administrator Staff Member Licensed User

    Basic4android v2.20 will better support the new themes introduced in Android 3.x and Android 4.x.

    - The targetSdkVersion default value for new projects is now 14 (this can also be easily done with the manifest editor).
    - The device visual designer supports the default theme. It also allows you to switch to other themes:

    [​IMG]

    [​IMG]

    [​IMG]

    Note that changing the theme on the device only affects the designer. You will also need to set the theme in the manifest editor (if other than the default theme).

    - The visual designer now supports a new DEFAULT color. Setting this color means that the theme default color will be used.

    - Menu items will now appear in the action bar on devices running Android 3.0 or above.

    With that changes it will be much simpler to create modern looking apps.
     
  2. NJDude

    NJDude Expert Licensed User

    Sweet!!
     
  3. Jaames

    Jaames Active Member Licensed User

    Super cool :sign0098:
     
  4. Roger Garstang

    Roger Garstang Well-Known Member Licensed User

    Does any of this carry over to designs created by code? It would be great to be able to set a default text color for labels and not have to set it for every label created, and other attributes/views. Unless by Default Color you mean things like Dark and Light themes...which would be nice to be able to select in code too, or maybe a menu item instead of manually tweaking the XML.
     
  5. Erel

    Erel Administrator Staff Member Licensed User

    These changes are not related to views created by code. When you create a view by code then it uses the default colors and drawables unless you explicitly set those. Up until now it wasn't possible to get the same effect with the visual designer.
     
  6. Roger Garstang

    Roger Garstang Well-Known Member Licensed User

    Now I'm confused. So, there has always been default colors and other properties...this part I agree with since if nothing is set in code there is still a base view created. This never really applied to the Designer since it has property pages and such that setup the values. So, now the designer reads the default values instead of just populating defaults from static property sheet values that were "hard coded"?

    And, the designer was now given an additional capability to set the default values which the by code methods don't have? Seems unfair to those that design by code. I could see how it would clutter up the properties/methods lists for the views to add all of the values though assuming there are multiple defaults for Text Colors, Background Colors, etc. Setting the defaults within the Designer would be cleaner. So, what about the ability to save/load a layout that sets defaults only and contains no views? Sort of like a Theme or CSS file in HTML.
     
  7. marcocim

    marcocim Member Licensed User

    Download new version

    Hi Erel,

    i have a regular B4A 2.02 developer license (with 2 year maintenance support) but i don't find any 'check for new updates' option on IDE menu.

    How i will download new B4A 2.20 version ?

    Thanks

    Marco
     
  8. JonPM

    JonPM Well-Known Member Licensed User

    You will receive an email with the download link once it is available
     
  9. moster67

    moster67 Well-Known Member Licensed User

    Sounds good Erel.



    **Starting off-topic although it is somehow related**

    Since you are already working on the Designer, are you planning any other enhancements related to the Designer or the Designer-script? I can think about two:

    1) to select one or more views in the Abstract-designer and add their names automatically into the script, perhaps by a popup-menu or double-clicking if the view selected is only one. This would save quite some time avoiding typing the name(s) of the view(s) in the script-editor, especially if the views are many

    2) some kind of Placeholder-mechanism. It is possible to use a panel today but I would love to see a specific way of using placeholders. This has been discussed in other threads.

    **end of off-topic**
     
    Last edited: Sep 12, 2012
  10. Erel

    Erel Administrator Staff Member Licensed User

    The designer color picker has a new "DEFAULT" value. Practically it means that the color is not set by the designer (and the default color is used).

    There are some changes planned to the designer scripts. I will soon post more information.
     
  11. Informatix

    Informatix Expert Licensed User

    Do you plan to improve the speed of LoadLayout ? Currently, its slowness keeps me away from the designer.
     
  12. Theera

    Theera Well-Known Member Licensed User

    Update v2.20

    Hi Erel,
    I need too.
    Best Regards
    Theera
     
  13. Erel

    Erel Administrator Staff Member Licensed User

    @Informatix, can you send me by mail a layout file which was significantly slower than building the same layout by code?

    @Theera, Version 2.20 was not yet released. Once it will be released you will receive an email.
     
  14. Informatix

    Informatix Expert Licensed User

    Every layout file. It's not specific. As I said in a recent tutorial, I timed the two ways of adding views in different projects and LoadLayout is 5 to 7 times slower. Another user reported the same problem in another thread.
    Here's a very simple project to illustrate it. In this example, LoadLayout is 15 times slower on my device. That's why I don't use it.
     

    Attached Files:

    Last edited: Sep 12, 2012
  15. Erel

    Erel Administrator Staff Member Licensed User

    Thank you. However this is not a realistic performance test as you are loading the layout file 100 times, which has different characteristics compared to loading a small number of large layout files.

    I will try to reproduce the performance issue with a large layout file.
     
  16. Informatix

    Informatix Expert Licensed User

    With my real "big" layouts, it is 5 to 7 times slower.

    EDIT: and sometimes you need to call it more than 100 times. When you create items in a ScrollView for example.
     
    Last edited: Sep 12, 2012
  17. Erel

    Erel Administrator Staff Member Licensed User

    The layout files loading time in the next version will be about 3 to 4 times faster. The layout files will also be about half the size.

    This is relevant for large layout files.

    There is some overhead when you access the file. If you need to access it 100 times then it might be better to create the layout by code.
     
  18. Informatix

    Informatix Expert Licensed User

    You're the king ! :)
     
  19. Roger Garstang

    Roger Garstang Well-Known Member Licensed User

    Any chance this could be a Radio/Option Button, Combobox, or SubMenu of the Project menu with options for 10, 11, and 14? I really don't want to override this with the Manifest file every time.

    I had posted an issue sometime back about a Tablet not drawing Tabs correctly. I had decided to try this out to see if perhaps adding [AddManifestText(<uses-sdk android:minSdkVersion="4" android:targetSdkVersion="14"/>)] to my Manifest would fix the tabs drawing wrong. It in fact made things worse. Current Tab at load still isn't drawn and it draws them with the ugly Blue underline only which looks horrible with Images in the tab and the blue line covers the images. My Edit Texts also draw wrong and text appears as a really faint grey instead of Black. I also cannot exit any activity with the Back button...not sure how to use any of my apps now since only home works and without force closing I go right back to the same screen. I do get an enhanced titlebar that contains the icon of the app now although it cuts off the bottom.

    I then decided to Test it on my Galaxy Note with ICS. It also gets the enhanced titlebar which draws ok, but takes up a lot of screen. Scrollviews no longer fade at top and bottom which I think is better along with appearing to scroll better. Tabs draw ok although the background is now a Dark Blue gradient and makes the images and text harder to read. It also cannot exit the activities with the Back Arrow though which is a big one.

    I think I'll be sticking with API 10 as even 11 displays most of the issues. Other than Battery life being slightly better for AMOLED I actually dislike the Dark ICS theme. Speaking of themes, thank you for clearing up the DEFAULT thing above. I now see that you meant Default was a color option and not setting the Defaults which would have been a cool addition.
     
  20. Erel

    Erel Administrator Staff Member Licensed User

    It will be extremely simple to change the value. You do not need to edit the manifest file. You just need to open the manifest editor and change 14 to whichever value you need.
     
Loading...