mirror of
https://github.com/nextcloud/android.git
synced 2024-11-27 09:39:25 +03:00
Update footer
This commit is contained in:
parent
ca674dd8a0
commit
7a15e20b20
3 changed files with 50 additions and 5 deletions
|
@ -48,6 +48,7 @@ import com.owncloud.android.files.services.FileDownloader.FileDownloaderBinder;
|
|||
import com.owncloud.android.files.services.FileUploader.FileUploaderBinder;
|
||||
import com.owncloud.android.services.OperationsService.OperationsServiceBinder;
|
||||
import com.owncloud.android.ui.activity.ComponentsGetter;
|
||||
import com.owncloud.android.ui.interfaces.ExtendedListFragmentInterface;
|
||||
import com.owncloud.android.utils.DisplayUtils;
|
||||
import com.owncloud.android.utils.FileStorageUtils;
|
||||
import com.owncloud.android.utils.MimeTypeUtil;
|
||||
|
@ -73,13 +74,16 @@ public class FileListListAdapter extends BaseAdapter implements FilterableListAd
|
|||
private FileDataStorageManager mStorageManager;
|
||||
private Account mAccount;
|
||||
private ComponentsGetter mTransferServiceGetter;
|
||||
private ExtendedListFragmentInterface extendedListFragmentInterface;
|
||||
|
||||
public FileListListAdapter(
|
||||
boolean justFolders,
|
||||
Context context,
|
||||
ComponentsGetter transferServiceGetter
|
||||
ComponentsGetter transferServiceGetter,
|
||||
ExtendedListFragmentInterface extendedListFragmentInterface
|
||||
) {
|
||||
|
||||
this.extendedListFragmentInterface = extendedListFragmentInterface;
|
||||
mJustFolders = justFolders;
|
||||
mContext = context;
|
||||
mAccount = AccountUtils.getCurrentOwnCloudAccount(mContext);
|
||||
|
@ -476,6 +480,7 @@ public class FileListListAdapter extends BaseAdapter implements FilterableListAd
|
|||
}
|
||||
mFiles = FileStorageUtils.sortOcFolder(mFiles);
|
||||
notifyDataSetChanged();
|
||||
extendedListFragmentInterface.finishedFiltering();
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -63,6 +63,7 @@ import com.owncloud.android.ui.dialog.CreateFolderDialogFragment;
|
|||
import com.owncloud.android.ui.dialog.RemoveFilesDialogFragment;
|
||||
import com.owncloud.android.ui.dialog.RenameFileDialogFragment;
|
||||
import com.owncloud.android.ui.helpers.SparseBooleanArrayParcelable;
|
||||
import com.owncloud.android.ui.interfaces.ExtendedListFragmentInterface;
|
||||
import com.owncloud.android.ui.preview.PreviewImageFragment;
|
||||
import com.owncloud.android.ui.preview.PreviewMediaFragment;
|
||||
import com.owncloud.android.ui.preview.PreviewTextFragment;
|
||||
|
@ -78,7 +79,7 @@ import java.util.List;
|
|||
*
|
||||
* TODO refactor to get rid of direct dependency on FileDisplayActivity
|
||||
*/
|
||||
public class OCFileListFragment extends ExtendedListFragment {
|
||||
public class OCFileListFragment extends ExtendedListFragment implements ExtendedListFragmentInterface {
|
||||
|
||||
private static final String TAG = OCFileListFragment.class.getSimpleName();
|
||||
|
||||
|
@ -193,7 +194,8 @@ public class OCFileListFragment extends ExtendedListFragment {
|
|||
mAdapter = new FileListListAdapter(
|
||||
mJustFolders,
|
||||
getActivity(),
|
||||
mContainerActivity
|
||||
mContainerActivity,
|
||||
this
|
||||
);
|
||||
setListAdapter(mAdapter);
|
||||
|
||||
|
@ -351,6 +353,11 @@ public class OCFileListFragment extends ExtendedListFragment {
|
|||
com.getbase.floatingactionbutton.R.id.fab_label)).setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void finishedFiltering() {
|
||||
updateFooter();
|
||||
}
|
||||
|
||||
/**
|
||||
* Handler for multiple selection mode.
|
||||
*
|
||||
|
@ -791,12 +798,12 @@ public class OCFileListFragment extends ExtendedListFragment {
|
|||
}
|
||||
}
|
||||
|
||||
private void updateLayout() {
|
||||
private void updateFooter() {
|
||||
if (!mJustFolders) {
|
||||
int filesCount = 0, foldersCount = 0;
|
||||
int count = mAdapter.getCount();
|
||||
OCFile file;
|
||||
for (int i=0; i < count ; i++) {
|
||||
for (int i = 0; i < count; i++) {
|
||||
file = (OCFile) mAdapter.getItem(i);
|
||||
if (file.isFolder()) {
|
||||
foldersCount++;
|
||||
|
@ -808,7 +815,12 @@ public class OCFileListFragment extends ExtendedListFragment {
|
|||
}
|
||||
// set footer text
|
||||
setFooterText(generateFooterText(filesCount, foldersCount));
|
||||
}
|
||||
}
|
||||
|
||||
private void updateLayout() {
|
||||
if (!mJustFolders) {
|
||||
updateFooter();
|
||||
// decide grid vs list view
|
||||
OwnCloudVersion version = AccountUtils.getServerVersion(
|
||||
((FileActivity)mContainerActivity).getAccount());
|
||||
|
|
|
@ -0,0 +1,28 @@
|
|||
/**
|
||||
* Nextcloud Android client application
|
||||
*
|
||||
* @author Mario Danic
|
||||
* Copyright (C) 2017 Mario Danic
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.owncloud.android.ui.interfaces;
|
||||
|
||||
/**
|
||||
* Interface for signaling filter finish
|
||||
*/
|
||||
|
||||
public interface ExtendedListFragmentInterface {
|
||||
void finishedFiltering();
|
||||
}
|
Loading…
Reference in a new issue