本文整理汇总了Java中com.google.samples.apps.iosched.util.ThrottledContentObserver类的典型用法代码示例。如果您正苦于以下问题:Java ThrottledContentObserver类的具体用法?Java ThrottledContentObserver怎么用?Java ThrottledContentObserver使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ThrottledContentObserver类属于com.google.samples.apps.iosched.util包,在下文中一共展示了ThrottledContentObserver类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: onAttach
import com.google.samples.apps.iosched.util.ThrottledContentObserver; //导入依赖的package包/类
@Override
public void onAttach(Activity activity) {
super.onAttach(activity);
// Register preference change listeners
ConfMessageCardUtils.registerPreferencesChangeListener(getContext(),
mConfMessagesAnswerChangeListener);
SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(getContext());
sp.registerOnSharedPreferenceChangeListener(mSettingsChangeListener);
// Register content observers
mSessionsObserver = new ThrottledContentObserver(new ThrottledContentObserver.Callbacks() {
@Override
public void onThrottledContentObserverFired() {
fireReloadEvent();
fireReloadTagsEvent();
}
});
mTagsObserver = new ThrottledContentObserver(new ThrottledContentObserver.Callbacks() {
@Override
public void onThrottledContentObserverFired() {
fireReloadTagsEvent();
}
});
}
开发者ID:dreaminglion,项目名称:iosched-reader,代码行数:26,代码来源:ExploreIOFragment.java
示例2: registerContentObserverOnUri
import com.google.samples.apps.iosched.util.ThrottledContentObserver; //导入依赖的package包/类
/**
* Registers this PresenterFragmentImpl as an explicit {@link ThrottledContentObserver} on the
* {@code uri}. This is required only if this PresenterFragmentImpl is expected to react to
* data changes while it is not visible. When a change is observed, the {@code queries} are run.
*/
public void registerContentObserverOnUri(Uri uri, final QueryEnum[] queriesToRun) {
checkState(queriesToRun != null && queriesToRun.length > 0, "Error registering content " +
"observer on uri " + uri + ", you must specify at least one query to run");
if (mContentObservers == null) {
mContentObservers = new HashMap<Uri, ThrottledContentObserver>();
}
if (!mContentObservers.containsKey(uri)) {
// Creates callback for content observer and add it to the hash map.
ThrottledContentObserver observer =
new ThrottledContentObserver(new ThrottledContentObserver.Callbacks() {
@Override
public void onThrottledContentObserverFired() {
onObservedContentChanged(queriesToRun);
}
});
mContentObservers.put(uri, observer);
} else {
// Uri already has a content observer.
LOGE(TAG, "This presenter is already registered as a content observer for uri " + uri
+ ", ignoring this call to registerContentObserverOnUri");
}
}
开发者ID:dreaminglion,项目名称:iosched-reader,代码行数:31,代码来源:PresenterFragmentImpl.java
示例3: onAttach
import com.google.samples.apps.iosched.util.ThrottledContentObserver; //导入依赖的package包/类
@Override
public void onAttach(Activity activity) {
super.onAttach(activity);
// Register content observers with the content resolver.
if (mContentObservers != null) {
Iterator<Map.Entry<Uri, ThrottledContentObserver>> observers =
mContentObservers.entrySet().iterator();
while (observers.hasNext()) {
Map.Entry<Uri, ThrottledContentObserver> entry = observers.next();
activity.getContentResolver().registerContentObserver(
entry.getKey(), true, entry.getValue());
}
}
}
开发者ID:dreaminglion,项目名称:iosched-reader,代码行数:16,代码来源:PresenterFragmentImpl.java
示例4: cleanUp
import com.google.samples.apps.iosched.util.ThrottledContentObserver; //导入依赖的package包/类
@Override
public void cleanUp() {
mUpdatableView = null;
mModel = null;
if (mContentObservers != null) {
Iterator<ThrottledContentObserver> observers = mContentObservers.values().iterator();
while (observers.hasNext()) {
getActivity().getContentResolver().unregisterContentObserver(observers.next());
}
}
}
开发者ID:dreaminglion,项目名称:iosched-reader,代码行数:12,代码来源:PresenterFragmentImpl.java
示例5: onAttach
import com.google.samples.apps.iosched.util.ThrottledContentObserver; //导入依赖的package包/类
@Override
public void onAttach(Activity activity) {
super.onAttach(activity);
if (!(activity instanceof Callbacks)) {
throw new ClassCastException("Activity must implement fragment's callbacks.");
}
mAppContext = getActivity().getApplicationContext();
mCallbacks = (Callbacks) activity;
mSessionsObserver = new ThrottledContentObserver(new ThrottledContentObserver.Callbacks() {
@Override
public void onThrottledContentObserverFired() {
onSessionsContentChanged();
}
});
mTagsObserver = new ThrottledContentObserver(new ThrottledContentObserver.Callbacks() {
@Override
public void onThrottledContentObserverFired() {
onTagsContentChanged();
}
});
activity.getContentResolver().registerContentObserver(
ScheduleContract.Sessions.CONTENT_URI, true, mSessionsObserver);
activity.getContentResolver().registerContentObserver(
ScheduleContract.Tags.CONTENT_URI, true, mTagsObserver);
SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(activity);
sp.registerOnSharedPreferenceChangeListener(mPrefChangeListener);
}
开发者ID:gdg-bh,项目名称:AppDevFestSudeste2015,代码行数:30,代码来源:SessionsFragment.java
示例6: isIdleNow
import com.google.samples.apps.iosched.util.ThrottledContentObserver; //导入依赖的package包/类
@Override
public boolean isIdleNow() {
mElapsedTime = TimeUtils.getCurrentTime(mContext) - mStartTime;
boolean idle = mElapsedTime > ThrottledContentObserver.getThrottleDelay();
if (idle) {
resourceCallback.onTransitionToIdle();
}
return idle;
}
开发者ID:google,项目名称:iosched,代码行数:10,代码来源:ThrottleContentObserverIdlingResource.java
注:本文中的com.google.samples.apps.iosched.util.ThrottledContentObserver类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论