Merge pull request #5252 from nextcloud/fix/lock-drawer-video-preview

Added locking and unlocking of Drawer in Videos Activities/Fragments
This commit is contained in:
Andy Scherzinger authored and GitHub committed 2020-01-20 13:02:03 +01:00
commit a07a165fb8
1 file changed
+9 -1
@@ -67,6 +67,7 @@ import com.owncloud.android.lib.common.OwnCloudClientManagerFactory;
import com.owncloud.android.lib.common.operations.RemoteOperationResult;
import com.owncloud.android.lib.common.utils.Log_OC;
import com.owncloud.android.media.MediaControlView;
import com.owncloud.android.ui.activity.DrawerActivity;
import com.owncloud.android.ui.activity.FileActivity;
import com.owncloud.android.ui.dialog.ConfirmationDialogFragment;
import com.owncloud.android.ui.dialog.RemoveFilesDialogFragment;
@@ -80,6 +81,7 @@ import javax.inject.Inject;
import androidx.annotation.DrawableRes;
import androidx.annotation.NonNull;
import androidx.annotation.StringRes;
import androidx.drawerlayout.widget.DrawerLayout;
/**
* This fragment shows a preview of a downloaded media file (audio or video).
@@ -264,6 +266,7 @@ public class PreviewMediaFragment extends FileFragment implements OnTouchListene
extractAndSetCoverArt(file);
}
}
toggleDrawerLockMode(containerActivity, DrawerLayout.LOCK_MODE_LOCKED_CLOSED);
}
/**
@@ -293,7 +296,7 @@ public class PreviewMediaFragment extends FileFragment implements OnTouchListene
public void onSaveInstanceState(@NonNull Bundle outState) {
super.onSaveInstanceState(outState);
Log_OC.v(TAG, "onSaveInstanceState");
toggleDrawerLockMode(containerActivity, DrawerLayout.LOCK_MODE_LOCKED_CLOSED);
outState.putParcelable(PreviewMediaFragment.EXTRA_FILE, getFile());
outState.putParcelable(PreviewMediaFragment.EXTRA_ACCOUNT, mAccount);
@@ -617,6 +620,7 @@ public class PreviewMediaFragment extends FileFragment implements OnTouchListene
public void onStop() {
Log_OC.v(TAG, "onStop");
mMediaPlayerServiceConnection.unbind();
toggleDrawerLockMode(containerActivity, DrawerLayout.LOCK_MODE_UNLOCKED);
super.onStop();
}
@@ -713,4 +717,8 @@ public class PreviewMediaFragment extends FileFragment implements OnTouchListene
return mAutoplay;
}
private void toggleDrawerLockMode(ContainerActivity containerActivity, int lockMode) {
((DrawerActivity) containerActivity).setDrawerLockMode(lockMode);
}
}