Skip to content
This repository was archived by the owner on Sep 10, 2020. It is now read-only.
Open
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
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
interface Analytics {
String CATEGORY_SETTINGS = "Settings";
String CATEGORY_RECORDING = "Recording";
String CATEGORY_SCREENSHOT = "Screenshot";
String CATEGORY_SHORTCUT = "Shortcut";

String ACTION_CAPTURE_INTENT_LAUNCH = "Launch Overlay Launch";
Expand All @@ -20,6 +21,7 @@ interface Analytics {
String ACTION_OVERLAY_CANCEL = "Overlay Cancel";
String ACTION_RECORDING_START = "Recording Start";
String ACTION_RECORDING_STOP = "Recording Stop";
String ACTION_SCREENSHOT_TAKEN = "Screenshot Taken";
String ACTION_SHORTCUT_ADDED = "Shortcut Added";
String ACTION_SHORTCUT_LAUNCHED = "Shortcut Launched";

Expand Down
67 changes: 67 additions & 0 deletions telecine/src/main/java/com/jakewharton/telecine/FlashView.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
package com.jakewharton.telecine;

import android.annotation.SuppressLint;
import android.content.Context;
import android.view.WindowManager;
import android.view.animation.DecelerateInterpolator;
import android.widget.FrameLayout;
import butterknife.ButterKnife;
import static android.graphics.PixelFormat.TRANSLUCENT;
import static android.view.ViewGroup.LayoutParams.MATCH_PARENT;
import static android.view.WindowManager.LayoutParams.FLAG_LAYOUT_INSET_DECOR;
import static android.view.WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN;
import static android.view.WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS;
import static android.view.WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE;
import static android.view.WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL;
import static android.view.WindowManager.LayoutParams.TYPE_SYSTEM_ERROR;

@SuppressLint("ViewConstructor") // Lint, in this case, I am smarter than you.
final class FlashView extends FrameLayout {

private final Listener listener;

static FlashView create(Context context, Listener listener) {
return new FlashView(context, listener);
}

private FlashView(Context context, Listener listener) {
super(context);

this.listener = listener;
inflate(context, R.layout.flash_view, this);
ButterKnife.bind(this);
}

@Override
protected void onAttachedToWindow() {
super.onAttachedToWindow();

animate().alpha(100)
.setDuration(200)
.withEndAction(new Runnable() {
@Override
public void run() {
listener.onFlashComplete();
}
})
.setInterpolator(new DecelerateInterpolator());
}

static WindowManager.LayoutParams createLayoutParams() {

final WindowManager.LayoutParams params =
new WindowManager.LayoutParams(MATCH_PARENT, MATCH_PARENT, TYPE_SYSTEM_ERROR, FLAG_NOT_FOCUSABLE
| FLAG_NOT_TOUCH_MODAL
| FLAG_LAYOUT_NO_LIMITS
| FLAG_LAYOUT_INSET_DECOR
| FLAG_LAYOUT_IN_SCREEN, TRANSLUCENT);

return params;
}

interface Listener {
/** Called when flash animation has completed. */
void onFlashComplete();
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,11 @@ interface Listener {

/** Called when stop is clicked. This view is unusable once this callback is invoked. */
void onStop();

void onScreenshot();
/** Called when screenshot is clicked. This view will hide itself completely before invoking
* this callback. It will reappear once the screenshot has been saved.
*/
}

@Bind(R.id.record_overlay_buttons) View buttonsView;
Expand Down Expand Up @@ -151,6 +156,10 @@ private OverlayView(Context context, Listener listener, boolean showCountDown) {
}, showCountDown ? COUNTDOWN_DELAY : NON_COUNTDOWN_DELAY);
}

@OnClick(R.id.record_overlay_screenshot) void onScreenshotClicked() {
listener.onScreenshot();
}

private void startRecording() {
recordingView.setVisibility(INVISIBLE);
stopView.setVisibility(VISIBLE);
Expand Down
Loading