app.hacked.ProjectDetailsActivity.java Source code

Java tutorial

Introduction

Here is the source code for app.hacked.ProjectDetailsActivity.java

Source

/*
 * Copyright (C) 2013 - Gareth Llewellyn
 *
 * This file is part of the Unofficial HackedIO Android App https://github.com/NetworksAreMadeOfString/HackedIO-Android-App
 *
 * This app is unofficial. The "Hacked.io" logo is copyright (and maybe even a trademark of) Telefnica UK Limited.
 * The author of this app is not affiliated with Telefnica UK Limited, The Lab ( https://thelab.o2.com/ ) or
 * Geeks of London ( http://geeksoflondon.com/ ) although the author <strong>is</strong> an attendee.
 *
 * This program is free software: you can redistribute it and/or modify it
 * under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
 * FOR A PARTICULAR PURPOSE. See the GNU General Public License
 * for more details.
 *
 * You should have received a copy of the GNU General Public License along with
 * this program. If not, see <http://www.gnu.org/licenses/>
 */
package app.hacked;

import android.app.ActionBar;
import android.os.Bundle;
import android.support.v4.app.FragmentActivity;

public class ProjectDetailsActivity extends FragmentActivity {
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.project_details_activity);

        // Set up the action bar.
        final ActionBar actionBar = getActionBar();
        getActionBar().setIcon(R.drawable.ic_ab_logo);
        getActionBar().setDisplayHomeAsUpEnabled(true);

        // savedInstanceState is non-null when there is fragment state
        // saved from previous configurations of this activity
        // (e.g. when rotating the screen from portrait to landscape).
        // In this case, the fragment will automatically be re-added
        // to its container so we don't need to manually add it.
        // For more information, see the Fragments API guide at:
        //
        // http://developer.android.com/guide/components/fragments.html
        //
        if (savedInstanceState == null) {
            // Create the detail fragment and add it to the activity
            // using a fragment transaction.
            Bundle arguments = new Bundle();
            arguments.putInt(ProjectDetailsFragment.PROJECTID,
                    getIntent().getIntExtra(ProjectDetailsFragment.PROJECTID, 0));
            arguments.putString(ProjectDetailsFragment.NAME,
                    getIntent().getStringExtra(ProjectDetailsFragment.NAME));
            arguments.putString(ProjectDetailsFragment.SYNOPSIS,
                    getIntent().getStringExtra(ProjectDetailsFragment.SYNOPSIS));
            arguments.putString(ProjectDetailsFragment.DESCRIPTION,
                    getIntent().getStringExtra(ProjectDetailsFragment.DESCRIPTION));
            arguments.putString(ProjectDetailsFragment.LOCATION,
                    getIntent().getStringExtra(ProjectDetailsFragment.LOCATION));
            arguments.putString(ProjectDetailsFragment.TECHNOLOGIES,
                    getIntent().getStringExtra(ProjectDetailsFragment.TECHNOLOGIES));
            arguments.putInt(ProjectDetailsFragment.POPULARITY,
                    getIntent().getIntExtra(ProjectDetailsFragment.POPULARITY, 1));
            //arguments.putString(ProjectDetailsFragment.TEAMMEMBERS, getIntent().getStringExtra(ProjectDetailsFragment.TEAMMEMBERS));
            arguments.putParcelableArrayList(ProjectDetailsFragment.TEAMMEMBERS,
                    getIntent().getParcelableArrayListExtra(ProjectDetailsFragment.TEAMMEMBERS));
            arguments.putBoolean(ProjectDetailsFragment.ARG_2PANE,
                    getIntent().getBooleanExtra(ProjectDetailsFragment.ARG_2PANE, false));

            ProjectDetailsFragment fragment = new ProjectDetailsFragment();
            fragment.setArguments(arguments);
            fragment.setHasOptionsMenu(true);
            getSupportFragmentManager().beginTransaction().replace(R.id.ProjectDetails, fragment).commit();
        }
    }
}