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!

Portable lego device stand

Here’s a quick post to just share a cool, but simple, portable Lego device stand that I found on the Instructables website.

After putting together my Lego device lab , I’ve sometimes found the need to have a stand for a device thats more portable.

After searching a little bit I found that there are loads of different solutions, but I thought I’d stick with the Lego theme as they are sometimes the cheaper solution (and look cool as well 🙂 )

So here’s a list of parts for my modified version (The original was slightly wider and better for tablets) of the stand here on the Instructables website by BrickSmith (thanks for sharing in the first place!).  While making this I also found a great place to by the individual Lego bricks were I got all the parts from called bricklink. (you’ll have to register and pick a seller as there are a few, I filtered seller by location in ‘more options’ e.g. UK).  Cost of each brick is cheap (2/3p) but postage will be majority of cost, so if you can get them posted by the same seller then you can save more.

  • 2 x Beam 7 (32524)
  • 2 x Beam 11 (32525)
  • 2x Beam 15 (32278)
  • 8x Technic Pin with Lengthwise Friction Ridges and Center Slots (2780)
  • 6 x Axle to Pin connector with Friction (43093)
  • 4 x Axel connectors (6538c)
  • 2 x Pin with Ball (6628)
  • 2 x Black Beam 2 x 4 Bent 90 Degrees, 2 and 4 holes (32140)
  • 2 x Axel 2 (3704)
  • 1 x Axel 4 (3705)

Note: the size of the last two Axel’s can be doubled to make a stand for a tablet to make the stand wider (i.e. 2 x Axel 6 & 1 x Axel 8).

Another quick tip to finish it off is to put a bit of sellotape on either side of the Lego were the device sits to stop it slipping out/tilting when adding and removing the phone.

I hope people find this useful and it gives dev’s a cheap way of adding a new portable stand to their desks.

Appy Developer Tools

Screen Shot 2016-07-14 at 11.49.28

This is the second part of sharing a few of resources I’ve collected over time, see the first part here on Android Studio plugins.

Here I’ve pulled together a list of Apps I’ve found that can be useful to Android App developers.  I also found another article a while back providing a similar list of apps with a few cool different ones here.

Continue reading

Plugin & Play

Screen Shot 2016-07-11 at 10.07.34

Over time as an Android developer I’ve collected a list of a lot of resources as I’m sure all dev’s have.  But I just thought I’d put a couple of posts together with a few of the cool ones that I’ve found along the way in case others find them useful.

Continue reading

First ‘Open Sauce’ Library

Ketchup

Being surrounded by Open Source libraries when developing Android apps (in my mind I always hear ‘Open Sauce’ – once read never forgotten, ha.), I’ve always been trying to create a semi useful library and also learn more about the process behind getting your code up to a central repo so other dev’s can benefit from it.  When working on another library contribution, I came up with some code that I thought would be a good candidate.

Continue reading

Lego Device Lab

wp-1461313474545.jpg

As most Android developers will know, working on the platform sometimes requires testing your app on a stupid amount of different devices. This usually leads to a scene similar to this on your desk.

Continue reading

Taking a bite of the Apple (iPhone)

movetoios

I decided last year that I needed to find out for myself what all the fuss was about owning an iPhone and take a bite of the Apple myself!

There has always been a rivalry between iPhone and Android developers/users and I’ve experienced my fair share of debates arguing which is the better platform, so being an Android developer & daily user, I thought the only way to find out myself was to buy an iPhone and experiencing the OS first hand.

Continue reading

Head in the Google Cloud Test Lab

devices-virtual

The Google Cloud Test Lab first came to my attention in Google I/O 2015 and was one of announcements that was ‘coming soon’ at the time.  It wasn’t until about a month ago that I received an email after signing up on the Google Test Lab website telling me that it was available to try out.

The Cloud Test Lab is made up of two features at the moment;

  • Cloud Test Lab can run instrumentation tests that you write using Espresso or Robotium
  • Use the Cloud Test Lab Robo test to simulate user actions and find crashes in your app

Continue reading

Creating a basic Material App Icon

devicestats_icon

Creating UI and graphics for app’s has always been a weakness for me, and I’m guessing most developers suffer the same problem.  As I’m always keen to learn new techniques, I recently created a material type icon for myself and though it would be great to share for other developers reference (and my own). 

I followed the technique used in this YouTube video, but there were a few times I had to rewind it to find out exactly what they were doing, which was another reason for writing it down.

Continue reading

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

« Older posts

© 2020 Barbuzz

Theme by Anders NorénUp ↑