by Ossi Hanhinen, @ohanhi
with the support of Futurice 💚.
Licensed under CC BY 4.0.
| mContent = (EditText) v.findViewById(R.id.dialog_item_content_EditText); | |
| mContent.setText(mContentInit); | |
| mContent.setRawInputType(InputType.TYPE_CLASS_TEXT); | |
| mContent.setImeActionLabel(getResources().getString(R.string.done), EditorInfo.IME_ACTION_DONE); | |
| mContent.setImeOptions(EditorInfo.IME_ACTION_DONE); | |
| mContent.setOnEditorActionListener(new TextView.OnEditorActionListener() { | |
| @Override | |
| public boolean onEditorAction(TextView v, int actionId, KeyEvent event) { | |
| if (event == null) { | 
Centralize the support libraries dependencies in gradle
Working with multi-modules project, it is very useful to centralize the dependencies, especially the support libraries.
A very good way is to separate gradle build files, defining something like:
root
  --gradleScript
 ----dependencies.gradle
| package com.example.mediasessioncompat; | |
| import android.app.PendingIntent; | |
| import android.content.Context; | |
| import android.content.Intent; | |
| import android.support.v4.media.MediaDescriptionCompat; | |
| import android.support.v4.media.MediaMetadataCompat; | |
| import android.support.v4.media.session.MediaButtonReceiver; | |
| import android.support.v4.media.session.MediaControllerCompat; | |
| import android.support.v4.media.session.MediaSessionCompat; | 
| //This file represents several classes. It's just named *.java for syntax highlighting purposes! | |
| //AIDL file: Defines interfaces for communicating between activities and your service. | |
| //You can see these implemented in the service @ 'private static class ServiceStub extends IPlaybackService.Stub' | |
| interface IPlaybackService { | |
| void stop(); | |
| void play(); | 
EDIT: You can find this same updated tutorial here -> Medium
Now I'm going to list how to publish an Android libray to jCenter and then syncronize it with Maven Central:
| import android.animation.ObjectAnimator; | |
| import android.graphics.Rect; | |
| import android.view.View; | |
| import android.view.ViewGroup; | |
| import android.view.ViewTreeObserver; | |
| /** | |
| * An OnGlobalLayoutListener interface that will adjust and resize a fullscreen scene's view when the soft keyboard is shown | |
| * or hidden. | |
| * | 
| <?xml version="1.0" encoding="utf-8"?> | |
| <!-- | |
| Copyright 2016 Google Inc. | |
| Licensed under the Apache License, Version 2.0 (the "License"); | |
| you may not use this file except in compliance with the License. | |
| You may obtain a copy of the License at | |
| http://www.apache.org/licenses/LICENSE-2.0 |