Java 类android.database.DataSetObserver 实例源码

项目:iosched-reader    文件:MyScheduleView.java   
public void setAdapter(MyScheduleAdapter adapter) {
    if (mAdapter != null && mObserver != null) {
        mAdapter.unregisterDataSetObserver(mObserver);
        mObserver = null;
    }
    mAdapter = adapter;
    rebuild();
    if (mAdapter != null) {
        mAdapter.registerDataSetObserver(new DataSetObserver() {
            @Override
            public void onChanged() {
                rebuild();
            }

            @Override
            public void onInvalidated() {
                setAdapter(null);
            }
        });
    }
}
项目:TextEmoji    文件:AdaptableRadioGroup.java   
private void init() {
    mDataSetObserver = new DataSetObserver() {
        @Override
        public void onChanged() {
            removeAllViews();
            for (int i = 0; i < mRadioAdapter.getCount(); i++) {
                RadioButton radioButton = mRadioAdapter.getRadioButton(i);
                addView(radioButton);
            }
            setCurrentItem(0);
        }

        @Override
        public void onInvalidated() {
            super.onInvalidated();
        }
    };

    mRadioAdapter = new MyRadioAdapter(null);
    mRadioAdapter.setViewPagerObserver(mDataSetObserver);
}
项目:youkes_browser    文件:SwipeListView.java   
/**
 * @see ListView#setAdapter(ListAdapter)
 */
@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();
        }
    });
}
项目:browser    文件:SwipeListView.java   
/**
 * @see ListView#setAdapter(ListAdapter)
 */
@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();
        }
    });
}
项目:PictureShow    文件:AlbumPage.java   
private void initView() {
    gridView = findViewById(R.id.grid);
    mToolbar = findViewById(R.id.topbar);
    setSupportActionBar(mToolbar);
    mToolbar.setNavigationOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            finish();
        }
    });
    setTitle(getIntent().getStringExtra(MediaSetUtils.SET_NAME));
    mAdapter = new TimeLineAdapter(this);
    mAdapter.setDecodeSize(decodeBitmapWidth);
    mAdapter.registerDataSetObserver(new DataSetObserver() {
        @Override
        public void onChanged() {
            super.onChanged();
        }
    });

    gridView.setAdapter(mAdapter);
    gridView.setOnItemClickListener(this);
}
项目:mupdf-android-viewer-nui    文件:AbstractWheelAdapter.java   
@Override
public void registerDataSetObserver(DataSetObserver observer) {
    if (datasetObservers == null) {
        datasetObservers = new LinkedList<DataSetObserver>();
    }
    datasetObservers.add(observer);
}
项目:Note    文件:AddListActivity.java   
@Override
protected void onRestoreInstanceState(Bundle savedInstanceState) {
    super.onRestoreInstanceState(savedInstanceState);
    myCalendar = (Calendar) savedInstanceState.getSerializable("calendar");
    hasReminder = savedInstanceState.getBoolean("hasReminder");
    items = (ArrayList<ListItem>) savedInstanceState.getSerializable("items");
    adapter = new ListItemArrayAdapter(this, items);
    add_list_values.setAdapter(adapter);

    adapter.registerDataSetObserver(new DataSetObserver() {
        @Override
        public void onChanged() {
            super.onChanged();

            int totalHeight = 0;
            for (int i = 0; i < adapter.getCount(); i++) {
                View listItem = adapter.getView(i, null, add_list_values);
                listItem.measure(0, 0);
                totalHeight += listItem.getMeasuredHeight();
            }

            ViewGroup.LayoutParams params = add_list_values.getLayoutParams();
            params.height = totalHeight + (add_list_values.getDividerHeight() * (adapter.getCount() - 1));
            add_list_values.setLayoutParams(params);
            add_list_values.requestLayout();
        }
    });
    adapter.notifyDataSetChanged();
}
项目:decoy    文件:AbstractWheelAdapter.java   
/**
 * Notifies observers about invalidating data
 */
