Android Open Source - GuildViewerApp2 News Detail Activity






From Project

Back to project page GuildViewerApp2.

License

The source code is released under:

Apache License

If you think the Android project GuildViewerApp2 listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package com.skywomantechnology.app.guildviewer;
//from  ww  w  .ja  va2 s.c  om
/*
 * Guild Viewer is an Android app that allows users to view news feeds and news feed details
 * on a mobile device and while not logged into the game servers.
 *
 * Copyright 2014 Sky Woman Technology LLC
 *
 *    Licensed under the Apache License, Version 2.0 (the "License");
 *    you may not use this file except in compliance with the License.
 *    You may obtain a copy of the License at
 *
 *        http://www.apache.org/licenses/LICENSE-2.0
 *
 *    Unless required by applicable law or agreed to in writing, software
 *    distributed under the License is distributed on an "AS IS" BASIS,
 *    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 *    See the License for the specific language governing permissions and
 *    limitations under the License.
 */

import android.app.Activity;
import android.os.Bundle;
import android.support.v4.app.NavUtils;
import android.view.MenuItem;


/**
 * An activity representing a single News detail screen. This
 * activity is only used on handset devices. On tablet-size devices,
 * item details are presented side-by-side with a list of items
 * in a {@link NewsListActivity}.
 * <p>
 * This activity is mostly just a 'shell' activity containing nothing
 * more than a {@link NewsDetailFragment}.
 */
public class NewsDetailActivity extends Activity {

    //public final String LOG_TAG = NewsDetailActivity.class.getSimpleName();

    /**
     * Handle the creation of the activity, see if there was previously a news item id
     *
     * @param savedInstanceState bundle with information a new instance would need to work right
     */
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_news_detail);
        try {
            //noinspection ConstantConditions
            getActionBar().setDisplayHomeAsUpEnabled(true);
        }catch (NullPointerException e) {
            // ignore NullPointerException
        }

        if (savedInstanceState == null) {
            Bundle arguments = new Bundle();
            arguments.putLong(NewsListFragment.NEWS_ID_KEY,
                    getIntent().getLongExtra(NewsListFragment.NEWS_ID_KEY, -1));
            NewsDetailFragment fragment = new NewsDetailFragment();
            fragment.setArguments(arguments);
            getFragmentManager().beginTransaction()
                    .add(R.id.news_detail_container, fragment)
                    .commit();
        }
    }

    /**
     *  process the selected options items
     *
     * @param item menu item
     * @return true if processed
     */
    @Override
    public boolean onOptionsItemSelected(MenuItem item) {
        int id = item.getItemId();
        if (id == android.R.id.home) {
            // This ID represents the Home or Up button.
            NavUtils.navigateUpFromSameTask(this);
            return true;
        }
        return super.onOptionsItemSelected(item);
    }
}




Java Source Code List

com.skywomantechnology.app.guildviewer.Constants.java
com.skywomantechnology.app.guildviewer.NewsAdapter.java
com.skywomantechnology.app.guildviewer.NewsDetailActivity.java
com.skywomantechnology.app.guildviewer.NewsDetailFragment.java
com.skywomantechnology.app.guildviewer.NewsListActivity.java
com.skywomantechnology.app.guildviewer.NewsListFragment.java
com.skywomantechnology.app.guildviewer.SetPreferenceActivity.java
com.skywomantechnology.app.guildviewer.SettingsFragment.java
com.skywomantechnology.app.guildviewer.Utility.java
com.skywomantechnology.app.guildviewer.data.GuildViewerAchievement.java
com.skywomantechnology.app.guildviewer.data.GuildViewerContract.java
com.skywomantechnology.app.guildviewer.data.GuildViewerDbHelper.java
com.skywomantechnology.app.guildviewer.data.GuildViewerGuild.java
com.skywomantechnology.app.guildviewer.data.GuildViewerItem.java
com.skywomantechnology.app.guildviewer.data.GuildViewerMember.java
com.skywomantechnology.app.guildviewer.data.GuildViewerNewsItem.java
com.skywomantechnology.app.guildviewer.data.NewsProvider.java
com.skywomantechnology.app.guildviewer.sync.GuildViewerAuthenticatorService.java
com.skywomantechnology.app.guildviewer.sync.GuildViewerAuthenticator.java
com.skywomantechnology.app.guildviewer.sync.GuildViewerSyncAdapter.java
com.skywomantechnology.app.guildviewer.sync.GuildViewerSyncService.java