user-interface-samples | Multiple samples showing the best practices | Android library
kandi X-RAY | user-interface-samples Summary
kandi X-RAY | user-interface-samples Summary
This repository contains a set of individual Android Studio projects to help you get started writing/understanding Android user interface features.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
- Reconstructs a NotificationCompat .
- Generate a BIG_PINT_STY notification .
- Generate a messaging style notification .
- Re - create a NotificationCompat .
- Create a new NotificationCompat .
- Toggles the ui flags .
- Find all elements which match the given pattern .
- Setup the drag event .
- Called when the view is created .
- Refresh all available shortcuts .
user-interface-samples Key Features
user-interface-samples Examples and Code Snippets
Community Discussions
Trending Discussions on user-interface-samples
QUESTION
I'm trying to get text input from a user in a Wear OS app. What I'm looking for is a similar interface to the screenshots below:
Google Notes
Play Store
I have not found anything in the documentation how to achieve something like that. The closest I came across was to use notifications as demonstrated here: https://github.com/android/user-interface-samples/tree/d192c9d2000e43f63cca3eb1b9af05cf2e2ee867/Notifications
This is quite similar to the screenshots from above, the problem however is that this just generates notifications the user then still has to click on. If there is a way such that the notification opens automatically, that would be great
ANSWER
Answered 2022-Jan-03 at 01:53A similar question was already asked here and that solves the issue: https://stackoverflow.com/a/70294785/17818420
The following code sends an intent to get the user input
QUESTION
I'm learning the Android Launcher Shortcuts.
The code A is from the office sample project.
I know that the Launcher Shortcuts API requires Android 7.1 (API 25) or higher.
The Code A can be compiled and run after I replace minSdkVersion 25
with minSdkVersion 21
, why?
Code A
...ANSWER
Answered 2021-Mar-08 at 08:50this feature will be available only on API25+ devices, still you can develop such app also for older devices (assuming there will be more features than shortcuts, then it makes sense :) )
some new features may need some class/method call (like ShortcutManager), which isn't available on older APIs supported by app. then you have to use some if
statement, like:
QUESTION
I am trying to integrate Firebase Cloud Messages into my app. The code I used in the showNotification
function is from the Android User Interface Samples. I tried it in the Activity and it worked but am not sure why it's not working in the service. The println
is showing the function is getting called and values are coming as expected. Is there anything am missing from the function?
ANSWER
Answered 2021-Jan-03 at 20:25Instead of
QUESTION
I am trying to implement the Android Bubbles notifications API but it's not working for me, it's displaying as an ordinary notification. I am testing on emulator API 30(Android 11). I got the people-example working on the device, and I am following the Conversation Notifications guidelines.
- The notification uses MessagingStyle.
- (Only if the app targets Android 11 or higher) The notification is associated with a valid long-lived dynamic or cached sharing shortcut. The notification can set this association by calling setShortcutId() or setShortcutInfo(). If the app targets Android 10 or lower, the notification doesn't have to be associated with a shortcut, as discussed in the fallback options section.
- The user hasn't demoted the conversation from the conversation section via notification channel settings, at the time of posting.
Please tell me what did I missed?
Also, I got a few optional questions about the design of Bubbles.
- At what point of the app should I create the shortcuts and when to update it?
- How the Person object needs to be cached?
This is what I got so far
...ANSWER
Answered 2020-Nov-23 at 15:38The one thing that I missed was adding .setLongLived(true)
for the ShortcutInfoCompat
. It solves the problem.
I learned that it best to manage the ShortcutInfo
on the app level since you can have at most 5 at a time, so there is no harm caching those in memory, it includes the Person
object as well.
Also, you should add LocusId for the NotificationCompat
, this id is shared among shortcuts, notifications, and views. To add it to the views you need to put in some extra work, as described in ContentCaptureManager
QUESTION
I'm learning Notifications, I use Android Studio 4.0 with latest androidx.core.app.NotificationManagerCompat.
There is a sample code about Notifications in the project user-interface-samples.
I find there are many differents about Notifications between this androidx and previous API.
Must the Notifications style be the one of BigTextStyleNotification
, BigPictureStyleNotification
, InboxStyleNotification
and MessagingStyleNotification
?
ANSWER
Answered 2020-Jul-27 at 09:26Following are the notification styles available :
Notification.BigPictureStyle, Notification.BigTextStyle, Notification.DecoratedCustomViewStyle, Notification.InboxStyle, Notification.MediaStyle, Notification.MessagingStyle
You can get more info on this link.
Just for information purposes, to create a notification without hustle and get all predefined formatting in one place, just do the following :
- Go to the Project Tab of android studio and right click.
- Click on New -> UI Component -> Notification
- Enter the required notification name
To call this notification just enter the following :
QUESTION
The following code is a sample code about Notifications in the project user-interface-samples.
Image A will be displayed when I launch BIG_PICTURE_STYLE notification, Image B will be displayed when I click the earth image and the notification icon on top toolbar will dismiss.
1: If I click "No" button on Image A,the notification icon on top toolbar will dismiss and this notification view will dismiss too.
I'm very strange the function private void handleActionComment(CharSequence comment)
in BigPictureSocialIntentService.java has recreates the notification, why will the notification icon dismiss?
2: I modified BigPictureSocialIntentService.java, you can see BigPictureSocialIntentService_Modified.java, then I click "No" button on Image A, I find the notification icon dismiss, but the notification view keep display,you can see Image C, why?
BTW, I test it in API 30.
MainActivity.java
...ANSWER
Answered 2020-Jul-15 at 08:46Reply action is meant to get user replies and display the reply to the user. so the Notification with reply action cannot be dismissed by you.
According to android documentation:
After you’ve processed the text, you must update the notification by calling NotificationManagerCompat.notify() with the same ID and tag (if used). This is necessary to hide direct reply UI and confirm to the user that their reply was received and processed correctly.
You must create another notification like last one and it should not have reply action to tell the user that his/her reply is received.
If you really want to dismiss the notification with the same ID and tag, you can create a normal notification and dismiss it immediately.
QUESTION
The Code A is a sample code about Notifications in the project user-interface-samples.
I trun off the notifications of the app, then run the app, an information "You need to enable notifications for this app"
is displayed.
When I click the Snackbar on API 28 emulator, the following error is displayed:
...ANSWER
Answered 2020-Jul-08 at 05:27update openNotificationSettingsForApp()
this method, there is different code to open notification settings activity for Oreo and above!
QUESTION
I'm learning Notifications.
There is a sample project user-interface-samples, I find many files in the project exists Code A.
But the artical tell me "NotificationCompat is obsolete", please see Image A
1: Code A use latest androidx namesapce, why is it obsolete?
2: Is there a sample project about Notifications based AndroidX which is part of Jetpack.
Code A
...ANSWER
Answered 2020-Jul-05 at 05:29You're looking at the documentation for android.support.v4.app.NotificationCompat
, part of the pre-AndroidX Support Libraries. That class is deprecated, but you aren't using that version, so the documentation there is irrelevant.
The AndroidX equivalent, androidx.core.app.NotificationCompat
is not deprecated.
QUESTION
Are there any examples of using the Jetpack / androidx preference library alongside the navigation component / Single activity? All the examples I'm seeing ( e.g. Google's example ) are using supportFragmentManager and replacing the content of a FrameLayout.
Navigating to the PreferenceFragmentCompat() with the navigation component almost works, in that it shows the Preferences page, but it is missing all of the toolbar/navigation icons. It's just implanted over the previous fragment, so to exit it, you need to hit the hardware back button.
Looks like this already has an issue filed with Google's issue tracker here
...ANSWER
Answered 2020-Feb-01 at 20:30I just ran into the same problem and this is how I implemented it. Before I get into the code I want to give a quick summary. I have a single activity and two fragments. One of the fragments is the main fragment that is the home screen for the application and the other is the fragment that shows the settings. I end up not using SupportFragmentManager
(which Google shows in their settings guide) as I was running into the same problem where the view would just appear on top of the previous view. So I just navigate to the settings fragment in the same way you would navigate to any other fragment in the single activity architecture using findNavController().navigate(...)
.
Firstly you will need to add the appropriate dependencies to your app build.gradle
:
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install user-interface-samples
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page