Tabnine Logo
PresentationActivity$DemoPresentation
Code IndexAdd Tabnine to your IDE (free)

How to use
PresentationActivity$DemoPresentation
in
com.example.android.apis.app

Best Java code snippets using com.example.android.apis.app.PresentationActivity$DemoPresentation (Showing top 12 results out of 315)

origin: qiubiteme/android_api_demos

/**
 * Shows a {@link Presentation} on the specified display.
 */
private void showPresentation(Display display, DemoPresentationContents contents) {
  final int displayId = display.getDisplayId();
  if (mActivePresentations.get(displayId) != null) {
    return;
  }
  Log.d(TAG, "Showing presentation photo #" + contents.photo
      + " on display #" + displayId + ".");
  DemoPresentation presentation = new DemoPresentation(this, display, contents);
  presentation.show();
  presentation.setOnDismissListener(mOnDismissListener);
  mActivePresentations.put(displayId, presentation);
}
origin: qiubiteme/android_api_demos

@Override
protected void onPause() {
  // Be sure to call the super class.
  super.onPause();
  // Unregister from the display manager.
  mDisplayManager.unregisterDisplayListener(mDisplayListener);
  // Dismiss all of our presentations but remember their contents.
  Log.d(TAG, "Activity is being paused.  Dismissing all active presentation.");
  for (int i = 0; i < mActivePresentations.size(); i++) {
    DemoPresentation presentation = mActivePresentations.valueAt(i);
    int displayId = mActivePresentations.keyAt(i);
    mSavedPresentationContents.put(displayId, presentation.mContents);
    presentation.dismiss();
  }
  mActivePresentations.clear();
}
origin: qiubiteme/android_api_demos

/**
 * Sets the preferred display mode id for the presentation.
 */
public void setPreferredDisplayMode(int modeId) {
  mContents.displayModeId = modeId;
  WindowManager.LayoutParams params = getWindow().getAttributes();
  params.preferredDisplayModeId = modeId;
  getWindow().setAttributes(params);
}
origin: li2/learning-android-open-source

  @Override
  protected void onCreate(Bundle savedInstanceState) {
    // Be sure to call the super class.
    super.onCreate(savedInstanceState);
    // Get the resources for the context of the presentation.
    // Notice that we are getting the resources from the context of the presentation.
    Resources r = getContext().getResources();
    // Inflate the layout.
    setContentView(R.layout.presentation_content);
    final Display display = getDisplay();
    final int displayId = display.getDisplayId();
    final int photo = mContents.photo;
    // Show a caption to describe what's going on.
    TextView text = (TextView)findViewById(R.id.text);
    text.setText(r.getString(R.string.presentation_photo_text,
        photo, displayId, display.getName()));
    // Show a n image for visual interest.
    ImageView image = (ImageView)findViewById(R.id.image);
    image.setImageDrawable(r.getDrawable(PHOTOS[photo]));
    GradientDrawable drawable = new GradientDrawable();
    drawable.setShape(GradientDrawable.RECTANGLE);
    drawable.setGradientType(GradientDrawable.RADIAL_GRADIENT);
    // Set the background to a random gradient.
    Point p = new Point();
    getDisplay().getSize(p);
    drawable.setGradientRadius(Math.max(p.x, p.y) / 2);
    drawable.setColors(mContents.colors);
    findViewById(android.R.id.content).setBackground(drawable);
  }
}
origin: qiubiteme/android_api_demos

  @Override
  protected void onCreate(Bundle savedInstanceState) {
    // Be sure to call the super class.
    super.onCreate(savedInstanceState);
    // Get the resources for the context of the presentation.
    // Notice that we are getting the resources from the context of the presentation.
    Resources r = getContext().getResources();
    // Inflate the layout.
    setContentView(R.layout.presentation_content);
    final Display display = getDisplay();
    final int displayId = display.getDisplayId();
    final int photo = mContents.photo;
    // Show a caption to describe what's going on.
    TextView text = (TextView)findViewById(R.id.text);
    text.setText(r.getString(R.string.presentation_photo_text,
        photo, displayId, display.getName()));
    // Show a n image for visual interest.
    ImageView image = (ImageView)findViewById(R.id.image);
    image.setImageDrawable(r.getDrawable(PHOTOS[photo]));
    GradientDrawable drawable = new GradientDrawable();
    drawable.setShape(GradientDrawable.RECTANGLE);
    drawable.setGradientType(GradientDrawable.RADIAL_GRADIENT);
    // Set the background to a random gradient.
    Point p = new Point();
    getDisplay().getSize(p);
    drawable.setGradientRadius(Math.max(p.x, p.y) / 2);
    drawable.setColors(mContents.colors);
    findViewById(android.R.id.content).setBackground(drawable);
  }
}
origin: li2/learning-android-open-source

