Get start and end icon view from TextInputLayout - android-textinputlayout

I want to get the end and start icon view from TextInputLayout so I can do stuff like check if it is hovered or not.
I don't know where to start (idk if this is possible), so any help will be greatly appreciated.

this.binding.inputLayout is the TextInputLayout:
// Get start icon
CheckableImageButton startIcon = this.binding.inputLayout.findViewById(com.google.android.material.R.id.text_input_start_icon);
// Get end icon
CheckableImageButton endIcon = this.binding.inputLayout.findViewById(com.google.android.material.R.id.text_input_end_icon);

Related

How do you show a video in it's correct dimensions in codenameOne?

I am displaying videos on a form but the video is always stretched to a square. I can't get hold of any video component to get it's true size. This is the code to display video:
imageVideoContainer = new Container(new BorderLayout(BorderLayout.CENTER_BEHAVIOR_SCALE)) {
protected Dimension calcPreferredSize() {
return new Dimension(Display.getInstance().getDisplayWidth(), Display.getInstance().getDisplayWidth());
}
};
media = MediaManager.createMedia(FileSystemStorage.getInstance().getAppHomePath() + movePath, true);
mp = new MediaPlayer(media);
mp.setAutoplay(true);
imageVideoContainer.add(BorderLayout.CENTER, mp);
container = new Container(new BoxLayout(BoxLayout.Y_AXIS));
container.add(BorderLayout.centerAbsolute(imageVideoContainer));
If I don't overwrite the calcPreferredSize it doesn't display at all. Any help appreciated. I've tried debugging to look into Media Player to get something that has a size but can't find anything.
The problem is that until the video is loaded the size isn't there. So when you add it to the form it's preferred size will be 0.
You then add it to center absolute which requires preferred size to position/size the video. A solution can be to start the video then call revalidate() to redo the layout and position the video correctly.

Im Trying to get Apple Script to Read A file and tell me if certain key words are in there

I've gotten this far but I don't know what to do next if you know.
Can you please make edits to the script and then post the script back?
on TerrorChecker()
tell application "Finder"
read ("/ Users / BenEvans / desktop / Test")
if "Blue,Red,Yellow" then display dialog "Terror Alert" buttons {"OK"} default button 1
end tell
do
Nothing
end TerrorChecker
TerrorChecker()
end TerrorChecker
assumed there's a file contains the keyword "darkness", try this one:
set fileContent to (read (choose file))
if "darkness" is in fileContent then
display dialog "terror alert" buttons {"OK"} default button 1
else
say "no keyword found"
end if
btw, the command read cannot handle property file, e.g. *.pdf, *.xls
then try this one:
set fileContent to (read (choose file))
if "blue" is in fileContent then
display dialog "terror alert" buttons {"OK"} default button 1
else if "red" is in fileContent then
display dialog "terror alert" buttons {"OK"} default button 1
else if "yellow" is in fileContent then
display dialog "terror alert" buttons {"OK"} default button 1
else
say "no keyword found"
end if
Your example was a little bit of a mess, so I've modified it below.
on run
TerrorChecker()
end run
on TerrorChecker()
tell application "Finder"
set theData to read "/Users/BenEvans/Desktop/Test"
if theData contains "Blue,Red,Yellow" then
display dialog "Terror Alert" buttons {"OK"} default button 1
end if
end tell
end TerrorChecker

Why doesn't show markers in processing using unfoldingmaps?

