use of com.marshalchen.common.uimodule.staggeredgridview.StaggeredGridView in project UltimateAndroid by cymcsg.
the class StaggeredGridEmptyViewActivity method onCreate.
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.staggered_grid_view_activity_sgv_empy_view);
setTitle("SGV");
mGridView = (StaggeredGridView) findViewById(R.id.grid_view);
LayoutInflater layoutInflater = getLayoutInflater();
View header = layoutInflater.inflate(R.layout.staggered_grid_view_list_item_header_footer, null);
View footer = layoutInflater.inflate(R.layout.staggered_grid_view_list_item_header_footer, null);
TextView txtHeaderTitle = (TextView) header.findViewById(R.id.txt_title);
TextView txtFooterTitle = (TextView) footer.findViewById(R.id.txt_title);
txtHeaderTitle.setText("THE HEADER!");
txtFooterTitle.setText("THE FOOTER!");
mGridView.addHeaderView(header);
mGridView.addFooterView(footer);
mGridView.setEmptyView(findViewById(android.R.id.empty));
mAdapter = new SampleAdapter(this, R.id.txt_line1);
// do we have saved data?
if (savedInstanceState != null) {
mData = savedInstanceState.getStringArrayList(SAVED_DATA_KEY);
fillAdapter();
}
if (mData == null) {
mData = SampleData.generateSampleData();
}
mGridView.setAdapter(mAdapter);
mGridView.setOnItemClickListener(this);
fetchDataReceiver = new BroadcastReceiver() {
@Override
public void onReceive(Context receiverContext, Intent receiverIntent) {
fillAdapter();
}
};
LocalBroadcastManager.getInstance(this).registerReceiver(fetchDataReceiver, new IntentFilter(FETCH_DATA_FILTER));
fetchData();
}
use of com.marshalchen.common.uimodule.staggeredgridview.StaggeredGridView in project UltimateAndroid by cymcsg.
the class StaggeredGridActivity method onCreate.
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.staggered_grid_view_activity_sgv);
setTitle("SGV");
mGridView = (StaggeredGridView) findViewById(R.id.grid_view);
LayoutInflater layoutInflater = getLayoutInflater();
View header = layoutInflater.inflate(R.layout.staggered_grid_view_list_item_header_footer, null);
View footer = layoutInflater.inflate(R.layout.staggered_grid_view_list_item_header_footer, null);
TextView txtHeaderTitle = (TextView) header.findViewById(R.id.txt_title);
TextView txtFooterTitle = (TextView) footer.findViewById(R.id.txt_title);
txtHeaderTitle.setText("THE HEADER!");
txtFooterTitle.setText("THE FOOTER!");
mGridView.addHeaderView(header);
mGridView.addFooterView(footer);
mAdapter = new SampleAdapter(this, R.id.txt_line1);
// do we have saved data?
if (savedInstanceState != null) {
mData = savedInstanceState.getStringArrayList(SAVED_DATA_KEY);
}
if (mData == null) {
mData = SampleData.generateSampleData();
}
for (String data : mData) {
mAdapter.add(data);
}
mGridView.setAdapter(mAdapter);
mGridView.setOnScrollListener(this);
mGridView.setOnItemClickListener(this);
mGridView.setOnItemLongClickListener(this);
}
Aggregations