This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static int getStatusBarHeight(Context context) { | |
int statusBarHeight = 0; | |
int resourceId = context.getResources().getIdentifier("status_bar_height", "dimen", "android"); | |
if (resourceId > 0) { | |
statusBarHeight = context.getResources().getDimensionPixelSize(resourceId); | |
} | |
return statusBarHeight; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-ignorewarnings | |
-keep public class * extends android.os.Binder | |
-keepclassmembers enum * { | |
**[] $VALUES; | |
public *; | |
} | |
# v7 | |
-keep public class android.support.v7.widget.** { *; } | |
-keep public class android.support.v7.internal.widget.** { *; } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Dagger 1 example | |
@Module( | |
complete = false, | |
library = true | |
) | |
public final class ApiModule { | |
@Provides | |
@Singleton | |
Retrofit provideRetrofit(Gson gson, Application app) { | |
return new Retrofit.Builder() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// TODO add <meta-data android:value="GlideModule" android:name="....OkHttpProgressGlideModule" /> | |
// TODO add <meta-data android:value="GlideModule" tools:node="remove" android:name="com.bumptech.glide.integration.okhttp.OkHttpGlideModule" /> | |
// or not use 'okhttp@aar' in Gradle depdendencies | |
public class OkHttpProgressGlideModule implements GlideModule { | |
@Override public void applyOptions(Context context, GlideBuilder builder) { } | |
@Override public void registerComponents(Context context, Glide glide) { | |
OkHttpClient client = new OkHttpClient(); | |
client.networkInterceptors().add(createInterceptor(new DispatchingProgressListener())); | |
glide.register(GlideUrl.class, InputStream.class, new OkHttpUrlLoader.Factory(client)); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
android.permission.ACCESS_ALL_DOWNLOADS | |
android.permission.ACCESS_BLUETOOTH_SHARE | |
android.permission.ACCESS_CACHE_FILESYSTEM | |
android.permission.ACCESS_CHECKIN_PROPERTIES | |
android.permission.ACCESS_CONTENT_PROVIDERS_EXTERNALLY | |
android.permission.ACCESS_DOWNLOAD_MANAGER | |
android.permission.ACCESS_DOWNLOAD_MANAGER_ADVANCED | |
android.permission.ACCESS_DRM_CERTIFICATES | |
android.permission.ACCESS_EPHEMERAL_APPS | |
android.permission.ACCESS_FM_RADIO |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Intent intent = new Intent(Intent.ACTION_VIEW); | |
ComponentName cn = new ComponentName("com.tencent.mm", "com.tencent.mm.plugin.base.stub.WXCustomSchemeEntryActivity"); | |
intent.setData(Uri.parse("weixin://dl/moments")); | |
intent.setFlags(Intent.FLAG_ACTIVITY_PREVIOUS_IS_TOP); | |
intent.setComponent(cn); | |
startActivity(intent); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# License for any modification to the original (linked below): | |
# ---------------------------------------------------------------------------- | |
# "THE BEER-WARE LICENSE" (Revision 42): | |
# Sebastiano Poggi 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. | |
# | |
# Based on http://bit.ly/295BHLx |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
official | |
aliyun | |
anzhi | |
baidu | |
googleplay | |
huawei | |
le | |
meizu | |
qihu360 | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
official | |
aliyun | |
anzhi | |
baidu | |
googleplay | |
huawei | |
le | |
meizu | |
qihu360 | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import android.support.v7.widget.LinearLayoutManager; | |
import android.support.v7.widget.RecyclerView; | |
public abstract class EndlessRecyclerOnScrollListener extends RecyclerView.OnScrollListener { | |
public static String TAG = EndlessRecyclerOnScrollListener.class.getSimpleName(); | |
private int previousTotal = 0; // The total number of items in the dataset after the last load | |
private boolean loading = true; // True if we are still waiting for the last set of data to load. | |
private int visibleThreshold = 5; // The minimum amount of items to have below your current scroll position before loading more. | |
int firstVisibleItem, visibleItemCount, totalItemCount; |
NewerOlder