Merge pull request #5393 from nextcloud/removeUnsetType

Remove UnsetType as we do not have bottom bar anymore…
This commit is contained in:
Andy Scherzinger 2020-02-05 15:17:44 +01:00 committed by GitHub
commit c7669fe9db
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
18 changed files with 227 additions and 48 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 36 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 38 KiB

After

Width:  |  Height:  |  Size: 38 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 12 KiB

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 25 KiB

After

Width:  |  Height:  |  Size: 25 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 40 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 36 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 36 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 34 KiB

After

Width:  |  Height:  |  Size: 34 KiB

View file

@ -0,0 +1,50 @@
/*
*
* Nextcloud Android client application
*
* @author Tobias Kaminsky
* Copyright (C) 2020 Tobias Kaminsky
* Copyright (C) 2020 Nextcloud GmbH
*
* 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 <https://www.gnu.org/licenses/>.
*/
package com.nextcloud.client;
import android.Manifest;
import com.owncloud.android.AbstractIT;
import com.owncloud.android.ui.activities.ActivitiesActivity;
import org.junit.Rule;
import org.junit.Test;
import androidx.test.espresso.intent.rule.IntentsTestRule;
import androidx.test.rule.GrantPermissionRule;
public class ActivitiesActivityIT extends AbstractIT {
@Rule public IntentsTestRule<ActivitiesActivity> activityRule = new IntentsTestRule<>(ActivitiesActivity.class,
true,
false);
@Rule
public final GrantPermissionRule permissionRule = GrantPermissionRule.grant(
Manifest.permission.WRITE_EXTERNAL_STORAGE);
@Test
public void openDrawer() throws InterruptedException {
super.openDrawer(activityRule);
}
}

View file

@ -0,0 +1,50 @@
/*
*
* Nextcloud Android client application
*
* @author Tobias Kaminsky
* Copyright (C) 2020 Tobias Kaminsky
* Copyright (C) 2020 Nextcloud GmbH
*
* 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 <https://www.gnu.org/licenses/>.
*/
package com.nextcloud.client;
import android.Manifest;
import com.owncloud.android.AbstractIT;
import com.owncloud.android.ui.activity.NotificationsActivity;
import org.junit.Rule;
import org.junit.Test;
import androidx.test.espresso.intent.rule.IntentsTestRule;
import androidx.test.rule.GrantPermissionRule;
public class NotificationsActivityIT extends AbstractIT {
@Rule public IntentsTestRule<NotificationsActivity> activityRule = new IntentsTestRule<>(NotificationsActivity.class,
true,
false);
@Rule
public final GrantPermissionRule permissionRule = GrantPermissionRule.grant(
Manifest.permission.WRITE_EXTERNAL_STORAGE);
@Test
public void openDrawer() throws InterruptedException {
super.openDrawer(activityRule);
}
}

View file

@ -0,0 +1,50 @@
/*
*
* Nextcloud Android client application
*
* @author Tobias Kaminsky
* Copyright (C) 2020 Tobias Kaminsky
* Copyright (C) 2020 Nextcloud GmbH
*
* 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 <https://www.gnu.org/licenses/>.
*/
package com.nextcloud.client;
import android.Manifest;
import com.owncloud.android.AbstractIT;
import com.owncloud.android.ui.activity.SyncedFoldersActivity;
import org.junit.Rule;
import org.junit.Test;
import androidx.test.espresso.intent.rule.IntentsTestRule;
import androidx.test.rule.GrantPermissionRule;
public class SyncedFoldersActivityIT extends AbstractIT {
@Rule public IntentsTestRule<SyncedFoldersActivity> activityRule = new IntentsTestRule<>(SyncedFoldersActivity.class,
true,
false);
@Rule
public final GrantPermissionRule permissionRule = GrantPermissionRule.grant(
Manifest.permission.WRITE_EXTERNAL_STORAGE);
@Test
public void openDrawer() throws InterruptedException {
super.openDrawer(activityRule);
}
}

