Search in sources :

Example 1 with GridView

use of android.widget.GridView in project MaterialEverywhere by antoniolg.

the class HomeActivity method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setActionBarIcon(R.drawable.ic_ab_drawer);
    GridView gridView = (GridView) findViewById(R.id.gridView);
    gridView.setAdapter(new GridViewAdapter());
    gridView.setOnItemClickListener(new AdapterView.OnItemClickListener() {

        @Override
        public void onItemClick(AdapterView<?> adapterView, View view, int i, long l) {
            String url = (String) view.getTag();
            DetailActivity.launch(HomeActivity.this, view.findViewById(R.id.image), url);
        }
    });
    drawer = (DrawerLayout) findViewById(R.id.drawer);
    drawer.setDrawerShadow(R.drawable.drawer_shadow, Gravity.START);
}
Also used : AdapterView(android.widget.AdapterView) GridView(android.widget.GridView) GridView(android.widget.GridView) ImageView(android.widget.ImageView) TextView(android.widget.TextView) View(android.view.View) AdapterView(android.widget.AdapterView)

Example 2 with GridView

use of android.widget.GridView in project UltimateAndroid by cymcsg.

the class MainFragment method onCreateView.

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View view = inflater.inflate(R.layout.drive_image_view_fragment_main, container, false);
    GridView gridView = (GridView) view.findViewById(R.id.gridView);
    gridView.setAdapter(new DisplayItemAdapter(view.getContext(), new ArrayList<String>(Arrays.asList(sampleTexts)), getFragmentManager()));
    return view;
}
Also used : DisplayItemAdapter(com.marshalchen.common.demoofui.driveimageview.DisplayItemAdapter) ArrayList(java.util.ArrayList) GridView(android.widget.GridView) GridView(android.widget.GridView) View(android.view.View)

Example 3 with GridView

use of android.widget.GridView in project ActionBar-PullToRefresh by chrisbanes.

the class GridViewActivity method onCreate.

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_gridview);
    GridView gridView = (GridView) findViewById(R.id.ptr_gridview);
    ListAdapter adapter = new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1, ITEMS);
    gridView.setAdapter(adapter);
    // Now find the PullToRefreshLayout and set it up
    mPullToRefreshLayout = (PullToRefreshLayout) findViewById(R.id.ptr_layout);
    ActionBarPullToRefresh.from(this).options(Options.create().scrollDistance(.75f).headerLayout(R.layout.customised_header).headerTransformer(new CustomisedHeaderTransformer()).build()).allChildrenArePullable().listener(this).useViewDelegate(GridView.class, new AbsListViewDelegate()).setup(mPullToRefreshLayout);
}
Also used : AbsListViewDelegate(uk.co.senab.actionbarpulltorefresh.library.viewdelegates.AbsListViewDelegate) GridView(android.widget.GridView) ListAdapter(android.widget.ListAdapter) ArrayAdapter(android.widget.ArrayAdapter)

Example 4 with GridView

use of android.widget.GridView in project Android-PullToRefresh by chrisbanes.

the class PullToRefreshGridActivity method onCreate.

/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_ptr_grid);
    mPullRefreshGridView = (PullToRefreshGridView) findViewById(R.id.pull_refresh_grid);
    mGridView = mPullRefreshGridView.getRefreshableView();
    // Set a listener to be invoked when the list should be refreshed.
    mPullRefreshGridView.setOnRefreshListener(new OnRefreshListener2<GridView>() {

        @Override
        public void onPullDownToRefresh(PullToRefreshBase<GridView> refreshView) {
            Toast.makeText(PullToRefreshGridActivity.this, "Pull Down!", Toast.LENGTH_SHORT).show();
            new GetDataTask().execute();
        }

        @Override
        public void onPullUpToRefresh(PullToRefreshBase<GridView> refreshView) {
            Toast.makeText(PullToRefreshGridActivity.this, "Pull Up!", Toast.LENGTH_SHORT).show();
            new GetDataTask().execute();
        }
    });
    mListItems = new LinkedList<String>();
    TextView tv = new TextView(this);
    tv.setGravity(Gravity.CENTER);
    tv.setText("Empty View, Pull Down/Up to Add Items");
    mPullRefreshGridView.setEmptyView(tv);
    mAdapter = new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1, mListItems);
    mGridView.setAdapter(mAdapter);
}
Also used : TextView(android.widget.TextView) GridView(android.widget.GridView) PullToRefreshGridView(com.handmark.pulltorefresh.library.PullToRefreshGridView)

Example 5 with GridView

use of android.widget.GridView in project Android-PullToRefresh by chrisbanes.

the class PullToRefreshGridView method createRefreshableView.

@Override
protected final GridView createRefreshableView(Context context, AttributeSet attrs) {
    final GridView gv;
    if (VERSION.SDK_INT >= VERSION_CODES.GINGERBREAD) {
        gv = new InternalGridViewSDK9(context, attrs);
    } else {
        gv = new InternalGridView(context, attrs);
    }
    // Use Generated ID (from res/values/ids.xml)
    gv.setId(R.id.gridview);
    return gv;
}
Also used : GridView(android.widget.GridView)

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