Android Open Source - Telecine Capture Helper






From Project

Back to project page Telecine.

License

The source code is released under:

Apache License

If you think the Android project Telecine listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package com.jakewharton.telecine;
/*ww w  .  j  a  va2s.  c om*/
import android.app.Activity;
import android.content.Intent;
import android.media.projection.MediaProjectionManager;
import com.google.android.gms.analytics.HitBuilders;
import timber.log.Timber;

import static android.content.Context.MEDIA_PROJECTION_SERVICE;

final class CaptureHelper {
  private static final int CREATE_SCREEN_CAPTURE = 4242;

  private CaptureHelper() {
    throw new AssertionError("No instances.");
  }

  static void fireScreenCaptureIntent(Activity activity, Analytics analytics) {
    MediaProjectionManager manager =
        (MediaProjectionManager) activity.getSystemService(MEDIA_PROJECTION_SERVICE);
    Intent intent = manager.createScreenCaptureIntent();
    activity.startActivityForResult(intent, CREATE_SCREEN_CAPTURE);

    analytics.send(new HitBuilders.EventBuilder() //
        .setCategory(Analytics.CATEGORY_SETTINGS)
        .setAction(Analytics.ACTION_CAPTURE_INTENT_LAUNCH)
        .build());
  }

  static boolean handleActivityResult(Activity activity, int requestCode, int resultCode,
      Intent data, Analytics analytics) {
    if (requestCode != CREATE_SCREEN_CAPTURE) {
      return false;
    }

    if (resultCode == 0) {
      Timber.d("Failed to acquire permission to screen capture.");
    } else {
      Timber.d("Acquired permission to screen capture. Starting service.");
      activity.startService(TelecineService.newIntent(activity, resultCode, data));
    }

    analytics.send(new HitBuilders.EventBuilder() //
        .setCategory(Analytics.CATEGORY_SETTINGS)
        .setAction(Analytics.ACTION_CAPTURE_INTENT_RESULT)
        .setValue(resultCode)
        .build());

    return true;
  }
}




Java Source Code List

com.jakewharton.telecine.Analytics.java
com.jakewharton.telecine.BooleanPreference.java
com.jakewharton.telecine.BugsnagTree.java
com.jakewharton.telecine.CaptureHelper.java
com.jakewharton.telecine.CheatSheet.java
com.jakewharton.telecine.HideFromRecents.java
com.jakewharton.telecine.IntPreference.java
com.jakewharton.telecine.OverlayView.java
com.jakewharton.telecine.RecordingSession.java
com.jakewharton.telecine.ShowCountdown.java
com.jakewharton.telecine.TelecineActivity.java
com.jakewharton.telecine.TelecineApplication.java
com.jakewharton.telecine.TelecineModule.java
com.jakewharton.telecine.TelecineService.java
com.jakewharton.telecine.TelecineShortcutConfigureActivity.java
com.jakewharton.telecine.TelecineShortcutLaunchActivity.java
com.jakewharton.telecine.VideoSizePercentageAdapter.java
com.jakewharton.telecine.VideoSizePercentage.java