View file

@ -0,0 +1,50 @@
/*
*
* Nextcloud Android client application
*
* @author Tobias Kaminsky
* Copyright (C) 2020 Tobias Kaminsky
* Copyright (C) 2020 Nextcloud GmbH
*
* 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 <https://www.gnu.org/licenses/>.
*/
package com.nextcloud.client;
import android.Manifest;
import com.owncloud.android.AbstractIT;
import com.owncloud.android.ui.activity.UploadListActivity;
import org.junit.Rule;
import org.junit.Test;
import androidx.test.espresso.intent.rule.IntentsTestRule;
import androidx.test.rule.GrantPermissionRule;
public class UploadListActivityActivityIT extends AbstractIT {
@Rule public IntentsTestRule<UploadListActivity> activityRule = new IntentsTestRule<>(UploadListActivity.class,
true,
false);
@Rule
public final GrantPermissionRule permissionRule = GrantPermissionRule.grant(
Manifest.permission.WRITE_EXTERNAL_STORAGE);
@Test
public void openDrawer() throws InterruptedException {
super.openDrawer(activityRule);
}
}

View file

@ -4,11 +4,13 @@ import android.accounts.Account;
import android.accounts.AccountManager;
import android.accounts.AuthenticatorException;
import android.accounts.OperationCanceledException;
import android.app.Activity;
import android.content.ActivityNotFoundException;
import android.content.Context;
import android.net.Uri;
import android.os.Bundle;
import com.facebook.testing.screenshot.Screenshot;
import com.nextcloud.client.account.UserAccountManager;
import com.nextcloud.client.account.UserAccountManagerImpl;
import com.owncloud.android.datamodel.FileDataStorageManager;
@ -29,10 +31,14 @@ import java.io.FileWriter;
import java.io.IOException;
import java.io.InputStream;
import androidx.test.espresso.contrib.DrawerActions;
import androidx.test.espresso.intent.rule.IntentsTestRule;
import androidx.test.ext.junit.runners.AndroidJUnit4;
import androidx.test.platform.app.InstrumentationRegistry;
import static androidx.test.InstrumentationRegistry.getInstrumentation;
import static androidx.test.espresso.Espresso.onView;
import static androidx.test.espresso.matcher.ViewMatchers.withId;
/**
@ -149,4 +155,16 @@ public abstract class AbstractIT {
protected void waitForIdleSync() {
InstrumentationRegistry.getInstrumentation().waitForIdleSync();
}
protected void openDrawer(IntentsTestRule activityRule) throws InterruptedException {
Activity sut = activityRule.launchActivity(null);
Thread.sleep(3000);
onView(withId(R.id.drawer_layout)).perform(DrawerActions.open());
waitForIdleSync();
Screenshot.snapActivity(sut).record();
}
}

View file

@ -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);

View file

@ -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
}
}

View file

@ -320,8 +320,7 @@ public class ExtendedListFragment extends Fragment implements
handler.post(() -> {
if (adapter instanceof OCFileListAdapter) {
EventBus.getDefault().post(new SearchEvent(query,
SearchRemoteOperation.SearchType.FILE_SEARCH,
SearchEvent.UnsetType.NO_UNSET));
SearchRemoteOperation.SearchType.FILE_SEARCH));
} else if (adapter instanceof LocalFileListAdapter) {
LocalFileListAdapter localFileListAdapter = (LocalFileListAdapter) adapter;
localFileListAdapter.filter(query);

View file

@ -86,7 +86,6 @@ import com.owncloud.android.ui.dialog.SetupEncryptionDialogFragment;
import com.owncloud.android.ui.dialog.SyncFileNotEnoughSpaceDialogFragment;
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;
@ -1384,20 +1383,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
@ -1524,12 +1509,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();
@ -1718,10 +1697,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);
}
private void syncAndCheckFiles(Collection<OCFile> files) {

View file

@ -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(),