protected void notifyDataInvalidatedEvent() {
    if (datasetObservers != null) {
        for (DataSetObserver observer : datasetObservers) {
            observer.onInvalidated();
        }
    }
}
项目:boohee_v5.6    文件:AbstractWheelAdapter.java   
protected void notifyDataInvalidatedEvent() {
    if (this.datasetObservers != null) {
        for (DataSetObserver observer : this.datasetObservers) {
            observer.onInvalidated();
        }
    }
}
项目:GitHub    文件:AbstractWheelAdapter.java   
/**
 * Notifies observers about data changing
 */
protected void notifyDataChangedEvent() {
    if (datasetObservers != null) {
        for (DataSetObserver observer : datasetObservers) {
            observer.onChanged();
        }
    }
}
项目:PictureShow    文件:MyMergeSortCursor.java   
@Override
public void unregisterDataSetObserver(DataSetObserver observer) {
    int length = mCursors.length;
    for (int i = 0 ; i < length ; i++) {
        if (mCursors[i] != null) {
            mCursors[i].unregisterDataSetObserver(observer);
        }
    }
}
项目:mupdf-android-viewer-nui    文件:AbstractWheelAdapter.java   
/**
 * Notifies observers about invalidating data
 */
protected void notifyDataInvalidatedEvent() {
    if (datasetObservers != null) {
        for (DataSetObserver observer : datasetObservers) {
            observer.onInvalidated();
        }
    }
}
项目:TripBuyer    文件:AbstractWheelAdapter.java   
@Override
public void registerDataSetObserver(DataSetObserver observer) {
    if (datasetObservers == null) {
        datasetObservers = new LinkedList<DataSetObserver>();
    }
    datasetObservers.add(observer);
}
项目:ultrasonic    文件:DragSortListView.java   
public AdapterWrapper(ListAdapter adapter) {
    super();
    mAdapter = adapter;

    mAdapter.registerDataSetObserver(new DataSetObserver() {
        public void onChanged() {
            notifyDataSetChanged();
        }

        public void onInvalidated() {
            notifyDataSetInvalidated();
        }
    });
}
项目:AssistantBySDK    文件:AbstractWheelAdapter.java   
@Override
public void registerDataSetObserver(DataSetObserver observer) {
    if (datasetObservers == null) {
        datasetObservers = new LinkedList<DataSetObserver>();
    }
    datasetObservers.add(observer);
}
项目:AssistantBySDK    文件:AbstractWheelAdapter.java   
/**
 * Notifies observers about data changing
 */
protected void notifyDataChangedEvent() {
    if (datasetObservers != null) {
        for (DataSetObserver observer : datasetObservers) {
            observer.onChanged();
        }
    }
}
项目:AssistantBySDK    文件:AbstractWheelAdapter.java   
/**
 * Notifies observers about invalidating data
 */
protected void notifyDataInvalidatedEvent() {
    if (datasetObservers != null) {
        for (DataSetObserver observer : datasetObservers) {
            observer.onInvalidated();
        }
    }
}
项目:SmartRefresh    文件:RefreshContentWrapper.java   
@Override
public void setViewPagerObserver(DataSetObserver observer) {
    super.setViewPagerObserver(observer);
    if (observer == null) {
        wrapperViewPager(mViewPager, this);
    }
}
项目:SlotNSlot_Android    文件:AbstractWheelAdapter.java   
@Override
public void registerDataSetObserver(DataSetObserver observer) {
    if (datasetObservers == null) {
        datasetObservers = new LinkedList<DataSetObserver>();
    }
    datasetObservers.add(observer);
}
项目:Hotspot-master-devp    文件:AbstractWheelAdapter.java   
@Override
public void registerDataSetObserver(DataSetObserver observer) {
    if (datasetObservers == null) {
        datasetObservers = new LinkedList<DataSetObserver>();
    }
    datasetObservers.add(observer);
}
项目:SlotNSlot_Android    文件:AbstractWheelAdapter.java   
/**
 * Notifies observers about data changing
 */
