本文整理汇总了Java中com.android.launcher3.model.WidgetsModel类的典型用法代码示例。如果您正苦于以下问题:Java WidgetsModel类的具体用法?Java WidgetsModel怎么用?Java WidgetsModel使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
WidgetsModel类属于com.android.launcher3.model包,在下文中一共展示了WidgetsModel类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: refreshAndBindWidgetsAndShortcuts
import com.android.launcher3.model.WidgetsModel; //导入依赖的package包/类
public void refreshAndBindWidgetsAndShortcuts(
final Callbacks callbacks, final boolean bindFirst) {
runOnWorkerThread(new Runnable() {
@Override
public void run() {
if (bindFirst && !mBgWidgetsModel.isEmpty()) {
bindWidgetsModel(callbacks, mBgWidgetsModel.clone());
}
final WidgetsModel model = mBgWidgetsModel.updateAndClone(mApp.getContext());
bindWidgetsModel(callbacks, model);
// update the Widget entries inside DB on the worker thread.
LauncherAppState.getInstance().getWidgetCache().removeObsoletePreviews(
model.getRawList());
}
});
}
示例2: loadAndBindWidgetsAndShortcuts
import com.android.launcher3.model.WidgetsModel; //导入依赖的package包/类
public void loadAndBindWidgetsAndShortcuts(final Callbacks callbacks, final boolean refresh) {
runOnWorkerThread(new Runnable() {
@Override
public void run() {
updateWidgetsModel(refresh);
final WidgetsModel model = mBgWidgetsModel.clone();
mHandler.post(new Runnable() {
@Override
public void run() {
Callbacks cb = getCallback();
if (callbacks == cb && cb != null) {
callbacks.bindAllPackages(model);
}
}
});
// update the Widget entries inside DB on the worker thread.
LauncherAppState.getInstance().getWidgetCache().removeObsoletePreviews(
model.getRawList());
}
});
}
示例3: bindWidgetsModel
import com.android.launcher3.model.WidgetsModel; //导入依赖的package包/类
@Override
public void bindWidgetsModel(WidgetsModel model) {
if (waitUntilResume(mBindWidgetModelRunnable, true)) {
mWidgetsModel = model;
return;
}
if (mWidgetsView != null && model != null) {
mWidgetsView.addWidgets(model);
mWidgetsModel = null;
}
}
示例4: LauncherModel
import com.android.launcher3.model.WidgetsModel; //导入依赖的package包/类
LauncherModel(LauncherAppState app, IconCache iconCache, AppFilter appFilter,
DeepShortcutManager deepShortcutManager) {
Context context = app.getContext();
mApp = app;
mBgAllAppsList = new AllAppsList(iconCache, appFilter);
mBgWidgetsModel = new WidgetsModel(context, iconCache, appFilter);
mIconCache = iconCache;
mDeepShortcutManager = deepShortcutManager;
mLauncherApps = LauncherAppsCompat.getInstance(context);
mUserManager = UserManagerCompat.getInstance(context);
}
示例5: bindWidgetsModel
import com.android.launcher3.model.WidgetsModel; //导入依赖的package包/类
private void bindWidgetsModel(final Callbacks callbacks, final WidgetsModel model) {
mHandler.post(new Runnable() {
@Override
public void run() {
Callbacks cb = getCallback();
if (callbacks == cb && cb != null) {
callbacks.bindWidgetsModel(model);
}
}
});
}
示例6: addWidgets
import com.android.launcher3.model.WidgetsModel; //导入依赖的package包/类
/**
* Initialize the widget data model.
*/
public void addWidgets(WidgetsModel model) {
mRecyclerView.setWidgets(model);
mAdapter.setWidgetsModel(model);
mAdapter.notifyDataSetChanged();
View loader = getContentView().findViewById(R.id.loader);
if (loader != null) {
((ViewGroup) getContentView()).removeView(loader);
}
}
示例7: LauncherModel
import com.android.launcher3.model.WidgetsModel; //导入依赖的package包/类
LauncherModel(LauncherAppState app, IconCache iconCache, AppFilter appFilter,
DeepShortcutManager deepShortcutManager) {
Context context = app.getContext();
mApp = app;
mBgAllAppsList = new AllAppsList(iconCache, appFilter);
mBgWidgetsModel = new WidgetsModel(context, iconCache, appFilter);
mIconCache = iconCache;//创建图片缓存
mDeepShortcutManager = deepShortcutManager;
mLauncherApps = LauncherAppsCompat.getInstance(context);
mUserManager = UserManagerCompat.getInstance(context);
}
示例8: bindAllPackages
import com.android.launcher3.model.WidgetsModel; //导入依赖的package包/类
@Override
public void bindAllPackages(final WidgetsModel model) {
if (waitUntilResume(mBindPackagesUpdatedRunnable, true)) {
mWidgetsModel = model;
return;
}
if (mWidgetsView != null && model != null) {
mWidgetsView.addWidgets(model);
mWidgetsModel = null;
}
}
示例9: LauncherModel
import com.android.launcher3.model.WidgetsModel; //导入依赖的package包/类
LauncherModel(LauncherAppState app, IconCache iconCache, AppFilter appFilter) {
Context context = app.getContext();
mAppsCanBeOnRemoveableStorage = Environment.isExternalStorageRemovable();
String oldProvider = context.getString(R.string.old_launcher_provider_uri);
// This may be the same as MIGRATE_AUTHORITY, or it may be replaced by a different
// resource string.
String redirectAuthority = Uri.parse(oldProvider).getAuthority();
ProviderInfo providerInfo =
context.getPackageManager().resolveContentProvider(MIGRATE_AUTHORITY, 0);
ProviderInfo redirectProvider =
context.getPackageManager().resolveContentProvider(redirectAuthority, 0);
Log.d(TAG, "Old launcher provider: " + oldProvider);
mOldContentProviderExists = (providerInfo != null) && (redirectProvider != null);
if (mOldContentProviderExists) {
Log.d(TAG, "Old launcher provider exists.");
} else {
Log.d(TAG, "Old launcher provider does not exist.");
}
mApp = app;
mBgAllAppsList = new AllAppsList(iconCache, appFilter);
mBgWidgetsModel = new WidgetsModel(context, iconCache, appFilter);
mIconCache = iconCache;
mLauncherApps = LauncherAppsCompat.getInstance(context);
mUserManager = UserManagerCompat.getInstance(context);
}
示例10: onlyBindAllApps
import com.android.launcher3.model.WidgetsModel; //导入依赖的package包/类
private void onlyBindAllApps() {
final Callbacks oldCallbacks = mCallbacks.get();
if (oldCallbacks == null) {
// This launcher has exited and nobody bothered to tell us. Just bail.
Log.w(TAG, "LoaderTask running with no launcher (onlyBindAllApps)");
return;
}
// shallow copy
@SuppressWarnings("unchecked")
final ArrayList<AppInfo> list
= (ArrayList<AppInfo>) mBgAllAppsList.data.clone();
final WidgetsModel widgetList = mBgWidgetsModel.clone();
Runnable r = new Runnable() {
public void run() {
final long t = SystemClock.uptimeMillis();
final Callbacks callbacks = tryGetCallbacks(oldCallbacks);
if (callbacks != null) {
callbacks.bindAllApplications(list);
callbacks.bindAllPackages(widgetList);
}
if (DEBUG_LOADERS) {
Log.d(TAG, "bound all " + list.size() + " apps from cache in "
+ (SystemClock.uptimeMillis()-t) + "ms");
}
}
};
boolean isRunningOnMainThread = !(sWorkerThread.getThreadId() == Process.myTid());
if (isRunningOnMainThread) {
r.run();
} else {
mHandler.post(r);
}
}
示例11: addWidgets
import com.android.launcher3.model.WidgetsModel; //导入依赖的package包/类
/**
* Initialize the widget data model.
*/
public void addWidgets(WidgetsModel model) {
mView.setWidgets(model);
mAdapter.setWidgetsModel(model);
mAdapter.notifyDataSetChanged();
updateScrubber();
}
示例12: setWidgetsModel
import com.android.launcher3.model.WidgetsModel; //导入依赖的package包/类
public void setWidgetsModel(WidgetsModel w) {
mWidgetsModel = w;
}
示例13: setWidgets
import com.android.launcher3.model.WidgetsModel; //导入依赖的package包/类
/**
* Sets the widget model in this view, used to determine the fast scroll position.
*/
public void setWidgets(WidgetsModel widgets) {
mWidgets = widgets;
}
示例14: getWidgets
import com.android.launcher3.model.WidgetsModel; //导入依赖的package包/类
public WidgetsModel getWidgets() {
if (mView != null) {
return mView.getWidgets();
}
return null;
}
示例15: getWidgets
import com.android.launcher3.model.WidgetsModel; //导入依赖的package包/类
public WidgetsModel getWidgets() {
return mWidgets;
}