Tag: Apps

Snippet app

While writing another app to help me with Android app development I thought it would be great to have the functionality of an app that I had used in the past in the app also.

That app is called Texpand and it allows you to save multiple files of text with associated abbreviations so that you can recall them in other apps on your device.

I always wondered how they achieved that functionality, so as Texpand was closed source, I set out to find out if I could replicate it in my own app.

This led to the creation of the app above that I’ve called Snippet. As well as publishing it on the play store it’s open source so feel free to take a look at the code on my Github account – https://github.com/andyb129/Snippet

Texpand still has its place as it has more functionality, but hopefully this simple implementation will be useful to people as well and as it’s open source I hope it helps other dev’s learn about the AccessibilityService in Android that they could use in their own apps.

How it works

Essentially the app centers around the AccessibilityService class that is available in Android.  You can create your own AccessibilityService and provide the user with information depending on the events that happen as show below (either across all android apps or specific ones).

class SnippetTextAccessibilityService: AccessibilityService() {

    override fun onAccessibilityEvent(accessibilityEvent: AccessibilityEvent?) {

        if (rootInActiveWindow != null) {
            if (accessibilityEvent.eventType == TYPE_VIEW_TEXT_CHANGED) {
                //perform action
            }
        }
    }
}

Once we have isolated the event, in this case TYPE_VIEW_TEXT_CHANGED , then we can use the information in that event to display the overlay to the user that you see in Snippet.

The overlay is the second part of the puzzle in this app and is generated by creating a Service and displaying a layout to the user that they can tap which then pastes the snippet of text.

The text snippets are searched and retrieved from a simple Room database that is mainly based on this excellent example provided by the team at Google (with a few tweaks) –

https://github.com/googlecodelabs/android-room-with-a-view/tree/kotlin 

I hope people find this useful and can learn something from it’s implementation. Thanks for reading & enjoy!

Feb App’itite

I vaguely promised in a previous blog post, I would try and update the apps I use on a daily basis and any new ones that have caught my eye.  Here are a few which I thought were useful and some that have replaced previous apps.

Continue reading

My Current ‘App’etite

Continuing on the theme of sharing/comparing my setup and recommendations, I thought I’d put together a list of the main apps I use and why I think they are great.  To start, here is my current home screen setup.

Screenshot_2015-07-26-17-07-47Screenshot_2015-07-26-17-06-53Screenshot_2015-07-26-17-07-32Screenshot_2015-07-26-17-08-06

I’ve decided to limit my list of apps to the top 10 for now, so here they are.

Continue reading

© 2024 Barbuzz

Theme by Anders NorénUp ↑