mirror of
https://github.com/Myzel394/Alibi.git
synced 2025-06-19 07:15:25 +02:00
feat: Add StartRecordingActivity
This commit is contained in:
parent
b5272e8d1c
commit
4688766c14
@ -127,4 +127,6 @@ dependencies {
|
|||||||
implementation 'com.maxkeppeler.sheets-compose-dialogs:duration:1.2.0'
|
implementation 'com.maxkeppeler.sheets-compose-dialogs:duration:1.2.0'
|
||||||
implementation 'com.maxkeppeler.sheets-compose-dialogs:list:1.2.0'
|
implementation 'com.maxkeppeler.sheets-compose-dialogs:list:1.2.0'
|
||||||
implementation 'com.maxkeppeler.sheets-compose-dialogs:input:1.2.0'
|
implementation 'com.maxkeppeler.sheets-compose-dialogs:input:1.2.0'
|
||||||
|
|
||||||
|
implementation 'com.joaomgcd:taskerpluginlibrary:0.4.4'
|
||||||
}
|
}
|
@ -29,6 +29,13 @@
|
|||||||
<category android:name="android.intent.category.LAUNCHER" />
|
<category android:name="android.intent.category.LAUNCHER" />
|
||||||
</intent-filter>
|
</intent-filter>
|
||||||
</activity>
|
</activity>
|
||||||
|
|
||||||
|
<activity
|
||||||
|
android:name=".StartRecordingActivity"
|
||||||
|
android:exported="true"
|
||||||
|
android:noHistory="true"
|
||||||
|
/>
|
||||||
|
|
||||||
<receiver
|
<receiver
|
||||||
android:name=".receivers.LocalChangeReceiver"
|
android:name=".receivers.LocalChangeReceiver"
|
||||||
android:exported="false">
|
android:exported="false">
|
||||||
|
@ -0,0 +1,20 @@
|
|||||||
|
package app.myzel394.alibi
|
||||||
|
|
||||||
|
import android.app.Activity
|
||||||
|
import android.content.Intent
|
||||||
|
import androidx.core.content.ContextCompat
|
||||||
|
import app.myzel394.alibi.services.AudioRecorderService
|
||||||
|
|
||||||
|
class StartRecordingActivity : Activity() {
|
||||||
|
override fun onStart() {
|
||||||
|
super.onStart()
|
||||||
|
|
||||||
|
val context = this
|
||||||
|
val intent = Intent(context, AudioRecorderService::class.java).apply {
|
||||||
|
putExtra("startNow", true)
|
||||||
|
}
|
||||||
|
ContextCompat.startForegroundService(context, intent)
|
||||||
|
|
||||||
|
finish()
|
||||||
|
}
|
||||||
|
}
|
@ -5,6 +5,7 @@ import android.app.Notification
|
|||||||
import android.app.PendingIntent
|
import android.app.PendingIntent
|
||||||
import android.app.Service
|
import android.app.Service
|
||||||
import android.content.Intent
|
import android.content.Intent
|
||||||
|
import android.content.Intent.getIntent
|
||||||
import android.os.Binder
|
import android.os.Binder
|
||||||
import android.os.IBinder
|
import android.os.IBinder
|
||||||
import androidx.core.app.NotificationCompat
|
import androidx.core.app.NotificationCompat
|
||||||
@ -14,6 +15,7 @@ import app.myzel394.alibi.NotificationHelper
|
|||||||
import app.myzel394.alibi.R
|
import app.myzel394.alibi.R
|
||||||
import app.myzel394.alibi.enums.RecorderState
|
import app.myzel394.alibi.enums.RecorderState
|
||||||
import app.myzel394.alibi.ui.utils.PermissionHelper
|
import app.myzel394.alibi.ui.utils.PermissionHelper
|
||||||
|
import kotlinx.coroutines.runBlocking
|
||||||
import java.time.LocalDateTime
|
import java.time.LocalDateTime
|
||||||
import java.time.ZoneId
|
import java.time.ZoneId
|
||||||
import java.util.Calendar
|
import java.util.Calendar
|
||||||
@ -58,6 +60,10 @@ abstract class RecorderService: Service() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (intent?.getBooleanExtra("startNow", false) == true) {
|
||||||
|
startRecording()
|
||||||
|
}
|
||||||
|
|
||||||
return super.onStartCommand(intent, flags, startId)
|
return super.onStartCommand(intent, flags, startId)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user