B4A Library DesignSupport - Additional Material Design components

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.pngScreenshot_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:
Note: Please, Please read these instructions carefully. AppCompat depends on many things like a special theme with special features. Even special versions of build tools are required and last but not least there are often bugs in the Google support libraries.

I created this instructions to help you getting things ready for using AppCompat. So please follow these instructions carefully and all should work as expected and you don't have to ask in the forum.

Thanks.
  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:
B4X:
<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:
B4X:
<item name="android:windowDrawsSystemBarBackgrounds">true</item>
<item name="android:statusBarColor">@android:color/transparent</item>

Your support:
Creating libraries and wrappers for existing library projects is a lot of work. The use of this library is totally free and you even don't need to mention in your app that you use it.
But if you use this library in your projects and you think it is useful to you please consider to make a donation:

Thanks very much for your support.


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
 

Attachments

  • FixedTabsExample2_00.zip
    23.4 KB · Views: 1,867
  • FloatLabelEditText1_0.zip
    8.2 KB · Views: 1,529
  • FloatingActionButton1_0.zip
    12.5 KB · Views: 1,626
  • ScrollingTabsExample2_00.zip
    8.3 KB · Views: 1,630
  • SnackBarExample2_00.zip
    7.7 KB · Views: 1,514
  • TabsWithCustomViewExample2_0.zip
    24.5 KB · Views: 1,762
  • NavigationView1_0.zip
    108.9 KB · Views: 2,427
  • BottomNavigationViewExample1_0.zip
    28.7 KB · Views: 1,666
  • DesignSupportLib2_31.zip
    58.3 KB · Views: 1,298
  • DesignSupportLib2_32.zip
    58.3 KB · Views: 2,052
  • DesignSupportLib3_00.zip
    65.9 KB · Views: 2,284
Last edited:

corwin42

Expert
Licensed User
Longtime User
Dear all examples I get the following error, not to be due, I am using his last libs.

Can you post the stacktrace? Without it is guessing in the dark. Here I guess you are using the wrong version of "Android SDK Build-tools". See the setup instructions of AppCompat library.
 

rscheel

Well-Known Member
Licensed User
Longtime User
Can you post the stacktrace? Without it is guessing in the dark. Here I guess you are using the wrong version of "Android SDK Build-tools". See the setup instructions of AppCompat library.

I am using the following libraries and SDK.

Captura.PNG Captura1.PNG

Captura2.PNG Captura4.PNG
 

corwin42

Expert
Licensed User
Longtime User

rscheel

Well-Known Member
Licensed User
Longtime User
Oh you all are so glad that I had all your errors and problems before. :p

As I said: Read the "setup the library" section of the AppCompat Library thread. Your issue will vanish when you do step 2.

I just saw my mistake, thanks for the help, but I had a problem with the sdk, so I'll have to install it again.
 

rscheel

Well-Known Member
Licensed User
Longtime User
With its new development will be possible to include a material drawer as used in android studio, maybe this bad asking this here, if so delete it.

Screenshot_20160624-103558.png
 

corwin42

Expert
Licensed User
Longtime User
With its new development will be possible to include a material drawer as used in android studio, maybe this bad asking this here, if so delete it.

I tried to add the NavigationView (which is part of the design support library) to this library and I wanted to make it compatible with AHNavigationDrawer library. To wrap the NavigionView would be easy. The problem I had was to change AHNavigationDrawer that it displays under the StatusBar. This is even tricky with XML Layouts (design support library adds additional layouts itself if you inflate an xml layout to make all things work).
I wasn't able to do this programatically and I didn't want to use xml layouts so I stopped my efforts.

Currently there are two librararies that create such a drawer in Material design but I would consider both to be beta but they are usable.
https://www.b4x.com/android/forum/threads/67557/#content
https://www.b4x.com/android/forum/threads/53883/#content

I myself started a wrap of this library but it takes much time to do it and do all the testing.

So short answer: Yes, there will be something in the future that you will be able to create such drawer.
 

fredo

Well-Known Member
Licensed User
Longtime User
Problem with ScrollingTabsExample2_00
after updating DesignSupport and AppCompat lib I get this errormessage: 24-06-_2016_17-54-34.jpg
The file "C:\Basic4android_600\libraries\android-support-v4.jar" could not be found

I followed the necessary steps for DesignSupport lib:

  1. This library depends on the AppCompat library. So do all the setup needed for AppCompat.
  2. Copy the DesignSupport.xml and DesignSupport.jar files to your CustomLibs folder
  3. Install/Update "Android Support Repository" with the SDK Manager. Use at least support repository 33.

and according to step 1 above I installed AppCompat new.

