mirror of
https://github.com/nextcloud/android.git
synced 2024-11-29 10:49:04 +03:00
All files shows root again
annotated functions with correct NonNull Signed-off-by: tobiasKaminsky <tobias@kaminsky.me>
This commit is contained in:
parent
9710a8a863
commit
25a67fe4cb
10 changed files with 51 additions and 13 deletions
|
@ -28,12 +28,14 @@ import android.app.Activity;
|
|||
import com.facebook.testing.screenshot.Screenshot;
|
||||
import com.owncloud.android.AbstractIT;
|
||||
import com.owncloud.android.R;
|
||||
import com.owncloud.android.datamodel.OCFile;
|
||||
import com.owncloud.android.lib.resources.files.CreateFolderRemoteOperation;
|
||||
import com.owncloud.android.lib.resources.files.ExistenceCheckRemoteOperation;
|
||||
import com.owncloud.android.lib.resources.files.SearchRemoteOperation;
|
||||
import com.owncloud.android.lib.resources.shares.CreateShareRemoteOperation;
|
||||
import com.owncloud.android.lib.resources.shares.OCShare;
|
||||
import com.owncloud.android.lib.resources.shares.ShareType;
|
||||
import com.owncloud.android.operations.CreateFolderOperation;
|
||||
import com.owncloud.android.ui.activity.FileDisplayActivity;
|
||||
import com.owncloud.android.ui.events.SearchEvent;
|
||||
|
||||
|
@ -43,6 +45,7 @@ import org.junit.Rule;
|
|||
import org.junit.Test;
|
||||
|
||||
import androidx.test.espresso.contrib.DrawerActions;
|
||||
import androidx.test.espresso.contrib.NavigationViewActions;
|
||||
import androidx.test.espresso.intent.rule.IntentsTestRule;
|
||||
import androidx.test.rule.GrantPermissionRule;
|
||||
|
||||
|
@ -50,6 +53,7 @@ import static androidx.test.espresso.Espresso.onView;
|
|||
import static androidx.test.espresso.action.ViewActions.click;
|
||||
import static androidx.test.espresso.matcher.ViewMatchers.withId;
|
||||
import static androidx.test.platform.app.InstrumentationRegistry.getInstrumentation;
|
||||
import static junit.framework.TestCase.assertEquals;
|
||||
import static junit.framework.TestCase.assertTrue;
|
||||
|
||||
|
||||
|
@ -136,4 +140,35 @@ public class FileDisplayActivityIT extends AbstractIT {
|
|||
|
||||
Screenshot.snapActivity(sut).record();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void allFiles() throws InterruptedException {
|
||||
// ActivityScenario<FileDisplayActivity> sut = ActivityScenario.launch(FileDisplayActivity.class);
|
||||
FileDisplayActivity sut = activityRule.launchActivity(null);
|
||||
|
||||
// given test folder
|
||||
assertTrue(new CreateFolderOperation("/test/", true).execute(client, getStorageManager()).isSuccess());
|
||||
|
||||
// navigate into it
|
||||
// sut.onActivity(activity -> activity.onBrowsedDownTo(getStorageManager().getFileByPath("/test/")));
|
||||
//sut.onBrowsedDownTo(getStorageManager().getFileByPath("/test/"));
|
||||
OCFile test = getStorageManager().getFileByPath("/test/");
|
||||
sut.setFile(test);
|
||||
sut.startSyncFolderOperation(test, false);
|
||||
|
||||
assertEquals(getStorageManager().getFileByPath("/test/"), sut.getCurrentDir());
|
||||
|
||||
// open drawer
|
||||
onView(withId(R.id.drawer_layout)).perform(DrawerActions.open());
|
||||
|
||||
// click "all files"
|
||||
onView(withId(R.id.nav_view))
|
||||
.perform(NavigationViewActions.navigateTo(R.id.nav_all_files));
|
||||
|
||||
// then should be in root again
|
||||
Thread.sleep(2000);
|
||||
assertEquals(getStorageManager().getFileByPath("/"), sut.getCurrentDir());
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -39,6 +39,7 @@ import com.owncloud.android.ui.dialog.ConflictsResolveDialog.OnConflictDecisionM
|
|||
|
||||
import javax.inject.Inject;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.fragment.app.Fragment;
|
||||
import androidx.fragment.app.FragmentTransaction;
|
||||
|
||||
|
@ -136,7 +137,7 @@ public class ConflictsResolveActivity extends FileActivity implements OnConflict
|
|||
}
|
||||
|
||||
@Override
|
||||
protected void onSaveInstanceState(Bundle outState) {
|
||||
protected void onSaveInstanceState(@NonNull Bundle outState) {
|
||||
super.onSaveInstanceState(outState);
|
||||
|
||||
outState.putParcelable(EXTRA_CONFLICT_UPLOAD, conflictUpload);
|
||||
|
|
|
@ -409,14 +409,13 @@ public abstract class DrawerActivity extends ToolbarActivity
|
|||
case R.id.nav_all_files:
|
||||
if (this instanceof FileDisplayActivity) {
|
||||
if (((FileDisplayActivity) this).getListOfFilesFragment() instanceof PhotoFragment) {
|
||||
// showFiles(false);
|
||||
Intent intent = new Intent(getApplicationContext(), FileDisplayActivity.class);
|
||||
intent.putExtra(FileDisplayActivity.DRAWER_MENU_ID, menuItem.getItemId());
|
||||
intent.setAction(FileDisplayActivity.ALL_FILES);
|
||||
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
|
||||
startActivity(intent);
|
||||
} else {
|
||||
showFiles(false);
|
||||
((FileDisplayActivity) this).browseToRoot();
|
||||
EventBus.getDefault().post(new ChangeMenuEvent());
|
||||
}
|
||||
} else {
|
||||
|
@ -1217,7 +1216,7 @@ public abstract class DrawerActivity extends ToolbarActivity
|
|||
}
|
||||
|
||||
@Override
|
||||
protected void onSaveInstanceState(Bundle outState) {
|
||||
protected void onSaveInstanceState(@NonNull Bundle outState) {
|
||||
super.onSaveInstanceState(outState);
|
||||
|
||||
outState.putBoolean(KEY_IS_ACCOUNT_CHOOSER_ACTIVE, mIsAccountChooserActive);
|
||||
|
@ -1225,7 +1224,7 @@ public abstract class DrawerActivity extends ToolbarActivity
|
|||
}
|
||||
|
||||
@Override
|
||||
public void onRestoreInstanceState(Bundle savedInstanceState) {
|
||||
public void onRestoreInstanceState(@NonNull Bundle savedInstanceState) {
|
||||
super.onRestoreInstanceState(savedInstanceState);
|
||||
|
||||
mIsAccountChooserActive = savedInstanceState.getBoolean(KEY_IS_ACCOUNT_CHOOSER_ACTIVE, false);
|
||||
|
@ -1257,7 +1256,7 @@ public abstract class DrawerActivity extends ToolbarActivity
|
|||
}
|
||||
|
||||
@Override
|
||||
public void onConfigurationChanged(Configuration newConfig) {
|
||||
public void onConfigurationChanged(@NonNull Configuration newConfig) {
|
||||
super.onConfigurationChanged(newConfig);
|
||||
if (mDrawerToggle != null) {
|
||||
mDrawerToggle.onConfigurationChanged(newConfig);
|
||||
|
|
|
@ -86,6 +86,7 @@ import java.lang.ref.WeakReference;
|
|||
|
||||
import javax.inject.Inject;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.fragment.app.DialogFragment;
|
||||
import androidx.fragment.app.Fragment;
|
||||
import androidx.fragment.app.FragmentManager;
|
||||
|
@ -253,7 +254,7 @@ public abstract class FileActivity extends DrawerActivity
|
|||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
protected void onSaveInstanceState(Bundle outState) {
|
||||
protected void onSaveInstanceState(@NonNull Bundle outState) {
|
||||
super.onSaveInstanceState(outState);
|
||||
outState.putParcelable(FileActivity.EXTRA_FILE, mFile);
|
||||
outState.putBoolean(FileActivity.EXTRA_FROM_NOTIFICATION, mFromNotification);
|
||||
|
|
|
@ -1180,7 +1180,7 @@ public class FileDisplayActivity extends FileActivity
|
|||
}
|
||||
|
||||
@Override
|
||||
protected void onSaveInstanceState(Bundle outState) {
|
||||
protected void onSaveInstanceState(@NonNull Bundle outState) {
|
||||
// responsibility of restore is preferred in onCreate() before than in
|
||||
// onRestoreInstanceState when there are Fragments involved
|
||||
Log_OC.v(TAG, "onSaveInstanceState() start");
|
||||
|
|
|
@ -243,7 +243,7 @@ public class ReceiveExternalFilesActivity extends FileActivity
|
|||
}
|
||||
|
||||
@Override
|
||||
protected void onSaveInstanceState(Bundle outState) {
|
||||
protected void onSaveInstanceState(@NonNull Bundle outState) {
|
||||
Log_OC.d(TAG, "onSaveInstanceState() start");
|
||||
super.onSaveInstanceState(outState);
|
||||
outState.putString(KEY_PARENTS, generatePath(mParents));
|
||||
|
|
|
@ -404,7 +404,7 @@ public class UploadFilesActivity extends FileActivity implements
|
|||
}
|
||||
|
||||
@Override
|
||||
protected void onSaveInstanceState(Bundle outState) {
|
||||
protected void onSaveInstanceState(@NonNull Bundle outState) {
|
||||
// responsibility of restore is preferred in onCreate() before than in
|
||||
// onRestoreInstanceState when there are Fragments involved
|
||||
Log_OC.d(TAG, "onSaveInstanceState() start");
|
||||
|
|
|
@ -395,7 +395,7 @@ public class UserInfoActivity extends FileActivity implements Injectable {
|
|||
}
|
||||
|
||||
@Override
|
||||
protected void onSaveInstanceState(Bundle outState) {
|
||||
protected void onSaveInstanceState(@NonNull Bundle outState) {
|
||||
super.onSaveInstanceState(outState);
|
||||
if (userInfo != null) {
|
||||
outState.putParcelable(KEY_USER_DATA, Parcels.wrap(userInfo));
|
||||
|
|
|
@ -64,6 +64,7 @@ import com.owncloud.android.utils.ThemeUtils;
|
|||
|
||||
import javax.inject.Inject;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.appcompat.app.ActionBar;
|
||||
import androidx.drawerlayout.widget.DrawerLayout;
|
||||
import androidx.viewpager.widget.ViewPager;
|
||||
|
@ -203,7 +204,7 @@ public class PreviewImageActivity extends FileActivity implements
|
|||
}
|
||||
|
||||
@Override
|
||||
protected void onSaveInstanceState(Bundle outState) {
|
||||
protected void onSaveInstanceState(@NonNull Bundle outState) {
|
||||
super.onSaveInstanceState(outState);
|
||||
outState.putBoolean(KEY_WAITING_FOR_BINDER, mRequestWaitingForBinder);
|
||||
outState.putBoolean(KEY_SYSTEM_VISIBLE, isSystemUIVisible());
|
||||
|
|
|
@ -39,6 +39,7 @@ import com.owncloud.android.lib.common.utils.Log_OC;
|
|||
import com.owncloud.android.ui.activity.FileActivity;
|
||||
import com.owncloud.android.utils.MimeTypeUtil;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.appcompat.app.AlertDialog;
|
||||
|
||||
/**
|
||||
|
@ -114,7 +115,7 @@ public class PreviewVideoActivity extends FileActivity implements OnCompletionLi
|
|||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public void onSaveInstanceState(Bundle outState) {
|
||||
public void onSaveInstanceState(@NonNull Bundle outState) {
|
||||
super.onSaveInstanceState(outState);
|
||||
outState.putInt(PreviewVideoActivity.EXTRA_START_POSITION, mVideoPlayer.getCurrentPosition());
|
||||
outState.putBoolean(PreviewVideoActivity.EXTRA_AUTOPLAY , mVideoPlayer.isPlaying());
|
||||
|
|
Loading…
Reference in a new issue