ConfirmDialogpublic class ConfirmDialog extends com.android.internal.app.AlertActivity implements android.text.Html.ImageGetter, DialogInterface.OnClickListener
Fields Summary |
---|
private static final String | TAG | private String | mPackage | private android.net.IConnectivityManager | mService | private android.widget.Button | mButton |
Methods Summary |
---|
public android.graphics.drawable.Drawable | getDrawable(java.lang.String source)
// Should only reach this when fetching the VPN icon for the warning string.
Drawable icon = getDrawable(R.drawable.ic_vpn_dialog);
icon.setBounds(0, 0, icon.getIntrinsicWidth(), icon.getIntrinsicHeight());
return icon;
| public void | onBackPressed()
| public void | onClick(android.content.DialogInterface dialog, int which)
try {
if (mService.prepareVpn(null, mPackage)) {
// Authorize this app to initiate VPN connections in the future without user
// intervention.
mService.setVpnPackageAuthorization(true);
setResult(RESULT_OK);
}
} catch (Exception e) {
Log.e(TAG, "onClick", e);
}
| protected void | onResume()
super.onResume();
try {
mPackage = getCallingPackage();
mService = IConnectivityManager.Stub.asInterface(
ServiceManager.getService(Context.CONNECTIVITY_SERVICE));
if (mService.prepareVpn(mPackage, null)) {
setResult(RESULT_OK);
finish();
return;
}
View view = View.inflate(this, R.layout.confirm, null);
((TextView) view.findViewById(R.id.warning)).setText(
Html.fromHtml(
getString(R.string.warning, VpnConfig.getVpnLabel(this, mPackage)),
this, null /* tagHandler */));
mAlertParams.mTitle = getText(R.string.prompt);
mAlertParams.mPositiveButtonText = getText(android.R.string.ok);
mAlertParams.mPositiveButtonListener = this;
mAlertParams.mNegativeButtonText = getText(android.R.string.cancel);
mAlertParams.mView = view;
setupAlert();
getWindow().setCloseOnTouchOutside(false);
mButton = mAlert.getButton(DialogInterface.BUTTON_POSITIVE);
mButton.setFilterTouchesWhenObscured(true);
} catch (Exception e) {
Log.e(TAG, "onResume", e);
finish();
}
|
|