Merge pull request #4044 from nextcloud/fixToolbar

Fix and test against IllegalStateException in FileDisplayActivity
This commit is contained in:
Andy Scherzinger authored and GitHub committed 2019-05-20 20:26:20 +02:00
commit bd4bc646c6
3 files changed
+26 -2

No files matched your search

@@ -0,0 +1,23 @@
package com.owncloud.android.ui.activity;
import com.owncloud.android.AbstractIT;
import org.junit.Rule;
import org.junit.Test;
import androidx.test.core.app.ActivityScenario;
import androidx.test.rule.GrantPermissionRule;
import static android.Manifest.permission.WRITE_EXTERNAL_STORAGE;
public class FileDisplayActivityTest extends AbstractIT {
@Rule public GrantPermissionRule mRuntimePermissionRule = GrantPermissionRule.grant(WRITE_EXTERNAL_STORAGE);
@Test
public void testSetupToolbar() {
try (ActivityScenario<FileDisplayActivity> scenario = ActivityScenario.launch(FileDisplayActivity.class)) {
scenario.recreate();
}
}
}
@@ -101,7 +101,7 @@ public final class PassCodeManager {
i.setFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP);
activity.startActivityForResult(i, PASSCODE_ACTIVITY);
} else {
if (preferences.getLockTimestamp() != 0) {
if (!askedForPin && preferences.getLockTimestamp() != 0) {
preferences.setLockTimestamp(System.currentTimeMillis());
}
}
@@ -228,11 +228,12 @@ public class FileDisplayActivity extends FileActivity
@Override
protected void onCreate(Bundle savedInstanceState) {
Log_OC.v(TAG, "onCreate() start");
super.onCreate(savedInstanceState); // this calls onAccountChanged() when ownCloud Account is valid
// Set the default theme to replace the launch screen theme.
setTheme(R.style.Theme_ownCloud_Toolbar_Drawer);
super.onCreate(savedInstanceState); // this calls onAccountChanged() when ownCloud Account is valid
/// Load of saved instance state
if (savedInstanceState != null) {
mWaitingToPreview = savedInstanceState.getParcelable(FileDisplayActivity.KEY_WAITING_TO_PREVIEW);