blob: 34d167e47514f27bae8d9129cd718aa446b3270b [file] [log] [blame]
alision96ff9b72013-07-05 10:59:16 -04001/*
2 * Copyright (C) 2004-2013 Savoir-Faire Linux Inc.
3 *
4 * Author: Alexandre Lision <alexandre.lision@savoirfairelinux.com>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 3 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
19 *
20 * Additional permission under GNU GPL version 3 section 7:
21 *
22 * If you modify this program, or any covered work, by linking or
23 * combining it with the OpenSSL project's OpenSSL library (or a
24 * modified version of that library), containing parts covered by the
25 * terms of the OpenSSL or SSLeay licenses, Savoir-Faire Linux Inc.
26 * grants you additional permission to convey the resulting work.
27 * Corresponding Source for a non-source form of such a combination
28 * shall include the source code for the parts of OpenSSL used as well
29 * as that of the covered work.
30 */
31
Alexandre Lision064e1e02013-10-01 16:18:42 -040032package org.sflphone.client;
33
34import org.sflphone.R;
35import org.sflphone.fragments.AboutFragment;
36import org.sflphone.fragments.HelpGesturesFragment;
alision96ff9b72013-07-05 10:59:16 -040037
alision96ff9b72013-07-05 10:59:16 -040038import android.app.Activity;
39import android.app.FragmentTransaction;
alision5de91782013-07-10 10:47:30 -040040import android.os.Bundle;
alision96ff9b72013-07-05 10:59:16 -040041import android.view.MenuItem;
42
43/**
44 * This Activity holds some conex fragments not requiring a lot of interaction: HelpGesturesFragment, LegalFragment, ContributeFragment
45 * @author lisional
46 *
47 */
48public class ActivityHolder extends Activity {
49
50 public interface args {
51 int FRAG_GESTURES = 0;
alision5de91782013-07-10 10:47:30 -040052 int FRAG_ABOUT= 1;
alision96ff9b72013-07-05 10:59:16 -040053 }
54
55 @Override
56 protected void onCreate(Bundle savedInstanceState) {
57 super.onCreate(savedInstanceState);
58 setContentView(R.layout.activity_holder);
59
60
61 FragmentTransaction ft = getFragmentManager().beginTransaction();
62 switch(getIntent().getIntExtra("ActivityHolder.args", -1)){
63 case args.FRAG_GESTURES:
64 ft.replace(R.id.frag_container, new HelpGesturesFragment());
65 break;
alision5de91782013-07-10 10:47:30 -040066 case args.FRAG_ABOUT:
67 ft.replace(R.id.frag_container, new AboutFragment());
alision96ff9b72013-07-05 10:59:16 -040068 break;
69 }
70
71 ft.commit();
72
73 getActionBar().setDisplayHomeAsUpEnabled(true);
74 }
75
76 @Override
77 public boolean onOptionsItemSelected(MenuItem item) {
78 switch (item.getItemId()) {
79 case android.R.id.home:
80 finish();
81 return true;
82 default:
83 return true;
84 }
85 }
86
87}