Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,19 @@
</intent-filter>
</service>

<service
android:name=".services.VoiceRecorderTileService"
android:exported="true"
android:label="@string/recording"
android:icon="@drawable/ic_start_recording_vector"
android:permission="android.permission.BIND_QUICK_SETTINGS_TILE">
<intent-filter>
<action android:name="android.service.quicksettings.action.QS_TILE" />
</intent-filter>
<meta-data android:name="android.service.quicksettings.ACTIVE_TILE" android:value="true" />
<meta-data android:name="android.service.quicksettings.TOGGLEABLE_TILE" android:value="true" />
</service>

<activity-alias
android:name=".activities.SplashActivity.Red"
android:enabled="false"
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
package org.fossify.voicerecorder.services

import android.content.Intent
import android.service.quicksettings.Tile
import android.service.quicksettings.TileService
import org.fossify.voicerecorder.helpers.RECORDING_RUNNING
import org.fossify.voicerecorder.helpers.RECORDING_STOPPED
import org.fossify.voicerecorder.models.Events
import org.fossify.voicerecorder.R
import org.fossify.voicerecorder.services.RecorderService
import org.greenrobot.eventbus.EventBus

class VoiceRecorderTileService: TileService() {
private var status = RECORDING_STOPPED

// Called when the user taps on your tile in an active or inactive state.
override fun onClick() {
super.onClick()
Intent(this@VoiceRecorderTileService, RecorderService::class.java).apply {
// try {
if (status == RECORDING_STOPPED) {
if (!RecorderService.isRunning) {
startService(this)
}
qsTile.state = Tile.STATE_ACTIVE
qsTile.label = "stop recording"
status = RECORDING_RUNNING
}
else {
if (RecorderService.isRunning) {
stopService(this)
}
qsTile.state = Tile.STATE_INACTIVE
qsTile.label = getString(R.string.recording)
status = RECORDING_STOPPED
}
qsTile.updateTile()
EventBus.getDefault().post(Events.RecordingStatus(status))
// } catch (ignored: Exception) {
// }
}
}
}
Loading