android.widget.GridView Java Examples

The following examples show how to use android.widget.GridView. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: FloatWindow.java    From AdDetector with Apache License 2.0 6 votes vote down vote up
public FloatWindow(final Context context) {
	super(context);
	LayoutInflater.from(context).inflate(R.layout.float_folder, this);
	View view = findViewById(R.id.big_window_layout);
	viewWidth = view.getLayoutParams().width;
	viewHeight = view.getLayoutParams().height;
	Button close = (Button) findViewById(R.id.finishBtn);
	close.setOnClickListener(new OnClickListener() {
		@Override
		public void onClick(View v) {
			// close float window,stop service.
			MyWindowManager.removeBigWindow(context);
			Intent intent = new Intent(getContext(), FloatWindowService.class);
			context.stopService(intent);
		}
	});
	appWall = (GridView) findViewById(R.id.app_wall);
	List<AppInfo> apps = getAllInstalledSysApps(context);
	AppWallAdapter adapter = new AppWallAdapter(context, 0, apps, appWall);
	appWall.setAdapter(adapter);
	appWall.setOnItemClickListener(new ItemClickListener() );
	appWall.setOnItemLongClickListener(new ItemLongClickListener());
}
 
Example #2
Source File: EditImageAty.java    From Huochexing12306 with Apache License 2.0 6 votes vote down vote up
private void initViews() {
	GridView gvIcons = (GridView) findViewById(R.id.icons);
	SimpleAdapter adapter = new SimpleAdapter(this, getIcons(),
			R.layout.item_editimage, new String[] { "item", "resId" },
			new int[] { R.id.item_editimage_ivIcon,
					R.id.item_editimaeg_tvResId });
	gvIcons.setAdapter(adapter);
	gvIcons.setOnItemClickListener(new OnItemClickListener() {

		@Override
		public void onItemClick(AdapterView<?> arg0, View arg1, int arg2,
				long arg3) {
			TextView tv1 = (TextView) arg1
					.findViewById(R.id.item_editimaeg_tvResId);
			int resId = Integer.valueOf(tv1.getText().toString());
			Intent intent = new Intent();
			intent.putExtra(RESULT, resId);
			EditImageAty.this.setResult(EditImageAty.this.getIntent()
					.getIntExtra(C_RESULT_CODE, 0), intent);
			EditImageAty.this.finish();
		}
	});
}
 
Example #3
Source File: DisplayActivity.java    From pearl with Apache License 2.0 6 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_display);
    ArrayList<String> listofURLs= new ArrayList<String>();
     listofURLs = getIntent().getStringArrayListExtra("list");


    //Used for testing purpose. It works
  //  Object ret = Pearl.retrieveJsonObject("0tag");
    //Toast.makeText(DisplayActivity.this, ""+ret.toString(), Toast.LENGTH_SHORT).show();
    //Log.d("Checksum",""+ret.toString());

    final ClassicAdapter adapter = new ClassicAdapter(DisplayActivity.this, listofURLs);
    grid=(GridView)findViewById(R.id.grid);
    grid.setAdapter(adapter);
    grid.setOnItemClickListener(new AdapterView.OnItemClickListener() {
        @Override
        public void onItemClick(AdapterView<?> adapterView, View view, int i, long l) {

            Toast.makeText(DisplayActivity.this, "Position " + adapterView.getChildAt(i).getTag()   + "", Toast.LENGTH_SHORT).show();
        }
    });
}
 
Example #4
Source File: MainActivity.java    From android-DoneBar with Apache License 2.0 6 votes vote down vote up
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    // Prepare list of samples in this dashboard.
    mSamples = new Sample[]{
        new Sample(R.string.donebaractivity_title, R.string.donebaractivity_description,
                DoneBarActivity.class),
        new Sample(R.string.donebuttonactivity_title, R.string.donebuttonactivity_description,
                DoneButtonActivity.class),
    };

    // Prepare the GridView
    mGridView = (GridView) findViewById(android.R.id.list);
    mGridView.setAdapter(new SampleAdapter());
    mGridView.setOnItemClickListener(this);
}
 
