Search in sources :

Example 46 with GridView

use of android.widget.GridView in project cw-omnibus by commonsguy.

the class GridDemo method onCreate.

@Override
public void onCreate(Bundle icicle) {
    super.onCreate(icicle);
    setContentView(R.layout.main);
    selection = (TextView) findViewById(R.id.selection);
    GridView g = (GridView) findViewById(R.id.grid);
    g.setAdapter(new ArrayAdapter<String>(this, R.layout.cell, items));
    g.setOnItemClickListener(this);
}
Also used : GridView(android.widget.GridView)

Example 47 with GridView

use of android.widget.GridView in project android_frameworks_base by ParanoidAndroid.

the class CharacterPickerDialog method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    WindowManager.LayoutParams params = getWindow().getAttributes();
    params.token = mView.getApplicationWindowToken();
    params.type = params.TYPE_APPLICATION_ATTACHED_DIALOG;
    params.flags = params.flags | Window.FEATURE_NO_TITLE;
    setContentView(R.layout.character_picker);
    GridView grid = (GridView) findViewById(R.id.characterPicker);
    grid.setAdapter(new OptionsAdapter(getContext()));
    grid.setOnItemClickListener(this);
    mCancelButton = (Button) findViewById(R.id.cancel);
    mCancelButton.setOnClickListener(this);
}
Also used : GridView(android.widget.GridView) WindowManager(android.view.WindowManager)

Example 48 with GridView

use of android.widget.GridView in project android_frameworks_base by AOSPA.

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

Example 49 with GridView

use of android.widget.GridView in project ApertureGallery by MJonesDev.

the class AlbumActivity method initializeView.

private void initializeView() {
    mView = (GridView) findViewById(com.marlonjones.projectevo.R.id.grid_view);
    mView.setAdapter(listAdapter = new ListAdapter(AlbumActivity.this));
    int position = mView.getFirstVisiblePosition();
    int columnsCount = 3;
    mView.setNumColumns(columnsCount);
    itemWidth = (ApertureBasing.displaySize.x - ((columnsCount + 2) * ApertureBasing.dp(4))) / columnsCount;
    mView.setColumnWidth(itemWidth);
    listAdapter.notifyDataSetChanged();
    mView.setSelection(position);
    mView.setOnItemClickListener(new AdapterView.OnItemClickListener() {

        @Override
        public void onItemClick(AdapterView<?> adapterView, View view, int position, long l) {
            Intent mIntent = new Intent(AlbumActivity.this, PhotoPreviewActivity.class);
            Bundle mBundle = new Bundle();
            mBundle.putInt("Key_FolderID", AlbummID);
            mBundle.putInt("Key_ID", position);
            mIntent.putExtras(mBundle);
            startActivity(mIntent);
        }
    });
    LoadAllAlbum();
}
Also used : Bundle(android.os.Bundle) AdapterView(android.widget.AdapterView) Intent(android.content.Intent) GridView(android.widget.GridView) ImageView(android.widget.ImageView) View(android.view.View) AdapterView(android.widget.AdapterView)

Example 50 with GridView

use of android.widget.GridView in project ApertureGallery by MJonesDev.

the class CameraFragment method initializeView.

private void initializeView(View v) {
    mView = (GridView) v.findViewById(R.id.grid_view);
    emptyView = (TextView) v.findViewById(R.id.searchEmptyView);
    emptyView.setOnTouchListener(new View.OnTouchListener() {

        @Override
        public boolean onTouch(View v, MotionEvent event) {
            return true;
        }
    });
    emptyView.setText("NoPhotos");
    mView.setAdapter(listAdapter = new ListAdapter(mContext));
    albumsSorted = GalleryFragment.albumsSorted;
    photos = GalleryFragment.albumsSorted.get(0).photos;
    int position = mView.getFirstVisiblePosition();
    int columnsCount = 3;
    mView.setNumColumns(columnsCount);
    itemWidth = (ApertureBasing.displaySize.x - ((columnsCount + 1) * ApertureBasing.dp(4))) / columnsCount;
    mView.setColumnWidth(itemWidth);
    listAdapter.notifyDataSetChanged();
    mView.setSelection(position);
    mView.setOnItemClickListener(new AdapterView.OnItemClickListener() {

        @Override
        public void onItemClick(AdapterView<?> adapterView, View view, int position, long l) {
            Intent mIntent = new Intent(mContext, PhotoPreviewActivity.class);
            Bundle mBundle = new Bundle();
            mBundle.putInt("Key_FolderID", 0);
            mBundle.putInt("Key_ID", position);
            mIntent.putExtras(mBundle);
            startActivity(mIntent);
        }
    });
    if (listAdapter != null) {
        listAdapter.notifyDataSetChanged();
    }
}
Also used : Bundle(android.os.Bundle) Intent(android.content.Intent) GridView(android.widget.GridView) ImageView(android.widget.ImageView) TextView(android.widget.TextView) View(android.view.View) AdapterView(android.widget.AdapterView) MotionEvent(android.view.MotionEvent) AdapterView(android.widget.AdapterView)

Aggregations

GridView (android.widget.GridView)142 View (android.view.View)86 AdapterView (android.widget.AdapterView)64 TextView (android.widget.TextView)42 ImageView (android.widget.ImageView)30 AbsListView (android.widget.AbsListView)20 Intent (android.content.Intent)15 ViewGroup (android.view.ViewGroup)14 OnItemClickListener (android.widget.AdapterView.OnItemClickListener)11 SuppressLint (android.annotation.SuppressLint)10 ArrayList (java.util.ArrayList)9 LayoutInflater (android.view.LayoutInflater)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