Search in sources :

Example 16 with GridView

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;
}
Also used : ViewGroup(android.view.ViewGroup) GridView(android.widget.GridView) View(android.view.View) AdapterView(android.widget.AdapterView)

Example 17 with GridView

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;
}
Also used : OnItemClickListener(android.widget.AdapterView.OnItemClickListener) GridView(android.widget.GridView) GridView(android.widget.GridView) ImageView(android.widget.ImageView) View(android.view.View) AdapterView(android.widget.AdapterView)

Example 18 with GridView

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;
}
Also used : KeyEvent(android.view.KeyEvent) GridView(android.widget.GridView) View(android.view.View) AdapterView(android.widget.AdapterView)

Example 19 with GridView

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);
}
Also used : LayoutInflater(android.view.LayoutInflater) GridView(android.widget.GridView) GridHolder(com.orhanobut.dialogplus.GridHolder) GridView(android.widget.GridView) View(android.view.View) LinearLayout(android.widget.LinearLayout) Test(org.junit.Test)

Example 20 with GridView

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();
}
Also used : Handler(android.os.Handler) GridView(android.widget.GridView) ImageView(android.widget.ImageView) View(android.view.View) AdapterView(android.widget.AdapterView) AbsListView(android.widget.AbsListView) TextView(android.widget.TextView)

Aggregations

GridView (android.widget.GridView)139 View (android.view.View)83 AdapterView (android.widget.AdapterView)61 TextView (android.widget.TextView)41 ImageView (android.widget.ImageView)28 AbsListView (android.widget.AbsListView)20 Intent (android.content.Intent)14 ViewGroup (android.view.ViewGroup)14 SuppressLint (android.annotation.SuppressLint)10 OnItemClickListener (android.widget.AdapterView.OnItemClickListener)10 LayoutInflater (android.view.LayoutInflater)8 ArrayList (java.util.ArrayList)8 WindowManager (android.view.WindowManager)7 Button (android.widget.Button)7 ColorDrawable (android.graphics.drawable.ColorDrawable)6 ListView (android.widget.ListView)6 LinearLayout (android.widget.LinearLayout)5 Bundle (android.os.Bundle)4 ViewTreeObserver (android.view.ViewTreeObserver)4 ArrayAdapter (android.widget.ArrayAdapter)4