2 * Copyright (C) 2012 Tobias Brunner
3 * HSR Hochschule fuer Technik Rapperswil
5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License as published by the
7 * Free Software Foundation; either version 2 of the License, or (at your
8 * option) any later version. See <http://www.fsf.org/copyleft/gpl.txt>.
10 * This program is distributed in the hope that it will be useful, but
11 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
12 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
16 package org
.strongswan
.android
.ui
;
18 import android
.content
.Intent
;
19 import android
.os
.Bundle
;
20 import android
.support
.v7
.app
.AppCompatActivity
;
22 import org
.strongswan
.android
.R
;
23 import org
.strongswan
.android
.data
.VpnProfile
;
24 import org
.strongswan
.android
.ui
.VpnProfileListFragment
.OnVpnProfileSelectedListener
;
26 public class VpnProfileSelectActivity
extends AppCompatActivity
implements OnVpnProfileSelectedListener
29 protected void onCreate(Bundle savedInstanceState
)
31 super.onCreate(savedInstanceState
);
32 setContentView(R
.layout
.vpn_profile_select
);
34 /* we should probably return a result also if the user clicks the back
35 * button before selecting a profile */
36 setResult(RESULT_CANCELED
);
40 public void onVpnProfileSelected(VpnProfile profile
)
42 Intent shortcut
= new Intent(VpnProfileControlActivity
.START_PROFILE
);
43 shortcut
.putExtra(VpnProfileControlActivity
.EXTRA_VPN_PROFILE_ID
, profile
.getUUID().toString());
45 Intent intent
= new Intent();
46 intent
.putExtra(Intent
.EXTRA_SHORTCUT_INTENT
, shortcut
);
47 intent
.putExtra(Intent
.EXTRA_SHORTCUT_NAME
, profile
.getName());
48 intent
.putExtra(Intent
.EXTRA_SHORTCUT_ICON_RESOURCE
, Intent
.ShortcutIconResource
.fromContext(this, R
.drawable
.ic_launcher
));
49 setResult(RESULT_OK
, intent
);