Example #5
Source File: MainActivity.java    From MediaChooser with Apache License 2.0 6 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    requestWindowFeature(Window.FEATURE_NO_TITLE);
    setContentView(R.layout.activity_main);
    folderViewButton = (Button) findViewById(R.id.folderButton);
    fileViewButton = (Button) findViewById(R.id.fileButton);
    gridView = (GridView) findViewById(R.id.gridView);
    folderViewButton.setOnClickListener(clickListener);
    fileViewButton.setOnClickListener(clickListener);

    IntentFilter videoIntentFilter = new IntentFilter(MediaChooser.VIDEO_SELECTED_ACTION_FROM_MEDIA_CHOOSER);
    registerReceiver(videoBroadcastReceiver, videoIntentFilter);

    IntentFilter imageIntentFilter = new IntentFilter(MediaChooser.IMAGE_SELECTED_ACTION_FROM_MEDIA_CHOOSER);
    registerReceiver(imageBroadcastReceiver, imageIntentFilter);

}
 
Example #6
Source File: BaseSharePlatformSelector.java    From BiliShare with Apache License 2.0 6 votes vote down vote up
protected static GridView createShareGridView(final Context context, AdapterView.OnItemClickListener onItemClickListener) {
    GridView grid = new GridView(context);
    ListAdapter adapter = new ArrayAdapter<ShareTarget>(context, 0, shareTargets) {
        // no need scroll
        @Override
        public View getView(int position, View convertView, ViewGroup parent) {
            View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.bili_socialize_shareboard_item, parent, false);
            view.setBackgroundDrawable(null);
            ImageView image = (ImageView) view.findViewById(R.id.bili_socialize_shareboard_image);
            TextView platform = (TextView) view.findViewById(R.id.bili_socialize_shareboard_pltform_name);

            ShareTarget target = getItem(position);
            image.setImageResource(target.iconId);
            platform.setText(target.titleId);
            return view;
        }
    };
    grid.setNumColumns(-1);
    grid.setStretchMode(GridView.STRETCH_COLUMN_WIDTH);
    grid.setColumnWidth(context.getResources().getDimensionPixelSize(R.dimen.bili_socialize_shareboard_size));
    grid.setLayoutParams(new ViewGroup.LayoutParams(-1, -2));
    grid.setSelector(R.drawable.bili_socialize_selector_item_background);
    grid.setAdapter(adapter);
    grid.setOnItemClickListener(onItemClickListener);
    return grid;
}
 
Example #7
Source File: GalleryChooseActivity.java    From PictureChooseLib with Apache License 2.0 6 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_gallery_choose);
    mGalleryGrid = (GridView) findViewById(R.id.pi_gallery_choose_grid);
    if(getIntent() != null){
        mTitleBarBackground = getIntent().getIntExtra(Constants.TITLE_BAR_BACKGROUND,mTitleBarBackground);
    }
    setTitleBarBackground(mTitleBarBackground);
    setTitleText(R.string.ps_gallery_choose);
    setRightText(R.string.ps_cancel);
    mGalleryList = new ArrayList<>();
    mGalleryChooseAdapter = new GalleryChooseAdapter(this,mGalleryList);
    mGalleryGrid.setAdapter(mGalleryChooseAdapter);
    mGalleryGrid.setOnItemClickListener(this);
    getGalleryList();
}
 
Example #8
Source File: PoiListAdapter.java    From TraceByAmap with MIT License 6 votes vote down vote up
@Override
public View getView(int position, View convertView, ViewGroup parent) {
    ViewHolder holder;
    if (convertView == null) {
        holder = new ViewHolder();
        convertView = View.inflate(ctx, R.layout.listview_item, null);
        holder.poititle = (TextView) convertView
               .findViewById(R.id.poititle);
        holder.subpois = (GridView) convertView.findViewById(R.id.listview_item_gridview);
        convertView.setTag(holder);
    } else {
        holder = (ViewHolder) convertView.getTag();
    }

    PoiItem item = list.get(position);
    holder.poititle.setText(item.getTitle());
    if (item.getSubPois().size() > 0) {
        List<SubPoiItem> subPoiItems = item.getSubPois();
        SubPoiAdapter subpoiAdapter=new SubPoiAdapter(ctx, subPoiItems); 
        holder.subpois.setAdapter(subpoiAdapter); 
    }


    return convertView;
}
 
