Search in sources :

Example 1 with MediaGridItemDecoration

use of com.owncloud.android.ui.decoration.MediaGridItemDecoration in project android by nextcloud.

the class UploadListActivity method setupContent.

private void setupContent() {
    binding.list.setEmptyView(binding.emptyList.getRoot());
    binding.emptyList.getRoot().setVisibility(View.GONE);
    binding.emptyList.emptyListIcon.setImageResource(R.drawable.uploads);
    binding.emptyList.emptyListIcon.getDrawable().mutate();
    binding.emptyList.emptyListIcon.setAlpha(0.5f);
    binding.emptyList.emptyListIcon.setVisibility(View.VISIBLE);
    binding.emptyList.emptyListViewHeadline.setText(getString(R.string.upload_list_empty_headline));
    binding.emptyList.emptyListViewText.setText(getString(R.string.upload_list_empty_text_auto_upload));
    binding.emptyList.emptyListViewText.setVisibility(View.VISIBLE);
    uploadListAdapter = new UploadListAdapter(this, uploadsStorageManager, getStorageManager(), userAccountManager, connectivityService, powerManagementService, clock);
    final GridLayoutManager lm = new GridLayoutManager(this, 1);
    uploadListAdapter.setLayoutManager(lm);
    int spacing = getResources().getDimensionPixelSize(R.dimen.media_grid_spacing);
    binding.list.addItemDecoration(new MediaGridItemDecoration(spacing));
    binding.list.setLayoutManager(lm);
    binding.list.setAdapter(uploadListAdapter);
    ThemeLayoutUtils.colorSwipeRefreshLayout(this, swipeListRefreshLayout);
    swipeListRefreshLayout.setOnRefreshListener(this::refresh);
    loadItems();
}
Also used : GridLayoutManager(androidx.recyclerview.widget.GridLayoutManager) MediaGridItemDecoration(com.owncloud.android.ui.decoration.MediaGridItemDecoration) UploadListAdapter(com.owncloud.android.ui.adapter.UploadListAdapter)

Example 2 with MediaGridItemDecoration

use of com.owncloud.android.ui.decoration.MediaGridItemDecoration in project android by nextcloud.

the class SyncedFoldersActivity method setupContent.

/**
 * sets up the UI elements and loads all media/synced folders.
 */
private void setupContent() {
    final int gridWidth = getResources().getInteger(R.integer.media_grid_width);
    boolean lightVersion = getResources().getBoolean(R.bool.syncedFolder_light);
    adapter = new SyncedFolderAdapter(this, clock, gridWidth, this, lightVersion);
    syncedFolderProvider = new SyncedFolderProvider(getContentResolver(), preferences, clock);
    binding.emptyList.emptyListIcon.setImageResource(R.drawable.nav_synced_folders);
    ThemeButtonUtils.colorPrimaryButton(binding.emptyList.emptyListViewAction, this);
    final GridLayoutManager lm = new GridLayoutManager(this, gridWidth);
    adapter.setLayoutManager(lm);
    int spacing = getResources().getDimensionPixelSize(R.dimen.media_grid_spacing);
    binding.list.addItemDecoration(new MediaGridItemDecoration(spacing));
    binding.list.setLayoutManager(lm);
    binding.list.setAdapter(adapter);
    load(gridWidth * 2, false);
}
Also used : GridLayoutManager(androidx.recyclerview.widget.GridLayoutManager) MediaGridItemDecoration(com.owncloud.android.ui.decoration.MediaGridItemDecoration) SyncedFolderProvider(com.owncloud.android.datamodel.SyncedFolderProvider) SyncedFolderAdapter(com.owncloud.android.ui.adapter.SyncedFolderAdapter) SuppressLint(android.annotation.SuppressLint)

Aggregations

GridLayoutManager (androidx.recyclerview.widget.GridLayoutManager)2 MediaGridItemDecoration (com.owncloud.android.ui.decoration.MediaGridItemDecoration)2 SuppressLint (android.annotation.SuppressLint)1 SyncedFolderProvider (com.owncloud.android.datamodel.SyncedFolderProvider)1 SyncedFolderAdapter (com.owncloud.android.ui.adapter.SyncedFolderAdapter)1 UploadListAdapter (com.owncloud.android.ui.adapter.UploadListAdapter)1