Optimising Vector Drawables
So vector drawables have been around since Android 5.0. They tools provided in Android Studio make them easy to work with. You can easily right click on the drawable folder and go to New -> Vector Asset and easily import an SVG file. I recently came across examples where I was seeing warnings about Very long vector path: I was intrigued so I tracked down the issue that added this lint check and it seemed to have used an arbitrary value of over 800 to be deemed as “very long”:
Android App Links
There are certain scenarios where your customers may find a product of yours on a search engine on the phone, but you want to direct them to your app experience when they click on the link. Take Amazon for example. If you search for a product you want to buy on Google and click on an Amazon link, it will direct you to the app to view the product. This has numerous benefits, the important ones being, an improved experience and not having to go through the cumbersome authentication process on your web site.
Setting up the Android emulator to run through Charles Proxy
Inevitably, you will most likely one day work in a “corporate” environment where it is not always sunshine and lollipops where everything is cloud based and BYOD (bring your own device). On top of that you may work in legacy environment where backends are expensive mainframe and test environments are limited due to the cost of running them. This of course causes many issues with day-to-day mobile development where, due to the limited backend environments, the numerous parallel streams of development will cause backends to break.
Ripple effect on a LinearLayout
I wanted to add a ripple effect on the Bottom Sheet I created in the previous post. This was easily achieved by adding: <item name="android:background">?android:attr/selectableItemBackground</item> to use the default Android ripple or: `<item name="android:background">?attr/selectableItemBackground</item> to use a definition in your theme. Here’s the result: You can see how all the ripples of each item in the LinearLayout are triggered, even though I put the ripple effect per row! Turns out that it was just that I had to add
Bottom Sheet Dialog
In the latest round of designs for our rewrite, I have been tasked to add a bottom sheet dialog rather than a regular dialog. With the new support for Bottom Sheets in the Design library, it was really easy to do. In the activity (eg. triggered by a button onclick): MyBottomSheetDialogFragment myBottomSheetDialogFragment = new MyBottomSheetDialogFragment(); myBottomSheetDialogFragment.show(getSupportFragmentManager(), myBottomSheetDialogFragment.getTag()); And the dialog class itself: public class MyBottomSheetDialogFragment extends BottomSheetDialogFragment { @Override public void setupDialog(final Dialog dialog, int style) { super.
Issue with CollapsingToolbarLayout title and design 25
We recently upgraded the design library to 25.0.1 to give the new bottom navigation a crack. This broke some existing functionality we had for the CollapsingToolbarLayout: This took a while to find, but using the famous Cheesesquare example from Chris Banes as a reference, I was able to narrow it down to not adding a setSupportActionBar(R.id.toolbar) to my activity (for which we didn’t require at the time). Hopefully it can save you a bit of time if you have encountered the same issue!
Java 8 and Jack weirdness with minifying
I have been using the latest and greatest for Android with Java 8 and Jack. This enables us to use the much awaited Lambdas in Android without having to resort to third party libraries like Retrolambda. The Jack compiler groups a few operations together, including minify which was previously done by Proguard. I have been encountering some weird issues with enabling minify for the release profile, running a simple clean assembleRelease consecutive times.
Setting up a local docker for Bitrise
So I had encountered an issue where things were working locally but not on our CI server Bitrise. This turned out to be an unrelated issue with Java 8 and minifying. In the process, I learnt about how to set up Docker locally with the same server set up as Bitrise so that I could test there build locally. This is the beauty with Bitrise, it is open source and you can see how things run on your own machine via Docker.
Google Play Store beta issue with new permissions model
I am currently working on a rewrite of our existing app, and I have encountered an unfortunate issue while trying to test our deployment to beta in the Google Play Store. While we use Hockeyapp to do our system testing, to do production deployments when everything is ok, I would like to push the app to beta and then manually promote to Production if all is ok. Our existing app had a compileSDKVersion of 21 and for the newer app, we of course have upped it to the most recent version (at the time of writing, 23).