Skip to content

Commit

Permalink
fix lint
Browse files Browse the repository at this point in the history
Signed-off-by: parneet-guraya <[email protected]>
  • Loading branch information
parneet-guraya committed Dec 22, 2023
1 parent 2d268d3 commit 6d8e0d4
Show file tree
Hide file tree
Showing 5 changed files with 40 additions and 32 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1395,7 +1395,7 @@ public void onReceive(Context context, Intent intent) {
if (uploadWasFine) {
OCFile ocFile = getFile();
if (PreviewImageFragment.canBePreviewed(ocFile)) {
startImagePreview(getFile(),true);
startImagePreview(getFile(), true);
} else if (PreviewTextFileFragment.canBePreviewed(ocFile)) {
startTextPreview(ocFile, true);
}
Expand Down Expand Up @@ -2044,7 +2044,7 @@ public void startMediaPreview(OCFile file, long startPlaybackPosition, boolean a
}
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);
Expand All @@ -2060,7 +2060,7 @@ public void startMediaPreview(OCFile file, long startPlaybackPosition, boolean a
}
}

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());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -155,13 +155,15 @@ class SetupEncryptionDialogFragment : DialogFragment(), Injectable {
dialog.dismiss()
notifyResult()
}

KEY_EXISTING_USED -> {
decryptPrivateKey(dialog)
}

KEY_GENERATE -> {
generateKey()
}

else -> dialog.dismiss()
}
}
Expand Down Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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

: FileActivity(), FileFragment.ContainerActivity, OnRemoteOperationListener,
SendShareDialog.SendShareDialogDownloader, Injectable {
@Suppress("TooManyFunctions")
class PreviewMediaActivity :

FileActivity(),
FileFragment.ContainerActivity,
OnRemoteOperationListener,
SendShareDialog.SendShareDialogDownloader,
Injectable {
private var user: User? = null
private var savedPlaybackPosition: Long = 0
private var autoplay = true
Expand Down Expand Up @@ -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) {
Expand All @@ -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)
}
Expand Down Expand Up @@ -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
}

Expand Down Expand Up @@ -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")
}

Expand Down Expand Up @@ -541,6 +553,7 @@ class PreviewMediaActivity
fileOperationsHelper.sendShareFile(file)
}

@Suppress("TooGenericExceptionCaught")
private fun playVideo() {
setupVideoView()
// load the video file in the video player
Expand Down Expand Up @@ -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?) {
Expand Down Expand Up @@ -721,4 +736,4 @@ class PreviewMediaActivity
return file != null && (MimeTypeUtil.isAudio(file) || MimeTypeUtil.isVideo(file))
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,6 @@ class PreviewVideoFullscreenDialog(
}
}


override fun onBackPressed() {
val isPlaying = mExoPlayer.isPlaying
if (isPlaying) {
Expand Down
8 changes: 0 additions & 8 deletions app/src/main/res/values/styles.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down Expand Up @@ -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>
Expand Down

0 comments on commit 6d8e0d4

Please sign in to comment.