protected void notifyDataChangedEvent() {
    if (datasetObservers != null) {
        for (DataSetObserver observer : datasetObservers) {
            observer.onChanged();
        }
    }
}
项目:Mybilibili    文件:CBLoopPagerAdapterWrapper.java   
CBLoopPagerAdapterWrapper(PagerAdapter adapter) {
    this.mAdapter = adapter;
    adapter.registerDataSetObserver(new DataSetObserver(){
        public void onChanged(){
            notifyDataSetChanged();
        }
    });
}
项目:Hotspot-master-devp    文件:AbstractWheelAdapter.java   
@Override
public void registerDataSetObserver(DataSetObserver observer) {
    if (datasetObservers == null) {
        datasetObservers = new LinkedList<DataSetObserver>();
    }
    datasetObservers.add(observer);
}
项目:Hotspot-master-devp    文件:AbstractWheelAdapter.java   
/**
 * Notifies observers about data changing
 */
protected void notifyDataChangedEvent() {
    if (datasetObservers != null) {
        for (DataSetObserver observer : datasetObservers) {
            observer.onChanged();
        }
    }
}
项目:Hotspot-master-devp    文件:AbstractWheelAdapter.java   
/**
 * Notifies observers about invalidating data
 */
protected void notifyDataInvalidatedEvent() {
    if (datasetObservers != null) {
        for (DataSetObserver observer : datasetObservers) {
            observer.onInvalidated();
        }
    }
}
项目:SlotNSlot_Android    文件:AbstractWheelAdapter.java   
/**
 * Notifies observers about invalidating data
 */
protected void notifyDataInvalidatedEvent() {
    if (datasetObservers != null) {
        for (DataSetObserver observer : datasetObservers) {
            observer.onInvalidated();
        }
    }
}
项目:NoticeDog    文件:DragSortListView.java   
public AdapterWrapper(ListAdapter adapter) {
    super();
    mAdapter = adapter;

    mAdapter.registerDataSetObserver(new DataSetObserver() {
        public void onChanged() {
            notifyDataSetChanged();
        }

        public void onInvalidated() {
            notifyDataSetInvalidated();
        }
    });
}
项目:CoolClock    文件:AbstractWheelAdapter.java   
@Override
public void registerDataSetObserver(DataSetObserver observer) {
    if (datasetObservers == null) {
        datasetObservers = new LinkedList<DataSetObserver>();
    }
    datasetObservers.add(observer);
}
项目:CoolClock    文件:AbstractWheelAdapter.java   
/**
 * Notifies observers about data changing
 */
protected void notifyDataChangedEvent() {
    if (datasetObservers != null) {
        for (DataSetObserver observer : datasetObservers) {
            observer.onChanged();
        }
    }
}
项目:CoolClock    文件:AbstractWheelAdapter.java   
/**
 * Notifies observers about invalidating data
 */