Example #9
Source File: GridLayoutAnimationFragment.java    From AndroidAll with Apache License 2.0 6 votes vote down vote up
@Override
protected void initViews(View view) {
    super.initViews(view);

    setLabel("GridLayoutAnimation");

    GridView grid = view.findViewById(R.id.grid_view);
    dataList.addAll(getData());
    mGridAdapter = new GridAdapter();
    grid.setAdapter(mGridAdapter);


    Button addData = view.findViewById(R.id.btn_start);
    addData.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            addData();
        }
    });
}
 
Example #10
Source File: GridDialogFragment.java    From Contacts with MIT License 6 votes vote down vote up
@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;
}
 
Example #11
Source File: MainActivity.java    From MobileGuard with MIT License 6 votes vote down vote up
/**
     * 1
     * init view
     */
    protected void initView() {
        setContentView(R.layout.activity_main);
        // bind
        gvMenu = (GridView) findViewById(R.id.gv_menu);
//        ivLightEffect = (ImageView) findViewById(R.id.iv_light_effect);
        rlCircle = findViewById(R.id.rl_circle);
        tvRamUseRate = (TextView) findViewById(R.id.tv_ram_use_rate);

        // start animation
        Animation rotateAnimation = AnimationUtils.loadAnimation(this, R.anim.rotate_forever);
        rlCircle.startAnimation(rotateAnimation);

//        Animation blinkAnimation = AnimationUtils.loadAnimation(this, R.anim.blink_forever);
//        ivLightEffect.startAnimation(blinkAnimation);
    }
 
Example #12
Source File: ThreadReplyActivity.java    From BigApp_Discuz_Android with Apache License 2.0 6 votes vote down vote up
@Override
public boolean initWidget() {
    ActionBarUtils.setHomeActionBar(this, R.drawable.ic_back);


    gridView = (GridView) findViewById(R.id.gridView);
    et = (EmoticonsEditText) findViewById(R.id.et);
    et1 = (EmoticonsEditText) findViewById(R.id.et1);
    tb = (ToggleButton) findViewById(R.id.tb);
    spinner = (BetterSpinner) findViewById(R.id.spinner);
    chooseThread = (TextView) findViewById(R.id.chooseThread);

    tb.setOnClickListener(this);

    et1.setVisibility(View.GONE);

    if (!FileUtils.isExists(SmileyUtils.getSmileyZipFilePath(this))) {
        tb.setVisibility(View.GONE);
    }

    return super.initWidget();
}
 
Example #13
Source File: GridFragment.java    From Contacts with MIT License 6 votes vote down vote up
@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;
}
 
Example #14
Source File: ListViewActivity.java    From letv with Apache License 2.0 6 votes vote down vote up
protected void onCreate(Bundle bundle) {
    z.c();
    super.onCreate(bundle);
    if (getIntent() != null) {
        this.a = (c) getIntent().getSerializableExtra(z);
        c cVar = this.a;
        z.c();
        View gridView = new GridView(getApplicationContext());
        gridView.setNumColumns(2);
        List list = cVar.u;
        gridView.setAdapter(new e(this, Integer.MIN_VALUE, list));
        gridView.setOnItemClickListener(new d(this, list));
        setContentView(gridView);
        return;
    }
    z.d();
}
 
Example #15
Source File: T9SearchFragment.java    From PinyinSearchLibrary with Apache License 2.0 6 votes vote down vote up
@Override
protected View initView(LayoutInflater inflater, ViewGroup container) {
	View view = inflater.inflate(R.layout.fragment_t9_search, container,
			false);
	mT9SearchGv = (GridView) view.findViewById(R.id.t9_search_grid_view);
	mT9SearchGv.setAdapter(mAppInfoAdapter);
	mSearchResultPromptTv = (TextView) view
			.findViewById(R.id.search_result_prompt_text_view);
	mT9TelephoneDialpadView = (T9TelephoneDialpadView) view
			.findViewById(R.id.t9_telephone_dialpad_view);
	mT9TelephoneDialpadView.setOnT9TelephoneDialpadView(this);
	mKeyboardSwitchLayout = view.findViewById(R.id.keyboard_switch_layout);
	mKeyboardSwitchIv = (ImageView) view
			.findViewById(R.id.keyboard_switch_image_view);
	showKeyboard();
	return view;
}
 
