]> git.ipfire.org Git - thirdparty/strongswan.git/blob - src/frontends/android/app/src/main/java/org/strongswan/android/ui/VpnProfileSelectActivity.java
27cecc7e99ba230572343877e1c752af539d1aa6
[thirdparty/strongswan.git] / src / frontends / android / app / src / main / java / org / strongswan / android / ui / VpnProfileSelectActivity.java
1 /*
2 * Copyright (C) 2012 Tobias Brunner
3 * HSR Hochschule fuer Technik Rapperswil
4 *
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>.
9 *
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
13 * for more details.
14 */
15
16 package org.strongswan.android.ui;
17
18 import android.content.Intent;
19 import android.os.Bundle;
20 import android.support.v7.app.AppCompatActivity;
21
22 import org.strongswan.android.R;
23 import org.strongswan.android.data.VpnProfile;
24 import org.strongswan.android.ui.VpnProfileListFragment.OnVpnProfileSelectedListener;
25
26 public class VpnProfileSelectActivity extends AppCompatActivity implements OnVpnProfileSelectedListener
27 {
28 @Override
29 protected void onCreate(Bundle savedInstanceState)
30 {
31 super.onCreate(savedInstanceState);
32 setContentView(R.layout.vpn_profile_select);
33
34 /* we should probably return a result also if the user clicks the back
35 * button before selecting a profile */
36 setResult(RESULT_CANCELED);
37 }
38
39 @Override
40 public void onVpnProfileSelected(VpnProfile profile)
41 {
42 Intent shortcut = new Intent(VpnProfileControlActivity.START_PROFILE);
43 shortcut.putExtra(VpnProfileControlActivity.EXTRA_VPN_PROFILE_ID, profile.getUUID().toString());
44
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);
50 finish();
51 }
52 }