1 // Copyright (c) 2013 Intel Corporation. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 package org.xwalk.core.extension.api.presentation;
7 import android.app.Presentation;
8 import android.os.Build;
9 import android.content.Context;
10 import android.content.DialogInterface;
11 import android.view.Display;
12 import android.view.View;
15 * A wrapper class of android.app.Presentation class introduced from API level 17.
17 public class PresentationViewJBMR1 extends PresentationView
18 implements DialogInterface.OnShowListener, DialogInterface.OnDismissListener {
20 private Presentation mPresentation;
22 public PresentationViewJBMR1(Context context, Display display) {
23 mPresentation = new Presentation(context, display);
32 public void dismiss() {
33 mPresentation.dismiss();
37 public void cancel() {
38 mPresentation.cancel();
42 public void setContentView(View contentView) {
43 mPresentation.setContentView(contentView);
47 public Display getDisplay() {
48 return mPresentation.getDisplay();
52 public void setPresentationListener(PresentationView.PresentationListener listener) {
53 super.setPresentationListener(listener);
55 if (mListener != null) {
56 mPresentation.setOnShowListener(this);
57 mPresentation.setOnDismissListener(this);
59 mPresentation.setOnShowListener(null);
60 mPresentation.setOnDismissListener(null);
65 public void onShow(DialogInterface dialog) {
66 if (mListener != null) mListener.onShow(this);
70 public void onDismiss(DialogInterface dialog) {
71 if (mListener != null) mListener.onDismiss(this);