Example #16
Source File: GalleryFragment.java    From CameraV with GNU General Public License v3.0 6 votes vote down vote up
@Override
public View onCreateView(LayoutInflater li, ViewGroup container,
		Bundle savedInstanceState) {
	super.onCreateView(li, container, savedInstanceState);

	rootView = li.inflate(R.layout.fragment_gallery, null);
	mediaDisplayGrid = (GridView) rootView
			.findViewById(R.id.media_display_grid);
	noMedia = (RelativeLayout) rootView
			.findViewById(R.id.media_display_no_media);
	noMedia.setVisibility(View.GONE);
	
	progressWait = (ProgressBar) rootView.findViewById(R.id.progressWait);
	progressWait.setVisibility(View.GONE);
	
	mEncodingMedia = rootView.findViewById(R.id.media_encoding);
	mEncodingMedia.setVisibility(View.GONE);
	mEncodingMedia.findViewById(R.id.ivClose).setOnClickListener(new View.OnClickListener() {
		
		@Override
		public void onClick(View v) {
			mEncodingMedia.setVisibility(View.GONE);
		}
	});
	return rootView;
}
 
Example #17
Source File: MssPreviewFragment.java    From MainScreenShow with GNU General Public License v2.0 6 votes vote down vote up
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    main = (RelativeLayout) inflater.inflate(R.layout.fragment_msspreview, container, false);
    gv = (GridView) main.findViewById(R.id.gv_mss);
    mssPA = new MSSPreviewAdapter();
    gv.setAdapter(mssPA);
    gv.setOnItemClickListener(new AdapterView.OnItemClickListener() {

        @Override
        public void onItemClick(AdapterView<?> arg0, View view,
                                int position, long arg3) {


        }
    });
    return main;
}
 
Example #18
Source File: VideoFragment.java    From MediaChooser with Apache License 2.0 6 votes vote down vote up
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {

		if(mView == null){
			mView = inflater.inflate(R.layout.view_grid_layout_media_chooser, container, false);

			mVideoGridView = (GridView)mView.findViewById(R.id.gridViewFromMediaChooser);

			if (getArguments() != null) {
				initVideos(getArguments().getString("name"));
			}else{
				initVideos();
			}

		}else{
			((ViewGroup) mView.getParent()).removeView(mView);
			if(mVideoAdapter == null || mVideoAdapter.getCount() == 0){
				Toast.makeText(getActivity(), getActivity().getString(R.string.no_media_file_available), Toast.LENGTH_SHORT).show();
			}
		}

		return mView;
	}
 
Example #19
Source File: AnimationAdapter.java    From android-open-project-demo with Apache License 2.0 6 votes vote down vote up
@SuppressLint("NewApi")
private long calculateAnimationDelay() {
    long delay;

    int lastVisiblePosition = getAbsListView().getLastVisiblePosition();
    int firstVisiblePosition = getAbsListView().getFirstVisiblePosition();

    int numberOfItemsOnScreen = lastVisiblePosition - firstVisiblePosition;
    int numberOfAnimatedItems = mLastAnimatedPosition - mFirstAnimatedPosition;

    if (numberOfItemsOnScreen + 1 < numberOfAnimatedItems) {
        delay = getAnimationDelayMillis();

        if (getAbsListView() instanceof GridView && Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
            delay += getAnimationDelayMillis() * ((mLastAnimatedPosition + 1) % ((GridView) getAbsListView()).getNumColumns());
        }
    } else {
        long delaySinceStart = (mLastAnimatedPosition - mFirstAnimatedPosition + 1) * getAnimationDelayMillis();
        delay = mAnimationStartMillis + getInitialDelayMillis() + delaySinceStart - System.currentTimeMillis();
    }
    return Math.max(0, delay);
}
 
