alision | 96ff9b7 | 2013-07-05 10:59:16 -0400 | [diff] [blame] | 1 | /* |
| 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 Lision | 064e1e0 | 2013-10-01 16:18:42 -0400 | [diff] [blame] | 32 | package org.sflphone.client; |
| 33 | |
| 34 | import org.sflphone.R; |
| 35 | import org.sflphone.fragments.AboutFragment; |
| 36 | import org.sflphone.fragments.HelpGesturesFragment; |
alision | 96ff9b7 | 2013-07-05 10:59:16 -0400 | [diff] [blame] | 37 | |
alision | 96ff9b7 | 2013-07-05 10:59:16 -0400 | [diff] [blame] | 38 | import android.app.Activity; |
| 39 | import android.app.FragmentTransaction; |
alision | 5de9178 | 2013-07-10 10:47:30 -0400 | [diff] [blame] | 40 | import android.os.Bundle; |
alision | 96ff9b7 | 2013-07-05 10:59:16 -0400 | [diff] [blame] | 41 | import 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 | */ |
| 48 | public class ActivityHolder extends Activity { |
| 49 | |
| 50 | public interface args { |
| 51 | int FRAG_GESTURES = 0; |
alision | 5de9178 | 2013-07-10 10:47:30 -0400 | [diff] [blame] | 52 | int FRAG_ABOUT= 1; |
alision | 96ff9b7 | 2013-07-05 10:59:16 -0400 | [diff] [blame] | 53 | } |
| 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; |
alision | 5de9178 | 2013-07-10 10:47:30 -0400 | [diff] [blame] | 66 | case args.FRAG_ABOUT: |
| 67 | ft.replace(R.id.frag_container, new AboutFragment()); |
alision | 96ff9b7 | 2013-07-05 10:59:16 -0400 | [diff] [blame] | 68 | 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 | } |