use of android.widget.GridView in project cw-omnibus by commonsguy.
the class GridDemo method onCreate.
@Override
public void onCreate(Bundle icicle) {
super.onCreate(icicle);
setContentView(R.layout.main);
selection = (TextView) findViewById(R.id.selection);
GridView g = (GridView) findViewById(R.id.grid);
g.setAdapter(new ArrayAdapter<String>(this, R.layout.cell, items));
g.setOnItemClickListener(this);
}
use of android.widget.GridView in project android_frameworks_base by ParanoidAndroid.
the class CharacterPickerDialog method onCreate.
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
WindowManager.LayoutParams params = getWindow().getAttributes();
params.token = mView.getApplicationWindowToken();
params.type = params.TYPE_APPLICATION_ATTACHED_DIALOG;
params.flags = params.flags | Window.FEATURE_NO_TITLE;
setContentView(R.layout.character_picker);
GridView grid = (GridView) findViewById(R.id.characterPicker);
grid.setAdapter(new OptionsAdapter(getContext()));
grid.setOnItemClickListener(this);
mCancelButton = (Button) findViewById(R.id.cancel);
mCancelButton.setOnClickListener(this);
}
use of android.widget.GridView in project android_frameworks_base by AOSPA.
the class GridScenario method onCreate.
@Override
protected void onCreate(Bundle icicle) {
super.onCreate(icicle);
// turn off title bar
requestWindowFeature(Window.FEATURE_NO_TITLE);
mScreenHeight = getWindowManager().getDefaultDisplay().getHeight();
final Params params = new Params();
init(params);
readAndValidateParams(params);
mGridView = new GridView(this);
mGridView.setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT));
mGridView.setDrawSelectorOnTop(false);
if (mNumColumns >= GridView.AUTO_FIT) {
mGridView.setNumColumns(mNumColumns);
}
if (mColumnWidth > 0) {
mGridView.setColumnWidth(mColumnWidth);
}
if (mVerticalSpacing > 0) {
mGridView.setVerticalSpacing(mVerticalSpacing);
}
mGridView.setStretchMode(mStretchMode);
mGridView.setAdapter(createAdapter());
if (mStartingSelectionPosition >= 0) {
mGridView.setSelection(mStartingSelectionPosition);
}
mGridView.setPadding(10, 10, 10, 10);
mGridView.setStackFromBottom(mStackFromBottom);
mGridView.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
public void onItemSelected(AdapterView parent, View v, int position, long id) {
positionSelected(position);
}
public void onNothingSelected(AdapterView parent) {
nothingSelected();
}
});
setContentView(mGridView);
}
use of android.widget.GridView in project ApertureGallery by MJonesDev.
the class AlbumActivity method initializeView.
private void initializeView() {
mView = (GridView) findViewById(com.marlonjones.projectevo.R.id.grid_view);
mView.setAdapter(listAdapter = new ListAdapter(AlbumActivity.this));
int position = mView.getFirstVisiblePosition();
int columnsCount = 3;
mView.setNumColumns(columnsCount);
itemWidth = (ApertureBasing.displaySize.x - ((columnsCount + 2) * ApertureBasing.dp(4))) / columnsCount;
mView.setColumnWidth(itemWidth);
listAdapter.notifyDataSetChanged();
mView.setSelection(position);
mView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> adapterView, View view, int position, long l) {
Intent mIntent = new Intent(AlbumActivity.this, PhotoPreviewActivity.class);
Bundle mBundle = new Bundle();
mBundle.putInt("Key_FolderID", AlbummID);
mBundle.putInt("Key_ID", position);
mIntent.putExtras(mBundle);
startActivity(mIntent);
}
});
LoadAllAlbum();
}
use of android.widget.GridView in project ApertureGallery by MJonesDev.
the class CameraFragment method initializeView.
private void initializeView(View v) {
mView = (GridView) v.findViewById(R.id.grid_view);
emptyView = (TextView) v.findViewById(R.id.searchEmptyView);
emptyView.setOnTouchListener(new View.OnTouchListener() {
@Override
public boolean onTouch(View v, MotionEvent event) {
return true;
}
});
emptyView.setText("NoPhotos");
mView.setAdapter(listAdapter = new ListAdapter(mContext));
albumsSorted = GalleryFragment.albumsSorted;
photos = GalleryFragment.albumsSorted.get(0).photos;
int position = mView.getFirstVisiblePosition();
int columnsCount = 3;
mView.setNumColumns(columnsCount);
itemWidth = (ApertureBasing.displaySize.x - ((columnsCount + 1) * ApertureBasing.dp(4))) / columnsCount;
mView.setColumnWidth(itemWidth);
listAdapter.notifyDataSetChanged();
mView.setSelection(position);
mView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> adapterView, View view, int position, long l) {
Intent mIntent = new Intent(mContext, PhotoPreviewActivity.class);
Bundle mBundle = new Bundle();
mBundle.putInt("Key_FolderID", 0);
mBundle.putInt("Key_ID", position);
mIntent.putExtras(mBundle);
startActivity(mIntent);
}
});
if (listAdapter != null) {
listAdapter.notifyDataSetChanged();
}
}
Aggregations