forked from mirrors/RecordYou
Merge branch 'main' into dep
This commit is contained in:
13
.github/workflows/ci.yml
vendored
13
.github/workflows/ci.yml
vendored
@@ -19,17 +19,20 @@ jobs:
|
||||
debug-builds:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: gradle/wrapper-validation-action@v1
|
||||
- uses: actions/checkout@v4
|
||||
- uses: gradle/wrapper-validation-action@v2
|
||||
|
||||
- name: Set up JDK 17
|
||||
uses: actions/setup-java@v3
|
||||
uses: actions/setup-java@v4
|
||||
with:
|
||||
java-version: 17
|
||||
distribution: "temurin"
|
||||
cache: "gradle"
|
||||
|
||||
- name: Compile
|
||||
run: |
|
||||
./gradlew assembleDebug
|
||||
|
||||
- name: Sign Apk
|
||||
continue-on-error: true
|
||||
id: sign_apk
|
||||
@@ -40,12 +43,14 @@ jobs:
|
||||
keyAlias: ${{ secrets.ANDROID_KEY_ALIAS }}
|
||||
keyStorePassword: ${{ secrets.ANDROID_KEYSTORE_PASSWORD }}
|
||||
keyPassword: ${{ secrets.ANDROID_KEY_PASSWORD }}
|
||||
|
||||
- name: Remove file that aren't signed
|
||||
continue-on-error: true
|
||||
run: |
|
||||
ls | grep 'signed\.apk$' && find . -type f -name '*.apk' ! -name '*-signed.apk' -delete
|
||||
|
||||
- name: Upload APK
|
||||
uses: actions/upload-artifact@v3
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: app
|
||||
path: app/build/outputs/apk/debug/*.apk
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
package com.bnyro.recorder.enums
|
||||
|
||||
enum class SortOrder {
|
||||
DEFAULT,
|
||||
MODIFIED,
|
||||
MODIFIED_REV,
|
||||
ALPHABETIC,
|
||||
ALPHABETIC_REV,
|
||||
SIZE,
|
||||
|
||||
@@ -4,6 +4,7 @@ import android.content.Intent
|
||||
import android.os.Build
|
||||
import android.service.quicksettings.TileService
|
||||
import androidx.annotation.RequiresApi
|
||||
import com.bnyro.recorder.enums.RecorderType
|
||||
import com.bnyro.recorder.ui.MainActivity
|
||||
|
||||
@RequiresApi(Build.VERSION_CODES.N)
|
||||
@@ -12,7 +13,7 @@ class AudioRecorderTile : TileService() {
|
||||
super.onClick()
|
||||
|
||||
val intent = Intent(this, MainActivity::class.java)
|
||||
.putExtra("action", "audio")
|
||||
.putExtra(MainActivity.EXTRA_ACTION_KEY, RecorderType.AUDIO.name)
|
||||
.apply {
|
||||
flags = Intent.FLAG_ACTIVITY_NEW_TASK
|
||||
}
|
||||
|
||||
@@ -4,6 +4,7 @@ import android.content.Intent
|
||||
import android.os.Build
|
||||
import android.service.quicksettings.TileService
|
||||
import androidx.annotation.RequiresApi
|
||||
import com.bnyro.recorder.enums.RecorderType
|
||||
import com.bnyro.recorder.ui.MainActivity
|
||||
|
||||
@RequiresApi(Build.VERSION_CODES.N)
|
||||
@@ -12,7 +13,7 @@ class ScreenRecorderTile : TileService() {
|
||||
super.onClick()
|
||||
|
||||
val intent = Intent(this, MainActivity::class.java)
|
||||
.putExtra("action", "screen")
|
||||
.putExtra(MainActivity.EXTRA_ACTION_KEY, RecorderType.VIDEO.name)
|
||||
.apply {
|
||||
flags = Intent.FLAG_ACTIVITY_NEW_TASK
|
||||
}
|
||||
|
||||
@@ -16,16 +16,17 @@ import com.bnyro.recorder.ui.models.ThemeModel
|
||||
import com.bnyro.recorder.ui.theme.RecordYouTheme
|
||||
|
||||
class MainActivity : ComponentActivity() {
|
||||
private var initialRecorder = RecorderType.NONE
|
||||
private var exitAfterRecordingStart = false
|
||||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
|
||||
val themeModel: ThemeModel by viewModels()
|
||||
|
||||
val initialRecorder = when (intent?.getStringExtra("action")) {
|
||||
"audio" -> RecorderType.AUDIO
|
||||
"screen" -> RecorderType.VIDEO
|
||||
else -> RecorderType.NONE
|
||||
}
|
||||
initialRecorder = intent?.getStringExtra(EXTRA_ACTION_KEY)?.let {
|
||||
RecorderType.valueOf(it)
|
||||
} ?: RecorderType.NONE
|
||||
intent?.putExtra(EXTRA_ACTION_KEY, "")
|
||||
|
||||
setContent {
|
||||
RecordYouTheme(
|
||||
@@ -51,4 +52,24 @@ class MainActivity : ComponentActivity() {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun onPause() {
|
||||
super.onPause()
|
||||
if (initialRecorder != RecorderType.NONE) {
|
||||
exitAfterRecordingStart = true
|
||||
initialRecorder = RecorderType.NONE
|
||||
}
|
||||
}
|
||||
|
||||
override fun onResume() {
|
||||
super.onResume()
|
||||
if (exitAfterRecordingStart) {
|
||||
exitAfterRecordingStart = false
|
||||
finish()
|
||||
}
|
||||
}
|
||||
|
||||
companion object {
|
||||
const val EXTRA_ACTION_KEY = "action"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -26,7 +26,7 @@ class PlayerModel(context: Context, private val fileRepository: FileRepository)
|
||||
|
||||
var selectedFiles by mutableStateOf(listOf<RecordingItemData>())
|
||||
|
||||
private var sortOrder = SortOrder.DEFAULT
|
||||
private var sortOrder = SortOrder.MODIFIED
|
||||
|
||||
var audioRecordingItems by mutableStateOf(listOf<RecordingItemData>())
|
||||
var screenRecordingItems by mutableStateOf(listOf<RecordingItemData>())
|
||||
|
||||
@@ -67,7 +67,8 @@ fun PlayerScreen(
|
||||
}
|
||||
|
||||
val sortOptions = listOf(
|
||||
SortOrder.DEFAULT to R.string.default_sort,
|
||||
SortOrder.MODIFIED to R.string.modified,
|
||||
SortOrder.MODIFIED_REV to R.string.modified_rev,
|
||||
SortOrder.ALPHABETIC to R.string.alphabetic,
|
||||
SortOrder.ALPHABETIC_REV to R.string.alphabetic_rev,
|
||||
SortOrder.SIZE to R.string.size,
|
||||
|
||||
@@ -138,7 +138,8 @@ class FileRepositoryImpl(val context: Context) : FileRepository {
|
||||
|
||||
fun List<DocumentFile>.sortedBy(sortOrder: SortOrder): List<DocumentFile> {
|
||||
return when (sortOrder) {
|
||||
SortOrder.DEFAULT -> this
|
||||
SortOrder.MODIFIED -> sortedBy { it.lastModified() }
|
||||
SortOrder.MODIFIED_REV -> sortedByDescending { it.lastModified() }
|
||||
SortOrder.ALPHABETIC -> sortedBy { it.name }
|
||||
SortOrder.ALPHABETIC_REV -> sortedByDescending { it.name }
|
||||
SortOrder.SIZE_REV -> sortedBy { it.length() }
|
||||
|
||||
@@ -8,6 +8,7 @@ import androidx.core.content.pm.ShortcutInfoCompat
|
||||
import androidx.core.content.pm.ShortcutManagerCompat
|
||||
import androidx.core.graphics.drawable.IconCompat
|
||||
import com.bnyro.recorder.R
|
||||
import com.bnyro.recorder.enums.RecorderType
|
||||
import com.bnyro.recorder.ui.MainActivity
|
||||
|
||||
object ShortcutHelper {
|
||||
@@ -16,8 +17,8 @@ object ShortcutHelper {
|
||||
@DrawableRes val iconRes: Int,
|
||||
@StringRes val label: Int
|
||||
) {
|
||||
object RecordAudio : AppShortcut("audio", R.drawable.ic_audio, R.string.record_sound)
|
||||
object RecordScreen : AppShortcut("screen", R.drawable.ic_screen, R.string.record_screen)
|
||||
object RecordAudio : AppShortcut(RecorderType.AUDIO.name, R.drawable.ic_audio, R.string.record_sound)
|
||||
object RecordScreen : AppShortcut(RecorderType.VIDEO.name, R.drawable.ic_screen, R.string.record_screen)
|
||||
}
|
||||
private val shortcuts = listOf(AppShortcut.RecordAudio, AppShortcut.RecordScreen)
|
||||
|
||||
@@ -29,7 +30,7 @@ object ShortcutHelper {
|
||||
.setIntent(
|
||||
Intent(context, MainActivity::class.java).apply {
|
||||
this.action = Intent.ACTION_VIEW
|
||||
putExtra("action", action)
|
||||
putExtra(MainActivity.EXTRA_ACTION_KEY, action)
|
||||
}
|
||||
)
|
||||
.build()
|
||||
|
||||
@@ -29,6 +29,8 @@
|
||||
<string name="back">Back</string>
|
||||
<!-- Sort order -->
|
||||
<string name="sort">Sort</string>
|
||||
<string name="modified">Modified</string>
|
||||
<string name="modified_rev">Modified (reversed)</string>
|
||||
<string name="alphabetic">Alphabetic</string>
|
||||
<string name="alphabetic_rev">Alphabetic (reversed)</string>
|
||||
<string name="size">Size</string>
|
||||
|
||||
Reference in New Issue
Block a user