Browse Source

Remove UnsetType as we do not have bottom bar anymore…

Signed-off-by: tobiasKaminsky <tobias@kaminsky.me>
tobiasKaminsky 5 years ago
parent
commit
e118f9a516

+ 4 - 12
src/main/java/com/owncloud/android/ui/activity/DrawerActivity.java

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

+ 0 - 7
src/main/java/com/owncloud/android/ui/events/SearchEvent.java

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

+ 3 - 24
src/main/java/com/owncloud/android/ui/fragment/OCFileListFragment.java

@@ -85,7 +85,6 @@ import com.owncloud.android.ui.dialog.RenameFileDialogFragment;
 import com.owncloud.android.ui.dialog.SetupEncryptionDialogFragment;
 import com.owncloud.android.ui.events.ChangeMenuEvent;
 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.FavoriteEvent;
 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() {
         // set title
 
@@ -1520,12 +1505,6 @@ public class OCFileListFragment extends ExtendedListFragment implements
 
         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 = () -> {
             if (isGridViewPreferred(mFile) && !isGridEnabled()) {
                 switchToGridView();
@@ -1714,10 +1693,10 @@ public class OCFileListFragment extends ExtendedListFragment implements
     }
 
     private boolean isSearchEventSet(SearchEvent event) {
-        return event != null && event.getSearchType() != null &&
+        return event != null &&
+            event.getSearchType() != null &&
             (!TextUtils.isEmpty(event.getSearchQuery()) ||
-                event.searchType == SearchRemoteOperation.SearchType.SHARED_SEARCH)
-            && event.getUnsetType() != null;
+                event.searchType == SearchRemoteOperation.SearchType.SHARED_SEARCH);
     }
 
     @Override

+ 1 - 3
src/main/java/com/owncloud/android/ui/fragment/PhotoFragment.java

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