We have an SMS app for Android Wear (https://play.google.com/store/apps/details?id=com.awear.coffee)
Right now we use regular notification actions and when you select Reply it launches our activity on the watch. I want to replace the Reply action with a notification page with a custom activity that holds a few buttons and a list of strings.
I've tried two approaches.
Create a large notification page that holds the content
This doesn't work because Notification.WearableExtender.setCustomContentHeight has a hidden max value so the content gets clipped. I think it's the same height as if you use setCustomSizePreset(SIZE_LARGE). I've verified that if I use a default notification with a ton of text it can be larger than this, but if you use a custom display intent it gets clipped.
Use a fullscreen notification page and add a scrollview to it
This doesn't work because the input gets blocked somehow. Whenever you scroll the activity receives Action.DOWN, Action.MOVE, Action.CANCEL in that order, so you only get one Action.MOVE no matter how long you drag. I'm guessing this is because the OS wants to control the left/right swipes.
Any ideas on how to get around this? I've tried setting custom onTouch listeners but they still never receive all the touch events.
Any help would be appreciated. It would make our app much better if we could reduce the number of taps and swipes needed.
Jakob
if you are using bridged notification(With out having wear module) You can insert extended text content to your notification by adding one of the "big view" styles(InboxStyle,BigTextStyle) to your notification. On a handheld device, users can see the big view content by expanding the notification. On a wearable device, the big view content is visible by default.
BigTextStyle bigStyle = new NotificationCompat.BigTextStyle();
bigStyle.bigText(someBigText);
NotificationCompat.Builder notificationBuilder =
new NotificationCompat.Builder(this)
.setSmallIcon(R.drawable.ic_small)
.setContentTitle(title)
.setContentText(contentText)
.setContentIntent(viewPendingIntent)
.addAction(R.drawable.ic_map,
getString(R.string.somestring), mapPendingIntent)
.setStyle(bigStyle);
I ran into the same problems.
The limit on setCustomContentHeight is frustrating. I couldn't find a way around it.
Likewise, there doesn't seem to be a good way to circumvent the limitations imposed on tap-listeners with the fullscreen notification.
My solution was to add an Action to the first page of the notification that launches an Activity based on the GridViewPager. Once there, the limitations are gone, but it still mostly looks like a Notification. With the principal differences being, (1) you have to 'tap' the first Notification card, rather than swipe it, and (2) swiping up and down don't automatically go to the next/previous notifications.
Related
I have installed Aritchie userdialogs version 5 and I'm using Xamarin.Forms Version 2.2. When I use UserDialogs.Instance.ErrorToast on Android, if the text is longer than screen width, it cut.
This is a problem cause the user might not see important part of a message.
(Same toast message on iOS for example not truncated and it takes the size of the content automatically).
How can I increase the height of this rectangle, or set an autosize if exist ?
When your Android app is running with a AppCompatActivity based Activity (which it seems that your is since it is using Material Design), Acr UserDialogs is creating a SnackBar for displaying the Toast, and by design a Google/Android SnackBar is supposed to be a short message.
https://www.google.com/design/spec/components/snackbars-toasts.html
Snackbars provide lightweight feedback about an operation by showing a brief message at the bottom of the screen
As such there is not built-in method for auto-sizing or multi-line wrapping of text. There are other SO questions related to this and their answers all point to the thing, you would need to modify the Android-based view that is contained within the Snackbar fragment when it is created:
TextView tv = (TextView) view.FindViewById(Resource.Id.SnackbarText);
// change the font size, view size, content wrap settings, etc...
If these are important messages that the user needs to dismiss, perhaps using a popup dialog would work in your design.
I'm a bit of a newbie so I apologize if this is an easy question.
I'm following this tutorial: http://www.truiton.com/2015/03/android-cardview-example/#comment-7174
It shows how to make a few CardViews in a layout with 2 TextViews in each - all programmatically.
I would like to modify it to have a Button instead of the TextViews and to have each Button make a Toast notification upon press. I am currently stuck because I have no context to make the Toast with (because I can only access the buttons in the MyRecyclerViewAdapter class). How may I solve this?
Well the fact that you have access to a button, means you have acces to a context. and to my knowledge, a onclick event on a button means that the button is still alive, and then you could assume that the context for the button is still active. The way to get the context from a view is very simple:
view.getContext();
The reason i mention the assumtion is that, relying on a view's context, could be a bad idea (for example after calling a webservice or something else, where a view could have been destroyed).
Summery:
I have a custom UITabBarAutoRotateController which returns YES from shouldAutorotateToInterfaceOrientation. This has no effect.
If I minimize and show the app again, the rotation issue goes away.
How do I refresh the screen so the user does not have to do this (so rotation works again)?
Details (setup graphically, so no code):
I have two UITabBarController in MainWindow.xib. I only want one to show at a time. So I am linking graphically rootViewController = tabBarController_name1. There is also tabBarController_name2.
I will also have an alert MessageBox for a user to choose what type of application they need, and it will choose a tab bar controller based on their request (per customer definition). This is commented out for now.
There is a bug with Rotation when two UITabBarControllers exist on the same xib. When I try to rotate the screen, it stays upward with wherever the main screen button (power button looking button) faces. HandleOrientationChange does not get called on the active custom ViewController being shown.
The reason I believe it's a bug is because if I hit the main screen button (minimizing the application), and click back on the application (brings it back to the foreground), rotation works perfectly!
Sorry for making you read all that mumbo :). My true question is, "Is there anyway I could refresh the main window or likewise UITabBarController's to get rotation working (without requiring the program be minimized and shown)"? A work-around, if you will?
p.s. I cannot use Storyboard for backwards compatibility reasons. The customer will be receiving this code/project. So I would like to keep this in one graphical page, rather than hiding/showing UITabBarItem's.
EDIT: two-uitabbarcontrollers-and-autorotation and uitabbarcontrollers-and-uinavigationcontrollers were both helpful, but did not address "why" this issue happens. "noob" here when it comes to xcode :)
Tab bar controller inside a navigation controller, or sharing a navigation root view is the answer. Do not use a TabBarViewController. Which, as a noob, I'm not quite sure why TabBarViewController exists (or at least isn't depreciated).
Dragging two TabBarViewControllers into the same page should result in a warning saying that you probably want to implement TabBarViewController by making a custom UIViewController and attaching a plain UITabBar to it.
Frustrating...but finally making progress :)
I'm trying to build an image gallery with photos fetched through an API. The API only allows 1 photo to be fetched at a time.
I want to display a photo and when the use swipes left/right display the previous or next photo.
I'd like the user experience to be seamless/fast. In order to achieve this I was thinking of doing the following:-
When a photo is viewed in full screen, fetch the previous and next photo in the background.
However, what event should I use so that the API call process does not cause any delay to the user.
So my question is, is there an event that is triggered after the photo/contents of the view is displayed on the screen.
That way , I can call the API in that event and pre-fetch the data.
If there's a different approach altogether I should take then please do suggest that too.
Thanks.
The approach you can take is slightly different that what you think. The viewActivate event I believe is the one that is fired off when the view is fully rendered and is ready to be pushed to the screen, but I believe that firing off your request will cause some chunky behavior in the transition which brings the view on to the screen. What you really want to do is add an event listener to the actual transition that brings the view onto the screen and when the transition completes you should then fire off your API request to get the additional pictures. A transition fires off a FlexEvent.TRANSITION_END event when a transition is completed. So attach your listener to that and it should do what you are looking for.
i'm attempting to get code to list of all icons visible in the notification area, to the left of the time. i've been experimenting with EnumDesktopWindows and GetWindowLong, without finding any way to single out the system tray icons. thanks!
Use the accessibility interfaces to enumerate the children of User Promoted Notification Area.