本文整理匯總了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();
}
}
}