diff --git a/app/src/main/java/org/lineageos/recorder/ListActivity.kt b/app/src/main/java/org/lineageos/recorder/ListActivity.kt index 72f2c779..3b37e1c1 100644 --- a/app/src/main/java/org/lineageos/recorder/ListActivity.kt +++ b/app/src/main/java/org/lineageos/recorder/ListActivity.kt @@ -173,6 +173,7 @@ class ListActivity : AppCompatActivity(), RecordingListCallbacks { promptDeleteAllRecordings() true } + else -> false } diff --git a/app/src/main/java/org/lineageos/recorder/list/ListActionModeCallback.kt b/app/src/main/java/org/lineageos/recorder/list/ListActionModeCallback.kt index 996251e4..3cd18a96 100644 --- a/app/src/main/java/org/lineageos/recorder/list/ListActionModeCallback.kt +++ b/app/src/main/java/org/lineageos/recorder/list/ListActionModeCallback.kt @@ -22,15 +22,17 @@ class ListActionModeCallback( override fun onPrepareActionMode(mode: ActionMode, menu: Menu) = false - override fun onActionItemClicked(mode: ActionMode, item: MenuItem) = when(item.itemId) { + override fun onActionItemClicked(mode: ActionMode, item: MenuItem) = when (item.itemId) { R.id.action_delete_selected -> { deleteSelected.run() true } + R.id.action_share_selected -> { shareSelected.run() true } + else -> false } diff --git a/app/src/main/java/org/lineageos/recorder/list/RecordingItemViewHolder.kt b/app/src/main/java/org/lineageos/recorder/list/RecordingItemViewHolder.kt index 369dd3dc..a6c9a75d 100644 --- a/app/src/main/java/org/lineageos/recorder/list/RecordingItemViewHolder.kt +++ b/app/src/main/java/org/lineageos/recorder/list/RecordingItemViewHolder.kt @@ -83,14 +83,17 @@ class RecordingItemViewHolder( callbacks.onRename(adapterPosition, it, titleTextView.text.toString()) true } + R.id.action_share -> { callbacks.onShare(it) true } + R.id.action_delete -> { callbacks.onDelete(adapterPosition, it) true } + else -> false } } ?: false diff --git a/app/src/main/java/org/lineageos/recorder/service/SoundRecorderService.kt b/app/src/main/java/org/lineageos/recorder/service/SoundRecorderService.kt index e6fcc7fb..0b8c1866 100644 --- a/app/src/main/java/org/lineageos/recorder/service/SoundRecorderService.kt +++ b/app/src/main/java/org/lineageos/recorder/service/SoundRecorderService.kt @@ -77,6 +77,7 @@ class SoundRecorderService : Service() { MSG_UNREGISTER_CLIENT -> synchronized(lock) { unregisterClientLocked(msg.replyTo.binder) } + else -> super.handleMessage(msg) } } @@ -125,13 +126,13 @@ class SoundRecorderService : Service() { } override fun onStartCommand(intent: Intent, flags: Int, startId: Int) = when (intent.action) { - ACTION_START -> if (intent.getStringExtra(EXTRA_FILE_NAME)?.let { - startRecording(it) - } == true) { - START_STICKY - } else { - START_NOT_STICKY - } + ACTION_START -> intent.getStringExtra(EXTRA_FILE_NAME)?.let { + if (startRecording(it)) { + START_STICKY + } else { + START_NOT_STICKY + } + } ?: START_NOT_STICKY ACTION_STOP -> if (stopRecording()) START_STICKY else START_NOT_STICKY diff --git a/app/src/main/java/org/lineageos/recorder/ui/WaveFormView.kt b/app/src/main/java/org/lineageos/recorder/ui/WaveFormView.kt index 2e84e99f..7814d3de 100644 --- a/app/src/main/java/org/lineageos/recorder/ui/WaveFormView.kt +++ b/app/src/main/java/org/lineageos/recorder/ui/WaveFormView.kt @@ -130,8 +130,9 @@ class WaveFormView @JvmOverloads constructor( } fun setAmplitude(amplitude: Int) { - synchronized(ampLock) { this.amplitude = - (amplitude / maxAudioValue).coerceAtMost(idleAmplitude) + synchronized(ampLock) { + this.amplitude = + (amplitude / maxAudioValue).coerceAtMost(idleAmplitude) } } diff --git a/app/src/main/java/org/lineageos/recorder/utils/PermissionManager.kt b/app/src/main/java/org/lineageos/recorder/utils/PermissionManager.kt index 84bba5f0..f0f5c436 100644 --- a/app/src/main/java/org/lineageos/recorder/utils/PermissionManager.kt +++ b/app/src/main/java/org/lineageos/recorder/utils/PermissionManager.kt @@ -86,7 +86,8 @@ class PermissionManager(private val activity: Activity) { error = error or (1 shl 1) } if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU - && !notificationManager.areNotificationsEnabled()) { + && !notificationManager.areNotificationsEnabled() + ) { error = error or (1 shl 2) } showPermissionRationale(PERMISSION_ERROR_MESSAGE_RES_IDS[error]) {