List of usage examples for android.database DataSetObserver DataSetObserver
DataSetObserver
From source file:il.co.globes.android.swipeListView.SwipeListView.java
/** * @see android.widget.ListView#setAdapter(android.widget.ListAdapter) *///from w ww . java 2 s . com @Override public void setAdapter(ListAdapter adapter) { super.setAdapter(adapter); touchListener.resetItems(); if (adapter != null) { adapter.registerDataSetObserver(new DataSetObserver() { @Override public void onChanged() { super.onChanged(); onListChanged(); touchListener.resetItems(); } }); } }
From source file:cn.fantasee.swipwmenulistview.swipelistview.SwipeListView.java
/** * @see ListView#setAdapter(ListAdapter) *//*from w w w . j a v a2s .c o m*/ @Override public void setAdapter(ListAdapter adapter) { super.setAdapter(adapter); touchListener.resetItems(); if (null != adapter) { adapter.registerDataSetObserver(new DataSetObserver() { @Override public void onChanged() { super.onChanged(); onListChanged(); touchListener.resetItems(); } }); } }
From source file:com.app.musicplayer.Custom.Swipe.SwipeListView.java
/** * @see android.widget.ListView#setAdapter(android.widget.ListAdapter) *//*from w w w .j a v a 2s . co m*/ @Override public void setAdapter(ListAdapter adapter) { super.setAdapter(adapter); touchListener.resetItems(); adapter.registerDataSetObserver(new DataSetObserver() { @Override public void onChanged() { super.onChanged(); onListChanged(); touchListener.resetItems(); } }); }
From source file:org.tigase.mobile.chat.ChatHistoryFragment.java
@Override public void onCreate(Bundle savedInstanceState) { this.setHasOptionsMenu(true); super.onCreate(savedInstanceState); this.setHasOptionsMenu(true); this.setRetainInstance(true); this.chatAdapter = new ChatAdapter(getActivity(), R.layout.chat_item); chatAdapter.registerDataSetObserver(new DataSetObserver() { @Override/* ww w.j a va 2 s . c om*/ public void onChanged() { super.onChanged(); if (DEBUG) Log.i(TAG, "Changed!"); lv.post(new Runnable() { @Override public void run() { lv.setSelection(Integer.MAX_VALUE); } }); } }); }
From source file:com.vincentbrison.openlibraries.android.swipelistview.SwipeListView.java
/** * @see android.widget.ListView#setAdapter(android.widget.ListAdapter) */// w ww . j a v a2 s . co m @Override public void setAdapter(ListAdapter adapter) { super.setAdapter(adapter); touchListener.resetItems(); adapter.registerDataSetObserver(new DataSetObserver() { @Override public void onChanged() { super.onChanged(); onListChanged(); touchListener.resetItems(); } }); }
From source file:com.fortysevendeg.swipelistview.ExpandableSwipeListView.java
/** * @see android.widget.ListView#setAdapter(android.widget.ListAdapter) */// w w w.j a va 2 s .c o m @Override public void setAdapter(ExpandableListAdapter adapter) { super.setAdapter(adapter); touchListener.resetItems(); adapter.registerDataSetObserver(new DataSetObserver() { @Override public void onChanged() { super.onChanged(); onListChanged(); touchListener.resetItems(); } }); }
From source file:com.example.scrumptious.SelectionFragment.java
/** * Resets the view to the initial defaults. *//*from ww w. j a v a 2 s.c o m*/ private void init(Bundle savedInstanceState) { disableButtons(); listElements = new ArrayList<BaseListElement>(); listElements.add(new EatListElement(0)); listElements.add(new LocationListElement(1)); listElements.add(new PeopleListElement(2)); listElements.add(new PhotoListElement(3)); if (savedInstanceState != null) { for (BaseListElement listElement : listElements) { listElement.restoreState(savedInstanceState); } pendingAnnounce = savedInstanceState.getBoolean(PENDING_ANNOUNCE_KEY, false); } ActionListAdapter listAdapter = new ActionListAdapter(getActivity(), R.id.selection_list, listElements); listAdapter.registerDataSetObserver(new DataSetObserver() { @Override public void onChanged() { updateShareContent(); } }); listView.setAdapter(listAdapter); AccessToken accessToken = AccessToken.getCurrentAccessToken(); if (accessToken != null) { profilePictureView.setProfileId(accessToken.getUserId()); } updateShareContent(); }
From source file:com.android.deskclock.AlarmClockFragment.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedState) { // Inflate the layout for this fragment final View v = inflater.inflate(R.layout.alarm_clock, container, false); long expandedId = INVALID_ID; long[] repeatCheckedIds = null; long[] selectedAlarms = null; Bundle previousDayMap = null;/*from w w w .j a va 2s . co m*/ if (savedState != null) { expandedId = savedState.getLong(KEY_EXPANDED_ID); repeatCheckedIds = savedState.getLongArray(KEY_REPEAT_CHECKED_IDS); mRingtoneTitleCache = savedState.getBundle(KEY_RINGTONE_TITLE_CACHE); mDeletedAlarm = savedState.getParcelable(KEY_DELETED_ALARM); mUndoShowing = savedState.getBoolean(KEY_UNDO_SHOWING); selectedAlarms = savedState.getLongArray(KEY_SELECTED_ALARMS); previousDayMap = savedState.getBundle(KEY_PREVIOUS_DAY_MAP); mSelectedAlarm = savedState.getParcelable(KEY_SELECTED_ALARM); } mExpandInterpolator = new DecelerateInterpolator(EXPAND_DECELERATION); mCollapseInterpolator = new DecelerateInterpolator(COLLAPSE_DECELERATION); if (USE_TRANSITION_FRAMEWORK) { mAddRemoveTransition = new AutoTransition(); mAddRemoveTransition.setDuration(ANIMATION_DURATION); /// M: Scrap the views in ListView and request layout again, then alarm item will be /// attached correctly. This is to avoid the case when some items are not correctly /// attached after animation end @{ mAddRemoveTransition.addListener(new Transition.TransitionListenerAdapter() { @Override public void onTransitionEnd(Transition transition) { mAlarmsList.clearScrapViewsIfNeeded(); } }); /// @} mRepeatTransition = new AutoTransition(); mRepeatTransition.setDuration(ANIMATION_DURATION / 2); mRepeatTransition.setInterpolator(new AccelerateDecelerateInterpolator()); mEmptyViewTransition = new TransitionSet().setOrdering(TransitionSet.ORDERING_SEQUENTIAL) .addTransition(new Fade(Fade.OUT)).addTransition(new Fade(Fade.IN)) .setDuration(ANIMATION_DURATION); } boolean isLandscape = getResources().getConfiguration().orientation == Configuration.ORIENTATION_LANDSCAPE; View menuButton = v.findViewById(R.id.menu_button); if (menuButton != null) { if (isLandscape) { menuButton.setVisibility(View.GONE); } else { menuButton.setVisibility(View.VISIBLE); setupFakeOverflowMenuButton(menuButton); } } mEmptyView = v.findViewById(R.id.alarms_empty_view); mMainLayout = (FrameLayout) v.findViewById(R.id.main); mAlarmsList = (ListView) v.findViewById(R.id.alarms_list); mUndoBar = (ActionableToastBar) v.findViewById(R.id.undo_bar); mUndoFrame = v.findViewById(R.id.undo_frame); mUndoFrame.setOnTouchListener(this); mFooterView = v.findViewById(R.id.alarms_footer_view); mFooterView.setOnTouchListener(this); mAdapter = new AlarmItemAdapter(getActivity(), expandedId, repeatCheckedIds, selectedAlarms, previousDayMap, mAlarmsList); mAdapter.registerDataSetObserver(new DataSetObserver() { private int prevAdapterCount = -1; @Override public void onChanged() { final int count = mAdapter.getCount(); if (mDeletedAlarm != null && prevAdapterCount > count) { showUndoBar(); } if (USE_TRANSITION_FRAMEWORK && ((count == 0 && prevAdapterCount > 0) || /* should fade in */ (count > 0 && prevAdapterCount == 0) /* should fade out */)) { TransitionManager.beginDelayedTransition(mMainLayout, mEmptyViewTransition); } mEmptyView.setVisibility(count == 0 ? View.VISIBLE : View.GONE); // Cache this adapter's count for when the adapter changes. prevAdapterCount = count; super.onChanged(); } }); if (mRingtoneTitleCache == null) { mRingtoneTitleCache = new Bundle(); } mAlarmsList.setAdapter(mAdapter); mAlarmsList.setVerticalScrollBarEnabled(true); mAlarmsList.setOnCreateContextMenuListener(this); if (mUndoShowing) { showUndoBar(); } return v; }
From source file:heartware.com.heartware_master.FriendsFragment.java
/** * Resets the view to the initial defaults. *//*from w w w . j av a 2s .c om*/ private void init(Bundle savedInstanceState) { bMeetup.setEnabled(false); listElements = new ArrayList<FB_BaseListElement>(); listElements.add(new ExerciseListElement(0)); listElements.add(new LocationListElement(1)); listElements.add(new PeopleListElement(2)); listElements.add(new PhotoListElement(3)); if (savedInstanceState != null) { for (FB_BaseListElement listElement : listElements) { listElement.restoreState(savedInstanceState); } pendingAnnounce = savedInstanceState.getBoolean(PENDING_ANNOUNCE_KEY, false); } ActionListAdapter listAdapter = new ActionListAdapter(getActivity(), R.id.selection_list, listElements); listAdapter.registerDataSetObserver(new DataSetObserver() { @Override public void onChanged() { updateShareContent(); } }); listView.setAdapter(listAdapter); AccessToken accessToken = AccessToken.getCurrentAccessToken(); if (accessToken != null) { profilePictureView.setProfileId(accessToken.getUserId()); } updateShareContent(); }
From source file:com.example.androidannotationtesttwo.widget.swiptlistview.SwipeListView.java
/** * @see android.widget.ListView#setAdapter(android.widget.ListAdapter) *///from ww w. ja v a 2 s . co m @Override public void setAdapter(ListAdapter adapter) { super.setAdapter(adapter); if (isDropDownStyle) { setSecondPositionVisible(); } touchListener.resetItems(); adapter.registerDataSetObserver(new DataSetObserver() { @Override public void onChanged() { super.onChanged(); onListChanged(); touchListener.resetItems(); } }); }