From 740fb7621e30156c5238fc8f3582662735855f13 Mon Sep 17 00:00:00 2001 From: Simon Marquis Date: Fri, 25 Nov 2016 15:40:02 +0100 Subject: [PATCH 1/3] Enable two static shortcuts: record and overlay. --- telecine/src/debug/res/values/strings.xml | 4 +- telecine/src/main/AndroidManifest.xml | 7 ++- .../com/jakewharton/telecine/Analytics.java | 2 + .../telecine/RecordingSession.java | 18 +++++++ .../jakewharton/telecine/TelecineService.java | 4 ++ .../TelecineShortcutConfigureActivity.java | 2 +- .../TelecineShortcutLaunchActivity.java | 5 ++ .../res/drawable/ic_shortcut_overlay_48dp.xml | 14 +++++ .../res/drawable/ic_shortcut_record_48dp.xml | 14 +++++ telecine/src/main/res/values-de/strings.xml | 2 +- telecine/src/main/res/values-es/strings.xml | 4 +- telecine/src/main/res/values-fr/strings.xml | 6 +-- telecine/src/main/res/values-it/strings.xml | 2 +- telecine/src/main/res/values-ja/strings.xml | 2 +- telecine/src/main/res/values-ka/strings.xml | 2 +- telecine/src/main/res/values-no/strings.xml | 2 +- telecine/src/main/res/values-pl/strings.xml | 2 +- .../src/main/res/values-pt-rBR/strings.xml | 2 +- .../src/main/res/values-pt-rPT/strings.xml | 2 +- telecine/src/main/res/values-ru/strings.xml | 2 +- telecine/src/main/res/values-tr/strings.xml | 2 +- telecine/src/main/res/values-v25/bools.xml | 5 ++ .../src/main/res/values-zh-rCN/strings.xml | 2 +- .../src/main/res/values-zh-rHK/strings.xml | 4 +- .../src/main/res/values-zh-rTW/strings.xml | 4 +- telecine/src/main/res/values/bools.xml | 4 ++ telecine/src/main/res/values/strings.xml | 5 +- telecine/src/main/res/xml/shortcuts.xml | 51 +++++++++++++++++++ 28 files changed, 149 insertions(+), 26 deletions(-) create mode 100644 telecine/src/main/res/drawable/ic_shortcut_overlay_48dp.xml create mode 100644 telecine/src/main/res/drawable/ic_shortcut_record_48dp.xml create mode 100644 telecine/src/main/res/values-v25/bools.xml create mode 100644 telecine/src/main/res/values/bools.xml create mode 100644 telecine/src/main/res/xml/shortcuts.xml diff --git a/telecine/src/debug/res/values/strings.xml b/telecine/src/debug/res/values/strings.xml index 931a1b8..a3a4121 100644 --- a/telecine/src/debug/res/values/strings.xml +++ b/telecine/src/debug/res/values/strings.xml @@ -3,6 +3,6 @@ Telecine Debug - Launch Debug - Launch Telecine Debug + Launch Debug + Launch Telecine Debug diff --git a/telecine/src/main/AndroidManifest.xml b/telecine/src/main/AndroidManifest.xml index cbde729..219a5ab 100644 --- a/telecine/src/main/AndroidManifest.xml +++ b/telecine/src/main/AndroidManifest.xml @@ -30,6 +30,10 @@ + @@ -41,6 +45,7 @@ android:theme="@style/Theme.Telecine.Transparent" android:excludeFromRecents="true" android:taskAffinity="" + android:enabled="@bool/widget_shortcut_enabled" > @@ -56,7 +61,7 @@ diff --git a/telecine/src/main/java/com/jakewharton/telecine/Analytics.java b/telecine/src/main/java/com/jakewharton/telecine/Analytics.java index 42fca61..3030e41 100644 --- a/telecine/src/main/java/com/jakewharton/telecine/Analytics.java +++ b/telecine/src/main/java/com/jakewharton/telecine/Analytics.java @@ -26,6 +26,8 @@ interface Analytics { String ACTION_QUICK_TILE_ADDED = "Quick Tile Added"; String ACTION_QUICK_TILE_LAUNCHED = "Quick Tile Launched"; String ACTION_QUICK_TILE_REMOVED = "Quick Tile Removed"; + String ACTION_STATIC_SHORTCUT_RECORD = "Static Shortcut Record"; + String ACTION_STATIC_SHORTCUT_OVERLAY = "Static Shortcut Overlay"; String VARIABLE_RECORDING_LENGTH = "Recording Length"; diff --git a/telecine/src/main/java/com/jakewharton/telecine/RecordingSession.java b/telecine/src/main/java/com/jakewharton/telecine/RecordingSession.java index dbca65f..ba28fe1 100644 --- a/telecine/src/main/java/com/jakewharton/telecine/RecordingSession.java +++ b/telecine/src/main/java/com/jakewharton/telecine/RecordingSession.java @@ -194,6 +194,24 @@ private RecordingInfo getRecordingInfo() { cameraWidth, cameraHeight, cameraFrameRate, sizePercentage); } + /** Perform a click on the start button to simulate the auto-recording. */ + void triggerAutoRecording() { + if (overlayView == null) { + throw new AssertionError(); + } + // Most of the time, overlayView is not yet attached to the Window + if (overlayView.isAttachedToWindow()) { + overlayView.onStartClicked(); + } else { + overlayView.post(new Runnable() { + @Override + public void run() { + triggerAutoRecording(); + } + }); + } + } + private void startRecording() { Timber.d("Starting screen recording..."); diff --git a/telecine/src/main/java/com/jakewharton/telecine/TelecineService.java b/telecine/src/main/java/com/jakewharton/telecine/TelecineService.java index 88c5a6b..11c93d1 100644 --- a/telecine/src/main/java/com/jakewharton/telecine/TelecineService.java +++ b/telecine/src/main/java/com/jakewharton/telecine/TelecineService.java @@ -98,6 +98,10 @@ static Intent newIntent(Context context, int resultCode, Intent data) { videoSizePercentageProvider); recordingSession.showOverlay(); + if (data.getBooleanExtra(TelecineShortcutLaunchActivity.EXTRA_AUTO_RECORDING, false)) { + Timber.d("Auto-recording requested!"); + recordingSession.triggerAutoRecording(); + } return START_NOT_STICKY; } diff --git a/telecine/src/main/java/com/jakewharton/telecine/TelecineShortcutConfigureActivity.java b/telecine/src/main/java/com/jakewharton/telecine/TelecineShortcutConfigureActivity.java index 88fa917..76a73e8 100644 --- a/telecine/src/main/java/com/jakewharton/telecine/TelecineShortcutConfigureActivity.java +++ b/telecine/src/main/java/com/jakewharton/telecine/TelecineShortcutConfigureActivity.java @@ -24,7 +24,7 @@ public final class TelecineShortcutConfigureActivity extends Activity { ShortcutIconResource icon = ShortcutIconResource.fromContext(this, R.drawable.ic_launcher); Intent intent = new Intent(); - intent.putExtra(Intent.EXTRA_SHORTCUT_NAME, getString(R.string.shortcut_name)); + intent.putExtra(Intent.EXTRA_SHORTCUT_NAME, getString(R.string.launch)); intent.putExtra(Intent.EXTRA_SHORTCUT_ICON_RESOURCE, icon); intent.putExtra(Intent.EXTRA_SHORTCUT_INTENT, launchIntent); diff --git a/telecine/src/main/java/com/jakewharton/telecine/TelecineShortcutLaunchActivity.java b/telecine/src/main/java/com/jakewharton/telecine/TelecineShortcutLaunchActivity.java index 08ab1fd..7531a10 100644 --- a/telecine/src/main/java/com/jakewharton/telecine/TelecineShortcutLaunchActivity.java +++ b/telecine/src/main/java/com/jakewharton/telecine/TelecineShortcutLaunchActivity.java @@ -9,6 +9,7 @@ public final class TelecineShortcutLaunchActivity extends Activity { private static final String KEY_ACTION = "launch-action"; + static final String EXTRA_AUTO_RECORDING = "auto-recording"; static Intent createQuickTileIntent(Context context) { Intent intent = new Intent(context, TelecineShortcutLaunchActivity.class); @@ -36,6 +37,10 @@ static Intent createQuickTileIntent(Context context) { } @Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { + if (getIntent().getBooleanExtra(EXTRA_AUTO_RECORDING, false) && data != null) { + // Add the auto-recording extra from the original intent to the result data. + data.putExtra(EXTRA_AUTO_RECORDING, true); + } if (!CaptureHelper.handleActivityResult(this, requestCode, resultCode, data, analytics)) { super.onActivityResult(requestCode, resultCode, data); } diff --git a/telecine/src/main/res/drawable/ic_shortcut_overlay_48dp.xml b/telecine/src/main/res/drawable/ic_shortcut_overlay_48dp.xml new file mode 100644 index 0000000..908e008 --- /dev/null +++ b/telecine/src/main/res/drawable/ic_shortcut_overlay_48dp.xml @@ -0,0 +1,14 @@ + + + + diff --git a/telecine/src/main/res/drawable/ic_shortcut_record_48dp.xml b/telecine/src/main/res/drawable/ic_shortcut_record_48dp.xml new file mode 100644 index 0000000..8746102 --- /dev/null +++ b/telecine/src/main/res/drawable/ic_shortcut_record_48dp.xml @@ -0,0 +1,14 @@ + + + + diff --git a/telecine/src/main/res/values-de/strings.xml b/telecine/src/main/res/values-de/strings.xml index 1e91214..f597df8 100644 --- a/telecine/src/main/res/values-de/strings.xml +++ b/telecine/src/main/res/values-de/strings.xml @@ -1,7 +1,7 @@ - Aufnahme starten + Aufnahme starten Leeren Aufnehmen 1… diff --git a/telecine/src/main/res/values-es/strings.xml b/telecine/src/main/res/values-es/strings.xml index d776b31..b026c38 100644 --- a/telecine/src/main/res/values-es/strings.xml +++ b/telecine/src/main/res/values-es/strings.xml @@ -1,6 +1,6 @@ - Inicia + Inicia Despejar Grabar Inicia superposición @@ -16,4 +16,4 @@ Toque el reloj para detener la grabación. Notificación de grabación Mostrar Toques - \ No newline at end of file + diff --git a/telecine/src/main/res/values-fr/strings.xml b/telecine/src/main/res/values-fr/strings.xml index b2c81d5..8b99261 100644 --- a/telecine/src/main/res/values-fr/strings.xml +++ b/telecine/src/main/res/values-fr/strings.xml @@ -1,7 +1,7 @@ - Lancer + Lancer Effacer Enregistrer 1… @@ -13,10 +13,10 @@ Masquer dans les applications récentes Taille de la vidéo Capture d\'écran vidéo réussie. - Appuyez pour afficher votre capture d\'écran vidéo. + Appuyez pour afficher votre capture d\'écran vidéo. Partager Supprimer - Capture d\'écran vidéo en cours. + Capture d\'écran vidéo en cours. Appuyez sur la zone de l\'horloge pour arrêter. Notification d\'enregistrement Afficher les appuis diff --git a/telecine/src/main/res/values-it/strings.xml b/telecine/src/main/res/values-it/strings.xml index 0d69095..ee40afb 100644 --- a/telecine/src/main/res/values-it/strings.xml +++ b/telecine/src/main/res/values-it/strings.xml @@ -2,7 +2,7 @@ - Avvia + Avvia Clear Registra 1… diff --git a/telecine/src/main/res/values-ja/strings.xml b/telecine/src/main/res/values-ja/strings.xml index 62907a6..d1ea5e6 100644 --- a/telecine/src/main/res/values-ja/strings.xml +++ b/telecine/src/main/res/values-ja/strings.xml @@ -1,7 +1,7 @@ - 起動 + 起動 クリア 録画 1… diff --git a/telecine/src/main/res/values-ka/strings.xml b/telecine/src/main/res/values-ka/strings.xml index 34451c9..7ee13ff 100644 --- a/telecine/src/main/res/values-ka/strings.xml +++ b/telecine/src/main/res/values-ka/strings.xml @@ -1,6 +1,6 @@ - ჩაწერის დაწყება + ჩაწერის დაწყება წაშლა ჩაწერა ჩაწერის დაწყება ფონურ რეჟიმში diff --git a/telecine/src/main/res/values-no/strings.xml b/telecine/src/main/res/values-no/strings.xml index 2b98461..3336bcc 100644 --- a/telecine/src/main/res/values-no/strings.xml +++ b/telecine/src/main/res/values-no/strings.xml @@ -1,7 +1,7 @@ - Start + Start Slett Ta opp Start overlay diff --git a/telecine/src/main/res/values-pl/strings.xml b/telecine/src/main/res/values-pl/strings.xml index 0eb9584..f8ed72a 100644 --- a/telecine/src/main/res/values-pl/strings.xml +++ b/telecine/src/main/res/values-pl/strings.xml @@ -1,7 +1,7 @@ - Uruchom + Uruchom Wyczyść Nagraj 1… diff --git a/telecine/src/main/res/values-pt-rBR/strings.xml b/telecine/src/main/res/values-pt-rBR/strings.xml index a6b2212..7e2ac59 100644 --- a/telecine/src/main/res/values-pt-rBR/strings.xml +++ b/telecine/src/main/res/values-pt-rBR/strings.xml @@ -1,6 +1,6 @@ - Iniciar + Iniciar Iniciar Telecine Limpar Gravar diff --git a/telecine/src/main/res/values-pt-rPT/strings.xml b/telecine/src/main/res/values-pt-rPT/strings.xml index 8a48354..7e7f664 100644 --- a/telecine/src/main/res/values-pt-rPT/strings.xml +++ b/telecine/src/main/res/values-pt-rPT/strings.xml @@ -1,6 +1,6 @@ - Iniciar + Iniciar Limpar Gravar 1… diff --git a/telecine/src/main/res/values-ru/strings.xml b/telecine/src/main/res/values-ru/strings.xml index adbfee1..606b69d 100644 --- a/telecine/src/main/res/values-ru/strings.xml +++ b/telecine/src/main/res/values-ru/strings.xml @@ -16,7 +16,7 @@ Не показывать в недавних приложениях Запись Уведомление о записи экрана - Начать запись + Начать запись Показывать нажатия на экран Размер видео diff --git a/telecine/src/main/res/values-tr/strings.xml b/telecine/src/main/res/values-tr/strings.xml index b727d9d..04227e8 100644 --- a/telecine/src/main/res/values-tr/strings.xml +++ b/telecine/src/main/res/values-tr/strings.xml @@ -1,7 +1,7 @@ - Çalıştır + Çalıştır Temizle Kayıt 1… diff --git a/telecine/src/main/res/values-v25/bools.xml b/telecine/src/main/res/values-v25/bools.xml new file mode 100644 index 0000000..a516b6b --- /dev/null +++ b/telecine/src/main/res/values-v25/bools.xml @@ -0,0 +1,5 @@ + + + + false + diff --git a/telecine/src/main/res/values-zh-rCN/strings.xml b/telecine/src/main/res/values-zh-rCN/strings.xml index 1730703..a736c0c 100644 --- a/telecine/src/main/res/values-zh-rCN/strings.xml +++ b/telecine/src/main/res/values-zh-rCN/strings.xml @@ -1,7 +1,7 @@ - 启动 + 启动 清除 记录 1… diff --git a/telecine/src/main/res/values-zh-rHK/strings.xml b/telecine/src/main/res/values-zh-rHK/strings.xml index 5dfb594..dbeda17 100644 --- a/telecine/src/main/res/values-zh-rHK/strings.xml +++ b/telecine/src/main/res/values-zh-rHK/strings.xml @@ -1,7 +1,7 @@ - 啟動 + 啟動 清除 記錄 1… @@ -18,4 +18,4 @@ 錄製屏幕中. 觸摸時鍾區域停止錄像. 錄像通知 - \ No newline at end of file + diff --git a/telecine/src/main/res/values-zh-rTW/strings.xml b/telecine/src/main/res/values-zh-rTW/strings.xml index e9e56b5..5e8833c 100644 --- a/telecine/src/main/res/values-zh-rTW/strings.xml +++ b/telecine/src/main/res/values-zh-rTW/strings.xml @@ -1,7 +1,7 @@ - 啟動 + 啟動 清除 記錄 1… @@ -18,4 +18,4 @@ 錄製屏幕中. 觸摸時鍾區域停止錄像. 錄像通知 - \ No newline at end of file + diff --git a/telecine/src/main/res/values/bools.xml b/telecine/src/main/res/values/bools.xml new file mode 100644 index 0000000..80f3ba1 --- /dev/null +++ b/telecine/src/main/res/values/bools.xml @@ -0,0 +1,4 @@ + + + true + diff --git a/telecine/src/main/res/values/strings.xml b/telecine/src/main/res/values/strings.xml index eb085f9..c5e5ef2 100644 --- a/telecine/src/main/res/values/strings.xml +++ b/telecine/src/main/res/values/strings.xml @@ -4,10 +4,9 @@ Telecine @string/app_name - Launch - Launch Telecine Clear Record + Start Recording 1… 2… 3… @@ -24,6 +23,8 @@ Touch the clock area to stop recording. Recording Notification Show Touches + Launch + Launch Telecine @string/countdown_three diff --git a/telecine/src/main/res/xml/shortcuts.xml b/telecine/src/main/res/xml/shortcuts.xml new file mode 100644 index 0000000..6545456 --- /dev/null +++ b/telecine/src/main/res/xml/shortcuts.xml @@ -0,0 +1,51 @@ + + + + + + + + + + + + + + + + From f1a99bee901da5a70df4f1ab6394feba28bba1f4 Mon Sep 17 00:00:00 2001 From: Simon Marquis Date: Wed, 4 Jan 2017 22:48:56 +0100 Subject: [PATCH 2/3] Fix drawable resource name --- telecine/src/main/res/xml/shortcuts.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/telecine/src/main/res/xml/shortcuts.xml b/telecine/src/main/res/xml/shortcuts.xml index 6545456..7cbeeb6 100644 --- a/telecine/src/main/res/xml/shortcuts.xml +++ b/telecine/src/main/res/xml/shortcuts.xml @@ -6,7 +6,7 @@ > Date: Wed, 4 Jan 2017 22:53:00 +0100 Subject: [PATCH 3/3] Add debug version of shortcuts as explained in #135 and #139 --- telecine/src/debug/res/xml/shortcuts.xml | 51 ++++++++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100644 telecine/src/debug/res/xml/shortcuts.xml diff --git a/telecine/src/debug/res/xml/shortcuts.xml b/telecine/src/debug/res/xml/shortcuts.xml new file mode 100644 index 0000000..c6ad403 --- /dev/null +++ b/telecine/src/debug/res/xml/shortcuts.xml @@ -0,0 +1,51 @@ + + + + + + + + + + + + + + + +