当前位置: 首页>>代码示例>>Java>>正文


Java ValueEventListener类代码示例

本文整理汇总了Java中com.wilddog.client.ValueEventListener的典型用法代码示例。如果您正苦于以下问题:Java ValueEventListener类的具体用法?Java ValueEventListener怎么用?Java ValueEventListener使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


ValueEventListener类属于com.wilddog.client包,在下文中一共展示了ValueEventListener类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: addValueToReadyListener

import com.wilddog.client.ValueEventListener; //导入依赖的package包/类
private void addValueToReadyListener(final Query wilddog, final GeoHashQuery query) {
    wilddog.addListenerForSingleValueEvent(new ValueEventListener() {
        @Override
        public void onDataChange(DataSnapshot dataSnapshot) {
            synchronized (GeoQuery.this) {
                GeoQuery.this.outstandingQueries.remove(query);
                GeoQuery.this.checkAndFireReady();
            }
        }

        @Override
        public void onCancelled(final SyncError syncError) {
            synchronized (GeoQuery.this) {
                for (final GeoQueryEventListener listener : GeoQuery.this.eventListeners) {
                    GeoQuery.this.wildGeo.raiseEvent(new Runnable() {
                        @Override
                        public void run() {
                            listener.onGeoQueryError(syncError);
                        }
                    });
                }
            }
        }
    });
}
 
开发者ID:WildDogTeam,项目名称:lib-android-wildgeo,代码行数:26,代码来源:GeoQuery.java

示例2: onStart

import com.wilddog.client.ValueEventListener; //导入依赖的package包/类
@Override
public void onStart() {
    super.onStart();
    // Setup our view and list adapter. Ensure it scrolls to the bottom as data changes
    final ListView listView = getListView();
    // Tell our list adapter that we only want 50 messages at a time
    mChatListAdapter = new ChatListAdapter(mWilddogRef.limitToLast(50), this, R.layout.chat_message, mUsername);
    listView.setAdapter(mChatListAdapter);
    mChatListAdapter.registerDataSetObserver(new DataSetObserver() {
        @Override
        public void onChanged() {
            super.onChanged();
            listView.setSelection(mChatListAdapter.getCount() - 1);
        }
    });

    // Finally, a little indication of connection status
    mConnectedListener = mWilddogRef.getRoot().child(".info/connected").addValueEventListener(new ValueEventListener() {
        @Override
        public void onDataChange(DataSnapshot dataSnapshot) {
            boolean connected = (Boolean) dataSnapshot.getValue();
            if (connected) {
                Toast.makeText(MainActivity.this, "Connected to Wilddog", Toast.LENGTH_SHORT).show();
            } else {
                Toast.makeText(MainActivity.this, "Disconnected from Wilddog", Toast.LENGTH_SHORT).show();
            }
        }

        @Override
        public void onCancelled(SyncError wilddogError) {
            // No-op
        }
    });
}
 
开发者ID:WildDogTeam,项目名称:demo-android-chat,代码行数:35,代码来源:MainActivity.java

示例3: getAllSegmentList

import com.wilddog.client.ValueEventListener; //导入依赖的package包/类
public static void getAllSegmentList(ValueEventListener valueEventListener) {
    new Wilddog(WILDDOG_SEGMENT).addListenerForSingleValueEvent(valueEventListener);
}
 
开发者ID:luania,项目名称:witchpot,代码行数:4,代码来源:DataService.java


注:本文中的com.wilddog.client.ValueEventListener类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。