2
* Copyright (C) 2012 Tobias Brunner
3
* 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 org.strongswan.android.R;
19
import org.strongswan.android.data.VpnProfile;
20
import org.strongswan.android.ui.VpnProfileListFragment.OnVpnProfileSelectedListener;
22
import android.app.Activity;
23
import android.content.Intent;
24
import android.os.Bundle;
26
public class VpnProfileSelectActivity extends Activity 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(MainActivity.START_PROFILE);
43
shortcut.putExtra(MainActivity.EXTRA_VPN_PROFILE_ID, profile.getId());
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);