This is a simple wrapper View for the new TextInputLayout from Design Library.
Normaly you use the TextInputLayout like this
| import groovy.xml.MarkupBuilder | |
| // Task to generate our public.xml file | |
| // See https://developer.android.com/studio/projects/android-library.html#PrivateResources | |
| // We assume resources within res-public are public | |
| task generatepublicxml { | |
| def resDir = project.projectDir.absolutePath + "/src/main/res-public" | |
| // Include the desired res types |
| #!/bin/bash | |
| for i in "$@" | |
| do | |
| case $i in | |
| -f=*|--file=*) | |
| FILENAME="${i#*=}" | |
| ;; | |
| -o=*|--out=*) | |
| OUTPUT="${i#*=}" |
| package com.example.columnspacing | |
| import android.graphics.Paint; | |
| import android.graphics.Rect; | |
| import android.support.v4.content.ContextCompat; | |
| import android.support.v7.widget.GridLayoutManager; | |
| import android.support.v7.widget.RecyclerView; | |
| import android.util.Log; | |
| import android.view.View; |
| import android.content.Intent; | |
| import android.os.Bundle; | |
| import android.support.v7.app.AppCompatActivity; | |
| import org.hamcrest.Description; | |
| import org.hamcrest.Matcher; | |
| import org.hamcrest.TypeSafeMatcher; | |
| import static android.support.test.InstrumentationRegistry.getInstrumentation; | |
| import static org.hamcrest.MatcherAssert.assertThat; |
| /* | |
| http://ant.apache.org/ivy/history/latest-milestone/ivyfile/dependency.html | |
| [1.0,2.0] matches all versions greater or equal to 1.0 and lower or equal to 2.0 | |
| [1.0,2.0[ matches all versions greater or equal to 1.0 and lower than 2.0 | |
| ]1.0,2.0] matches all versions greater than 1.0 and lower or equal to 2.0 | |
| ]1.0,2.0[ matches all versions greater than 1.0 and lower than 2.0 | |
| [1.0,) matches all versions greater or equal to 1.0 | |
| ]1.0,) matches all versions greater than 1.0 | |
| (,2.0] matches all versions lower or equal to 2.0 | |
| (,2.0[ matches all versions lower than 2.0 |
| /* | |
| * Copyright (C) 2016 Jeff Gilfelt. | |
| * | |
| * 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 |
| @Override | |
| public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { | |
| // ... Some magical things | |
| if (ContextCompat.checkSelfPermission(getActivity(), READ_CONTACTS) == PackageManager.PERMISSION_GRANTED) { | |
| // We have access. Life is good. | |
| setupContactsPicker(); | |
| } else if (ActivityCompat.shouldShowRequestPermissionRationale(getActivity(), READ_CONTACTS)) { | |
This is a simple wrapper View for the new TextInputLayout from Design Library.
Normaly you use the TextInputLayout like this
| #!/usr/bin/python | |
| # License for any modification to the original (linked below): | |
| # ---------------------------------------------------------------------------- | |
| # "THE BEER-WARE LICENSE" (Revision 42): | |
| # Sebastiano Poggi and Daniele Conti wrote this file. As long as you retain | |
| # this notice you can do whatever you want with this stuff. If we meet some day, | |
| # and you think this stuff is worth it, you can buy us a beer in return. | |
| import argparse, sys, subprocess, tempfile |
| import android.app.Activity; | |
| import android.app.Instrumentation; | |
| import android.app.KeyguardManager; | |
| import android.app.KeyguardManager.KeyguardLock; | |
| import android.content.Context; | |
| import android.content.pm.PackageManager; | |
| import android.os.IBinder; | |
| import android.os.PowerManager; | |
| import android.os.PowerManager.WakeLock; | |
| import android.support.test.InstrumentationRegistry; |