git init
or
| private class HttpInterceptor implements Interceptor { | |
| @Override | |
| public Response intercept(Chain chain) throws IOException { | |
| Request request = chain.request(); | |
| //Build new request | |
| Request.Builder builder = request.newBuilder(); | |
| builder.header("Accept", "application/json"); //if necessary, say to consume JSON | |
| ActivityManager manager = (ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE); | |
| int memoryClass = manager.getMemoryClass(); | |
| 48 - Samsung Nexus S | |
| 64 - Samsung Galaxy Nexus | |
| Samsung S2 | |
| Samsung S3 | |
| 128 - Samsung S4 |
| package retrofit.converter; | |
| import com.bluelinelabs.logansquare.LoganSquare; | |
| import java.lang.reflect.ParameterizedType; | |
| import java.lang.reflect.Type; | |
| import java.util.List; | |
| import retrofit.converter.ConversionException; | |
| import retrofit.converter.Converter; |
| /** | |
| * 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 = |
| public class RecyclerToListViewScrollListener extends RecyclerView.OnScrollListener { | |
| private final AbsListView.OnScrollListener scrollListener; | |
| private int lastFirstVisible = -1; | |
| private int lastVisibleCount = -1; | |
| private int lastItemCount = -1; | |
| public RecyclerToListViewScrollListener(AbsListView.OnScrollListener scrollListener) { | |
| this.scrollListener = scrollListener; | |
| } | |
You can use this class to realize a simple sectioned grid RecyclerView.Adapter without changing your code.
The RecyclerView has to use a GridLayoutManager.
This is a porting of the class SimpleSectionedListAdapter provided by Google
If you are looking for a sectioned list RecyclerView.Adapter you can take a look here
This test rule is now in the 'test-rules' support repository. Use that one!
https://developer.android.com/reference/android/support/test/rule/ActivityTestRule.html
| /* | |
| * Copyright 2014 Chris Banes | |
| * | |
| * 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 |
| /* | |
| * Copyright (C) 2014 I.C.N.H GmbH | |
| * | |
| * 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 |