use of android.widget.GridView in project emojicon by rockerhieu.
the class EmojiconRecentsGridFragment method onViewCreated.
@Override
public void onViewCreated(View view, Bundle savedInstanceState) {
EmojiconRecentsManager recents = EmojiconRecentsManager.getInstance(view.getContext());
mAdapter = new EmojiconAdapter(view.getContext(), recents, mUseSystemDefault);
GridView gridView = (GridView) view.findViewById(R.id.Emoji_GridView);
gridView.setAdapter(mAdapter);
gridView.setOnItemClickListener(this);
}
use of android.widget.GridView in project platform_frameworks_base by android.
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 platform_frameworks_base by android.
the class GridThrasher method onCreate.
@Override
public void onCreate(Bundle icicle) {
super.onCreate(icicle);
setContentView(R.layout.grid_thrasher);
mText = (TextView) findViewById(R.id.text);
mAdapter = new ThrashListAdapter(this);
GridView g = (GridView) findViewById(R.id.grid);
g.setAdapter(mAdapter);
mHandler.postDelayed(mThrash, 5000);
g.setOnItemSelectedListener(this);
}
use of android.widget.GridView in project AndroidDynamicLoader by mmin18.
the class ImageGridFragment method onCreateView.
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
MyResources res = MyResources.getResource(ImageGridFragment.class);
final View v = res.inflate(getActivity(), R.layout.image_grid_fragment, container, false);
final GridView mGridView = (GridView) v.findViewById(R.id.gridView);
mGridView.setAdapter(mAdapter);
mGridView.setOnItemClickListener(this);
mGridView.setOnScrollListener(new AbsListView.OnScrollListener() {
@Override
public void onScrollStateChanged(AbsListView absListView, int scrollState) {
// Pause fetcher to ensure smoother scrolling when flinging
if (scrollState == AbsListView.OnScrollListener.SCROLL_STATE_FLING) {
mImageFetcher.setPauseWork(true);
} else {
mImageFetcher.setPauseWork(false);
}
}
@Override
public void onScroll(AbsListView absListView, int firstVisibleItem, int visibleItemCount, int totalItemCount) {
}
});
// This listener is used to get the final width of the GridView and then calculate the
// number of columns and the width of each column. The width of each column is variable
// as the GridView has stretchMode=columnWidth. The column width is used to set the height
// of each view so we get nice square thumbnails.
mGridView.getViewTreeObserver().addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() {
@Override
public void onGlobalLayout() {
if (mAdapter.getNumColumns() == 0) {
final int numColumns = (int) Math.floor(mGridView.getWidth() / (mImageThumbSize + mImageThumbSpacing));
if (numColumns > 0) {
final int columnWidth = (mGridView.getWidth() / numColumns) - mImageThumbSpacing;
mAdapter.setNumColumns(numColumns);
mAdapter.setItemHeight(columnWidth);
Log.d(TAG, "onCreateView - numColumns set to " + numColumns);
}
}
}
});
return v;
}
use of android.widget.GridView in project ButterRemote-Android by se-bastiaan.
the class DonationFragment method onCreateDialog.
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
Activity activity = getActivity();
assert activity != null;
View view = getActivity().getLayoutInflater().inflate(R.layout.donation_dialog, null, false);
AlertDialog.Builder builder = new AlertDialog.Builder(activity).setTitle(R.string.donation_title).setView(view).setNegativeButton(android.R.string.cancel, null);
TextView info = (TextView) view.findViewById(R.id.info);
info.setText(Html.fromHtml(getString(R.string.donation_info)));
info.setMovementMethod(new LinkMovementMethod());
mError = (TextView) view.findViewById(R.id.error);
mProgressBar = (ProgressBar) view.findViewById(android.R.id.progress);
mGridView = (GridView) view.findViewById(R.id.grid);
mGridView.setAdapter(new DonationAdapter(getActivity(), mDonationList, mInventorySet));
mGridView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
DonationAdapter adapter = (DonationAdapter) parent.getAdapter();
Donation donation = adapter.getItem(position);
if (!mInventorySet.contains(donation.sku)) {
/**
* See {@link sharedcode.turboeditor.iab.DonationFragment#verifyDeveloperPayload(Purchase)}.
*/
String payload = "";
try {
mHelper.launchPurchaseFlow(getActivity(), donation.sku, RC_REQUEST, mPurchaseFinishedListener, payload);
} catch (Exception e) {
Toast.makeText(getActivity(), "Failed to launch a purchase flow.", Toast.LENGTH_SHORT).show();
}
} else {
Toast.makeText(getActivity(), getString(R.string.donation_item_bought), Toast.LENGTH_LONG);
}
}
});
final AlertDialog alertDialog;
alertDialog = builder.create();
initBilling();
return alertDialog;
}
Aggregations