
it.tidalwave.bluebill.mobile.android.news.NewsItemActivity Maven / Gradle / Ivy
/***********************************************************************************************************************
*
* blueBill Mobile - Android - open source birding
* Copyright (C) 2009-2011 by Tidalwave s.a.s. (http://www.tidalwave.it)
*
***********************************************************************************************************************
*
* 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.
*
***********************************************************************************************************************
*
* WWW: http://bluebill.tidalwave.it/mobile
* SCM: https://kenai.com/hg/bluebill~android-src
*
**********************************************************************************************************************/
package it.tidalwave.bluebill.mobile.android.news;
import android.content.Intent;
import javax.annotation.Nonnull;
import android.app.Activity;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;
import android.webkit.WebView;
import android.widget.TextView;
import it.tidalwave.bluebill.mobile.android.R;
import it.tidalwave.bluebill.mobile.android.util.CommonOptionsMenuController;
import it.tidalwave.mobile.android.util.UriEncoder;
import it.tidalwave.util.logging.Logger;
/***********************************************************************************************************************
*
* @stereotype View
* @stereotype Activity
*
* @author Fabrizio Giudici
* @version $Id$
*
**********************************************************************************************************************/
public class NewsItemActivity extends Activity
{
private static final String CLASS = NewsItemActivity.class.getName();
private static final Logger logger = Logger.getLogger(CLASS);
private final CommonOptionsMenuController commonOptionsMenuController = new CommonOptionsMenuController(this);
/*******************************************************************************************************************
*
*
******************************************************************************************************************/
@Override
protected void onCreate (final @Nonnull Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_news_item);
final Intent intent = getIntent();
((TextView)findViewById(R.id.tvDate)).setText(intent.getExtras().getString("date"));
((TextView)findViewById(R.id.tvTitle)).setText(intent.getExtras().getString("title"));
final String text = "" + UriEncoder.uriEncoded(intent.getExtras().getString("content")) + "";
final WebView webView = (WebView)findViewById(R.id.wvContent);
webView.setNetworkAvailable(false);
webView.loadData(text, "text/html", "utf-8");
}
/*******************************************************************************************************************
*
*
******************************************************************************************************************/
@Override
public boolean onCreateOptionsMenu (final @Nonnull Menu menu)
{
getMenuInflater().inflate(R.menu.news_options_menu, menu);
return true;
}
/*******************************************************************************************************************
*
*
******************************************************************************************************************/
@Override
public boolean onOptionsItemSelected (final @Nonnull MenuItem item)
{
return commonOptionsMenuController.onOptionsItemSelected(item);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy