Android Open Source - RateBeer-Mobile Mail View






From Project

Back to project page RateBeer-Mobile.

License

The source code is released under:

GNU General Public License

If you think the Android project RateBeer-Mobile 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

/*
 * Copyright 2010, Jesper Fussing Mrk/*w  w  w  .ja v  a2 s .c  o  m*/
 *
 * This file is part of Ratebeer Mobile for Android.
 *
 * Ratebeer Mobile 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.
 *
 * Ratebeer Mobile 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 Ratebeer Mobile.  If not, see <http://www.gnu.org/licenses/>.
 */
package dk.moerks.ratebeermobile;

import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;
import android.widget.Toast;
import dk.moerks.ratebeermobile.activity.BetterRBDefaultActivity;
import dk.moerks.ratebeermobile.task.DeleteBeermailTask;
import dk.moerks.ratebeermobile.task.RetrieveBeermailTask;
import dk.moerks.ratebeermobile.vo.Message;

public class MailView extends BetterRBDefaultActivity {
  //private static final String LOGTAG = "MailView";

    String messageId;
    String from;
    String senderId;
    String subject;
  private Button replyMailButton;
  
  @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.mailview);

        Bundle extras = getIntent().getExtras();
        if(extras !=null) {
          messageId = extras.getString("MESSAGEID");
          from = extras.getString("SENDER");
          senderId = extras.getString("SENDERID");
          subject = extras.getString("SUBJECT");
        } else {
          messageId = null;
          from = null;
          senderId = null;
          subject = null;
        }
        // We can already show the sender and subject
        showBasedInfo();

        if(messageId != null){
          // Retrieve the beermail message text
          new RetrieveBeermailTask(MailView.this).execute(messageId);
        }

        replyMailButton = (Button) findViewById(R.id.replyMailButton);
        // Disable the reply button until we have all the neccesary details
        replyMailButton.setEnabled(false);
        replyMailButton.setOnClickListener(new View.OnClickListener() {
          public void onClick(View v) {
              TextView messageTextT = (TextView) findViewById(R.id.mail_reply_message);
              Intent mailIntent = new Intent(MailView.this, MailAction.class);
              mailIntent.putExtra("ISREPLY", true);
              mailIntent.putExtra("MESSAGEID", messageId);
              mailIntent.putExtra("SENDER", from);
              mailIntent.putExtra("SENDERID", senderId);
              mailIntent.putExtra("SUBJECT", subject);
              mailIntent.putExtra("MESSAGE", messageTextT.getText());
              startActivity(mailIntent);  
            }
        });
        
        Button deleteMailButton = (Button) findViewById(R.id.deleteMailButton);
        deleteMailButton.setOnClickListener(new View.OnClickListener() {
          public void onClick(View v) {
            new DeleteBeermailTask(MailView.this).execute(messageId);
            }
        });
  }

  public void onBeermailRetrieved(Message result) {
    
    // Show the time and message text that we just retrieved from the server
        TextView timeText = (TextView) findViewById(R.id.mail_reply_time);
        TextView messageText = (TextView) findViewById(R.id.mail_reply_message);
        timeText.setText(result.getTime());
        messageText.setText(result.getMessage());
        
        // Enable the reply button now as well, since we have all needed info
        //replyMailButton.setEnabled(true);
  }

  public void showBasedInfo() {
    // Fill in the from and subject TextViews from the Intent extras
        TextView fromText = (TextView) findViewById(R.id.mail_reply_from);
        TextView subjectText = (TextView) findViewById(R.id.mail_reply_subject);
        fromText.setText(from);
        subjectText.setText(subject);
  }

  public void onBeermailDeleted(String result) {
    Toast.makeText(this, R.string.toast_mail_deleted, Toast.LENGTH_LONG).show();
  }
  
}




Java Source Code List

