Java Code Examples for android.widget.GridView#setEmptyView()

The following examples show how to use android.widget.GridView#setEmptyView() . 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: ContactsGridFragment.java    From Contacts with MIT License 6 votes vote down vote up
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
{
	// Log.d("KlyphFragment2", "onCreateView");
	View view = inflater.inflate(getCustomLayout(), container, false);

	mGridView = (GridView) view.findViewById(R.id.grid);

	View emptyView = getEmptyView();

	if (emptyView != null)
	{
		emptyView.setId(android.R.id.empty);

		((ViewGroup) mGridView.getParent()).addView(emptyView);

		mGridView.setEmptyView(emptyView);
	}

	return view;
}
 
Example 2
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 3
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 4
Source File: GridFragment.java    From Klyph 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 5
Source File: GridDialogFragment.java    From Klyph 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 6
Source File: FavouriteServerListFragment.java    From Plumble with GNU General Public License v3.0 6 votes vote down vote up
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
                         Bundle savedInstanceState) {
    View view = inflater.inflate(R.layout.fragment_server_list, container, false);
    mServerGrid = (GridView) view.findViewById(R.id.server_list_grid);
    mServerGrid.setOnItemClickListener(this);
    mServerGrid.setEmptyView(view.findViewById(R.id.server_list_grid_empty));

    TextView donateText = (TextView) view.findViewById(R.id.donate_box);
    donateText.setVisibility(BuildConfig.DONATE_NAG ? View.VISIBLE : View.GONE);
    donateText.setOnClickListener(new OnClickListener() {
        @Override
        public void onClick(View v) {
            Intent playIntent = new Intent(Intent.ACTION_VIEW, Uri.parse("market://details?id=com.morlunk.mumbleclient"));
            startActivity(playIntent);
        }
    });

    registerForContextMenu(mServerGrid);
    return view;
}
 
Example 7
Source File: GalleryFragment.java    From remoteyourcam-usb with Apache License 2.0 5 votes vote down vote up
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {

    formatParser = new SimpleDateFormat("yyyyMMdd'T'HHmmss.S");
    currentScrollState = OnScrollListener.SCROLL_STATE_IDLE;

    View view = inflater.inflate(R.layout.gallery_frag, container, false);

    storageSpinner = (Spinner) view.findViewById(R.id.storage_spinner);
    storageAdapter = new StorageAdapter(getActivity());
    storageSpinner.setAdapter(storageAdapter);

    emptyView = (TextView) view.findViewById(android.R.id.empty);
    emptyView.setText(getString(R.string.gallery_loading));

    galleryView = (GridView) view.findViewById(android.R.id.list);
    galleryAdapter = new GalleryAdapter(getActivity(), this);
    galleryAdapter.setReverseOrder(getSettings().isGalleryOrderReversed());
    galleryView.setAdapter(galleryAdapter);
    galleryView.setOnScrollListener(this);
    galleryView.setEmptyView(emptyView);
    galleryView.setOnItemClickListener(this);

    orderCheckbox = (CheckBox) view.findViewById(R.id.reverve_order_checkbox);
    orderCheckbox.setChecked(getSettings().isGalleryOrderReversed());
    orderCheckbox.setOnCheckedChangeListener(new OnCheckedChangeListener() {
        @Override
        public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
            onReverseOrderStateChanged(isChecked);
        }
    });

    enableUi(false);

    ((SessionActivity) getActivity()).setSessionView(this);

    return view;
}
 
Example 8
Source File: ActionsListFragment.java    From io2014-codelabs with Apache License 2.0 5 votes vote down vote up
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
                         Bundle savedInstanceState) {
    View listView = inflater.inflate(R.layout.list_fragment, container, false);
    mGridView = (GridView) listView.findViewById(R.id.grid_view);
    TextView emptyView = (TextView) listView.findViewById(android.R.id.empty);
    mGridView.setEmptyView(emptyView);
    return listView;
}
 
