Remove UnsetType as we do not have bottom bar anymore…

Signed-off-by: tobiasKaminsky <tobias@kaminsky.me>
This commit is contained in:
tobiasKaminsky 2020-02-04 11:51:47 +01:00
parent 7c84a9f929
commit e118f9a516
No known key found for this signature in database
GPG key ID: 0E00D4D47D0C5AF7
4 changed files with 8 additions and 46 deletions

View file

@ -430,9 +430,7 @@ public abstract class DrawerActivity extends ToolbarActivity
break; break;
case R.id.nav_favorites: case R.id.nav_favorites:
handleSearchEvents(new SearchEvent("", handleSearchEvents(new SearchEvent("", SearchRemoteOperation.SearchType.FAVORITE_SEARCH),
SearchRemoteOperation.SearchType.FAVORITE_SEARCH,
SearchEvent.UnsetType.NO_UNSET),
menuItem.getItemId()); menuItem.getItemId());
break; break;
case R.id.nav_photos: case R.id.nav_photos:
@ -472,15 +470,11 @@ public abstract class DrawerActivity extends ToolbarActivity
UserInfoActivity.openAccountRemovalConfirmationDialog(getAccount(), getSupportFragmentManager()); UserInfoActivity.openAccountRemovalConfirmationDialog(getAccount(), getSupportFragmentManager());
break; break;
case R.id.nav_shared: case R.id.nav_shared:
handleSearchEvents(new SearchEvent("", handleSearchEvents(new SearchEvent("", SearchRemoteOperation.SearchType.SHARED_SEARCH),
SearchRemoteOperation.SearchType.SHARED_SEARCH,
SearchEvent.UnsetType.UNSET_BOTTOM_NAV_BAR),
menuItem.getItemId()); menuItem.getItemId());
break; break;
case R.id.nav_recently_modified: case R.id.nav_recently_modified:
handleSearchEvents(new SearchEvent("", handleSearchEvents(new SearchEvent("", SearchRemoteOperation.SearchType.RECENTLY_MODIFIED_SEARCH),
SearchRemoteOperation.SearchType.RECENTLY_MODIFIED_SEARCH,
SearchEvent.UnsetType.UNSET_BOTTOM_NAV_BAR),
menuItem.getItemId()); menuItem.getItemId());
break; break;
default: default:
@ -532,9 +526,7 @@ public abstract class DrawerActivity extends ToolbarActivity
} }
private void startPhotoSearch(MenuItem menuItem) { private void startPhotoSearch(MenuItem menuItem) {
SearchEvent searchEvent = new SearchEvent("image/%", SearchEvent searchEvent = new SearchEvent("image/%", SearchRemoteOperation.SearchType.PHOTO_SEARCH);
SearchRemoteOperation.SearchType.PHOTO_SEARCH,
SearchEvent.UnsetType.NO_UNSET);
Intent intent = new Intent(getApplicationContext(), FileDisplayActivity.class); Intent intent = new Intent(getApplicationContext(), FileDisplayActivity.class);
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);

View file

@ -39,11 +39,4 @@ import lombok.Setter;
public class SearchEvent { public class SearchEvent {
public String searchQuery; public String searchQuery;
public SearchRemoteOperation.SearchType searchType; public SearchRemoteOperation.SearchType searchType;
public UnsetType unsetType;
public enum UnsetType {
NO_UNSET,
UNSET_DRAWER,
UNSET_BOTTOM_NAV_BAR
}
} }

View file

@ -85,7 +85,6 @@ import com.owncloud.android.ui.dialog.RenameFileDialogFragment;
import com.owncloud.android.ui.dialog.SetupEncryptionDialogFragment; import com.owncloud.android.ui.dialog.SetupEncryptionDialogFragment;
import com.owncloud.android.ui.events.ChangeMenuEvent; import com.owncloud.android.ui.events.ChangeMenuEvent;
import com.owncloud.android.ui.events.CommentsEvent; import com.owncloud.android.ui.events.CommentsEvent;
import com.owncloud.android.ui.events.DummyDrawerEvent;
import com.owncloud.android.ui.events.EncryptionEvent; import com.owncloud.android.ui.events.EncryptionEvent;
import com.owncloud.android.ui.events.FavoriteEvent; import com.owncloud.android.ui.events.FavoriteEvent;
import com.owncloud.android.ui.events.SearchEvent; import com.owncloud.android.ui.events.SearchEvent;
@ -1380,20 +1379,6 @@ public class OCFileListFragment extends ExtendedListFragment implements
} }
} }
private void unsetAllMenuItems(final boolean unsetDrawer) {
new Handler(Looper.getMainLooper()).post(() -> {
if (unsetDrawer) {
EventBus.getDefault().post(new DummyDrawerEvent());
}
});
}
public void setTitleFromSearchEvent(SearchEvent event) {
prepareCurrentSearch(event);
setTitle();
}
private void setTitle() { private void setTitle() {
// set title // set title
@ -1520,12 +1505,6 @@ public class OCFileListFragment extends ExtendedListFragment implements
setFabVisible(false); setFabVisible(false);
if (event.getUnsetType() == SearchEvent.UnsetType.UNSET_BOTTOM_NAV_BAR) {
unsetAllMenuItems(false);
} else if (event.getUnsetType() == SearchEvent.UnsetType.UNSET_DRAWER) {
unsetAllMenuItems(true);
}
Runnable switchViewsRunnable = () -> { Runnable switchViewsRunnable = () -> {
if (isGridViewPreferred(mFile) && !isGridEnabled()) { if (isGridViewPreferred(mFile) && !isGridEnabled()) {
switchToGridView(); switchToGridView();
@ -1714,10 +1693,10 @@ public class OCFileListFragment extends ExtendedListFragment implements
} }
private boolean isSearchEventSet(SearchEvent event) { private boolean isSearchEventSet(SearchEvent event) {
return event != null && event.getSearchType() != null && return event != null &&
event.getSearchType() != null &&
(!TextUtils.isEmpty(event.getSearchQuery()) || (!TextUtils.isEmpty(event.getSearchQuery()) ||
event.searchType == SearchRemoteOperation.SearchType.SHARED_SEARCH) event.searchType == SearchRemoteOperation.SearchType.SHARED_SEARCH);
&& event.getUnsetType() != null;
} }
@Override @Override

View file

@ -65,9 +65,7 @@ public class PhotoFragment extends OCFileListFragment {
public void onCreate(Bundle savedInstanceState) { public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
searchEvent = new SearchEvent("image/%", searchEvent = new SearchEvent("image/%", SearchRemoteOperation.SearchType.PHOTO_SEARCH);
SearchRemoteOperation.SearchType.PHOTO_SEARCH,
SearchEvent.UnsetType.NO_UNSET);
searchRemoteOperation = new SearchRemoteOperation(searchEvent.getSearchQuery(), searchRemoteOperation = new SearchRemoteOperation(searchEvent.getSearchQuery(),
searchEvent.getSearchType(), searchEvent.getSearchType(),