use of android.app.Dialog in project GSYVideoPlayer by CarGuo.
the class StandardGSYVideoPlayer method showVolumeDialog.
@Override
protected void showVolumeDialog(float deltaY, int volumePercent) {
super.showVolumeDialog(deltaY, volumePercent);
if (mVolumeDialog == null) {
View localView = LayoutInflater.from(getContext()).inflate(R.layout.video_volume_dialog, null);
mDialogVolumeProgressBar = ((ProgressBar) localView.findViewById(R.id.volume_progressbar));
if (mVolumeProgressDrawable != null) {
mDialogVolumeProgressBar.setProgressDrawable(mVolumeProgressDrawable);
}
mVolumeDialog = new Dialog(getContext(), R.style.video_style_dialog_progress);
mVolumeDialog.setContentView(localView);
mVolumeDialog.getWindow().addFlags(8);
mVolumeDialog.getWindow().addFlags(32);
mVolumeDialog.getWindow().addFlags(16);
mVolumeDialog.getWindow().setLayout(-2, -2);
WindowManager.LayoutParams localLayoutParams = mVolumeDialog.getWindow().getAttributes();
localLayoutParams.gravity = Gravity.TOP | Gravity.LEFT;
localLayoutParams.width = getWidth();
localLayoutParams.height = getHeight();
int[] location = new int[2];
getLocationOnScreen(location);
localLayoutParams.x = location[0];
localLayoutParams.y = location[1];
mVolumeDialog.getWindow().setAttributes(localLayoutParams);
}
if (!mVolumeDialog.isShowing()) {
mVolumeDialog.show();
}
mDialogVolumeProgressBar.setProgress(volumePercent);
}
use of android.app.Dialog in project GSYVideoPlayer by CarGuo.
the class StandardGSYVideoPlayer method showProgressDialog.
@Override
protected void showProgressDialog(float deltaX, String seekTime, int seekTimePosition, String totalTime, int totalTimeDuration) {
super.showProgressDialog(deltaX, seekTime, seekTimePosition, totalTime, totalTimeDuration);
if (mProgressDialog == null) {
View localView = LayoutInflater.from(getContext()).inflate(R.layout.video_progress_dialog, null);
mDialogProgressBar = ((ProgressBar) localView.findViewById(R.id.duration_progressbar));
if (mDialogProgressBarDrawable != null) {
mDialogProgressBar.setProgressDrawable(mDialogProgressBarDrawable);
}
mDialogSeekTime = ((TextView) localView.findViewById(R.id.tv_current));
mDialogTotalTime = ((TextView) localView.findViewById(R.id.tv_duration));
mDialogIcon = ((ImageView) localView.findViewById(R.id.duration_image_tip));
mProgressDialog = new Dialog(getContext(), R.style.video_style_dialog_progress);
mProgressDialog.setContentView(localView);
mProgressDialog.getWindow().addFlags(Window.FEATURE_ACTION_BAR);
mProgressDialog.getWindow().addFlags(32);
mProgressDialog.getWindow().addFlags(16);
mProgressDialog.getWindow().setLayout(getWidth(), getHeight());
if (mDialogProgressNormalColor != -11) {
mDialogTotalTime.setTextColor(mDialogProgressNormalColor);
}
if (mDialogProgressHighLightColor != -11) {
mDialogSeekTime.setTextColor(mDialogProgressHighLightColor);
}
WindowManager.LayoutParams localLayoutParams = mProgressDialog.getWindow().getAttributes();
localLayoutParams.gravity = Gravity.TOP;
localLayoutParams.width = getWidth();
localLayoutParams.height = getHeight();
int[] location = new int[2];
getLocationOnScreen(location);
localLayoutParams.x = location[0];
localLayoutParams.y = location[1];
mProgressDialog.getWindow().setAttributes(localLayoutParams);
}
if (!mProgressDialog.isShowing()) {
mProgressDialog.show();
}
mDialogSeekTime.setText(seekTime);
mDialogTotalTime.setText(" / " + totalTime);
if (totalTimeDuration > 0)
mDialogProgressBar.setProgress(seekTimePosition * 100 / totalTimeDuration);
if (deltaX > 0) {
mDialogIcon.setBackgroundResource(R.drawable.video_forward_icon);
} else {
mDialogIcon.setBackgroundResource(R.drawable.video_backward_icon);
}
}
use of android.app.Dialog in project AndroidChromium by JackyAndroid.
the class CertificateViewer method showDialogForView.
// Displays a dialog with scrolling for the given view.
private void showDialogForView(View view) {
Dialog dialog = new Dialog(mContext);
dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
dialog.addContentView(view, new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.MATCH_PARENT));
dialog.show();
}
use of android.app.Dialog in project AndroidChromium by JackyAndroid.
the class ItemChooserDialog method showDialogForView.
private void showDialogForView(View view) {
mDialog = new Dialog(mActivity) {
@Override
public void onWindowFocusChanged(boolean hasFocus) {
super.onWindowFocusChanged(hasFocus);
if (!hasFocus)
super.dismiss();
}
};
mDialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
mDialog.setCanceledOnTouchOutside(true);
mDialog.addContentView(view, new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.MATCH_PARENT));
mDialog.setOnDismissListener(new DialogInterface.OnDismissListener() {
@Override
public void onDismiss(DialogInterface dialog) {
mItemSelectedCallback.onItemSelected("");
}
});
Window window = mDialog.getWindow();
if (!DeviceFormFactor.isTablet(mActivity)) {
// On smaller screens, make the dialog fill the width of the screen,
// and appear at the top.
window.setBackgroundDrawable(new ColorDrawable(Color.WHITE));
window.setGravity(Gravity.TOP);
window.setLayout(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);
}
mDialog.show();
}
use of android.app.Dialog in project AndroidChromium by JackyAndroid.
the class RepostFormWarningDialog method onCreateDialog.
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
AlertDialog.Builder builder = new AlertDialog.Builder(getActivity(), R.style.AlertDialogTheme).setMessage(R.string.http_post_warning);
if (savedInstanceState == null) {
assert mTab != null;
builder.setNegativeButton(R.string.cancel, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int id) {
if (!mTab.isInitialized())
return;
mTab.getWebContents().getNavigationController().cancelPendingReload();
}
});
builder.setPositiveButton(R.string.http_post_warning_resend, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int id) {
if (!mTab.isInitialized())
return;
mTab.getWebContents().getNavigationController().continuePendingReload();
}
});
}
Dialog dialog = builder.create();
setCurrentDialogForTesting(dialog);
return dialog;
}
Aggregations