Android - custom view and animation - android

I am experimenting with Views in Android and am trying to create a custom 'widget'. What I want to do is create a portion of a circle with an indicator at 12'o clock. I'd then like to to swipe over the circle and when I do, I'd like to see the indicator move to left or right corresponding to a swipe to the left or the right.
I have looked up a number of sources however I am unsure of how to draw an 'indicator' within the arc. In addtion, what needs to be done to animate the arc ? Can this be achieved without OpenGL ?
I am aware of the circlular progress bar and I believe the problem is quite similar, however I didn't have to add a marker inside the circle.
Here is an image of the screen shot of the View I would like to recreate:

This approach would work,Creating a View with rounded corners and position it to bottom to make it seem like arc

Related

Draw Arc horizontally on a view layout

Task : To animate arc with alpha, scaling pulse
I have done almost everything using this Code : "https://github.com/booncol/Pulsator4Droid/blob/master/pulsator4droid/src/main/java/pl/bclogic/pulsator4droid/library/PulsatorLayout.java"
The only change I want to do instead of full circle I want half of it only arc would be great. But this drawn shape should be from bottom to top and placed horizontally on view.
I have searched half of the Internet for implementing this silly thing but
my drawn arc or circle is either like : "(" or ")" I want this curved shape to be facing top like in Some outgoing radiation type.
Have a refference from this link
https://github.com/DevLight-Mobile-Agency/PulseView
This will generate a wave from your icon's shape..
So i believe, for semi-circle wave, the requirement will be a semicircle icon .

Alpha fade direction on Android

Is it possible to change the alpha value of an ImageView along a specific direction i.e. from top to bottom or bottom to top on Android?
I am trying to animate with imageView.animate().alpha(0).setDuration(500).start();
however this just fades the entire view out uniformly, but I'd like to do this form top to bottom instead.
Any help appreciated.
As far as I know, it is not (yet) possible with the Android built in animations. You will have to create your own custom animation.
Haven't tried, but maybe you can achieve this by using the Transformation class, and/or overriding the onApplyTransformation method from the AlphaAnimation class
method.

Cut hole in (any)layout, that shows the underneath layouts

What I want to achieve is this
sample
basically there must be 2 layers where the one on top needs to have a hole on a specific location, with a specifc radius, that can show the underneath layout. Moreover, the hole can must be able to be resized (scale animation).
The best thing I've found is a proper library (https://github.com/amlcurran/ShowcaseView) but looks limited and I don't want to import a library just for that. Another solution could be to add a custom shape and add it as a background to the top Layout (the problem with that solution is that I am not able to move the shape and to set the position/size). Or I could have a canvas and draw over it but looks overkill.
Is there an easier component to I use in order to achieve this result?

Curved buttons and a circle

Hey I was wondering if there is any way to do this without going insane with lil buttons built up to make it but basically what I want to do is make two curved buttons around a circle one, is there any way of doing this?
Hers an example of what I kinda want, sorry for how crude the drawing is.
There are two parts in answering this question : how to have buttons looking like this, and getting the touch on the areas you draw.
For the first part, you can use a FrameLayout or a Relative Layout to draw your buttons exactly where you want, and custom images as background (maybe for the circle you can make a ShapeDrawable).
For the second part, it can be very simple : if the Circle (biggest button) is on top of the other two, then this can be ok. But I guess the touchable area on each button will be a rectangle.
Another way to do this is create a custom view, handle the Touch events yourself and based on the X and Y, detect which part has been touched

android - how to define touchable areas inside a circle

I'm currently trying to create a circle (via canvas drawing, opengl or drawable) and define 4-5 buttons inside of it. My first thought was to create some drawables (quarters of circles) and overlay them onto the main circle, but then I'll have the touchable zone too large - e.g. in the middle of the main circle.
Is there anyone who tried this and found a decent solution to it?
You could just override onTouch() in your custom View that draws the circle (and other button graphics), and do a bit of simple maths when you get the finger down event to determine whether the user has touched within the circle, and what particular defined zone within the circle.

Categories

Resources