mirror of
https://github.com/nextcloud/android.git
synced 2024-11-23 21:55:48 +03:00
fix lint
Signed-off-by: parneet-guraya <gurayaparneet@gmail.com>
This commit is contained in:
parent
719cbdd871
commit
e73e3e4b8c
5 changed files with 39 additions and 31 deletions
|
@ -1395,7 +1395,7 @@ public class FileDisplayActivity extends FileActivity
|
|||
if (uploadWasFine) {
|
||||
OCFile ocFile = getFile();
|
||||
if (PreviewImageFragment.canBePreviewed(ocFile)) {
|
||||
startImagePreview(getFile(),true);
|
||||
startImagePreview(getFile(), true);
|
||||
} else if (PreviewTextFileFragment.canBePreviewed(ocFile)) {
|
||||
startTextPreview(ocFile, true);
|
||||
}
|
||||
|
@ -2044,7 +2044,7 @@ public class FileDisplayActivity extends FileActivity
|
|||
}
|
||||
if (showPreview && file.isDown() && !file.isDownloading() || streamMedia) {
|
||||
if (showInActivity) {
|
||||
startMediaActivity(file, startPlaybackPosition, autoplay, showPreview, streamMedia, user);
|
||||
startMediaActivity(file, startPlaybackPosition, autoplay, user);
|
||||
} else {
|
||||
configureToolbarForPreview(file);
|
||||
Fragment mediaFragment = PreviewMediaFragment.newInstance(file, user.get(), startPlaybackPosition, autoplay, false);
|
||||
|
@ -2060,7 +2060,7 @@ public class FileDisplayActivity extends FileActivity
|
|||
}
|
||||
}
|
||||
|
||||
private void startMediaActivity(OCFile file, long startPlaybackPosition, boolean autoplay, boolean showPreview, boolean streamMedia, Optional<User> user) {
|
||||
private void startMediaActivity(OCFile file, long startPlaybackPosition, boolean autoplay, Optional<User> user) {
|
||||
Intent previewMediaIntent = new Intent(this, PreviewMediaActivity.class);
|
||||
previewMediaIntent.putExtra(PreviewMediaActivity.EXTRA_FILE, file);
|
||||
previewMediaIntent.putExtra(PreviewMediaActivity.EXTRA_USER, user.get());
|
||||
|
|
|
@ -155,6 +155,7 @@ class SetupEncryptionDialogFragment : DialogFragment(), Injectable {
|
|||
dialog.dismiss()
|
||||
notifyResult()
|
||||
}
|
||||
|
||||
KEY_EXISTING_USED -> {
|
||||
decryptPrivateKey(dialog)
|
||||
}
|
||||
|
@ -162,6 +163,7 @@ class SetupEncryptionDialogFragment : DialogFragment(), Injectable {
|
|||
KEY_GENERATE -> {
|
||||
generateKey()
|
||||
}
|
||||
|
||||
else -> dialog.dismiss()
|
||||
}
|
||||
}
|
||||
|
@ -376,7 +378,7 @@ class SetupEncryptionDialogFragment : DialogFragment(), Injectable {
|
|||
binding.encryptionStatus.setText(R.string.end_to_end_encryption_generating_keys)
|
||||
}
|
||||
|
||||
@Suppress("TooGenericExceptionCaught", "TooGenericExceptionThrown", "ReturnCount")
|
||||
@Suppress("TooGenericExceptionCaught", "TooGenericExceptionThrown", "ReturnCount", "LongMethod")
|
||||
@Deprecated("Deprecated in Java")
|
||||
override fun doInBackground(vararg voids: Void?): String {
|
||||
// - create CSR, push to server, store returned public key in database
|
||||
|
|
|
@ -109,10 +109,14 @@ import javax.inject.Inject
|
|||
* By now, if the [OCFile] passed is not downloaded, an [IllegalStateException] is generated on
|
||||
* instantiation too.
|
||||
*/
|
||||
class PreviewMediaActivity
|
||||
@Suppress("TooManyFunctions")
|
||||
class PreviewMediaActivity :
|
||||
|
||||
: FileActivity(), FileFragment.ContainerActivity, OnRemoteOperationListener,
|
||||
SendShareDialog.SendShareDialogDownloader, Injectable {
|
||||
FileActivity(),
|
||||
FileFragment.ContainerActivity,
|
||||
OnRemoteOperationListener,
|
||||
SendShareDialog.SendShareDialogDownloader,
|
||||
Injectable {
|
||||
private var user: User? = null
|
||||
private var savedPlaybackPosition: Long = 0
|
||||
private var autoplay = true
|
||||
|
@ -206,6 +210,7 @@ class PreviewMediaActivity
|
|||
*
|
||||
* @param file audio file with potential cover art
|
||||
*/
|
||||
@Suppress("TooGenericExceptionCaught", "NestedBlockDepth")
|
||||
private fun extractAndSetCoverArt(file: OCFile) {
|
||||
if (MimeTypeUtil.isAudio(file)) {
|
||||
if (file.storagePath == null) {
|
||||
|
@ -217,7 +222,7 @@ class PreviewMediaActivity
|
|||
val data = mmr.embeddedPicture
|
||||
if (data != null) {
|
||||
val bitmap = BitmapFactory.decodeByteArray(data, 0, data.size)
|
||||
binding.imagePreview.setImageBitmap(bitmap) //associated cover art in bitmap
|
||||
binding.imagePreview.setImageBitmap(bitmap) // associated cover art in bitmap
|
||||
} else {
|
||||
setThumbnailForAudio(file)
|
||||
}
|
||||
|
@ -349,21 +354,24 @@ class PreviewMediaActivity
|
|||
WindowInsetsCompat.CONSUMED
|
||||
}
|
||||
}
|
||||
|
||||
@OptIn(UnstableApi::class)
|
||||
private fun setupVideoView() {
|
||||
initWindowInsetsController()
|
||||
val type = WindowInsetsCompat.Type.systemBars()
|
||||
binding.exoplayerView.setShowNextButton(false)
|
||||
binding.exoplayerView.setShowPreviousButton(false)
|
||||
binding.exoplayerView.setControllerVisibilityListener(PlayerView.ControllerVisibilityListener { visibility ->
|
||||
if (visibility == View.VISIBLE) {
|
||||
windowInsetsController.show(type)
|
||||
supportActionBar!!.show()
|
||||
} else if (visibility == View.GONE) {
|
||||
windowInsetsController.hide(type)
|
||||
supportActionBar!!.hide()
|
||||
binding.exoplayerView.setControllerVisibilityListener(
|
||||
PlayerView.ControllerVisibilityListener { visibility ->
|
||||
if (visibility == View.VISIBLE) {
|
||||
windowInsetsController.show(type)
|
||||
supportActionBar!!.show()
|
||||
} else if (visibility == View.GONE) {
|
||||
windowInsetsController.hide(type)
|
||||
supportActionBar!!.hide()
|
||||
}
|
||||
}
|
||||
})
|
||||
)
|
||||
binding.exoplayerView.player = exoPlayer
|
||||
}
|
||||
|
||||
|
@ -409,11 +417,15 @@ class PreviewMediaActivity
|
|||
additionalFilter.add(R.id.action_send_share_file)
|
||||
}
|
||||
newInstance(file, false, additionalFilter)
|
||||
.setResultListener(supportFragmentManager, this, object : ResultListener {
|
||||
override fun onResult(actionId: Int) {
|
||||
onFileActionChosen(actionId)
|
||||
.setResultListener(
|
||||
supportFragmentManager,
|
||||
this,
|
||||
object : ResultListener {
|
||||
override fun onResult(actionId: Int) {
|
||||
onFileActionChosen(actionId)
|
||||
}
|
||||
}
|
||||
})
|
||||
)
|
||||
.show(supportFragmentManager, "actions")
|
||||
}
|
||||
|
||||
|
@ -541,6 +553,7 @@ class PreviewMediaActivity
|
|||
fileOperationsHelper.sendShareFile(file)
|
||||
}
|
||||
|
||||
@Suppress("TooGenericExceptionCaught")
|
||||
private fun playVideo() {
|
||||
setupVideoView()
|
||||
// load the video file in the video player
|
||||
|
@ -588,7 +601,9 @@ class PreviewMediaActivity
|
|||
val result = sfo.execute(client)
|
||||
return if (!result.isSuccess) {
|
||||
null
|
||||
} else Uri.parse(result.data[0] as String)
|
||||
} else {
|
||||
Uri.parse(result.data[0] as String)
|
||||
}
|
||||
}
|
||||
|
||||
override fun onPostExecute(uri: Uri?) {
|
||||
|
@ -721,4 +736,4 @@ class PreviewMediaActivity
|
|||
return file != null && (MimeTypeUtil.isAudio(file) || MimeTypeUtil.isVideo(file))
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -128,7 +128,6 @@ class PreviewVideoFullscreenDialog(
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
override fun onBackPressed() {
|
||||
val isPlaying = mExoPlayer.isPlaying
|
||||
if (isPlaying) {
|
||||
|
|
|
@ -250,10 +250,6 @@
|
|||
<item name="windowActionBarOverlay">true</item>
|
||||
</style>
|
||||
|
||||
<style name="Theme.ownCloud.Media" parent="Theme.Material3.DayNight.NoActionBar">
|
||||
<item name="android:windowLayoutInDisplayCutoutMode">shortEdges</item>
|
||||
</style>
|
||||
|
||||
<style name="Theme.ownCloud.Overlay" parent="Theme.ownCloud.OverlayBase">
|
||||
<item name="android:navigationBarColor">@color/black</item>
|
||||
<item name="toolbarStyle">@style/Theme.ownCloud.Overlay.ActionBar</item>
|
||||
|
@ -458,10 +454,6 @@
|
|||
<item name="android:textStyle">bold</item>
|
||||
</style>
|
||||
|
||||
<style name="FullScreenExoControlButton" parent="ExoStyledControls.Button.Center">
|
||||
<item name="android:background">@drawable/ripple</item>
|
||||
</style>
|
||||
|
||||
<style name="Widget.Nextcloud.AppWidget.Container" parent="android:Widget">
|
||||
<item name="android:id">@android:id/background</item>
|
||||
<item name="android:background">?android:attr/colorBackground</item>
|
||||
|
|
Loading…
Reference in a new issue