本文整理汇总了Java中com.netease.nim.uikit.common.framework.NimSingleThreadExecutor类的典型用法代码示例。如果您正苦于以下问题:Java NimSingleThreadExecutor类的具体用法?Java NimSingleThreadExecutor怎么用?Java NimSingleThreadExecutor使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
NimSingleThreadExecutor类属于com.netease.nim.uikit.common.framework包,在下文中一共展示了NimSingleThreadExecutor类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: asyncLoadAvatarBitmapToCache
import com.netease.nim.uikit.common.framework.NimSingleThreadExecutor; //导入依赖的package包/类
/**
* 异步加载头像位图到Glide缓存中
*/
private void asyncLoadAvatarBitmapToCache(final String url) {
if (TextUtils.isEmpty(url)) {
return;
}
final int imageSize = HeadImageView.DEFAULT_AVATAR_THUMB_SIZE;
NimSingleThreadExecutor.getInstance().execute(new Runnable() {
@Override
public void run() {
Glide.with(context)
.load(url)
.downloadOnly(imageSize, imageSize);
}
});
}
示例2: buildDataCacheAsync
import com.netease.nim.uikit.common.framework.NimSingleThreadExecutor; //导入依赖的package包/类
/**
* 本地缓存构建(异步)
*/
public static void buildDataCacheAsync(final Context context, final Observer<Void> buildCompletedObserver) {
NimSingleThreadExecutor.getInstance().execute(new Runnable() {
@Override
public void run() {
buildDataCache();
// callback
if (context != null && buildCompletedObserver != null) {
new Handler(context.getMainLooper()).post(new Runnable() {
@Override
public void run() {
buildCompletedObserver.onEvent(null);
}
});
}
LogUtil.i(TAG, "build data cache completed");
}
});
}
示例3: buildDataCacheAsync
import com.netease.nim.uikit.common.framework.NimSingleThreadExecutor; //导入依赖的package包/类
/**
* 本地缓存构建(异步)
*/
public static void buildDataCacheAsync() {
NimSingleThreadExecutor.getInstance().execute(new Runnable() {
@Override
public void run() {
buildDataCache();
LogUtil.i(TAG, "build data cache completed");
}
});
}
示例4: asyncLoadAvatarBitmapToCache
import com.netease.nim.uikit.common.framework.NimSingleThreadExecutor; //导入依赖的package包/类
/**
* 异步加载头像位图到Glide缓存中
*/
private void asyncLoadAvatarBitmapToCache(final String account) {
NimSingleThreadExecutor.getInstance().execute(new Runnable() {
@Override
public void run() {
UserInfo userInfo = NimUIKit.getUserInfoProvider().getUserInfo(account);
if (userInfo != null) {
loadAvatarBitmapToCache(userInfo.getAvatar());
}
}
});
}
示例5: buildDataCacheAsync
import com.netease.nim.uikit.common.framework.NimSingleThreadExecutor; //导入依赖的package包/类
/**
* 本地缓存构建(异步)
*/
public static void buildDataCacheAsync() {
NimSingleThreadExecutor.getInstance().execute(new Runnable() {
@Override
public void run() {
buildDataCache();
LogUtil.i(TAG, "build data cache completed");
NimUIKitImpl.notifyCacheBuildComplete();
}
});
}