B4A Library MSMaterialEditText

Edit: See this post for imho a better B4A implementation.
-------------------------------------------------------------------------------------------------
 
Last edited:

BarryW

Active Member
Licensed User
Longtime User
Edit: See this post for imho a better B4A implementation.
-------------------------------------------------------------------------------------------------


This is both a post for a library port and also for library help.

Source
So basically I ported this library: https://github.com/desmondtzq/MaterialEditText

Purpose
This allows you to create a FloatingHint, which is a very cool effect. See here for effect:
This is an Development version, well before Alpha.

Requires some additional res files attached to this post.

Questions and Issues
Theme
Like the EditTextWrapper, the MaterialEditText extends EditText, then I further wrap it in <TextViewWrapper>.
In my opinion EditTextWrapper and MSMaterialEditText have the same hierarchy and inheritance.
However, for some reason, my MaterialEditText does not get applied the same theme (e.g. holo) as an EditText? The is demoed in the sample.

Secondly, how do I inherit documentation and param names?

Thirdly, how can I override Initialize?

How to set this to a single line only... Tnx
 

BarryW

Active Member
Licensed User
Longtime User
PasswordMode is not working on your clsMaterialEditText . . . Any Suggestion?
 

thedesolatesoul

Expert
Licensed User
Longtime User
Works for me with one line of code
B4X:
MET2.AsEditText.PasswordMode = True
1zv4aj6.jpg
 

Joni Van Roost

Member
Licensed User
Longtime User
Hello thedesolatesoul,

I would really love to use this library for my project, but I can't seem to figure out how to get it to work.
Could you post an example or something? Because when I add the customview and set it as clsMaterialEditText it just shows up completely white.

Thanks in advance.
 

Joni Van Roost

Member
Licensed User
Longtime User
It happens in the final app, I changed the color and it shows up in the color I selected but it's completely blank and I can't click on anything.
 

Joni Van Roost

Member
Licensed User
Longtime User
I don't really use a designer script either.. I just added the customview with the designer and then set it as clsMaterialEditText. I can't really upload my project because it's quite big and contains a lot of SQL. I am using appcompat though so maybe it is because of the material themes as you said earlier? Could you perhaps upload an example so I can have a look at how you do it? It's probably something I'm doing wrong. Thanks in advance.
 

thedesolatesoul

Expert
Licensed User
Longtime User
Yes i think its a theme issue but i cant help you without reproducing your problem. My example might work fine for you, what we need to understand is what is causing the issue in your project. If you could cut down your project to the point where you only keep the manifest and the activity/layout intact and remove everything else then we can see what the problem is.
 

Joni Van Roost

Member
Licensed User
Longtime User
I took out the Login screen and modified it for this example, I also added the Manifest file from the full project but I had to comment out a lot of stuff because it uses appcompat and Google Maps libraries and such. As I said it's probably something I'm doing wrong but I can't seem to figure it out. I'm sorry about the comment lines, they are in dutch so my other group members can understand my code ;)

I had to upload it to dropbox because the file was just a little bit too big too upload here so here's the link:

https://www.dropbox.com/s/dyhtiw6t79o6psr/Example.zip?dl=0
 

thedesolatesoul

Expert
Licensed User
Longtime User
I took out the Login screen and modified it for this example, I also added the Manifest file from the full project but I had to comment out a lot of stuff because it uses appcompat and Google Maps libraries and such. As I said it's probably something I'm doing wrong but I can't seem to figure it out. I'm sorry about the comment lines, they are in dutch so my other group members can understand my code ;)

I had to upload it to dropbox because the file was just a little bit too big too upload here so here's the link:

https://www.dropbox.com/s/dyhtiw6t79o6psr/Example.zip?dl=0
Ok, Im guessing you are testing on an Android 5 device.
This happens because the theme is actually white text on a dark background. But B4A EditTexts are not able to follow the theme as you are aware. You have to use the AppCompat versions to make them theme compatible.
To make the text visible, I just added:
B4X:
MaterialEditText.AsEditText.TextColor = Colors.Black
This is something you need to probably decide when finalizing the theme and color schemes of the app.
 

Joni Van Roost

Member
Licensed User
Longtime User
I tried using your solution but it doesn't seem to make a difference, I set the debugger to "Debug" instead of "Release" (which I should've done before I posted this, I'm sorry) and It shows me an error. Maybe it has something to do with a library that is incompatible?

Here's the log file
 

Attachments

  • log.txt
    6.8 KB · Views: 154
Top