mirror of
https://github.com/nextcloud/android.git
synced 2024-12-21 08:24:08 +03:00
Progress on all fronts
This commit is contained in:
parent
1e16812ab3
commit
b0700a38e9
12 changed files with 406 additions and 211 deletions
|
@ -5,17 +5,17 @@
|
|||
* Copyright (C) 2016 Andy Scherzinger
|
||||
* Copyright (C) 2016 Nextcloud
|
||||
* Copyright (C) 2016 ownCloud Inc.
|
||||
*
|
||||
* <p>
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 3 of the License, or any later version.
|
||||
*
|
||||
* <p>
|
||||
* 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.
|
||||
*
|
||||
* <p>
|
||||
* 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/>.
|
||||
*/
|
||||
|
@ -56,6 +56,7 @@ import com.owncloud.android.lib.common.utils.Log_OC;
|
|||
import com.owncloud.android.lib.resources.files.SearchOperation;
|
||||
import com.owncloud.android.lib.resources.users.GetRemoteUserInfoOperation;
|
||||
import com.owncloud.android.ui.TextDrawable;
|
||||
import com.owncloud.android.ui.events.DummyDrawerEvent;
|
||||
import com.owncloud.android.ui.events.MenuItemClickEvent;
|
||||
import com.owncloud.android.ui.events.SearchEvent;
|
||||
import com.owncloud.android.utils.DisplayUtils;
|
||||
|
@ -294,6 +295,7 @@ public abstract class DrawerActivity extends ToolbarActivity implements DisplayU
|
|||
}
|
||||
|
||||
if (getResources().getBoolean(R.bool.bottom_toolbar_enabled)) {
|
||||
navigationView.getMenu().removeItem(R.id.nav_photos);
|
||||
navigationView.getMenu().removeItem(R.id.nav_all_files);
|
||||
navigationView.getMenu().removeItem(R.id.nav_settings);
|
||||
navigationView.getMenu().removeItem(R.id.nav_favorites);
|
||||
|
@ -339,7 +341,14 @@ public abstract class DrawerActivity extends ToolbarActivity implements DisplayU
|
|||
}
|
||||
}
|
||||
|
||||
@Subscribe(threadMode = ThreadMode.MAIN)
|
||||
public void onMessageEvent(DummyDrawerEvent event) {
|
||||
unsetAllDrawerMenuItems();
|
||||
}
|
||||
|
||||
|
||||
private void selectNavigationItem(final MenuItem menuItem) {
|
||||
|
||||
switch (menuItem.getItemId()) {
|
||||
case R.id.nav_all_files:
|
||||
menuItem.setChecked(true);
|
||||
|
@ -349,7 +358,12 @@ public abstract class DrawerActivity extends ToolbarActivity implements DisplayU
|
|||
case R.id.nav_favorites:
|
||||
menuItem.setChecked(true);
|
||||
mCheckedMenuItem = menuItem.getItemId();
|
||||
EventBus.getDefault().post(new SearchEvent("", SearchOperation.SearchType.FAVORITE_SEARCH));
|
||||
EventBus.getDefault().post(new SearchEvent("", SearchOperation.SearchType.FAVORITE_SEARCH,
|
||||
SearchEvent.UnsetType.NO_UNSET));
|
||||
break;
|
||||
case R.id.nav_photos:
|
||||
EventBus.getDefault().post(new SearchEvent("image/%",
|
||||
SearchOperation.SearchType.CONTENT_TYPE_SEARCH, SearchEvent.UnsetType.NO_UNSET));
|
||||
break;
|
||||
case R.id.nav_on_device:
|
||||
menuItem.setChecked(true);
|
||||
|
@ -384,15 +398,26 @@ public abstract class DrawerActivity extends ToolbarActivity implements DisplayU
|
|||
startActivityForResult(manageAccountsIntent, ACTION_MANAGE_ACCOUNTS);
|
||||
break;
|
||||
case R.id.nav_recently_added:
|
||||
EventBus.getDefault().post(new SearchEvent("%", SearchOperation.SearchType.CONTENT_TYPE_SEARCH));
|
||||
menuItem.setChecked(true);
|
||||
mCheckedMenuItem = menuItem.getItemId();
|
||||
EventBus.getDefault().post(new SearchEvent("%", SearchOperation.SearchType.CONTENT_TYPE_SEARCH,
|
||||
SearchEvent.UnsetType.UNSET_BOTTOM_NAV_BAR));
|
||||
break;
|
||||
case R.id.nav_recently_modified:
|
||||
EventBus.getDefault().post(new SearchEvent("", SearchOperation.SearchType.RECENTLY_MODIFIED_SEARCH));
|
||||
menuItem.setChecked(true);
|
||||
mCheckedMenuItem = menuItem.getItemId();
|
||||
EventBus.getDefault().post(new SearchEvent("", SearchOperation.SearchType.RECENTLY_MODIFIED_SEARCH,
|
||||
SearchEvent.UnsetType.UNSET_BOTTOM_NAV_BAR));
|
||||
break;
|
||||
case R.id.nav_shared:
|
||||
menuItem.setChecked(true);
|
||||
mCheckedMenuItem = menuItem.getItemId();
|
||||
break;
|
||||
case R.id.nav_videos:
|
||||
EventBus.getDefault().post(new SearchEvent("video/%", SearchOperation.SearchType.CONTENT_TYPE_SEARCH));
|
||||
menuItem.setChecked(true);
|
||||
mCheckedMenuItem = menuItem.getItemId();
|
||||
EventBus.getDefault().post(new SearchEvent("video/%", SearchOperation.SearchType.CONTENT_TYPE_SEARCH,
|
||||
SearchEvent.UnsetType.UNSET_BOTTOM_NAV_BAR));
|
||||
break;
|
||||
case Menu.NONE:
|
||||
// account clicked
|
||||
|
@ -670,6 +695,17 @@ public abstract class DrawerActivity extends ToolbarActivity implements DisplayU
|
|||
showQuota(true);
|
||||
}
|
||||
|
||||
protected void unsetAllDrawerMenuItems() {
|
||||
if (mNavigationView != null && mNavigationView.getMenu() != null) {
|
||||
Menu menu = mNavigationView.getMenu();
|
||||
for (int i = 0; i < menu.size(); i++) {
|
||||
menu.getItem(i).setChecked(false);
|
||||
}
|
||||
}
|
||||
|
||||
mCheckedMenuItem = Menu.NONE;
|
||||
}
|
||||
|
||||
/**
|
||||
* checks/highlights the provided menu item if the drawer has been initialized and the menu item exists.
|
||||
*
|
||||
|
|
|
@ -81,6 +81,7 @@ import com.owncloud.android.operations.SynchronizeFileOperation;
|
|||
import com.owncloud.android.operations.UploadFileOperation;
|
||||
import com.owncloud.android.services.observer.FileObserverService;
|
||||
import com.owncloud.android.syncadapter.FileSyncAdapter;
|
||||
import com.owncloud.android.ui.fragment.ExtendedListFragment;
|
||||
import com.owncloud.android.ui.fragment.FileDetailFragment;
|
||||
import com.owncloud.android.ui.fragment.FileFragment;
|
||||
import com.owncloud.android.ui.fragment.OCFileListFragment;
|
||||
|
@ -319,27 +320,6 @@ public class FileDisplayActivity extends HookActivity
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onStart() {
|
||||
Log_OC.v(TAG, "onStart() start");
|
||||
super.onStart();
|
||||
Log_OC.v(TAG, "onStart() end");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onStop() {
|
||||
Log_OC.v(TAG, "onStop() start");
|
||||
super.onStop();
|
||||
Log_OC.v(TAG, "onStop() end");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onDestroy() {
|
||||
Log_OC.v(TAG, "onDestroy() start");
|
||||
super.onDestroy();
|
||||
Log_OC.v(TAG, "onDestroy() end");
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when the ownCloud {@link Account} associated to the Activity was just updated.
|
||||
*/
|
||||
|
@ -941,6 +921,16 @@ public class FileDisplayActivity extends HookActivity
|
|||
return (mSearchEditFrame != null && mSearchEditFrame.getVisibility() == View.VISIBLE);
|
||||
}
|
||||
|
||||
private void revertBottomNavigationBarToAllFiles() {
|
||||
if (getResources().getBoolean(R.bool.bottom_toolbar_enabled)) {
|
||||
BottomNavigationView bottomNavigationView = (BottomNavigationView) getListOfFilesFragment().getView()
|
||||
.findViewById(R.id.bottom_navigation_view);
|
||||
if (bottomNavigationView.getMenu().findItem(R.id.nav_bar_settings).isChecked()) {
|
||||
bottomNavigationView.getMenu().findItem(R.id.nav_bar_files).setChecked(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBackPressed() {
|
||||
boolean isFabOpen = isFabOpen();
|
||||
|
@ -955,14 +945,6 @@ public class FileDisplayActivity extends HookActivity
|
|||
* 4. navigate up (only if drawer and FAB aren't open)
|
||||
*/
|
||||
|
||||
if (getResources().getBoolean(R.bool.bottom_toolbar_enabled)) {
|
||||
BottomNavigationView bottomNavigationView = (BottomNavigationView) getListOfFilesFragment().getView()
|
||||
.findViewById(R.id.bottom_navigation_view);
|
||||
if (bottomNavigationView.getMenu().findItem(R.id.nav_bar_settings).isChecked()) {
|
||||
bottomNavigationView.getMenu().findItem(R.id.nav_bar_files).setChecked(true);
|
||||
}
|
||||
}
|
||||
|
||||
if (isSearchOpen && searchView != null) {
|
||||
searchView.setQuery("", true);
|
||||
searchView.onActionViewCollapsed();
|
||||
|
@ -1018,6 +1000,7 @@ public class FileDisplayActivity extends HookActivity
|
|||
Log_OC.v(TAG, "onResume() start");
|
||||
super.onResume();
|
||||
|
||||
revertBottomNavigationBarToAllFiles();
|
||||
// refresh list of files
|
||||
|
||||
if (searchView != null && !TextUtils.isEmpty(searchQuery)) {
|
||||
|
@ -1206,7 +1189,7 @@ public class FileDisplayActivity extends HookActivity
|
|||
OCFileListFragment ocFileListFragment = getListOfFilesFragment();
|
||||
if (ocFileListFragment != null) {
|
||||
if (!mSyncInProgress) {
|
||||
ocFileListFragment.setEmptyListMessage(false);
|
||||
ocFileListFragment.setEmptyListMessage(ExtendedListFragment.SearchType.NO_SEARCH);
|
||||
} else {
|
||||
ocFileListFragment.setEmptyListLoadingMessage();
|
||||
}
|
||||
|
|
|
@ -809,5 +809,4 @@ public class Preferences extends PreferenceActivity
|
|||
public void onCancelMigration() {
|
||||
// Migration was canceled so we don't do anything
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -0,0 +1,27 @@
|
|||
/**
|
||||
* 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.events;
|
||||
|
||||
/**
|
||||
* Dummy drawer event
|
||||
*/
|
||||
|
||||
public class DummyDrawerEvent {
|
||||
}
|
|
@ -30,11 +30,24 @@ public class SearchEvent {
|
|||
|
||||
public final SearchOperation.SearchType searchType;
|
||||
|
||||
public final UnsetType unsetType;
|
||||
|
||||
public SearchEvent(String searchQuery, SearchOperation.SearchType searchType) {
|
||||
public enum UnsetType {
|
||||
NO_UNSET,
|
||||
UNSET_DRAWER,
|
||||
UNSET_BOTTOM_NAV_BAR;
|
||||
}
|
||||
|
||||
public SearchEvent(String searchQuery, SearchOperation.SearchType searchType, UnsetType unsetType) {
|
||||
|
||||
this.searchQuery = searchQuery;
|
||||
this.searchType = searchType;
|
||||
this.unsetType = unsetType;
|
||||
|
||||
}
|
||||
|
||||
public UnsetType getUnsetType() {
|
||||
return unsetType;
|
||||
}
|
||||
|
||||
public String getSearchQuery() {
|
||||
|
|
|
@ -1,21 +1,20 @@
|
|||
/**
|
||||
* ownCloud Android client application
|
||||
*
|
||||
* <p>
|
||||
* Copyright (C) 2012 Bartek Przybylski
|
||||
* Copyright (C) 2012-2016 ownCloud Inc.
|
||||
*
|
||||
* <p>
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2,
|
||||
* as published by the Free Software Foundation.
|
||||
*
|
||||
* <p>
|
||||
* 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 General Public License for more details.
|
||||
*
|
||||
* <p>
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
package com.owncloud.android.ui.fragment;
|
||||
|
@ -24,8 +23,10 @@ import android.animation.LayoutTransition;
|
|||
import android.app.Activity;
|
||||
import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
import android.os.Looper;
|
||||
import android.support.annotation.DrawableRes;
|
||||
import android.support.annotation.StringRes;
|
||||
import android.support.design.widget.BottomNavigationView;
|
||||
import android.support.v4.app.Fragment;
|
||||
import android.support.v4.view.MenuItemCompat;
|
||||
import android.support.v4.widget.SwipeRefreshLayout;
|
||||
|
@ -66,6 +67,18 @@ import java.util.ArrayList;
|
|||
import third_parties.in.srain.cube.GridViewWithHeaderAndFooter;
|
||||
|
||||
import static android.content.res.Configuration.ORIENTATION_LANDSCAPE;
|
||||
import static com.owncloud.android.ui.fragment.ExtendedListFragment.SearchType.FAVORITE_SEARCH;
|
||||
import static com.owncloud.android.ui.fragment.ExtendedListFragment.SearchType.FAVORITE_SEARCH_FILTER;
|
||||
import static com.owncloud.android.ui.fragment.ExtendedListFragment.SearchType.FILE_SEARCH;
|
||||
import static com.owncloud.android.ui.fragment.ExtendedListFragment.SearchType.NO_SEARCH;
|
||||
import static com.owncloud.android.ui.fragment.ExtendedListFragment.SearchType.PHOTO_SEARCH;
|
||||
import static com.owncloud.android.ui.fragment.ExtendedListFragment.SearchType.RECENTLY_ADDED_SEARCH;
|
||||
import static com.owncloud.android.ui.fragment.ExtendedListFragment.SearchType.RECENTLY_ADDED_SEARCH_FILTER;
|
||||
import static com.owncloud.android.ui.fragment.ExtendedListFragment.SearchType.RECENTLY_MODIFIED_SEARCH;
|
||||
import static com.owncloud.android.ui.fragment.ExtendedListFragment.SearchType.RECENTLY_MODIFIED_SEARCH_FILTER;
|
||||
import static com.owncloud.android.ui.fragment.ExtendedListFragment.SearchType.REGULAR_FILTER;
|
||||
import static com.owncloud.android.ui.fragment.ExtendedListFragment.SearchType.VIDEO_SEARCH;
|
||||
import static com.owncloud.android.ui.fragment.ExtendedListFragment.SearchType.VIDEO_SEARCH_FILTER;
|
||||
|
||||
public class ExtendedListFragment extends Fragment
|
||||
implements OnItemClickListener, OnEnforceableRefreshListener, SearchView.OnQueryTextListener {
|
||||
|
@ -114,6 +127,25 @@ public class ExtendedListFragment extends Fragment
|
|||
protected SearchView searchView;
|
||||
private Handler handler = new Handler();
|
||||
|
||||
protected Menu mMenu;
|
||||
|
||||
public enum SearchType {
|
||||
NO_SEARCH,
|
||||
REGULAR_FILTER,
|
||||
FILE_SEARCH,
|
||||
FAVORITE_SEARCH,
|
||||
FAVORITE_SEARCH_FILTER,
|
||||
VIDEO_SEARCH,
|
||||
VIDEO_SEARCH_FILTER,
|
||||
PHOTO_SEARCH,
|
||||
PHOTOS_SEARCH_FILTER,
|
||||
RECENTLY_MODIFIED_SEARCH,
|
||||
RECENTLY_MODIFIED_SEARCH_FILTER,
|
||||
RECENTLY_ADDED_SEARCH,
|
||||
RECENTLY_ADDED_SEARCH_FILTER
|
||||
}
|
||||
|
||||
|
||||
protected void setListAdapter(BaseAdapter listAdapter) {
|
||||
mAdapter = listAdapter;
|
||||
mCurrentListView.setAdapter(listAdapter);
|
||||
|
@ -166,6 +198,7 @@ public class ExtendedListFragment extends Fragment
|
|||
|
||||
@Override
|
||||
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
|
||||
mMenu = menu;
|
||||
final MenuItem item = menu.findItem(R.id.action_search);
|
||||
searchView = (SearchView) MenuItemCompat.getActionView(item);
|
||||
searchView.setOnQueryTextListener(this);
|
||||
|
@ -200,6 +233,17 @@ public class ExtendedListFragment extends Fragment
|
|||
public void run() {
|
||||
if (getActivity() != null && !(getActivity() instanceof FolderPickerActivity)) {
|
||||
setFabEnabled(!hasFocus);
|
||||
|
||||
if (getResources().getBoolean(R.bool.bottom_toolbar_enabled)) {
|
||||
BottomNavigationView bottomNavigationView = (BottomNavigationView) getActivity().
|
||||
findViewById(R.id.bottom_navigation_view);
|
||||
if (hasFocus) {
|
||||
bottomNavigationView.setVisibility(View.GONE);
|
||||
} else {
|
||||
bottomNavigationView.setVisibility(View.VISIBLE);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}, 100);
|
||||
|
@ -220,9 +264,10 @@ public class ExtendedListFragment extends Fragment
|
|||
|
||||
if (currentVisibility != oldVisibility) {
|
||||
if (currentVisibility == View.VISIBLE) {
|
||||
setEmptyListMessage(true);
|
||||
|
||||
setEmptyListMessage(SearchType.REGULAR_FILTER);
|
||||
} else {
|
||||
setEmptyListMessage(false);
|
||||
setEmptyListMessage(NO_SEARCH);
|
||||
}
|
||||
|
||||
oldVisibility = currentVisibility;
|
||||
|
@ -555,22 +600,52 @@ public class ExtendedListFragment extends Fragment
|
|||
mEmptyListMessage.setText(message);
|
||||
mEmptyListIcon.setImageResource(icon);
|
||||
|
||||
new Handler(Looper.getMainLooper()).post(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
mEmptyListIcon.setVisibility(View.VISIBLE);
|
||||
mEmptyListProgress.setVisibility(View.GONE);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
public void setEmptyListMessage(boolean isSearch) {
|
||||
if (isSearch) {
|
||||
setMessageForEmptyList(R.string.file_list_empty_headline_search,
|
||||
R.string.file_list_empty_search, R.drawable.ic_search_light_grey);
|
||||
|
||||
} else {
|
||||
public void setEmptyListMessage(SearchType searchType) {
|
||||
if (searchType == NO_SEARCH) {
|
||||
setMessageForEmptyList(
|
||||
R.string.file_list_empty_headline,
|
||||
R.string.file_list_empty,
|
||||
R.drawable.ic_list_empty_folder
|
||||
);
|
||||
} else if (searchType == FILE_SEARCH) {
|
||||
setMessageForEmptyList(R.string.file_list_empty_headline_server_search,
|
||||
R.string.file_list_empty, R.drawable.ic_search_light_grey);
|
||||
} else if (searchType == FAVORITE_SEARCH) {
|
||||
setMessageForEmptyList(R.string.file_list_empty_headline_server_search,
|
||||
R.string.file_list_empty_favorites, R.drawable.ic_search_light_grey);
|
||||
} else if (searchType == VIDEO_SEARCH) {
|
||||
setMessageForEmptyList(R.string.file_list_empty_headline_server_search_videos,
|
||||
R.string.file_list_empty_text_videos, R.drawable.ic_search_light_grey);
|
||||
} else if (searchType == PHOTO_SEARCH) {
|
||||
setMessageForEmptyList(R.string.file_list_empty_headline_server_search_photos,
|
||||
R.string.file_list_empty_text_photos, R.drawable.ic_search_light_grey);
|
||||
} else if (searchType == RECENTLY_MODIFIED_SEARCH) {
|
||||
setMessageForEmptyList(R.string.file_list_empty_headline_server_search,
|
||||
R.string.file_list_empty_recently_modified, R.drawable.ic_search_light_grey);
|
||||
} else if (searchType == RECENTLY_ADDED_SEARCH) {
|
||||
setMessageForEmptyList(R.string.file_list_empty_headline_server_search,
|
||||
R.string.file_list_empty_recently_added, R.drawable.ic_search_light_grey);
|
||||
} else if (searchType == REGULAR_FILTER) {
|
||||
setMessageForEmptyList(R.string.file_list_empty_headline_search,
|
||||
R.string.file_list_empty_search, R.drawable.ic_search_light_grey);
|
||||
} else if (searchType == FAVORITE_SEARCH_FILTER) {
|
||||
|
||||
} else if (searchType == VIDEO_SEARCH_FILTER) {
|
||||
|
||||
} else if (searchType == RECENTLY_MODIFIED_SEARCH_FILTER) {
|
||||
|
||||
} else if (searchType == RECENTLY_ADDED_SEARCH_FILTER) {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -582,9 +657,14 @@ public class ExtendedListFragment extends Fragment
|
|||
mEmptyListHeadline.setText(R.string.file_list_loading);
|
||||
mEmptyListMessage.setText("");
|
||||
|
||||
new Handler(Looper.getMainLooper()).post(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
mEmptyListIcon.setVisibility(View.GONE);
|
||||
mEmptyListProgress.setVisibility(View.VISIBLE);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -6,19 +6,18 @@
|
|||
* @author David A. Velasco
|
||||
* Copyright (C) 2011 Bartek Przybylski
|
||||
* Copyright (C) 2016 ownCloud Inc.
|
||||
*
|
||||
* <p>
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2,
|
||||
* as published by the Free Software Foundation.
|
||||
*
|
||||
* <p>
|
||||
* 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 General Public License for more details.
|
||||
*
|
||||
* <p>
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
package com.owncloud.android.ui.fragment;
|
||||
|
||||
|
@ -31,6 +30,8 @@ import android.content.Intent;
|
|||
import android.content.SharedPreferences;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
import android.os.Looper;
|
||||
import android.preference.PreferenceManager;
|
||||
import android.support.annotation.NonNull;
|
||||
import android.support.design.widget.BottomNavigationView;
|
||||
|
@ -73,6 +74,7 @@ import com.owncloud.android.ui.dialog.ConfirmationDialogFragment;
|
|||
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.events.DummyDrawerEvent;
|
||||
import com.owncloud.android.ui.events.MenuItemClickEvent;
|
||||
import com.owncloud.android.ui.events.SearchEvent;
|
||||
import com.owncloud.android.ui.helpers.SparseBooleanArrayParcelable;
|
||||
|
@ -207,11 +209,12 @@ public class OCFileListFragment extends ExtendedListFragment implements OCFileLi
|
|||
EventBus.getDefault().post(new MenuItemClickEvent(item));
|
||||
break;
|
||||
case R.id.nav_bar_favorites:
|
||||
EventBus.getDefault().post(new SearchEvent("", SearchOperation.SearchType.FAVORITE_SEARCH));
|
||||
EventBus.getDefault().post(new SearchEvent("", SearchOperation.SearchType.FAVORITE_SEARCH,
|
||||
SearchEvent.UnsetType.UNSET_DRAWER));
|
||||
break;
|
||||
case R.id.nav_bar_photos:
|
||||
EventBus.getDefault().post(new SearchEvent("image/%",
|
||||
SearchOperation.SearchType.CONTENT_TYPE_SEARCH));
|
||||
SearchOperation.SearchType.CONTENT_TYPE_SEARCH, SearchEvent.UnsetType.UNSET_DRAWER));
|
||||
break;
|
||||
case R.id.nav_bar_settings:
|
||||
EventBus.getDefault().post(new MenuItemClickEvent(item));
|
||||
|
@ -1065,8 +1068,32 @@ public class OCFileListFragment extends ExtendedListFragment implements OCFileLi
|
|||
editor.apply();
|
||||
}
|
||||
|
||||
private void unsetAllMenuItems(final boolean unsetDrawer) {
|
||||
new Handler(Looper.getMainLooper()).post(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
if (unsetDrawer) {
|
||||
EventBus.getDefault().post(new DummyDrawerEvent());
|
||||
} else {
|
||||
if (bottomNavigationView != null) {
|
||||
bottomNavigationView.getMenu().findItem(R.id.nav_bar_files).setChecked(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
@Subscribe(threadMode = ThreadMode.BACKGROUND)
|
||||
public void onMessageEvent(SearchEvent event) {
|
||||
setEmptyListLoadingMessage();
|
||||
|
||||
if (event.getUnsetType().equals(SearchEvent.UnsetType.UNSET_BOTTOM_NAV_BAR)) {
|
||||
unsetAllMenuItems(false);
|
||||
} else if (event.getUnsetType().equals(SearchEvent.UnsetType.UNSET_DRAWER)) {
|
||||
unsetAllMenuItems(true);
|
||||
}
|
||||
|
||||
Account currentAccount = com.owncloud.android.authentication.AccountUtils.
|
||||
getCurrentOwnCloudAccount(MainApp.getAppContext());
|
||||
|
||||
|
@ -1081,7 +1108,25 @@ public class OCFileListFragment extends ExtendedListFragment implements OCFileLi
|
|||
SearchOperation operation = new SearchOperation(event.getSearchQuery(), event.getSearchType());
|
||||
RemoteOperationResult remoteOperationResult = operation.execute(mClient);
|
||||
if (remoteOperationResult.isSuccess() || remoteOperationResult.getData() != null) {
|
||||
|
||||
if (event.getSearchType().equals(SearchOperation.SearchType.FILE_SEARCH)) {
|
||||
setEmptyListMessage(SearchType.FILE_SEARCH);
|
||||
} else if (event.getSearchType().equals(SearchOperation.SearchType.CONTENT_TYPE_SEARCH)) {
|
||||
if (event.getSearchQuery().equals("image/%")) {
|
||||
setEmptyListMessage(SearchType.PHOTO_SEARCH);
|
||||
} else if (event.getSearchQuery().equals("video/%")) {
|
||||
setEmptyListMessage(SearchType.VIDEO_SEARCH);
|
||||
}
|
||||
} else if (event.getSearchType().equals(SearchOperation.SearchType.FAVORITE_SEARCH)) {
|
||||
setEmptyListMessage(SearchType.FAVORITE_SEARCH);
|
||||
} else if (event.getSearchType().equals(SearchOperation.SearchType.RECENTLY_ADDED_SEARCH)) {
|
||||
setEmptyListMessage(SearchType.RECENTLY_ADDED_SEARCH);
|
||||
} else if (event.getSearchType().equals(SearchOperation.SearchType.RECENTLY_MODIFIED_SEARCH)) {
|
||||
setEmptyListMessage(SearchType.RECENTLY_MODIFIED_SEARCH);
|
||||
}
|
||||
|
||||
mAdapter.setData(remoteOperationResult.getData());
|
||||
|
||||
}
|
||||
} catch (AuthenticatorException e) {
|
||||
e.printStackTrace();
|
||||
|
@ -1092,8 +1137,6 @@ public class OCFileListFragment extends ExtendedListFragment implements OCFileLi
|
|||
} catch (OperationCanceledException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -66,7 +66,8 @@ public class UploadListFragment extends ExpandableListFragment {
|
|||
View v = super.onCreateView(inflater, container, savedInstanceState);
|
||||
getListView().setChoiceMode(ListView.CHOICE_MODE_MULTIPLE);
|
||||
setMessageForEmptyList(
|
||||
R.string.upload_list_empty_headline, R.string.upload_list_empty_text, R.drawable.ic_list_empty_upload
|
||||
R.string.upload_list_empty_headline, R.string.upload_list_empty_text_auto_upload,
|
||||
R.drawable.ic_list_empty_upload
|
||||
);
|
||||
setOnRefreshListener(this);
|
||||
return v;
|
||||
|
|
|
@ -27,17 +27,16 @@
|
|||
android:orderInCategory="0"
|
||||
android:id="@+id/nav_all_files"
|
||||
android:icon="@drawable/ic_folder_open"
|
||||
android:title="@string/drawer_item_files"/>
|
||||
android:title="@string/drawer_item_all_files"/>
|
||||
<item
|
||||
android:orderInCategory="0"
|
||||
android:id="@+id/nav_favorites"
|
||||
android:icon="@drawable/ic_favorite"
|
||||
android:title="@string/drawer_item_favorites"/>
|
||||
<item
|
||||
android:orderInCategory="0"
|
||||
android:id="@+id/nav_on_device"
|
||||
android:icon="@drawable/ic_action_available_offline"
|
||||
android:title="@string/drawer_item_on_device"/>
|
||||
android:id="@+id/nav_photos"
|
||||
android:icon="@drawable/file_image"
|
||||
android:title="@string/drawer_item_photos"/>
|
||||
<item
|
||||
android:orderInCategory="0"
|
||||
android:id="@+id/nav_recently_added"
|
||||
|
@ -59,6 +58,11 @@
|
|||
android:title="@string/drawer_item_videos"
|
||||
android:icon="@drawable/file_movie"
|
||||
android:visible="false"/>
|
||||
<item
|
||||
android:orderInCategory="0"
|
||||
android:id="@+id/nav_on_device"
|
||||
android:icon="@drawable/ic_action_available_offline"
|
||||
android:title="@string/drawer_item_on_device"/>
|
||||
<item
|
||||
android:orderInCategory="0"
|
||||
android:id="@+id/nav_folder_sync"
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
<item
|
||||
android:id="@+id/nav_bar_files"
|
||||
android:icon="@drawable/ic_folder_open"
|
||||
android:title="@string/drawer_item_files"/>
|
||||
android:title="@string/drawer_item_all_files"/>
|
||||
<item
|
||||
android:id="@+id/nav_bar_favorites"
|
||||
android:icon="@drawable/ic_favorite"
|
||||
|
|
|
@ -62,7 +62,7 @@
|
|||
<!-- Drawer options -->
|
||||
<bool name="recently_added_enabled">false</bool>
|
||||
<bool name="recently_modified_enabled">false</bool>
|
||||
<bool name="shared_enabled">false</bool>
|
||||
<bool name="shared_enabled">true</bool>
|
||||
<bool name="videos_enabled">false</bool>
|
||||
|
||||
<!-- Bottom toolbar -->
|
||||
|
|
|
@ -88,13 +88,22 @@
|
|||
<string name="file_list_seconds_ago">seconds ago</string>
|
||||
<string name="file_list_empty_headline">No files in here</string>
|
||||
<string name="file_list_empty">Upload some content or sync with your devices!</string>
|
||||
<string name="file_list_empty_favorites">Favorite some files or sync with your devices!</string>
|
||||
<string name="file_list_loading">Loading…</string>
|
||||
<string name="file_list_no_app_for_file_type">No app found for file type!</string>
|
||||
<string name="local_file_list_empty">There are no files in this folder.</string>
|
||||
<string name="file_list_empty_headline_search">No results in this folder</string>
|
||||
<string name="file_list_empty_headline_server_search">No results</string>
|
||||
<string name="file_list_empty_headline_server_search_videos">No videos</string>
|
||||
<string name="file_list_empty_headline_server_search_photos">No photos</string>
|
||||
<string name="file_list_empty_search">Try looking in another folder?</string>
|
||||
<string name="file_list_empty_recently_modified">No recently modified files found</string>
|
||||
<string name="file_list_empty_recently_added">No recently added files found</string>
|
||||
<string name="file_list_empty_text_photos">Upload some photos or activate auto upload!</string>
|
||||
<string name="file_list_empty_text_videos">Upload some videos or activate auto upload!</string>
|
||||
<string name="upload_list_empty_headline">No uploads available</string>
|
||||
<string name="upload_list_empty_text">Upload some content or activate instant upload!</string>
|
||||
<string name="upload_list_empty_text_auto_upload">Upload some content or activate auto upload!</string>
|
||||
<string name="file_list_folder">folder</string>
|
||||
<string name="file_list_folders">folders</string>
|
||||
<string name="file_list_file">file</string>
|
||||
|
|
Loading…
Reference in a new issue