use of android.widget.GridView in project facebook-android-sdk by facebook.
the class MainActivity method onCreate.
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
gameController = new GameController(this, getIntent());
board = (GridView) findViewById(R.id.board);
validNumbers = (GridView) findViewById(R.id.valid_numbers);
gameController.setBoardView(board);
gameController.setSelectionView(validNumbers);
Button newGame = (Button) findViewById(R.id.new_board);
newGame.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
gameController.newGame();
}
});
Button clearBoard = (Button) findViewById(R.id.clear_board);
clearBoard.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
gameController.clearBoard();
}
});
final ShareButton share = (ShareButton) findViewById(R.id.share_button);
share.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
share.setShareContent(getLinkContent());
}
});
final SendButton send = (SendButton) findViewById(R.id.send_button);
send.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
send.setShareContent(getLinkContent());
}
});
Button copy = (Button) findViewById(R.id.copy_button);
copy.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
ClipboardManager clipboard = (ClipboardManager) getSystemService(CLIPBOARD_SERVICE);
ClipData clip = ClipData.newUri(getContentResolver(), "Iconicus", gameController.getShareUri());
clipboard.setPrimaryClip(clip);
Toast.makeText(MainActivity.this, R.string.link_copied, Toast.LENGTH_SHORT).show();
}
});
}
use of android.widget.GridView in project android-topeka by googlesamples.
the class SignInFragment method setUpGridView.
private void setUpGridView(View container) {
mAvatarGrid = (GridView) container.findViewById(R.id.avatars);
mAvatarGrid.setAdapter(new AvatarAdapter(getActivity()));
mAvatarGrid.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
mSelectedAvatarView = view;
mSelectedAvatar = Avatar.values()[position];
// showing the floating action button if input data is valid
if (isInputDataValid()) {
mDoneFab.show();
}
}
});
mAvatarGrid.setNumColumns(calculateSpanCount());
if (mSelectedAvatar != null) {
mAvatarGrid.setItemChecked(mSelectedAvatar.ordinal(), true);
}
}
use of android.widget.GridView in project android_frameworks_base by DirtyUnicorns.
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 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();
}
Aggregations