VPN: UI for forgetting disconnected VPNs

Made possible by expanded internal VPN APIs.

Bug: 20872408
Bug: 20692490
Bug: 20747154
Change-Id: Idc87084a130afa18b27c85cc9d4b5033dcedaabe
This commit is contained in:
Robin Lee
2015-05-12 18:35:37 +01:00
parent fd210786ea
commit 01b35bcae3
5 changed files with 99 additions and 104 deletions

View File

@@ -41,28 +41,25 @@ import com.android.settings.R;
*/
class AppDialog extends AlertDialog implements DialogInterface.OnClickListener {
private final Listener mListener;
private final PackageInfo mPkgInfo;
private final PackageInfo mPackageInfo;
private final String mLabel;
private final boolean mConnected;
AppDialog(Context context, Listener listener, PackageInfo pkgInfo, String label,
boolean connected) {
AppDialog(Context context, Listener listener, PackageInfo pkgInfo, String label) {
super(context);
mListener = listener;
mPkgInfo = pkgInfo;
mPackageInfo = pkgInfo;
mLabel = label;
mConnected = connected;
}
public final PackageInfo getPackageInfo() {
return mPkgInfo;
return mPackageInfo;
}
@Override
protected void onCreate(Bundle savedState) {
setTitle(mLabel);
setMessage(getContext().getString(R.string.vpn_version, mPkgInfo.versionName));
setMessage(getContext().getString(R.string.vpn_version, mPackageInfo.versionName));
createButtons();
super.onCreate(savedState);
@@ -71,11 +68,9 @@ class AppDialog extends AlertDialog implements DialogInterface.OnClickListener {
protected void createButtons() {
Context context = getContext();
if (mConnected) {
// Forget the network
setButton(DialogInterface.BUTTON_NEGATIVE,
context.getString(R.string.vpn_forget), this);
}
// Forget the network
setButton(DialogInterface.BUTTON_NEGATIVE,
context.getString(R.string.vpn_forget), this);
// Dismiss
setButton(DialogInterface.BUTTON_POSITIVE,