Skip to content

Instantly share code, notes, and snippets.

@BCsl
BCsl / NTUSUtils.java
Last active June 29, 2025 08:32
NTP 网络时间
/**
* Created by chensuilun on 2017/7/4.
*/
public class NTUSUtils {
private static final String TAG = "NTUSUtils";
private static final String NTP_TRUSTED_TIME = "android.util.NtpTrustedTime";
private static final String GET_INSTANCE = "getInstance";//private NtpTrustedTime getInstance(Context context)
private static final String FORCE_REFRESH = "forceRefresh"; //public boolean forceRefresh()
private static final String GET_CACHED_NTP_TIME = "getCachedNtpTime";//public long getCachedNtpTime()
private static Context sContext = AppApplication.getContext();
@BCsl
BCsl / DownloadManagerRx.java
Last active December 8, 2017 07:51
多线程断点下载
/**
* Created by chensuilun on 2017/12/08.
*/
public class DownloadManagerRx implements IDownloadListener {
private static final String TAG = "DownloadManagerRx";
private static DownloadManagerRx mInstance;
private HashMap<Object, Disposable> mRunningRequest;
private Map<Object, Float> mProgress;
private List<IDownloadListener> mIDownloadListeners;
Pick Audio file from Gallery:
//Use MediaStore.Audio.Media.EXTERNAL_CONTENT_URI
Intent intent = new Intent(Intent.ACTION_PICK, MediaStore.Audio.Media.EXTERNAL_CONTENT_URI);
Pick Video file from Gallery:
//Use MediaStore.Audio.Media.EXTERNAL_CONTENT_URI
Intent intent = new Intent(Intent.ACTION_PICK, MediaStore.Video.Media.EXTERNAL_CONTENT_URI);
Pick Image from gallery:
@BCsl
BCsl / AndroidLogKotlin.xml
Created May 18, 2019 10:20 — forked from goodev/AndroidLogKotlin.xml
Android log live template for kotlin:
<templateSet group="AndroidLogKotlin">
<template name="logm" value="android.util.Log.d(TAG, $FORMAT$)" description="Log method name and its arguments" toReformat="true" toShortenFQNames="true">
<variable name="FORMAT" expression="groovyScript(&quot;def params = _2.collect {it + ' = [$' + it + ']'}.join(', '); return '\&quot;' + _1 + '() called' + (params.empty ? '' : ' with: ' + params) + '\&quot;'&quot;, kotlinFunctionName(), functionParameters())" defaultValue="" alwaysStopAt="false" />
<context>
<option name="KOTLIN_STATEMENT" value="true" />
</context>
</template>
<template name="logd" value="android.util.Log.d(TAG, &quot;$METHOD_NAME$: $content$&quot;)" description="Log.d(String)" toReformat="true" toShortenFQNames="true">
<variable name="METHOD_NAME" expression="kotlinFunctionName()" defaultValue="" alwaysStopAt="false" />
<variable name="content" expression="" defaultValue="" alwaysStopAt="true" />