Example 9
Source File: GalleryFragment.java    From remoteyourcam-usb with Apache License 2.0 5 votes vote down vote up
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {

    formatParser = new SimpleDateFormat("yyyyMMdd'T'HHmmss.S");
    currentScrollState = OnScrollListener.SCROLL_STATE_IDLE;

    View view = inflater.inflate(R.layout.gallery_frag, container, false);

    storageSpinner = (Spinner) view.findViewById(R.id.storage_spinner);
    storageAdapter = new StorageAdapter(getActivity());
    storageSpinner.setAdapter(storageAdapter);

    emptyView = (TextView) view.findViewById(android.R.id.empty);
    emptyView.setText(getString(R.string.gallery_loading));

    galleryView = (GridView) view.findViewById(android.R.id.list);
    galleryAdapter = new GalleryAdapter(getActivity(), this);
    galleryAdapter.setReverseOrder(getSettings().isGalleryOrderReversed());
    galleryView.setAdapter(galleryAdapter);
    galleryView.setOnScrollListener(this);
    galleryView.setEmptyView(emptyView);
    galleryView.setOnItemClickListener(this);

    orderCheckbox = (CheckBox) view.findViewById(R.id.reverve_order_checkbox);
    orderCheckbox.setChecked(getSettings().isGalleryOrderReversed());
    orderCheckbox.setOnCheckedChangeListener(new OnCheckedChangeListener() {
        @Override
        public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
            onReverseOrderStateChanged(isChecked);
        }
    });

    enableUi(false);

    ((SessionActivity) getActivity()).setSessionView(this);

    return view;
}
 
Example 10
Source File: ActorBrowserTvFragment.java    From Mizuu with Apache License 2.0 5 votes vote down vote up
public void onViewCreated(View v, Bundle savedInstanceState) {
	super.onViewCreated(v, savedInstanceState);

	mProgressBar = (ProgressBar) v.findViewById(R.id.progress);
	if (mActors.size() > 0)
		mProgressBar.setVisibility(View.GONE); // Hack to remove the ProgressBar on orientation change

	mAdapter = new ImageAdapter(getActivity());

	mGridView = (GridView) v.findViewById(R.id.gridView);
	mGridView.setAdapter(mAdapter);

	// Calculate the total column width to set item heights by factor 1.5
	mGridView.getViewTreeObserver().addOnGlobalLayoutListener(
			new ViewTreeObserver.OnGlobalLayoutListener() {
				@Override
				public void onGlobalLayout() {
					final int numColumns = (int) Math.floor(
							mGridView.getWidth() / (mImageThumbSize + mImageThumbSpacing));
					if (numColumns > 0) {
						mGridView.setNumColumns(numColumns);
					}
				}
			});
	mGridView.setOnItemClickListener(new OnItemClickListener() {
		@Override
		public void onItemClick(AdapterView<?> arg0, View arg1, int arg2, long arg3) {
               ActivityOptionsCompat options = ActivityOptionsCompat.makeSceneTransitionAnimation(getActivity(), arg1.findViewById(R.id.cover), "cover");
               ActivityCompat.startActivity(getActivity(), IntentUtils.getActorIntent(getActivity(), mActors.get(arg2)), options.toBundle());
		}
	});
	
	TextView title = (TextView) v.findViewById(R.id.empty_library_title);
	title.setText(R.string.no_actors);
	
	TextView description = (TextView) v.findViewById(R.id.empty_library_description);
	description.setText(R.string.no_actors_description);
	
	mGridView.setEmptyView(v.findViewById(R.id.empty_library_layout));
}
 