Example #20
Source File: CityActivity.java    From MyHearts with Apache License 2.0 6 votes vote down vote up
@Override
public void initView() {

    initData();

    View view = View.inflate(this, R.layout.head_city_list, null);
    gridView = (GridView) view.findViewById(R.id.gridview_hot);
    gridViewAdapter = new CityGridViewAdapter(this, hotCity);
    gridView.setAdapter(gridViewAdapter);
    gridView.setSelector(new ColorDrawable(Color.TRANSPARENT));

    sideBar = (SideBar) findViewById(R.id.sidrbar);
    dialog = (TextView) findViewById(R.id.dialog);
    sideBar.setTextView(dialog);

    sortListView = (ListView) findViewById(R.id.country_lvcountry);
    sortListView.addHeaderView(view);
    adapter = new SortAdapter(this, SourceDateList);
    sortListView.setAdapter(adapter);
    clearEditText = (ClearCityEditText) findViewById(R.id.filter_edit);
}
 
Example #21
Source File: VideoActivity.java    From GreenDamFileExploere with Apache License 2.0 6 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    setContentView(R.layout.activity_video);
    mViewNothing = findViewById(R.id.nothing);

    mGridView = (GridView) findViewById(R.id.mVideoGrideView);
    mAdapter = new VideoGridViewAdapter(this, mVideos, mGridView);
    mGridView.setAdapter(mAdapter);

    mGridView.setOnItemClickListener(this);
    mGridView.setOnItemLongClickListener(this);

    mThread = new VideoLoadThread();
    mThread.start();
}
 
Example #22
Source File: IconSampleActivity.java    From SVG-Android with Apache License 2.0 6 votes vote down vote up
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_icon_sample);
    setTitle(getIntent().getStringExtra("title"));

    GridView gridView = (GridView) findViewById(R.id.icon_grid);
    gridView.setAdapter(new ArrayAdapter<Integer>(this, R.layout.item_icon, ICONS) {

        @NonNull
        @Override
        public View getView(int position, android.view.View convertView, @NonNull ViewGroup parent) {
            ViewHolder holder;
            if (convertView == null) {
                convertView = LayoutInflater.from(IconSampleActivity.this).inflate(R.layout.item_icon, parent, false);
                holder = new ViewHolder();
                holder.imageview = (ImageView)(convertView.findViewById(R.id.item_image));
                convertView.setTag(holder);
            } else {
                holder = (ViewHolder) convertView.getTag();
            }
            holder.imageview.setImageResource(ICONS[position]);
            return convertView;
        }
    });
}
 
Example #23
Source File: DateGridFragment.java    From iSCAU-Android with GNU General Public License v3.0 6 votes vote down vote up
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
		Bundle savedInstanceState) {
	gridView = (GridView) inflater.inflate(R.layout.date_grid_fragment,
			container, false);
	// Client normally needs to provide the adapter and onItemClickListener
	// before the fragment is attached to avoid complex crash due to
	// fragment life cycles
	if (gridAdapter != null) {
		gridView.setAdapter(gridAdapter);
	}

	if (onItemClickListener != null) {
		gridView.setOnItemClickListener(onItemClickListener);
	}
	if(onItemLongClickListener != null) {
		gridView.setOnItemLongClickListener(onItemLongClickListener);
	}
	return gridView;
}
 
Example #24
Source File: MainViewHelper.java    From palmsuda with Apache License 2.0 6 votes vote down vote up
private GridView createGridView(List<ModuleItem> items) {
	GridView gView = (GridView) mInflater.inflate(R.layout.main_gridview,
			null);
	gView.setVerticalSpacing(vspace);
	gView.setPadding(0, vspace / 2, 0, 0);
	GdvAdapter adapter = new GdvAdapter(mActivity,
			mActivity.getImageWorker(), gView);
	adapter.setData(items);
	gView.setAdapter(adapter);
	gView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
		@Override
		public void onItemClick(AdapterView<?> arg0, View arg1, int arg2,
				long arg3) {
			ModuleItem item = (ModuleItem) arg0.getAdapter().getItem(arg2);
			mActivity.gridViewClick(mAItem, item);
		}
	});
	return gView;
}
 
Example #25
Source File: PullToRefreshGridView.java    From handmarkPulltorefreshLibrary with Apache License 2.0 5 votes vote down vote up
@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;
}
 
Example #26
Source File: PullToRefreshGridView.java    From FanXin-based-HuanXin with GNU General Public License v2.0 5 votes vote down vote up
@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;
}
 
