Added locking and unlocking of Drawer in Videos Activities/Fragments

This commit is contained in:
Kilian Périsset 2020-01-20 12:30:02 +01:00
parent 465b209ec9
commit 2f02f6bdf4
No known key found for this signature in database
GPG key ID: 82E3444C03B10ECF

View file

@ -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.operations.RemoteOperationResult;
import com.owncloud.android.lib.common.utils.Log_OC; import com.owncloud.android.lib.common.utils.Log_OC;
import com.owncloud.android.media.MediaControlView; 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.activity.FileActivity;
import com.owncloud.android.ui.dialog.ConfirmationDialogFragment; import com.owncloud.android.ui.dialog.ConfirmationDialogFragment;
import com.owncloud.android.ui.dialog.RemoveFilesDialogFragment; import com.owncloud.android.ui.dialog.RemoveFilesDialogFragment;
@ -80,6 +81,7 @@ import javax.inject.Inject;
import androidx.annotation.DrawableRes; import androidx.annotation.DrawableRes;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
import androidx.annotation.StringRes; import androidx.annotation.StringRes;
import androidx.drawerlayout.widget.DrawerLayout;
/** /**
* This fragment shows a preview of a downloaded media file (audio or video). * 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); 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) { public void onSaveInstanceState(@NonNull Bundle outState) {
super.onSaveInstanceState(outState); super.onSaveInstanceState(outState);
Log_OC.v(TAG, "onSaveInstanceState"); Log_OC.v(TAG, "onSaveInstanceState");
toggleDrawerLockMode(containerActivity, DrawerLayout.LOCK_MODE_LOCKED_CLOSED);
outState.putParcelable(PreviewMediaFragment.EXTRA_FILE, getFile()); outState.putParcelable(PreviewMediaFragment.EXTRA_FILE, getFile());
outState.putParcelable(PreviewMediaFragment.EXTRA_ACCOUNT, mAccount); outState.putParcelable(PreviewMediaFragment.EXTRA_ACCOUNT, mAccount);
@ -617,6 +620,7 @@ public class PreviewMediaFragment extends FileFragment implements OnTouchListene
public void onStop() { public void onStop() {
Log_OC.v(TAG, "onStop"); Log_OC.v(TAG, "onStop");
mMediaPlayerServiceConnection.unbind(); mMediaPlayerServiceConnection.unbind();
toggleDrawerLockMode(containerActivity, DrawerLayout.LOCK_MODE_UNLOCKED);
super.onStop(); super.onStop();
} }
@ -713,4 +717,8 @@ public class PreviewMediaFragment extends FileFragment implements OnTouchListene
return mAutoplay; return mAutoplay;
} }
private void toggleDrawerLockMode(ContainerActivity containerActivity, int lockMode) {
((DrawerActivity) containerActivity).setDrawerLockMode(lockMode);
}
} }