W27Y16 – Inbox, Android Studio, Gradle, Chrome shortcuts, Markdown anchors and more.

That’s a transition for my blog: from now, articles will be written in English! (sorry for all the English langage mistakes, it’s the beginning).

Number of different topics for this week: 6

Shortcuts to topics
Prevent the Gmail to Inbox redirection
Chrome useful shortcuts : new / close tabs
Hum, build.gradle problem
Retrieve the dimensions for an SVG element
Use a custom font in your Android app
Anchors in your markdown file

Prevent the Gmail to Inbox redirection

bringbackgmail I was unpleasantly surprise to see that my Gmail account was redirected automatically to Inbox, without my knowing! To prevent this behaviour, you have to go to your Inbox page, in the left panel select “Settings” et uncheck the automatic redirection Redirect Gmail to inbox.google.com.

Chrome useful shortcuts : new / close tabs

cmdplus These two shortcuts are my favorites and I use them very often with Chrome:

  • Cmd + T to open a new tab
  • Cmd + W to close the current tab

Hum, build.gradle problem

gradleversions I just get an error message at the moment I tried to launch the gradle build…

Error:(1, 1) A problem occurred evaluating project ':app'.
> Failed to apply plugin [id 'com.android.application']
> Could not create plugin of type 'AppPlugin'.

It’s simply because I’ve loaded an old project and my gradle settings had been modified without my knowing… The solution is also to change this settings:

  • Android Studio > Preferences > Build, Execution, Deployment > Gradle

Check the Use default gradle build wrapper (recommended). If the problem persist, I’ve a second solution : go to this link (http://tools.android.com/tech-docs/new-build-system) and get the latest plugin version number and edit your version number in your build.gradle file from your project (classpath ‘com.android.tools.build:gradle:2.2.0-alpha4’ for example).

Retrieve the dimensions for an SVG element

svgdimensions Easy, you only have to call the method getBBox() who returns a JSON object with all the properties you need:

  • x
  • y
  • width
  • height

An example of use…

var element = document.getElementById("box");
var elementbBox = element.getBBox();

Use a custom font in your Android app

fonts To use a custom font, it’s pretty simple. You only have to copy/paste the .tff in the assets folder from your project (this folder location is very important).
Now, you can use it in the activity class like this:

Typeface tfCustom = Typeface.createFromAsset(getAssets(),"Roboto.ttf"); 
tvHelloWorld.setTypeface(tfCustom); // tvHelloWorld is a TextView for example

A good practise is to create a subfolder “fonts” in the assets folder.

Anchors in your markdown file

anchorsmd I think that anchors in big markdown files are very interesting! The use it, first declare your html balise, for example in your H3 title like this:

<a name="myanchor"></a>

Now, add an hyperlink to the word you want to shortcut to this anchor:

[link](#myanchor)