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
| /* | |
| * Copyright (C) 2016 Eric Cochran | |
| * | |
| * 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 | |
| * | |
| * Unless required by applicable law or agreed to in writing, software |
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
| import android.content.BroadcastReceiver; | |
| import android.content.Context; | |
| import android.content.Intent; | |
| import android.content.IntentFilter; | |
| import android.net.ConnectivityManager; | |
| import android.net.NetworkInfo; | |
| import android.os.Looper; | |
| import rx.Observable; | |
| import rx.Scheduler; |
| public class ClickToSelectEditText <T> extends AppCompatEditText { | |
| CharSequence mHint; | |
| OnItemSelectedListener<T> onItemSelectedListener; | |
| ListAdapter mSpinnerAdapter; | |
| public ClickToSelectEditText(Context context) { | |
| super(context); | |
| /* | |
| * Copyright 2015 Farbod Salamat-Zadeh | |
| * | |
| * 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 | |
| * | |
| * Unless required by applicable law or agreed to in writing, software |
This Gist has been discontinued and will be updated on a GitHub project here. The files I have removed from this Gist can be found there. Please feel free to open issues, pull requests, etc, so that I can change and improve the library how you like.
If you are already using the Gist, delete the layout XML, values XML, and Java files (the ones I have removed from this Gist), and instead add the following in your app module's build.gradle dependencies:
compile 'com.satsuware.lib:usefulviews:+'
Make sure to change your imports as well in the files that you are using the LabelledSpinner component.
| package nz.bradcampbell.app.presentation; | |
| import android.content.Context; | |
| import android.support.v4.view.LayoutInflaterFactory; | |
| import android.util.AttributeSet; | |
| import android.view.View; | |
| import java.lang.reflect.Constructor; | |
| import java.lang.reflect.InvocationTargetException; | |
| import java.util.HashMap; |
| import android.util.Log; | |
| import com.squareup.leakcanary.AnalysisResult; | |
| import com.squareup.leakcanary.DisplayLeakService; | |
| import com.squareup.leakcanary.HeapDump; | |
| import retrofit.RestAdapter; | |
| import retrofit.RetrofitError; | |
| import retrofit.http.Multipart; | |
| import retrofit.http.POST; | |
| import retrofit.http.Part; | |
| import retrofit.mime.TypedFile; |
| import android.content.Context; | |
| import android.os.Debug; | |
| import java.io.File; | |
| public class OomExceptionHandler implements Thread.UncaughtExceptionHandler { | |
| private static final String FILENAME = "out-of-memory.hprof"; | |
| public static void install(Context context) { | |
| Thread.UncaughtExceptionHandler defaultHandler = Thread.getDefaultUncaughtExceptionHandler(); |
| /** | |
| * Show the activity over the lockscreen and wake up the device. If you launched the app manually | |
| * both of these conditions are already true. If you deployed from the IDE, however, this will | |
| * save you from hundreds of power button presses and pattern swiping per day! | |
| */ | |
| public static void riseAndShine(Activity activity) { | |
| activity.getWindow().addFlags(FLAG_SHOW_WHEN_LOCKED); | |
| PowerManager power = (PowerManager) activity.getSystemService(POWER_SERVICE); | |
| PowerManager.WakeLock lock = |