use of github.chenupt.multiplemodel.ModelListAdapter in project DragTopLayout by chenupt.
the class GridViewFragment method initView.
private void initView() {
gridView = (GridView) getView().findViewById(R.id.grid_view);
adapter = new ModelListAdapter(getActivity(), DataService.getInstance().getModelManager());
gridView.setAdapter(adapter);
adapter.setList(DataService.getInstance().getList());
adapter.notifyDataSetChanged();
// attach top
gridView.setOnScrollListener(new AbsListView.OnScrollListener() {
@Override
public void onScrollStateChanged(AbsListView view, int scrollState) {
}
@Override
public void onScroll(AbsListView view, int firstVisibleItem, int visibleItemCount, int totalItemCount) {
EventBus.getDefault().post(AttachUtil.isAdapterViewAttach(view));
}
});
}
use of github.chenupt.multiplemodel.ModelListAdapter in project DragTopLayout by chenupt.
the class ListViewFragment method initView.
private void initView() {
listView = (ListView) getView().findViewById(R.id.list_view);
adapter = new ModelListAdapter(getActivity(), DataService.getInstance().getModelManager());
listView.setAdapter(adapter);
adapter.setList(DataService.getInstance().getList());
adapter.notifyDataSetChanged();
listView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
Toast.makeText(getActivity(), "Clicked " + position, Toast.LENGTH_SHORT).show();
}
});
// attach top
listView.setOnScrollListener(new AbsListView.OnScrollListener() {
@Override
public void onScrollStateChanged(AbsListView view, int scrollState) {
}
@Override
public void onScroll(AbsListView view, int firstVisibleItem, int visibleItemCount, int totalItemCount) {
EventBus.getDefault().post(AttachUtil.isAdapterViewAttach(view));
}
});
}
use of github.chenupt.multiplemodel.ModelListAdapter in project DragTopLayout by chenupt.
the class PullToRefreshActivity method onCreate.
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_pulltorefresh);
Toolbar toolbar = (Toolbar) findViewById(R.id.tool_bar);
toolbar.setTitle("PullToRefresh");
setSupportActionBar(toolbar);
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
pullToRefreshTopLayout = (PullToRefreshTopLayout) findViewById(R.id.pull_to_refresh_layout);
listView = (ListView) findViewById(R.id.list_view);
ModelListAdapter adapter = new ModelListAdapter(this, DataService.getInstance().getModelManager());
listView.setAdapter(adapter);
adapter.setList(DataService.getInstance().getList());
adapter.notifyDataSetChanged();
// attach top
listView.setOnScrollListener(new AbsListView.OnScrollListener() {
@Override
public void onScrollStateChanged(AbsListView view, int scrollState) {
}
@Override
public void onScroll(AbsListView view, int firstVisibleItem, int visibleItemCount, int totalItemCount) {
pullToRefreshTopLayout.getRefreshableView().setTouchMode(AttachUtil.isAdapterViewAttach(view));
}
});
}
Aggregations