use of android.widget.GridView in project SeriesGuide by UweTrottmann.
the class ListsFragment method onActivityCreated.
@Override
public void onActivityCreated(Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);
mAdapter = new ListItemsAdapter(getActivity(), onContextMenuClickListener);
if (getView() == null) {
return;
}
// setup grid view
GridView gridView = (GridView) getView().findViewById(android.R.id.list);
// enable app bar scrolling out of view only on L or higher
ViewCompat.setNestedScrollingEnabled(gridView, AndroidUtils.isLollipopOrHigher());
gridView.setAdapter(mAdapter);
gridView.setOnItemClickListener(this);
gridView.setEmptyView(getView().findViewById(android.R.id.empty));
gridView.setFastScrollAlwaysVisible(false);
gridView.setFastScrollEnabled(true);
getLoaderManager().initLoader(LOADER_ID, getArguments(), loaderCallbacks);
}
use of android.widget.GridView in project CustomShapeImageView by MostafaGazar.
the class SamplesActivity method onCreate.
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_samples);
GridView gridView = (GridView) findViewById(R.id.gridview);
gridView.setAdapter(new SvgImagesAdapter(this));
}
use of android.widget.GridView in project material-dialogs by afollestad.
the class ColorChooserDialog method onCreateDialog.
@NonNull
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
if (getArguments() == null || !getArguments().containsKey("builder")) {
throw new IllegalStateException("ColorChooserDialog should be created using its Builder interface.");
}
generateColors();
int preselectColor;
boolean foundPreselectColor = false;
if (savedInstanceState != null) {
foundPreselectColor = !savedInstanceState.getBoolean("in_custom", false);
preselectColor = getSelectedColor();
} else {
if (getBuilder().setPreselectionColor) {
preselectColor = getBuilder().preselectColor;
if (preselectColor != 0) {
for (int topIndex = 0; topIndex < colorsTop.length; topIndex++) {
if (colorsTop[topIndex] == preselectColor) {
foundPreselectColor = true;
topIndex(topIndex);
if (getBuilder().accentMode) {
subIndex(2);
} else if (colorsSub != null) {
findSubIndexForColor(topIndex, preselectColor);
} else {
subIndex(5);
}
break;
}
if (colorsSub != null) {
for (int subIndex = 0; subIndex < colorsSub[topIndex].length; subIndex++) {
if (colorsSub[topIndex][subIndex] == preselectColor) {
foundPreselectColor = true;
topIndex(topIndex);
subIndex(subIndex);
break;
}
}
if (foundPreselectColor) {
break;
}
}
}
}
} else {
preselectColor = Color.BLACK;
foundPreselectColor = true;
}
}
circleSize = getResources().getDimensionPixelSize(R.dimen.md_colorchooser_circlesize);
final Builder builder = getBuilder();
MaterialDialog.Builder bd = new MaterialDialog.Builder(getActivity()).title(getTitle()).autoDismiss(false).customView(R.layout.md_dialog_colorchooser, false).negativeText(builder.cancelBtn).positiveText(builder.doneBtn).neutralText(builder.allowUserCustom ? builder.customBtn : 0).onPositive(new MaterialDialog.SingleButtonCallback() {
@Override
public void onClick(@NonNull MaterialDialog dialog, @NonNull DialogAction which) {
callback.onColorSelection(ColorChooserDialog.this, getSelectedColor());
dismiss();
}
}).onNegative(new MaterialDialog.SingleButtonCallback() {
@Override
public void onClick(@NonNull MaterialDialog dialog, @NonNull DialogAction which) {
if (isInSub()) {
dialog.setActionButton(DialogAction.NEGATIVE, getBuilder().cancelBtn);
isInSub(false);
// Do this to avoid ArrayIndexOutOfBoundsException
subIndex(-1);
invalidate();
} else {
dialog.cancel();
}
}
}).onNeutral(new MaterialDialog.SingleButtonCallback() {
@Override
public void onClick(@NonNull MaterialDialog dialog, @NonNull DialogAction which) {
toggleCustom(dialog);
}
}).showListener(new DialogInterface.OnShowListener() {
@Override
public void onShow(DialogInterface dialog) {
invalidateDynamicButtonColors();
}
});
if (builder.theme != null) {
bd.theme(builder.theme);
}
final MaterialDialog dialog = bd.build();
final View v = dialog.getCustomView();
grid = (GridView) v.findViewById(R.id.md_grid);
if (builder.allowUserCustom) {
selectedCustomColor = preselectColor;
colorChooserCustomFrame = v.findViewById(R.id.md_colorChooserCustomFrame);
customColorHex = (EditText) v.findViewById(R.id.md_hexInput);
customColorIndicator = v.findViewById(R.id.md_colorIndicator);
customSeekA = (SeekBar) v.findViewById(R.id.md_colorA);
customSeekAValue = (TextView) v.findViewById(R.id.md_colorAValue);
customSeekR = (SeekBar) v.findViewById(R.id.md_colorR);
customSeekRValue = (TextView) v.findViewById(R.id.md_colorRValue);
customSeekG = (SeekBar) v.findViewById(R.id.md_colorG);
customSeekGValue = (TextView) v.findViewById(R.id.md_colorGValue);
customSeekB = (SeekBar) v.findViewById(R.id.md_colorB);
customSeekBValue = (TextView) v.findViewById(R.id.md_colorBValue);
if (!builder.allowUserCustomAlpha) {
v.findViewById(R.id.md_colorALabel).setVisibility(View.GONE);
customSeekA.setVisibility(View.GONE);
customSeekAValue.setVisibility(View.GONE);
customColorHex.setHint("2196F3");
customColorHex.setFilters(new InputFilter[] { new InputFilter.LengthFilter(6) });
} else {
customColorHex.setHint("FF2196F3");
customColorHex.setFilters(new InputFilter[] { new InputFilter.LengthFilter(8) });
}
if (!foundPreselectColor) {
// If color wasn't found in the preset colors, it must be custom
toggleCustom(dialog);
}
}
invalidate();
return dialog;
}
use of android.widget.GridView in project CurtainView by aicaprio.
the class SampleActivity method showSample2.
private void showSample2() {
setContentView(R.layout.activity_sample2);
final CurtainView curtainView = (CurtainView) findViewById(R.id.cv1);
final ImageView iv1 = (ImageView) findViewById(R.id.iv1);
final GridView gv1 = (GridView) findViewById(R.id.gv1);
final List<Map<String, Integer>> data = getData();
gv1.setAdapter(new SimpleAdapter(this, data, R.layout.item_numbers, new String[] { TEXT_TAG }, new int[] { R.id.item_tvNum }));
gv1.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
showToast(data.get(position).get(TEXT_TAG) + " clicked");
}
});
iv1.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
curtainView.toggleStatus();
}
});
curtainView.setScrollerInterpolator(new BounceInterpolator());
curtainView.post(new Runnable() {
@Override
public void run() {
curtainView.setCurtainGravityAndFixedValue(null, iv1.getHeight());
}
});
}
use of android.widget.GridView in project SlidingMenu by jfeinstein10.
the class BirdGridFragment method onCreateView.
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
if (mPos == -1 && savedInstanceState != null)
mPos = savedInstanceState.getInt("mPos");
TypedArray imgs = getResources().obtainTypedArray(R.array.birds_img);
mImgRes = imgs.getResourceId(mPos, -1);
GridView gv = (GridView) inflater.inflate(R.layout.list_grid, null);
gv.setBackgroundResource(android.R.color.black);
gv.setAdapter(new GridAdapter());
gv.setOnItemClickListener(new OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
if (getActivity() == null)
return;
ResponsiveUIActivity activity = (ResponsiveUIActivity) getActivity();
activity.onBirdPressed(mPos);
}
});
return gv;
}
Aggregations