B4A Library DesignSupport - Additional Material Design components

Discussion in 'Additional libraries, classes and official updates' started by corwin42, Oct 1, 2015.

  1. corwin42

    corwin42 Expert Licensed User

    This library is a wrapper to some of the objects of Googles Design Support library.

    Requirements:

    This library requires B4A 6.31 or above.
    From V2.32 on B4A V6.80 or newer is required. If you use an older B4A version use the V2.31 library.
    AppCompat 3.30 or above is required.
    The examples need some additional libraries like AHViewPager, XMLViewEx, XMLLayoutBuilder

    Currently it supports:
    • Snackbar - The new modern toastmessages
      Screenshot_20151001-110844.png
    • TabLayout - The new material like tabs with fixed tabs and scrolling tabs feature. Works standalone or together with a ViewPager library. Supports icons as tabs and custom layouts for the tabs.
      Screenshot_20151001-110749.png Screenshot_20151001-110809.png
    • FloatlabelEditText - An enhanced EditText object that supports a floating label, counter and error messages.
      Screenshot_20160624-105201.png
    • FloatingActionButton - A very simple Floating Action Button. Has show- and hide animations but is very simple.
      Screenshot_20160624-104708.png
    • NavigationDrawer - Material Design compliant Navigation Drawer. See NavigationView Example for detailed instructions.
      Screenshot_20160826-160906.png
    • BottomNavigationView - Material Design compliant Bottom Navigation View. See BottomNavigationView Example for detailed instructions.
      Screenshot_20161219-091326.png
    Installation:

    1. This library depends on the AppCompat library. So do all the setup needed for AppCompat.
    2. Copy the DesignSupport.xml, DesignSupport.jar and DesignSupport.aar files to your CustomLibs folder
    3. Install/Update Android Support Packages with the SDK Manager.
    Setup and usage:
    1. Setup your project like a project that uses AppCompat library.
    If you want to use the DSFloatlabelEditText object with the ErrorText or counter feature you should add the following item to your Theme:
    Code:
    <item name="textColorError">@color/design_textinput_error_color_light</item>
    Otherwise your app will crash if the textinput reaches the maxCounter length.

    If you want to use the DSNavigationDrawer object you should add the following items to your Theme:
    Code:
    <item name="android:windowDrawsSystemBarBackgrounds">true</item>
    <item name=
    "android:statusBarColor">@android:color/transparent</item>

    Version History:

    V1.00
    • Initial version with SnackBar and TabLayout objects.
    V2.00
    • Requires B4A 6.0 or above
    • Uses new Maven repositories for support libraries
    • Enhanced Designer support (custom properties are supported)
    • New: DSFloatlabelEditText - New EditText with floating label, counter, error messages
    • New: DSFloatingActionButton - Standard Floating Action Button.
    V2.10
    • New: Requires Support Repository 36
    • New: DSNavigationDrawer - A complete DrawerLayout implementation/wrapper
    • New: DSNavigationView
    • New: Support for ShowPasswordToggle in FloatLabelEditText
    • Fix: FloatLabelEditText.Enabled=True/False should work now.
    V2.20
    • Fix: DSNavigationDrawer should work without a secondary drawer.
    • New: BottomNavigationView - Wrapper for the BottomNavigationView
    • Fix: Some minor fixes and changes
    V2.21
    • Fix: DSTablayout can use other ViewPagers than AHViewPager
    • Fix: Small internal bugfixes.
    V2.22
    • Fix: Change packagename to anywheresoftware.b4a.orbjects to reduce resouce fields
    V2.23
    • Fix: Fix error in FloatLabelEditText
    V2.30
    • New: Dismiss event for DSSnackbar
    • New: Support CharSequence where possible
    V2.31
    • Fix: Getters return String instead of CharSequence to avoid problems.
    V2.32
    • Fix: Compiled against B4A 6.80 Core library to avoid some problems with CharSequences.
    V3.00
    • Fix: Compiled against Support Library 28.0.0 to fix a problem with TabLayout
     

    Attached Files:

    Last edited: Nov 5, 2018
  2. corwin42

    corwin42 Expert Licensed User

    Some words about future development of this library.

    I'm planning to wrap more classes of the official design support library. I started to wrap the NavigationView but I decided to discard it again because I had some issues with it supporting the NavigationDrawer over StatusBar feature. I think the great MaterialDrawer library wrapped by @thedesolatesoul is a perfect solution we can get for B4A.
     
  3. yiankos1

    yiankos1 Active Member Licensed User

    Great job! I think everyone knows java should help to finish this library, in order our apps can compete other apps at market.
    Thanks in advance.
     
    migrec likes this.
  4. ArminKH

    ArminKH Well-Known Member

    excellent !
    thank u corwin ;)
    damet garm
     
    mostafakazemimk likes this.
  5. walterf25

    walterf25 Well-Known Member Licensed User

    Awesome work Bud, you rock!
     
    Asgard likes this.
  6. Blue.Sky

    Blue.Sky Active Member Licensed User

    Hi
    I get below error.What's solution?
     
  7. FrankDev

    FrankDev Active Member Licensed User

    my error.


    LogCat connected to: emulator-5554
    --------- beginning of /dev/log/main
    --------- beginning of /dev/log/system
    ** Activity (main) Create, isFirst = true **~e:main_activity_create (java line: 332)
    java.lang.ClassCastException: example.tablayout.fixedtabsicon.main cannot be cast to android.support.v7.app.ActionBarActivity
    at de.amberhome.objects.appcompat.ACToolBarWrapper.SetAsActionBar(ACToolBarWrapper.java:244)
    at example.tablayout.fixedtabsicon.main._activity_create(main.java:332)
    at java.lang.reflect.Method.invokeNative(Native Method)
    at java.lang.reflect.Method.invoke(Method.java:515)
    at anywheresoftware.b4a.BA.raiseEvent2(BA.java:187)
    at example.tablayout.fixedtabsicon.main.afterFirstLayout(main.java:102)
    at example.tablayout.fixedtabsicon.main.access$000(main.java:17)
    at example.tablayout.fixedtabsicon.main$WaitForLayout.run(main.java:80)
    at android.os.Handler.handleCallback(Handler.java:733)
    at android.os.Handler.dispatchMessage(Handler.java:95)
    at android.os.Looper.loop(Looper.java:136)
    at android.app.ActivityThread.main(ActivityThread.java:5001)
    at java.lang.reflect.Method.invokeNative(Native Method)
    at java.lang.reflect.Method.invoke(Method.java:515)
    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:785)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:601)
    at dalvik.system.NativeStart.main(Native Method)
    java.lang.ClassCastException: example.tablayout.fixedtabsicon.main cannot be cast to android.support.v7.app.ActionBarActivity
    ** Service (svrautostart) Create **
    ** Service (svrautostart) Start **
     
    Asgard likes this.
  8. DonManfred

    DonManfred Expert Licensed User

    Really great work! I like the new Examples very well ;-)
     
    corwin42 likes this.
  9. corwin42

    corwin42 Expert Licensed User

    @Blue.Sky
    My guess is that you are not compiling with v23 android.jar. Check in "Configure Paths" dialog in B4A.

    @FrankDev
    Do you use latest AppCompat library?

    @All
    Be sure you have all libraries at the latest version.
    - SDK support library v23.0.1
    - AppCompat wrapper v2.00
    - AHViewPager

    And compile with v23 android.jar.
     
  10. inakigarm

    inakigarm Well-Known Member Licensed User

    Well, I don't know where's the problem. When trying to run snackbar (scrollingtabs doesn't run also), I get this error:
    Code:
    B4A version: 5.20
    Parsing code.    (
    0.01s)
    Compiling code.    (
    0.51s)
    Compiling layouts code.    (
    0.02s)
    Generating R 
    file.    (6.34s)
    Compiling generated Java code.    Error
    javac 
    1.8.0_45
    src\de\amberhome\designsupport\snackbar\main.java:
    17: error: cannot find symbol
    public class main extends android.support.v7.app.AppCompatActivity implements B4AActivity{
                                                    ^
      symbol:   class AppCompatActivity
      
    location: package android.support.v7.app
    Note: Some messages have been simplified; recompile with -Xdiags:verbose 
    to get full output
    1 errorv
    I've downloaded android sdk v23 (and configured on path), appcompatv2.0 and sdk platform tools v23.01

    Any idea ?
     
    Last edited: Oct 3, 2015
  11. Anser

    Anser Well-Known Member Licensed User

    The Sample attached in the 1st post "TabsWithCustomViewExample1_0.zip" is not working.
    It is expecting a lib named XmlViewEx

    I could not find, so called XmlViewEx lib in this forum. Found a Class Module with that name posted by you. Added that Class module to the project, but I was getting so many errors.

    All other samples posted by you in the post #1 is working fine. :)

    Very nice lib.

    Regards

    Anser
     
  12. DonManfred

    DonManfred Expert Licensed User

    Anser likes this.
  13. Anser

    Anser Well-Known Member Licensed User

    Thanks for the info.

    Need to hunt for the info on "How to compile a class to Lib" and the tools required. Anyway shall start the hunt. Looks like need Eclipse and other stuffs ;)
     
  14. DonManfred

    DonManfred Expert Licensed User

  15. Anser

    Anser Well-Known Member Licensed User

    Yes. It worked.

    Thanks
     
  16. DonManfred

    DonManfred Expert Licensed User

    @corwin42
    You should also mention that you need to compile the XmlViewEx to a library if not already done before. See #11 to #15

    Maybe a good idea to add it to the description in #1
    I fell into this trap too (but was able to do while downloading the class and compiling it to library) :)
     
  17. FrankDev

    FrankDev Active Member Licensed User

    thats the problem :)

    thanks for help and the great lib
     
  18. Croïd

    Croïd Active Member Licensed User

    cheering :)
     
  19. corwin42

    corwin42 Expert Licensed User

    Ok, I will add some more explanations next week. I was a bit stressed this week because we had to prepare a family weekend trip. I just wanted to release all this stuff.
     
    DonManfred likes this.
  20. inakigarm

    inakigarm Well-Known Member Licensed User

    Well, I've found the problem; I suppose was my fault ;-(

    When copying new android-support-v4.jar and android-support-v7-appcompat.jar to my libraries folder, the files didn't overwrite the old files.

    So if anyone have/will have an error like:
    Code:
    error: cannot find symbol
    public class main extends android.support.v7.app.AppCompatActivity implements B4AActivity{
    and android-support-v4.jar and android-support-v7-appcompat.jar are in libraries folder, the solution is to update this files to the new updated jar's from ....Android\android-sdk\extras\android\support\v7\appcompat\libs

    Otherwise, great job @corwin42 !!
     
Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice