This is a list of Jetbrains IDE shortcuts I use everyday.
Comments welcome! Tell me your favorites.
| fun isEmailValid(email: String): Boolean { | |
| return Pattern.compile( | |
| "^(([\\w-]+\\.)+[\\w-]+|([a-zA-Z]|[\\w-]{2,}))@" | |
| + "((([0-1]?[0-9]{1,2}|25[0-5]|2[0-4][0-9])\\.([0-1]?" | |
| + "[0-9]{1,2}|25[0-5]|2[0-4][0-9])\\." | |
| + "([0-1]?[0-9]{1,2}|25[0-5]|2[0-4][0-9])\\.([0-1]?" | |
| + "[0-9]{1,2}|25[0-5]|2[0-4][0-9]))|" | |
| + "([a-zA-Z]+[\\w-]+\\.)+[a-zA-Z]{2,4})$" | |
| ).matcher(email).matches() | |
| } |
| // Add the following to your build.gradle file | |
| // implementation "android.arch.lifecycle:reactivestreams:1.0.0-beta1" | |
| import android.arch.lifecycle.LifecycleOwner | |
| import android.arch.lifecycle.LiveData | |
| import android.arch.lifecycle.LiveDataReactiveStreams | |
| import io.reactivex.Flowable | |
| /** |
| /** Set the View visibility to VISIBLE and eventually animate the View alpha till 100% */ | |
| fun View.visible(animate: Boolean = true) { | |
| if (animate) { | |
| animate().alpha(1f).setDuration(300).setListener(object : AnimatorListenerAdapter() { | |
| override fun onAnimationStart(animation: Animator) { | |
| super.onAnimationStart(animation) | |
| visibility = View.VISIBLE | |
| } | |
| }) | |
| } else { |
| package <you_package>.data.api; | |
| import android.content.Context; | |
| import android.support.annotation.NonNull; | |
| import com.google.gson.ExclusionStrategy; | |
| import com.google.gson.FieldAttributes; | |
| import com.google.gson.Gson; | |
| import com.google.gson.GsonBuilder; |
Table of Contents
| import com.google.gson.Gson; | |
| import com.google.gson.GsonBuilder; | |
| import okhttp3.OkHttpClient; | |
| import retrofit2.Retrofit; | |
| import retrofit2.converter.gson.GsonConverterFactory; | |
| /** | |
| * Created by mladenrakonjac on 01/06/16. | |
| */ | |
| public class ServiceGenerator { |
| api: bundle exec puma -C config/puma.rb |
| curl -L http://bit.ly/10hA8iC | bash |
Original solution sacrifices new api lint check.
Here my solution:
int minSdk = hasProperty('minSdk') ? minSdk.toInteger() : 16
apply plugin: 'com.android.application'
android {
compileSdkVersion 23