Android Question Change the color of a text progressively

LucaMs

Expert
Licensed User
Longtime User
I started to develop a custom view to achieve this:
Untitled.gif


I would like to know if it already exists.

In addition, I will ask someone for help (I do not write but I have some names in mind :)) since beginning to get tired :D.
 

LucaMs

Expert
Licensed User
Longtime User
Well, I had done a couple of tests.

The first without custom view, the second is a draft of a custom view.

If someone wants to collaborate... because it is and will be available to all... [Chargeable - for free :D]

The sources are of a couple of hours ago, so do not pretend that they are the right ones: I've already forgotten :p
 

Attachments

  • t1.zip
    12.3 KB · Views: 164
  • t2.zip
    13.5 KB · Views: 155
Last edited:
Upvote 0

LucaMs

Expert
Licensed User
Longtime User
Main things to do:

change the name of the variable mSliceW :D;

determine whether to adapt the text to the size of the panel or vice versa, or neither;

calculate the proportions to determine the size of the slice if the time has importance

adjust the transparency of the panels;


...
 
Upvote 0

LucaMs

Expert
Licensed User
Longtime User
It seems my diary!

I found a nice problem to use the panels in the custom view.

More precisely, the events of the panels.

Adding a panel in a normal layout, if you added the routine that handles the Touch event, the Click-LongClick events will not be raised.

This is not a problem in a normal layout, but it is in a custom view.
The reason is that in the custom view class the Touch routine MUST be present so that it can eventually raise the routine in the calling module. Thus, the Click and LongClick routines in the custom view class will never be raised.
 

Attachments

  • t2.zip
    13.7 KB · Views: 140
Last edited:
Upvote 0

LucaMs

Expert
Licensed User
Longtime User
I woke up with a great idea :eek::
the custom view must resemble a label; the fact that it is composed of two panels has no importance to the user. So, no Touch event!

But this will be a problem in another possible custom view in the future.
 
Upvote 0

LucaMs

Expert
Licensed User
Longtime User
This is funny :).

As it was, did not allow a second color change, so I made some changes.

Wants someone (like Speedy Manfred :D) find this strange bug while I have breakfast?

The size of the panels change (see the log), who knows where !?

[oooops, I forgot to attach the project]
 

Attachments

  • t3.zip
    13.4 KB · Views: 164
Upvote 0

sorex

Expert
Licensed User
Longtime User
no, even worse :)

320x480 but that's the develop phone at home, my phone only has 240x400.

I noticed a huge scaling script but it was not used, seems to be overkill aswell.
 
Upvote 0

LucaMs

Expert
Licensed User
Longtime User
I should adapt TextSize and "Text positions" used in the canvas DrawText.

For this it would be helpful the intervention of super expert Klaus :D

Also, I wish it were possible to change the color in times of no importance, but also as if it were a progress bar. (this is not a good translation, I trust in your intuition :))
 
Upvote 0

sorex

Expert
Licensed User
Longtime User
do you really type all your posts in google translate first?

I don't know what you mean with that last line.
 
Upvote 0

LucaMs

Expert
Licensed User
Longtime User
I should adapt TextSize and "Text positions" used in the canvas DrawText.

For this it would be helpful the intervention of super expert Klaus :D

Also, I wish it were possible to change the color in times of no importance, but also as if it were a progress bar. (this is not a good translation, I trust in your intuition :))


Thinking a bit 'better, TextSize and Views are resized in the project code (or Designer scripts), not in the internal code of views!
 
Upvote 0

LucaMs

Expert
Licensed User
Longtime User
do you really type all your posts in google translate first?

I don't know what you mean with that last line.

Yes, I almost always write in Italian in Google Translate and then I try to correct the translation it does.

In this way I learn also "new" words.


"Last line":

Io vorrei consentire sia il cambio di colore in tempi prestabiliti dall'utente, sia con le tecniche analoghe ad una progressbar. :D
 
Last edited:
Upvote 0

ivan.tellez

Active Member
Licensed User
Longtime User
For the example:

just draw the Yellow text

then:
Use a timer to...

Clip a region (wider every time)
Draw the Red text
Unclip
if cip > control.width then StopTimer
 
Upvote 0
Top