Example #27
Source File: ComposeTweetActivity.java    From catnut with MIT License 5 votes vote down vote up
private void injectLayout() {
	// for panel
	mSlidingPaneLayout = (SlidingPaneLayout) findViewById(R.id.sliding_pane_layout);
	mEmotions = (GridView) findViewById(R.id.emotions);
	mEmotions.setAdapter(new EmotionsAdapter(this));
	mEmotions.setOnItemClickListener(this);
	mSlidingPaneLayout.setPanelSlideListener(new SliderListener());
	mSlidingPaneLayout.openPane();
	mSlidingPaneLayout.getViewTreeObserver().addOnGlobalLayoutListener(new FirstLayoutListener());
	// for tweet
	mAvatar = (ImageView) findViewById(R.id.avatar);
	mScreenName = (TextView) findViewById(R.id.screen_name);
	mText = (EditText) findViewById(R.id.text);
	mLocationMarker = findViewById(R.id.location_marker);
	// set data to layout...
	new AsyncQueryHandler(getContentResolver()) {
		@Override
		protected void onQueryComplete(int token, Object cookie, Cursor cursor) {
			if (cursor.moveToNext()) {
				Picasso.with(ComposeTweetActivity.this)
						.load(cursor.getString(cursor.getColumnIndex(User.avatar_large)))
						.placeholder(R.drawable.error)
						.error(R.drawable.error)
						.into(mAvatar);
				mScreenName.setText("@" + cursor.getString(cursor.getColumnIndex(User.screen_name)));
			}
			cursor.close();
		}
	}.startQuery(0, null,
			CatnutProvider.parse(User.MULTIPLE, mApp.getAccessToken().uid),
			new String[]{User.avatar_large, User.screen_name}, null, null, null);
	// other stuffs...
	mText.addTextChangedListener(this);
}
 
Example #28
Source File: PullToRefreshGridView.java    From SweetMusicPlayer with Apache License 2.0 5 votes vote down vote up
@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;
}
 
Example #29
Source File: ImageSelectorFragment.java    From Android-ImagesPickers with Apache License 2.0 5 votes vote down vote up
@Override
public void onViewCreated(View view, Bundle savedInstanceState) {
    super.onViewCreated(view, savedInstanceState);

    context = getActivity();

    time_text = (TextView) view.findViewById(R.id.time_text);
    category_button = (TextView) view.findViewById(R.id.category_button);
    grid_image = (GridView) view.findViewById(R.id.grid_image);
    popupAnchorView = view.findViewById(R.id.footer_layout);

    time_text.setVisibility(View.GONE);

    init();
}
 
Example #30
Source File: PtrFrameLayout.java    From CommonPullToRefresh with Apache License 2.0 5 votes vote down vote up
public void setLoadMoreEnable(boolean loadMoreEnable) {
    if (this.isLoadMoreEnable == loadMoreEnable) {
        return;
    }
    this.isLoadMoreEnable = loadMoreEnable;
    if (!hasInitLoadMoreView && isLoadMoreEnable) {
        mContentView = getContentView();
        if (null == loadMoreViewFactory) {
            loadMoreViewFactory = new DefaultLoadMoreViewFooter();
        }
        mLoadMoreView = loadMoreViewFactory.madeLoadMoreView();

        if (null == mLoadMoreHandler) {
            if (mContentView instanceof GridView) {
                mLoadMoreHandler = new GridViewHandler();
            } else if (mContentView instanceof AbsListView) {
                mLoadMoreHandler = new ListViewHandler();
            } else if (mContentView instanceof RecyclerView) {
                mLoadMoreHandler = new RecyclerViewHandler();
            }
        }

        if (null == mLoadMoreHandler) {
            throw new IllegalStateException("unSupported contentView !");
        }

        hasInitLoadMoreView = mLoadMoreHandler.handleSetAdapter(mContentView, mLoadMoreView,
                onClickLoadMoreListener);
        mLoadMoreHandler.setOnScrollBottomListener(mContentView, onScrollBottomListener);
        return;
    }

    if (hasInitLoadMoreView) {
        if (isLoadMoreEnable) {
            mLoadMoreHandler.addFooter();
        } else {
            mLoadMoreHandler.removeFooter();
        }
    }
}