@Override
protected void onPause() {
  // Be sure to call the super class.
  super.onPause();
  // Unregister from the display manager.
  mDisplayManager.unregisterDisplayListener(mDisplayListener);
  // Dismiss all of our presentations but remember their contents.
  Log.d(TAG, "Activity is being paused.  Dismissing all active presentation.");
  for (int i = 0; i < mActivePresentations.size(); i++) {
    DemoPresentation presentation = mActivePresentations.valueAt(i);
    int displayId = mActivePresentations.keyAt(i);
    mSavedPresentationContents.put(displayId, presentation.mContents);
    presentation.dismiss();
  }
  mActivePresentations.clear();
}
origin: qiubiteme/android_api_demos

/**
 * Hides a {@link Presentation} on the specified display.
 */
private void hidePresentation(Display display) {
  final int displayId = display.getDisplayId();
  DemoPresentation presentation = mActivePresentations.get(displayId);
  if (presentation == null) {
    return;
  }
  Log.d(TAG, "Dismissing presentation on display #" + displayId + ".");
  presentation.dismiss();
  mActivePresentations.delete(displayId);
}
origin: li2/learning-android-open-source

/**
 * Hides a {@link Presentation} on the specified display.
 */
private void hidePresentation(Display display) {
  final int displayId = display.getDisplayId();
  DemoPresentation presentation = mActivePresentations.get(displayId);
  if (presentation == null) {
    return;
  }
  Log.d(TAG, "Dismissing presentation on display #" + displayId + ".");
  presentation.dismiss();
  mActivePresentations.delete(displayId);
}
origin: li2/learning-android-open-source

/**
 * Shows a {@link Presentation} on the specified display.
 */
private void showPresentation(Display display, PresentationContents contents) {
  final int displayId = display.getDisplayId();
  if (mActivePresentations.get(displayId) != null) {
    return;
  }
  Log.d(TAG, "Showing presentation photo #" + contents.photo
      + " on display #" + displayId + ".");
  DemoPresentation presentation = new DemoPresentation(this, display, contents);
  presentation.show();
  presentation.setOnDismissListener(mOnDismissListener);
  mActivePresentations.put(displayId, presentation);
}
origin: qiubiteme/android_api_demos

  @Override
  public void onDismiss(DialogInterface dialog) {
    DemoPresentation presentation = (DemoPresentation)dialog;
    int displayId = presentation.getDisplay().getDisplayId();
    Log.d(TAG, "Presentation on display #" + displayId + " was dismissed.");
    mActivePresentations.delete(displayId);
    mDisplayListAdapter.notifyDataSetChanged();
  }
};
origin: qiubiteme/android_api_demos

/**
 * Sets the display mode of the {@link Presentation} on the specified display
 * if it is already shown.
 */
private void setPresentationDisplayMode(Display display, int displayModeId) {
  final int displayId = display.getDisplayId();
  DemoPresentation presentation = mActivePresentations.get(displayId);
  if (presentation == null) {
    return;
  }
  presentation.setPreferredDisplayMode(displayModeId);
}
origin: li2/learning-android-open-source

  @Override
  public void onDismiss(DialogInterface dialog) {
    DemoPresentation presentation = (DemoPresentation)dialog;
    int displayId = presentation.getDisplay().getDisplayId();
    Log.d(TAG, "Presentation on display #" + displayId + " was dismissed.");
    mActivePresentations.delete(displayId);
    mDisplayListAdapter.notifyDataSetChanged();
  }
};
com.example.android.apis.appPresentationActivity$DemoPresentation

Javadoc

The presentation to show on the secondary display. Note that the presentation display may have different metrics from the display on which the main activity is showing so we must be careful to use the presentation's own Context whenever we load resources.

Most used methods

  • <init>
  • dismiss
  • findViewById
  • getContext
  • getDisplay
  • setContentView
  • setOnDismissListener
  • show
  • getWindow
  • setPreferredDisplayMode
    Sets the preferred display mode id for the presentation.

Popular in Java

  • Finding current android device location
  • setScale (BigDecimal)
  • onCreateOptionsMenu (Activity)
  • startActivity (Activity)
  • SecureRandom (java.security)
    This class generates cryptographically secure pseudo-random numbers. It is best to invoke SecureRand
  • BitSet (java.util)
    The BitSet class implements abit array [http://en.wikipedia.org/wiki/Bit_array]. Each element is eit
  • Collection (java.util)
    Collection is the root of the collection hierarchy. It defines operations on data collections and t
  • Deque (java.util)
    A linear collection that supports element insertion and removal at both ends. The name deque is shor
  • Cipher (javax.crypto)
    This class provides access to implementations of cryptographic ciphers for encryption and decryption
  • LoggerFactory (org.slf4j)
    The LoggerFactory is a utility class producing Loggers for various logging APIs, most notably for lo
  • Best IntelliJ plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now