Skip to content

Commit

Permalink
Recorder: Reformat code
Browse files Browse the repository at this point in the history
Change-Id: If279e887e5b862541e2b9fbdef0d149c919ffb92
  • Loading branch information
SebaUbuntu committed Feb 25, 2024
1 parent 2418712 commit e188969
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 11 deletions.
1 change: 1 addition & 0 deletions app/src/main/java/org/lineageos/recorder/ListActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,7 @@ class ListActivity : AppCompatActivity(), RecordingListCallbacks {
promptDeleteAllRecordings()
true
}

else -> false
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ class SoundRecorderService : Service() {
MSG_UNREGISTER_CLIENT -> synchronized(lock) {
unregisterClientLocked(msg.replyTo.binder)
}

else -> super.handleMessage(msg)
}
}
Expand Down Expand Up @@ -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

Expand Down
5 changes: 3 additions & 2 deletions app/src/main/java/org/lineageos/recorder/ui/WaveFormView.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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]) {
Expand Down

0 comments on commit e188969

Please sign in to comment.