本文整理汇总了Java中android.database.DataSetObserver类的典型用法代码示例。如果您正苦于以下问题:Java DataSetObserver类的具体用法?Java DataSetObserver怎么用?Java DataSetObserver使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
DataSetObserver类属于android.database包,在下文中一共展示了DataSetObserver类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setAdapter
import android.database.DataSetObserver; //导入依赖的package包/类
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);
}
});
}
}
示例2: init
import android.database.DataSetObserver; //导入依赖的package包/类
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);
}
示例3: setAdapter
import android.database.DataSetObserver; //导入依赖的package包/类
/**
* @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();
}
});
}
示例4: initView
import android.database.DataSetObserver; //导入依赖的package包/类
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);
}
示例5: registerDataSetObserver
import android.database.DataSetObserver; //导入依赖的package包/类
@Override
public void registerDataSetObserver(DataSetObserver observer) {
if (datasetObservers == null) {
datasetObservers = new LinkedList<DataSetObserver>();
}
datasetObservers.add(observer);
}
示例6: onRestoreInstanceState
import android.database.DataSetObserver; //导入依赖的package包/类
@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();
}
示例7: notifyDataInvalidatedEvent
import android.database.DataSetObserver; //导入依赖的package包/类
/**
* Notifies observers about invalidating data
*/
protected void notifyDataInvalidatedEvent() {
if (datasetObservers != null) {
for (DataSetObserver observer : datasetObservers) {
observer.onInvalidated();
}
}
}
示例8: notifyDataInvalidatedEvent
import android.database.DataSetObserver; //导入依赖的package包/类
protected void notifyDataInvalidatedEvent() {
if (this.datasetObservers != null) {
for (DataSetObserver observer : this.datasetObservers) {
observer.onInvalidated();
}
}
}
示例9: notifyDataChangedEvent
import android.database.DataSetObserver; //导入依赖的package包/类
/**
* Notifies observers about data changing
*/
protected void notifyDataChangedEvent() {
if (datasetObservers != null) {
for (DataSetObserver observer : datasetObservers) {
observer.onChanged();
}
}
}
示例10: unregisterDataSetObserver
import android.database.DataSetObserver; //导入依赖的package包/类
@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);
}
}
}
示例11: AdapterWrapper
import android.database.DataSetObserver; //导入依赖的package包/类
public AdapterWrapper(ListAdapter adapter) {
super();
mAdapter = adapter;
mAdapter.registerDataSetObserver(new DataSetObserver() {
public void onChanged() {
notifyDataSetChanged();
}
public void onInvalidated() {
notifyDataSetInvalidated();
}
});
}
示例12: setViewPagerObserver
import android.database.DataSetObserver; //导入依赖的package包/类
@Override
public void setViewPagerObserver(DataSetObserver observer) {
super.setViewPagerObserver(observer);
if (observer == null) {
wrapperViewPager(mViewPager, this);
}
}
示例13: CBLoopPagerAdapterWrapper
import android.database.DataSetObserver; //导入依赖的package包/类
CBLoopPagerAdapterWrapper(PagerAdapter adapter) {
this.mAdapter = adapter;
adapter.registerDataSetObserver(new DataSetObserver(){
public void onChanged(){
notifyDataSetChanged();
}
});
}
示例14: registerDataSetObserver
import android.database.DataSetObserver; //导入依赖的package包/类
@Override
public void registerDataSetObserver(DataSetObserver observer) {
if (datasetObservers == null) {
datasetObservers = new LinkedList<DataSetObserver>();
}
datasetObservers.add(observer);
}
示例15: notifyDataChangedEvent
import android.database.DataSetObserver; //导入依赖的package包/类
/**
* Notifies observers about data changing
*/
protected void notifyDataChangedEvent() {
if (datasetObservers != null) {
for (DataSetObserver observer : datasetObservers) {
observer.onChanged();
}
}
}