Example 11
Source File: FeaturesActivity.java    From Android-nRF-Toolbox with BSD 3-Clause "New" or "Revised" License 4 votes vote down vote up
@Override
protected void onCreate(final Bundle savedInstanceState) {
	super.onCreate(savedInstanceState);
	setContentView(R.layout.activity_features);

       final Toolbar toolbar = findViewById(R.id.toolbar_actionbar);
       setSupportActionBar(toolbar);

	// ensure that Bluetooth exists
	if (!ensureBLEExists())
		finish();

	final DrawerLayout drawer = drawerLayout = findViewById(R.id.drawer_layout);
	drawer.setDrawerShadow(R.drawable.drawer_shadow, GravityCompat.START);

	// Set the drawer toggle as the DrawerListener
	drawerToggle = new ActionBarDrawerToggle(this, drawerLayout, R.string.drawer_open, R.string.drawer_close) {
           @Override
           public void onDrawerSlide(final View drawerView, final float slideOffset) {
               // Disable the Hamburger icon animation
               super.onDrawerSlide(drawerView, 0);
           }
       };
	drawer.addDrawerListener(drawerToggle);

	// setup plug-ins in the drawer
	setupPluginsInDrawer(drawer.findViewById(R.id.plugin_container));

	// configure the app grid
	final GridView grid = findViewById(R.id.grid);
	grid.setAdapter(new AppAdapter(this));
	grid.setEmptyView(findViewById(android.R.id.empty));

	getSupportActionBar().setDisplayHomeAsUpEnabled(true);

	final Intent intent = getIntent();
	if (intent.hasExtra(EXTRA_APP) && intent.hasExtra(EXTRA_ADDRESS)) {
		final String app = intent.getStringExtra(EXTRA_APP);
		switch (app) {
			case "HRM":
				final Intent newIntent = new Intent(this, HRActivity.class);
				newIntent.putExtra(EXTRA_ADDRESS, intent.getByteArrayExtra(EXTRA_ADDRESS));
				newIntent.setFlags(Intent.FLAG_ACTIVITY_NO_ANIMATION);
				startActivity(newIntent);
				break;
			default:
				// other are not supported yet
				break;
		}
	}
}
 
Example 12
Source File: ManageDownloadsActivity.java    From android-viewer-for-khan-academy with GNU General Public License v3.0 4 votes vote down vote up
@Override
protected void onStart() {
	super.onStart();
	
	gridView = (GridView) findViewById(R.id.grid);
	gridView.setChoiceMode(AbsListView.CHOICE_MODE_MULTIPLE_MODAL);
	gridView.setMultiChoiceModeListener(multiChoiceModeListener);
	gridView.setOnItemClickListener(itemClickListener);
	
	View emptyView = getLayoutInflater().inflate(R.layout.listview_empty, null, false);
	((TextView) emptyView.findViewById(R.id.text_list_empty)).setText(R.string.msg_no_downloaded_videos);
	ViewGroup.LayoutParams p = new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT);
	addContentView(emptyView, p);
	
	gridView.setEmptyView(emptyView);
	
	requestDataService(new ObjectCallback<KADataService>() {
		@Override
		public void call(final KADataService dataService) {
			ManageDownloadsActivity.this.dataService = dataService;
			
			CursorAdapter adapter = new Adapter(ManageDownloadsActivity.this, null, 0, dataService.getThumbnailManager());
			gridView.setAdapter(adapter);

			new AsyncTask<Void, Void, Cursor>() {
				@Override
				protected Cursor doInBackground(Void... arg) {
					return getCursor();
				}
				
				@Override
				protected void onPostExecute(Cursor cursor) {
					((CursorAdapter) gridView.getAdapter()).changeCursor(cursor);
				}
			}.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
			
			final ActionBar ab = getActionBar();
			ab.setDisplayHomeAsUpEnabled(true);
			
			ab.setNavigationMode(ActionBar.NAVIGATION_MODE_LIST);
			ab.setTitle("");
			
			setupListNavigation();
			
			// The receiver performs actions that require a dataService, so register it here.
			IntentFilter filter = new IntentFilter();
			filter.addAction(ACTION_LIBRARY_UPDATE);
			filter.addAction(ACTION_BADGE_EARNED);
			filter.addAction(ACTION_OFFLINE_VIDEO_SET_CHANGED);
			filter.addAction(ACTION_DOWNLOAD_PROGRESS_UPDATE);
			filter.addAction(ACTION_TOAST);
			broadcastManager.registerReceiver(receiver, filter);
		}
	});
}