protected void notifyDataInvalidatedEvent() {
    if (datasetObservers != null) {
        for (DataSetObserver observer : datasetObservers) {
            observer.onInvalidated();
        }
    }
}
项目:PagerTabIndicator    文件:PagerTabsIndicator.java   
public PagerTabsIndicator(Context context, AttributeSet attrs, int defStyleAttr) {
    super(context, attrs, defStyleAttr);
    setHorizontalScrollBarEnabled(false);
    tabsContainer = new LinearLayout(getContext());
    addView(tabsContainer, LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);

    //Load default dimens
    textSize = getContext().getResources().getDimensionPixelSize(R.dimen.tab_default_text_size);
    indicatorHeight = getContext().getResources().getDimensionPixelSize(R.dimen.tab_default_indicator_height);
    indicatorBgHeight = getContext().getResources().getDimensionPixelSize(R.dimen.tab_default_indicator_bg_height);
    dividerWidth = getContext().getResources().getDimensionPixelSize(R.dimen.tab_default_divider_width);
    dividerMargin = getContext().getResources().getDimensionPixelSize(R.dimen.tab_default_divider_margin);

    //Load default colors
    textColor = getResources().getColor(R.color.tab_default_text_color);
    indicatorColor = getResources().getColor(R.color.tab_indicator_color);
    highlightTextColor = indicatorColor;
    indicatorBgColor = getResources().getColor(R.color.tab_indicator_bg_color);
    dividerColor = getResources().getColor(R.color.tab_default_divider_color);
    tabPadding = getResources().getDimensionPixelSize(R.dimen.tab_default_padding);

    TypedArray typedArray = context.obtainStyledAttributes(attrs, R.styleable.PagerTabsIndicator);

    tabPadding = typedArray.getDimensionPixelSize(R.styleable.PagerTabsIndicator_tab_padding, tabPadding);
    textSize = typedArray.getDimensionPixelSize(R.styleable.PagerTabsIndicator_tab_text_size, textSize);
    textColor = typedArray.getColor(R.styleable.PagerTabsIndicator_tab_text_color, textColor);
    highlightTextColor = typedArray.getColor(R.styleable.PagerTabsIndicator_tab_highlight_text_color, highlightTextColor);
    highlightText = typedArray.getBoolean(R.styleable.PagerTabsIndicator_tab_highlight_text_color, highlightText);
    showDivider = typedArray.getBoolean(R.styleable.PagerTabsIndicator_tab_show_divider, showDivider);
    lockExpanded = typedArray.getBoolean(R.styleable.PagerTabsIndicator_tab_lock_expanded, lockExpanded);
    indicatorType = typedArray.getInt(R.styleable.PagerTabsIndicator_tab_indicator, indicatorType);
    indicatorResource = typedArray.getResourceId(R.styleable.PagerTabsIndicator_tab_indicator_resource, indicatorResource);
    indicatorHeight = typedArray.getDimensionPixelSize(R.styleable.PagerTabsIndicator_tab_indicator_height, indicatorHeight);
    indicatorBgHeight = typedArray.getDimensionPixelSize(R.styleable.PagerTabsIndicator_tab_indicator_bg_height, indicatorBgHeight);
    indicatorMargin = typedArray.getDimensionPixelSize(R.styleable.PagerTabsIndicator_tab_indicator_margin, indicatorMargin);
    indicatorColor = typedArray.getColor(R.styleable.PagerTabsIndicator_tab_indicator_color, indicatorColor);
    indicatorBgColor = typedArray.getColor(R.styleable.PagerTabsIndicator_tab_indicator_bg_color, indicatorBgColor);
    dividerWidth = typedArray.getDimensionPixelSize(R.styleable.PagerTabsIndicator_tab_divider_width, dividerWidth);
    dividerMargin = typedArray.getDimensionPixelSize(R.styleable.PagerTabsIndicator_tab_divider_margin, dividerMargin);
    dividerColor = typedArray.getColor(R.styleable.PagerTabsIndicator_tab_divider_color, dividerColor);
    dividerResource = typedArray.getResourceId(R.styleable.PagerTabsIndicator_tab_divider_resource, dividerResource);
    showBarIndicator = typedArray.getBoolean(R.styleable.PagerTabsIndicator_tab_show_bar_indicator, showBarIndicator);
    tabElevation = typedArray.getDimensionPixelSize(R.styleable.PagerTabsIndicator_tab_elevation, tabElevation);
    indicatorScaleType = typedArray.getInt(R.styleable.PagerTabsIndicator_tab_indicator_scale_type, indicatorScaleType);
    disableTabAnimation = typedArray.getBoolean(R.styleable.PagerTabsIndicator_tab_disable_animation, disableTabAnimation);

    typedArray.recycle();
    prepareResources();

    adapterObserver = new DataSetObserver() {
        @Override
        public void onChanged() {
            notifyDatasetChanged();
        }

        @Override
        public void onInvalidated() {
            super.onInvalidated();
        }
    };
}
项目:GongXianSheng    文件:SwipeMenuAdapter.java   
@Override
public void registerDataSetObserver(DataSetObserver observer) {
    mAdapter.registerDataSetObserver(observer);
}
项目:KrGallery    文件:BaseFragmentAdapter.java   
@Override
public void unregisterDataSetObserver(DataSetObserver observer) {
    if (observer != null) {
        super.unregisterDataSetObserver(observer);
    }
}
项目:boohee_v5.6    文件:PagerAdapter.java   
public void registerDataSetObserver(DataSetObserver observer) {
    this.mObservable.registerObserver(observer);
}
项目:GitHub    文件:AbstractWheelAdapter.java   
@Override
public void unregisterDataSetObserver(DataSetObserver observer) {
    if (datasetObservers != null) {
        datasetObservers.remove(observer);
    }
}
项目:Note    文件:AddListActivity.java   
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_add_list);
    ButterKnife.bind(this);

    setTitle(getString(R.string.add_list_title));
    setSupportActionBar(toolbar);
    getSupportActionBar().setDisplayHomeAsUpEnabled(true);
    getSupportActionBar().setHomeButtonEnabled(true);

    myCalendar = Calendar.getInstance();

    items = new ArrayList<>();
    adapter = new ListItemArrayAdapter(this, items);
    add_list_values.setAdapter(adapter);

    add_list_content.setImeOptions(EditorInfo.IME_ACTION_DONE);

    adapter.registerDataSetObserver(new DataSetObserver() {
        @Override
        public void onChanged() {
            super.onChanged();

            int totalHeight = 0;
            for (int i = 0; i < adapter.getCount(); i++) {
                View listItem = adapter.getView(i, null, add_list_values);
                listItem.measure(0, 0);
                totalHeight += listItem.getMeasuredHeight();
            }

            ViewGroup.LayoutParams params = add_list_values.getLayoutParams();
            params.height = totalHeight + (add_list_values.getDividerHeight() * (adapter.getCount() - 1));
            add_list_values.setLayoutParams(params);
            add_list_values.requestLayout();
        }
    });

    date = new DatePickerDialog.OnDateSetListener() {

        @Override
        public void onDateSet(DatePicker view, int year, int monthOfYear,
                              int dayOfMonth) {
            myCalendar.set(Calendar.YEAR, year);
            myCalendar.set(Calendar.MONTH, monthOfYear);
            myCalendar.set(Calendar.DAY_OF_MONTH, dayOfMonth);
            new TimePickerDialog(AddListActivity.this, time, myCalendar.get(Calendar.HOUR_OF_DAY), myCalendar.get(Calendar.MINUTE), true).show();
        }
    };

    time = new TimePickerDialog.OnTimeSetListener() {
        @Override
        public void onTimeSet(TimePicker timePicker, int hour, int minute) {
            myCalendar.set(Calendar.HOUR_OF_DAY, hour);
            myCalendar.set(Calendar.MINUTE, minute);
            if (myCalendar.getTime().before(Calendar.getInstance().getTime()))
                Toast.makeText(AddListActivity.this, getString(R.string.provide_valid_date_time), Toast.LENGTH_LONG).show();
            else
                updateRemind(true);
        }
    };
}
项目:boohee_v5.6    文件:PLA_HeaderViewListAdapter.java   
public void unregisterDataSetObserver(DataSetObserver observer) {
    if (this.mAdapter != null) {
        this.mAdapter.unregisterDataSetObserver(observer);
    }
}
项目:GitHub    文件:CommonAdapter.java   
public void unregisterDataSetObserver(DataSetObserver observer) {
    mDataSetObservable.unregisterObserver(observer);
}
项目:PlusGram    文件:BaseFragmentAdapter.java   
@Override
public void unregisterDataSetObserver(DataSetObserver observer) {
    if (observer != null) {
        super.unregisterDataSetObserver(observer);
    }
}
项目:GitHub    文件:BaseRecyclerAdapter.java   
public void unregisterDataSetObserver(DataSetObserver observer) {
    mDataSetObservable.unregisterObserver(observer);
}