com.github.droidfu.DroidFuApplication.java
com.github.droidfu.DroidFu.java
com.github.droidfu.activities.BetterActivityHelper.java
com.github.droidfu.activities.BetterActivity.java
com.github.droidfu.activities.BetterDefaultActivity.java
com.github.droidfu.activities.BetterListActivity.java
com.github.droidfu.adapters.ListAdapterWithProgress.java
com.github.droidfu.concurrent.BetterAsyncTaskCallable.java
com.github.droidfu.concurrent.BetterAsyncTask.java
com.github.droidfu.services.BetterService.java
dk.moerks.ratebeermobile.BeerMail.java
dk.moerks.ratebeermobile.BeerView.java
dk.moerks.ratebeermobile.Home.java
dk.moerks.ratebeermobile.MailAction.java
dk.moerks.ratebeermobile.MailView.java
dk.moerks.ratebeermobile.PlaceView.java
dk.moerks.ratebeermobile.Places.java
dk.moerks.ratebeermobile.RateBeer.java
dk.moerks.ratebeermobile.Rate.java
dk.moerks.ratebeermobile.Rating.java
dk.moerks.ratebeermobile.Search.java
dk.moerks.ratebeermobile.Settings.java
dk.moerks.ratebeermobile.activity.BetterRBActivity.java
dk.moerks.ratebeermobile.activity.BetterRBDefaultActivity.java
dk.moerks.ratebeermobile.activity.BetterRBListActivity.java
dk.moerks.ratebeermobile.activity.RBActivity.java
dk.moerks.ratebeermobile.adapters.FeedAdapter.java
dk.moerks.ratebeermobile.adapters.MessageAdapter.java
dk.moerks.ratebeermobile.adapters.PlacesAdapter.java
dk.moerks.ratebeermobile.adapters.ReviewAdapter.java
dk.moerks.ratebeermobile.adapters.SearchAdapter.java
dk.moerks.ratebeermobile.exceptions.LocationException.java
dk.moerks.ratebeermobile.exceptions.LoginException.java
dk.moerks.ratebeermobile.exceptions.NetworkException.java
dk.moerks.ratebeermobile.exceptions.RBException.java
dk.moerks.ratebeermobile.exceptions.RBParserException.java
dk.moerks.ratebeermobile.io.NetBroker.java
dk.moerks.ratebeermobile.io.TwitterPoster.java
dk.moerks.ratebeermobile.overlays.PinOverlayItem.java
dk.moerks.ratebeermobile.receivers.BeerMailServiceReceiver.java
dk.moerks.ratebeermobile.receivers.BootReceiver.java
dk.moerks.ratebeermobile.services.BeerMailService.java
dk.moerks.ratebeermobile.services.BeerSearchHistoryProvider.java
dk.moerks.ratebeermobile.task.BarcodeLookupTask.java
dk.moerks.ratebeermobile.task.BetterRBTask.java
dk.moerks.ratebeermobile.task.DeleteBeermailTask.java
dk.moerks.ratebeermobile.task.PostTwitterStatusTask.java
dk.moerks.ratebeermobile.task.RefreshFriendFeedTask.java
dk.moerks.ratebeermobile.task.RetrieveBeerImageTask.java
dk.moerks.ratebeermobile.task.RetrieveBeerInfoTask.java
dk.moerks.ratebeermobile.task.RetrieveBeerReviewsTask.java
dk.moerks.ratebeermobile.task.RetrieveBeermailTask.java
dk.moerks.ratebeermobile.task.RetrieveBeermailsTask.java
dk.moerks.ratebeermobile.task.RetrievePlacesTask.java
dk.moerks.ratebeermobile.task.RetrieveRatingTask.java
dk.moerks.ratebeermobile.task.RetrieveUserIdTask.java
dk.moerks.ratebeermobile.task.SaveRatingTask.java
dk.moerks.ratebeermobile.task.SearchTask.java
dk.moerks.ratebeermobile.task.SendBeermailTask.java
dk.moerks.ratebeermobile.task.SetDrinkingBeerIdTask.java
dk.moerks.ratebeermobile.task.SetDrinkingStatusTask.java
dk.moerks.ratebeermobile.util.BCPParser.java
dk.moerks.ratebeermobile.util.RBJSONParser.java
dk.moerks.ratebeermobile.util.RBParser.java
dk.moerks.ratebeermobile.util.StringUtils.java
dk.moerks.ratebeermobile.vo.BeerInfo.java
dk.moerks.ratebeermobile.vo.Feed.java
dk.moerks.ratebeermobile.vo.MessageHeader.java
dk.moerks.ratebeermobile.vo.Message.java
dk.moerks.ratebeermobile.vo.PlacesInfo.java
dk.moerks.ratebeermobile.vo.RatingData.java
dk.moerks.ratebeermobile.vo.Review.java
dk.moerks.ratebeermobile.vo.SearchResult.java