I want to maker a marker. I use mac.
I try to make this by processing. And I use an unfoldingmap library.
But a marker doesn't show.
Additionally, I draw a text for knowing my position. But It doesn't show.
Thank you for your answer!
import de.fhpotsdam.unfolding.*;
import de.fhpotsdam.unfolding.geo.*;
import de.fhpotsdam.unfolding.utils.*;
import de.fhpotsdam.unfolding.providers.*;
import de.fhpotsdam.unfolding.marker.*;
UnfoldingMap map;
void setup() {
size(800,600);
map=new UnfoldingMap(this,new Google.GoogleMapProvider());
MapUtils.createDefaultEventDispatcher(this,map);
Location seoulLocation=new Location(37.549,126.989);
map.zoomAndPanTo(seoulLocation,10);
float maxPanningDistance=30; //in km
map.setPanningRestriction(seoulLocation,maxPanningDistance);
SimplePointMarker seoulMarker=new SimplePointMarker(seoulLocation);
//SimplePointMarker dublinMarker=new SimplePointMarker(dublinLocation);
map.addMarkers(seoulMarker);
map.setTweening(true);
}
void draw() {
map.draw();
// position showing
Location location=map.getLocation(mouseX,mouseY);
fill(100);
text(location.getLat()+","+location.getLon(),mouseX,mouseY);
}
I try to show my mouse position in draw fucntion.but It doesn't show.
But if I delete "map.draw()", then I can show. But I don't know why.
When I run your code, both things show up.
The marker is here:
You can zoom in to see it better:
Similarly, I also see the text. In this screenshot, my mouse is just to the right of the marker:
If this is not what you're seeing, then check the console are of the Processing editor for any errors.

image array creating unwanted image in top corner

I have this set up in my main.lua file
images = {
display.newImageRect("images/player3.png", 45,35),
display.newImageRect("images/player4.png", 45,35),
display.newImageRect("images/player5.png", 45,35)
}
and call it from my game.lua file with this code:
bird = images[math.random(1,3)]
bird.x, bird.y = -80, 140
bird.name = "bird"
physics.addBody( bird, "static")
bird.isFixedRotation = true
birdIntro = transition.to(bird,{time=1000, x=100, onComplete= birdReady})
A random image spawns (where it should, in the middle) but the issue is that a second image spawns and sits in the top left corner of the screen (slightly off screen). I can't seem to remove it and keep the one correct image only, any solutions?
Your help is greatly appreciated.
Thanks
I think the problem is your images array. I've found by calling the display.newImageRect it will create the object and plop it on the screen. Even if you don't want it to show the object right then. Usually I see this when I should be putting it in a display group (not sure if you are doing that).
I think the solution might be to have the array of images be the image paths and then you can set bird equal to a new image rect at that point, thus only creating 1 image rectangle instead of 3.
images = {
"images/player3.png",
"images/player4.png",
"images/player5.png",
}
bird = display.newImageRect(images[math.random(1,3)],45,35)
Let me know if that works.

Libgdx Animation run loop only twice

So I'm trying to stop an animation after running twice.
I am playing the animation by setting
Animation blink = new Animation(BLINK_TIME, frames); // parameters are my fields
This is how i get my current frame:
if(animate){
stateTime += Gdx.graphics.getDeltaTime(); //stateTime was initialized to 0
currentFrame.setRegion(blink.getKeyFrame(stateTime, true));
}
else
currentFrame.setRegion(defaultRegion); // again, my own field!
Everything works fine uptill here when the animate field is true.
Now I want to stop the animation, this is what I do for it:
if(blink.isAnimationFinished(stateTime)){
blinkTimes++;
if(blinkTimes>=2)
animate = false;
}
The problem is, isAnimationFinished(stateTime) never gets called. I guess it has to do something with looping animation. Can someone please point me in the right direction?
Thanks!
Found the Problem!
isAnimationFinished(stateTime) does not work when animation is being played in the loop. So, I had to play it in Animation.Normal mode and use false in blink.getKeyFrame(stateTime, false) telling the Animation class to run it in non-loop mode!
Everything seems ok. I think you have initialized
stateTime = 0;
inside the render method or update method where firstly its value = 0 and then you add deltaTime to it.. In the end it never reaches to position where animation gets finished.
I think you should log the value of stateTime when your
if(animate) // log what is your stateTime
And 1 more thing
if(blink.isAnimationFinished(stateTime)){
blinkTimes++;
stateTime = 0 ; //----------- because your animation should start from begining else it will complete 2 cycles in no time.
if(blinkTimes>=2)
animate = false;
}
I hope this helps.. and if i am not getting your question properly just let me know.

Resources