use of android.widget.GridView in project Klyph by jonathangerbaud.
the class GridFragment method onCreateView.
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View view = inflater.inflate(getCustomLayout(), container, false);
gridView = (GridView) view.findViewById(R.id.grid);
View emptyView = getEmptyView();
if (emptyView != null) {
emptyView.setId(android.R.id.empty);
((ViewGroup) gridView.getParent()).addView(emptyView);
gridView.setEmptyView(emptyView);
}
return view;
}
use of android.widget.GridView in project Android-Universal-Image-Loader by nostra13.
the class ImageGridFragment method onCreateView.
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View rootView = inflater.inflate(R.layout.fr_image_grid, container, false);
listView = (GridView) rootView.findViewById(R.id.grid);
((GridView) listView).setAdapter(new ImageAdapter(getActivity()));
listView.setOnItemClickListener(new OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
startImagePagerActivity(position);
}
});
return rootView;
}
use of android.widget.GridView in project dialogplus by orhanobut.
the class GridHolder method getView.
@Override
public View getView(LayoutInflater inflater, ViewGroup parent) {
View view = inflater.inflate(R.layout.dialog_grid, parent, false);
View outMostView = view.findViewById(R.id.dialogplus_outmost_container);
outMostView.setBackgroundResource(backgroundResource);
gridView = (GridView) view.findViewById(R.id.dialogplus_list);
gridView.setNumColumns(columnNumber);
gridView.setOnItemClickListener(this);
gridView.setOnKeyListener(new View.OnKeyListener() {
@Override
public boolean onKey(View v, int keyCode, KeyEvent event) {
if (keyListener == null) {
throw new NullPointerException("keyListener should not be null");
}
return keyListener.onKey(v, keyCode, event);
}
});
headerContainer = (ViewGroup) view.findViewById(R.id.dialogplus_header_container);
footerContainer = (ViewGroup) view.findViewById(R.id.dialogplus_footer_container);
return view;
}
use of android.widget.GridView in project dialogplus by orhanobut.
the class GridHolderTest method testViewInflation.
@Test
public void testViewInflation() {
GridHolder holder = new GridHolder(3);
LayoutInflater layoutInflater = LayoutInflater.from(context);
View view = holder.getView(layoutInflater, new LinearLayout(context));
assertThat(view).isNotNull();
assertThat(holder.getInflatedView().getId()).isEqualTo(R.id.dialogplus_list);
GridView gridView = (GridView) holder.getInflatedView();
assertThat(gridView.getOnItemClickListener()).isInstanceOf(GridHolder.class);
}
use of android.widget.GridView in project JamsMusicPlayer by psaravan.
the class BrowserSubGridActivity method onCreate.
@Override
protected void onCreate(Bundle savedInstanceState) {
mContext = getApplicationContext();
mApp = (Common) mContext;
mHandler = new Handler();
mDBColumnsMap = new HashMap<Integer, String>();
//Set the theme and inflate the layout.
setTheme();
overridePendingTransition(R.anim.fade_in, R.anim.fade_out);
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_browser_sub_grid);
mHeaderImagePath = getIntent().getExtras().getString("headerImagePath");
mFragmentId = getIntent().getExtras().getInt("fragmentId");
mHeaderText = getIntent().getExtras().getString("headerText");
mHeaderSubText = getIntent().getExtras().getString("subText");
if (mHeaderText == null || mHeaderText.isEmpty())
mHeaderText = mContext.getResources().getString(R.string.unknown_genre);
mHeaderLayout = (RelativeLayout) findViewById(R.id.browser_sub_header_layout);
mHeaderImage = (ImageView) findViewById(R.id.browser_sub_header_image);
mHeaderTextView = (TextView) findViewById(R.id.browser_sub_header_text);
mHeaderSubTextView = (TextView) findViewById(R.id.browser_sub_header_sub_text);
mGridView = (GridView) findViewById(R.id.browser_sub_grid_view);
mDrawerParentLayout = (RelativeLayout) findViewById(R.id.browser_sub_drawer_parent);
mDrawerLayout = (DrawerLayout) findViewById(R.id.browser_sub_drawer_root);
mNavDrawerLayout = (RelativeLayout) findViewById(R.id.nav_drawer_container);
mCurrentQueueDrawerLayout = (RelativeLayout) findViewById(R.id.current_queue_drawer_container);
mPlayAllText = (TextView) findViewById(R.id.browser_sub_play_all);
mHeaderTextView.setTypeface(TypefaceHelper.getTypeface(mContext, "Roboto-Regular"));
mHeaderTextView.setText(mHeaderText);
mHeaderTextView.setSelected(true);
mHeaderSubTextView.setTypeface(TypefaceHelper.getTypeface(mContext, "Roboto-Regular"));
mHeaderSubTextView.setText(mHeaderSubText);
mHeaderSubTextView.setSelected(true);
mPlayAllText.setTypeface(TypefaceHelper.getTypeface(mContext, "Roboto-Regular"));
mPlayAllText.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
int playbackRouteId = Common.PLAY_ALL_SONGS;
switch(mFragmentId) {
case Common.ARTISTS_FLIPPED_FRAGMENT:
playbackRouteId = Common.PLAY_ALL_BY_ARTIST;
break;
case Common.ALBUM_ARTISTS_FLIPPED_FRAGMENT:
playbackRouteId = Common.PLAY_ALL_BY_ALBUM_ARTIST;
break;
case Common.GENRES_FLIPPED_FRAGMENT:
playbackRouteId = Common.PLAY_ALL_IN_GENRE;
break;
}
mApp.getPlaybackKickstarter().initPlayback(mContext, mQuerySelection, playbackRouteId, 0, true, false);
}
});
mDrawerParentLayout.setBackgroundColor(UIElementsHelper.getBackgroundColor(mContext));
applyKitKatTranslucency();
//Load the drawer fragments.
loadDrawerFragments();
//Set the number of gridview columns based on the screen density and orientation.
if (mApp.isPhoneInLandscape() || mApp.isTabletInLandscape()) {
mGridView.setNumColumns(4);
} else if (mApp.isPhoneInPortrait()) {
mGridView.setNumColumns(2);
} else if (mApp.isTabletInPortrait()) {
mGridView.setNumColumns(3);
}
//Start the content animations as soon the activity's transition finishes.
mHandler.postDelayed(animateContent, 300);
//Start loading the GridView cursor.
AsyncRunQuery task = new AsyncRunQuery();
task.execute();
}
Aggregations