Are Android app widgets (for home screen) allowed gestures? - android

I noticed that when I swipe my finger from left to right across a home screen widget, in simulator on a AVD, Android switch to the left home screen.
I was wondering if its possible to prevent this behavior and allow home screen gadgets to listen and react to finger gestures (like swipe)? Its very critical for my widget UI design.

Sorry I am posting this reply as a separate answer because it wouldn't fit as a comment. :)
So interaction with widgets is very limited.
The thing is, widgets aren't "mini applications," they are... widgets. They live in the world of, and are dependent upon, the real application containing them.
There is a continual demand for widgets to support more and more complicated interactions, but every time we start down that path it ends up making the interaction with the containing application much more complicated as well, and seems likely to negatively impact overall usability.
For example, if widgets can process swipes, then the user is now very uncertain about how they can swipe between screens because they will get different behavior depending where they swipe. They could even get stuck in a state where it is nearly impossible to swipe between screens because of the widgets covering the touchable area.
So the way I would recommend thinking of widgets is as a window into the key information associated with your app, to jump into more details of that information by tapping on the widget and switching to the app, and possibly some additional buttons to perform key operations.
Also as of 2.0, with the new wallpaper themes, you can make the UI of the activity that the user visits from your widget sit on top of the same wallpaper as home. This makes the switch between it and home feel much more like an interaction inside of home rather than with another application.

Starting with API level 11 (Android 3.0.x) you can use "android.widget.RemoteViewsService.RemoteViewsFactory" and and assign a widget to use (from docs):
ListView: A view that shows items in a vertically scrolling list. For an example, see the Gmail app widget.
GridView: A view that shows items in two-dimensional scrolling grid. For an example, see the Bookmarks app widget.
StackView: A stacked card view (kind of like a rolodex), where the user can flick the front card up/down to see the previous/next card, respectively. Examples include the YouTube and Books app widgets.
See http://developer.android.com/guide/topics/appwidgets/index.html section Using App Widgets with Collections.
So yes - if you use one of the above layouts your widget will accept gestures.

One more is:
AdapterViewFlipper: An adapter-backed simple ViewAnimator that animates between two or more views. Only one child is shown at a time.
Doc: https://developer.android.com/reference/android/widget/AdapterViewFlipper
Example: https://github.com/sunphiz/adapterviewflipper-widget

Related

Android - Create a view that includes the entire screen