If you upgrade from an earlier release you can deinstall the "Android Support Library" since it is outdated and marked as obsolete in the Android SDK.
  • First copy the AppCompat.jar, AppCompat.aar and AppCompat.xml files to your additional libraries folder.
  • Start the Android SDK-Manager and download/update the latest Extras->Android Support Repository. Use at least support repository 33!
  • In Android SDK-Manager be sure that the "Android SDK Build-tools" 23.0.3 is installed!
  • In the B4A IDE in your projects check the AppCompat library on the libraries tab.
  • Make sure that you reference the latest android.jar in the IDE under the "Tools/Configure Paths" menu.
  • If you are updating from a version older than v3.20 then remove the b4a_appcompat resource folder delivered with older versions of this library.
To use the AppCompat library your activities MUST extend android.support.v7.app.AppCompatActivity (extending the old android.support.v7.app.ActionBarActivity still works.)

SDK and B4A-paths looked like this after all those steps:
24-06-_2016_18-07-25.jpg

So, since the merrormessage states that the file "android-support-v4.jar" is missing I must have set something wrong.

When I tried to do my copybackstep as described here, I noticed, that there is no "extras\android\support\"-folder anymore (naturally, because I deinstalled the "Android Support Library").


What am I missing?
Does anyone have a clue?




 

corwin42

Expert
Licensed User
Longtime User
What am I missing?
Does anyone have a clue?

Updating to AHViewPager 3.0 should fix it.

Normally B4A should handle this issue automatically but if I understood Erel correct, there is still a bug which causes this problem.

Btw: Thanks very much. :)
 

rscheel

Well-Known Member
Licensed User
Longtime User
Problem with ScrollingTabsExample2_00
after updating DesignSupport and AppCompat lib I get this errormessage: View attachment 45399
The file "C:\Basic4android_600\libraries\android-support-v4.jar" could not be found

I followed the necessary steps for DesignSupport lib:

  1. This library depends on the AppCompat library. So do all the setup needed for AppCompat.
  2. Copy the DesignSupport.xml and DesignSupport.jar files to your CustomLibs folder
  3. Install/Update "Android Support Repository" with the SDK Manager. Use at least support repository 33.

and according to step 1 above I installed AppCompat new.

If you upgrade from an earlier release you can deinstall the "Android Support Library" since it is outdated and marked as obsolete in the Android SDK.
  • First copy the AppCompat.jar, AppCompat.aar and AppCompat.xml files to your additional libraries folder.
  • Start the Android SDK-Manager and download/update the latest Extras->Android Support Repository. Use at least support repository 33!
  • In Android SDK-Manager be sure that the "Android SDK Build-tools" 23.0.3 is installed!
  • In the B4A IDE in your projects check the AppCompat library on the libraries tab.
  • Make sure that you reference the latest android.jar in the IDE under the "Tools/Configure Paths" menu.
  • If you are updating from a version older than v3.20 then remove the b4a_appcompat resource folder delivered with older versions of this library.
To use the AppCompat library your activities MUST extend android.support.v7.app.AppCompatActivity (extending the old android.support.v7.app.ActionBarActivity still works.)

SDK and B4A-paths looked like this after all those steps:
View attachment 45400

So, since the merrormessage states that the file "android-support-v4.jar" is missing I must have set something wrong.

When I tried to do my copybackstep as described here, I noticed, that there is no "extras\android\support\"-folder anymore (naturally, because I deinstalled the "Android Support Library").


What am I missing?
Does anyone have a clue?



Replace your library AHViewPager v2.21 to v3.00
 

ivan.tellez

Active Member
Licensed User
Longtime User
Hi, is there a way to make the DSFloatlabelEditText read only?

Setting the "enabled" property to False, does nothing on the designer nor programatically. I'm doing something wrong or its a bug?

Thanks
 

corwin42

Expert
Licensed User
Longtime User
Hi, is there a way to make the DSFloatlabelEditText read only?

Setting the "enabled" property to False, does nothing on the designer nor programatically. I'm doing something wrong or its a bug?

Will be fixed for the next version.
 

Roberto P.

Well-Known Member
Licensed User
Longtime User
Hi All
How to add menu in AcToolbarLight?
Thanks
 

corwin42

Expert
Licensed User
Longtime User
IAlso, just curiosity, when you set a error text, its the standard behavior for the floating label to stay on top, even when the text is empty?
This seems to be the normal behavior.
Hi All
How to add menu in AcToolbarLight?
Thanks
This question is not related to this library. Please create a new thread in the questions forum.
 

corwin42

Expert
Licensed User
Longtime User
A small preview of the main new feature of the upcoming version of the DesignSupport library. Hope you will like it...

Screenshot_20160826-160906.png
 
Last edited:

scsjc

Well-Known Member
Licensed User
Longtime User
Hello,
is possible resize height from SnackBar ?

thanks!!!
 

DonManfred

Expert
Licensed User
Longtime User
is possible resize height from SnackBar ?
If i remember correctly the size of a snackbar is 80dip per guideline. 112dip for a snackbar with two lines and an action.
I don´t think it can be changed but i´ll accept other answers too :)
 
Top