fix lint/spotbugs warnings

Signed-off-by: Marcel Hibbe <dev@mhibbe.de>
This commit is contained in:
Marcel Hibbe 2021-06-29 22:44:01 +02:00
parent c7bb6402fe
commit 741748137a
No known key found for this signature in database
GPG key ID: C793F8B59F43CE7B
8 changed files with 10 additions and 34 deletions

View file

@ -91,7 +91,6 @@ class IncomingVoiceMessageViewHolder(incomingView: View) : MessageHolders
// parent message handling
setParentMessageDataOnMessageItem(message)
updateDownloadState(message)
binding.seekbar.max = message.voiceMessageDuration
@ -103,10 +102,8 @@ class IncomingVoiceMessageViewHolder(incomingView: View) : MessageHolders
binding.seekbar.progress = message.voiceMessagePlayedSeconds
} else {
binding.playPauseBtn.visibility = View.VISIBLE
binding.playPauseBtn.icon = ContextCompat.getDrawable(
context!!, R.drawable
.ic_baseline_play_arrow_voice_message_24
)
binding.playPauseBtn.icon =
ContextCompat.getDrawable(context!!, R.drawable.ic_baseline_play_arrow_voice_message_24)
}
if (message.isDownloadingVoiceMessage) {
@ -126,9 +123,6 @@ class IncomingVoiceMessageViewHolder(incomingView: View) : MessageHolders
message.resetVoiceMessage = false
}
activity = itemView.context as Activity
binding.seekbar.setOnSeekBarChangeListener(object : SeekBar.OnSeekBarChangeListener {
override fun onStopTrackingTouch(seekBar: SeekBar) {
// unused atm
@ -159,7 +153,6 @@ class IncomingVoiceMessageViewHolder(incomingView: View) : MessageHolders
WorkManager.getInstance(context!!).getWorkInfoByIdLiveData(workInfo.id)
.observeForever { info: WorkInfo? ->
if (info != null) {
when (info.state) {
WorkInfo.State.RUNNING -> {
Log.d(TAG, "WorkInfo.State.RUNNING in ViewHolder")

View file

@ -102,10 +102,8 @@ class OutcomingVoiceMessageViewHolder(outcomingView: View) : MessageHolders
binding.seekbar.progress = message.voiceMessagePlayedSeconds
} else {
binding.playPauseBtn.visibility = View.VISIBLE
binding.playPauseBtn.icon = ContextCompat.getDrawable(
context!!, R.drawable
.ic_baseline_play_arrow_voice_message_24
)
binding.playPauseBtn.icon =
ContextCompat.getDrawable(context!!, R.drawable.ic_baseline_play_arrow_voice_message_24)
}
if (message.isDownloadingVoiceMessage) {
@ -125,9 +123,6 @@ class OutcomingVoiceMessageViewHolder(outcomingView: View) : MessageHolders
message.resetVoiceMessage = false
}
activity = itemView.context as Activity
binding.seekbar.setOnSeekBarChangeListener(object : SeekBar.OnSeekBarChangeListener {
override fun onStopTrackingTouch(seekBar: SeekBar) {
// unused atm

View file

@ -3,5 +3,5 @@ package com.nextcloud.talk.adapters.messages
import com.nextcloud.talk.models.json.chat.ChatMessage
interface VoiceMessageInterface {
fun updateMediaPlayerProgressBySlider(message : ChatMessage, progress : Int)
fun updateMediaPlayerProgressBySlider(message: ChatMessage, progress: Int)
}

View file

@ -90,22 +90,13 @@ public class ChatMessage implements MessageContentType, MessageContentType.Image
@JsonField(name = "messageType")
public String messageType;
public boolean isDownloadingVoiceMessage;
public boolean resetVoiceMessage;
public boolean isPlayingVoiceMessage;
public int voiceMessageDuration;
public int voiceMessagePlayedSeconds;
public VoiceMessageDownloadState voiceMessageDownloadState;
public int voiceMessageDownloadProgress;
public enum VoiceMessageDownloadState {
NOT_STARTED,
RUNNING,
SUCCEEDED,
FAILED
}
@JsonIgnore
List<MessageType> messageTypesToIgnore = Arrays.asList(
MessageType.REGULAR_TEXT_MESSAGE,
@ -116,8 +107,6 @@ public class ChatMessage implements MessageContentType, MessageContentType.Image
MessageType.SINGLE_NC_GEOLOCATION_MESSAGE,
MessageType.VOICE_MESSAGE);
public boolean hasFileAttachment() {
if (messageParameters != null && messageParameters.size() > 0) {
for (HashMap.Entry<String, HashMap<String, String>> entry : messageParameters.entrySet()) {

View file

@ -83,7 +83,7 @@
style="@style/Widget.AppTheme.Button.IconButton"
android:layout_width="48dp"
android:layout_height="48dp"
android:contentDescription="@string/play_voice_message"
android:contentDescription="@string/play_pause_voice_message"
android:visibility="visible"
app:cornerRadius="@dimen/button_corner_radius"
app:icon="@drawable/ic_baseline_play_arrow_voice_message_24"

View file

@ -68,7 +68,7 @@
style="@style/Widget.AppTheme.Button.IconButton"
android:layout_width="48dp"
android:layout_height="48dp"
android:contentDescription="@string/play_voice_message"
android:contentDescription="@string/play_pause_voice_message"
android:visibility="visible"
app:rippleColor="#1FFFFFFF"
app:cornerRadius="@dimen/button_corner_radius"

View file

@ -389,8 +389,7 @@
<string name="nc_voice_message_hold_to_record_info">Hold to record, release to send.</string>
<string name="nc_description_record_voice">Record voice message</string>
<string name="nc_voice_message_slide_to_cancel">&lt;&lt; Slide to cancel</string>
<string name="play_voice_message">Play voice message</string>
<string name="pause_voice_message">Pause voice message</string>
<string name="play_pause_voice_message">Play/pause voice message</string>
<string name="nc_voice_message_missing_audio_permission">Permission for audio recording is required</string>
<!-- Phonebook Integration -->

View file

@ -1 +1 @@
440
441