I am not the best at android programming so please correct any errors I make.
According to this developer.android.com.
Android view is:
This class represents the basic building block for user interface
components. A View occupies a rectangular area on the screen and is
responsible for drawing and event handling. View is the base class for
widgets, which are used to create interactive UI components (buttons,
text fields, etc.).
However, I have not found an article about how to get a full view. I mean as in an entire screen as a view. The image I used below is to show what I want to include in that view. I want to include everything on screen. Everything On that Screen. (I can't repeat enough). It includes the chat heads, background, and menu bar. Everything that is on screen.
I can't figure out how to get a view like that from a service or from an activity. Any help is appreciated. I don't have exact code because I don't know how to do this.
Edit:
I know that I am very bad at explaining, so if you are confused, I am going to explain what I want to do with my view.
So basically, I want to make a screen tapper that taps for you so you can king of "cheat" games like cookie clicker. Therefore I need a view that contains the entire screen so then I can fake "touches" on the screen.
Hope this cleared any confusion
So you have a few things to deal with. Generally, the menu bar (and possibly soft-key buttons on the bottom) will remain visible. However, you can hide the menu bar:
hide the top menu bar in my android device & Tablet
You may want gestures to allow users to see it. Or, since it appears you are building a game, you just leave it hidden until they hit "home" or "back" or "exit" or whatever.
The "chat heads" are a horrible idea, but some developers think they are awesome. You can see more about that here:
Creating a system overlay window (always on top)
You might find something like this will work (but if new notifications pop-up, it may not help):
http://goobbe.com/questions/1390940/how-to-close-cancel-dismiss-a-system-dialog-programmatically-android

What is the best approach to design a set of "guiding screens" for an android app?

I need to design introduction walk-through screens when my app launches. It can be done by simple ViewPager or horizontal scroll view (?) but the additional requirements which are hindering me from using these are
A lot of animations on each screen
Animations will be bound to scroll position (i.e., current stage on an animation will be determined by how much user has scrolled, and it should roll back animation if user scrolls back without finish gesture)
Some items need to animate across different screens (e.g., There is a box on first screen, when user scrolls to the next screen, the box becomes larger without moving and a graph (a part of second screen) also comes into display under it)
I dont know if I explained the scenario well enough so please ask for clarification in comments. I need just a direction to control/approach/library.
Thanks
I'd recommend this library : ShowCase
In this way, you can make interactive tutorial and walkthrough your app.
You can also take this library and add some functionality.
Use viewpager, for each fragment you can use different animation inside that fragment, each fragment is independent from other views/fragments
You can use horizontal scroll view but it will take extra time and difficult to code
Seems like a ViewPager has everything you need.

HTC Blinkfeed or Samsung's My Magazine implementation?

I was recently looking at apps like Blinkfeed and My Magazine that run as fully functional apps but live right next to the Android home screen. Given that widget can only take up a certain amount of space of the home screen and have limited functionality,I could conclude that they aren't widgets.
I would be interested to know how companies like HTC and Samsung implement these full screen apps that live to the left of the screen. I tried googling it but perhaps I am not googling the right thing as I couldn't find a word about how both of these things were implemented. Hence I decided to turn to the wisdom of the internet !! :D
Consider homescreen as the Activity that has floating buttons (those that are at the bottom).
This activity (fragmentactivity to be precise) contains ViewPager of fragments on each page.
And the leftmost page/fragment is the ListView (Blinkfeed).
(*) are the floating buttons , probably LinearLayout that has transparent background and contains buttons.

How can I suggest a swipe-to-right gesture in a list on a mobile device?

I have done live user testing for a list in my app, and have come to an interesting puzzle.
A list, specifically a single-column table in iOS, may often have a swipe right gesture for more actions, like the twitter app and mail app, and a million other apps. But when important functionality is embedded in the UI beyond that action, and a user cannot figure it out, the only thing that comes to mind to alleviate that is something like the accessory button, ie. a right-pointing triangle or chevron button.
There is probably another way but it's not coming to me. Maybe making the rows taller than normal?
This was meant as a comment but was rejected as too-long.
So after thinking more about this, the ideal solution is a visual clue, rather than painfully obvious text saying "swipe a row for more options". Perhaps when a list (UITableView, etc) is shown and rows (UITableViewCell, etc) are created and added, then as they appear an animation begins of the main visible content sliding into place in the OPPOSITE direction of the desired swipe animation, with a minimal visual indicator afterward, reminding the user that the content is moveable!
Sound good? Optionally, immediately before the animation begins, any underlying content may be shown for a split second (if its supposed to appear underneath). Sweet!

Three listviews in one screen

I have an app on iPhone with cascading design like on the picture, and I'd like to port it to Android. Is there a simple and recommended way to do this?
The section menu on the left (Section A, B,C,D) is the first that the user needs to select, then the user needs to pick a category in the middle (all, popular, pc, xbox,...), then he is presented with a list of articles for chosen category.
I could imagine doing it with three ListViews, but then the app could also listen to a swipe gesture to make the rightmost ListView "full screen", and hide the first two listviews. I could implement a swipe listener for the whole activity and set first two listviews' visibility to hidden, right?
Are my assumptions correct and would this be the right way to do this?
It could definetly work the way you explain it - if the design is good is another discussion. Personally I'm not a fan of throwing in endless amounts of data in one screen, when the space is as limited as it is on most mobile phones (I would probably do it with 3 different screens with a ListView on each)
Implementing the mentioned swipe gesture is doable and you could certainly just hide the two other ListViews with the function setVisibility( View.GONE ).
Hope it helps.
You might want to use the new fragments API, it's specifically built for this kind of thing (and it's compatible all the way down to Android 1.6). Also, as KasperMoerch says, putting all that info on a small screen can get ugly. Using fragments will make it easier for you to gradually increase the amount of information displayed as the screen size increases.
I'm not sure you can just listen for a swipe gesture over an entire activity like that. I think you have to wrap the fragments in a custom view (for example an extended LinearLayout) and do the swipe listening there. However, achieving a finger-tracking animation (i.e. where the rightmost pane follows the finger precisely as it swipes across) is a pretty daunting task (I wouldn't really know where to begin, probably in the custom view though). The best way (I think) to do it is to make a compromise and just start an animation (right-to-left slide) when you detect a swipe. However, the simplest solution is to not animate at all.
You can also take into consideration dropping the swipe gesture altogether and just providing an "expand" button.

Categories

Resources