I wrote a blog post recently on Android Accessibility on my work tech blog around how we went about reviewing the accessibility of one part of the app I worked on for the JustEatTakeaway.com 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) –
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.
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.
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.
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.
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
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.
After hearing last minute about the Android Dev Summit last year, I was interested to see what topics they would cover and there was some great content. As all of the talks were recorded I had a few on my list that I wanted to watch after the event but there was one I missed until I listened to one of the fragmented podcast episodes. They highly recommended a talk called ‘Android Studio For Experts‘, which the podcast host Donn Felker said was an essential watch as they packed so many dev tips into the episode.
I’ve been meaning to write a blog post about Virtual Reality (VR) for a while, and in particular what I call the ‘poor man’s VR’. My interest in it started when Google announced the Google Cardboard take on VR at Google I/O 2014. After seeing it I was really curious to see how good it actually was. (compared to things like the Oculus rift). Obviously it wouldn’t be comparable to custom PC driven VR but I just wondered what type of experience you’d get with a phone.
Droidcon has become a bit of an annual pilgrimage for me as an Android developer and this year I think it was the best one yet. It was my fourth time visiting, but I think the speakers really made it this year and it was a star studied list with a good variety of topics which made it great. Also, as always, it was a good chance to catch up with old colleagues and meet new people to share dev war stories!