• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java ThrottledContentObserver类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了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;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java ServiceManager类代码示例发布时间:1970-01-01
下一篇:
Java ConcurrentWeakHashMap类代码示例发布时间:1970-01-01
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap