Android Open Source - info-mailer Main Activity






From Project

Back to project page info-mailer.

License

The source code is released under:

MIT License

If you think the Android project info-mailer 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 hu.thewolf.infomailer;
//from ww  w  .java2 s .  c  o  m
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.Menu;
import android.view.View;
import android.view.View.OnClickListener;

public class MainActivity extends Activity {

  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
//    findViewById(R.id.startBtn).setOnClickListener(new OnClickListener() {
//      
//      @Override
//      public void onClick(View v) {
//        ArrayList<Pair<String, String>> smses = new ArrayList<Pair<String,String>>();
//        for (int i=0; i<5; i++) {
//          smses.add(new Pair<String,String>(StringEscapeUtils.escapeHtml4("+3620999999"+i), StringEscapeUtils.escapeHtml4("message <b>no</b>. "+i + "&amp;dsfsd")));
//        }
//        smses.add(new Pair<String,String>(StringEscapeUtils.escapeHtml4("SMS"), StringEscapeUtils.escapeHtml4("message from SMS")));
//        boolean success = true; 
//        
//        Intent eMailIntent = new Intent(MainActivity.this, NotifierService.class);
//        String now = android.text.format.DateFormat.format(DATEFORMAT, new Date()).toString();
//        if (smses.isEmpty()) {
//          eMailIntent.putExtra(NotifierService.SUBJECT, "Something went wrong, 0 sms loaded");
//          eMailIntent.putExtra(NotifierService.BODY, "It's not even an exception!");
//        } else {
//          if (smses.size() > 1) {        
//            eMailIntent.putExtra(NotifierService.SUBJECT, "New messages" + (success?"":": some failed to receive"));
//          } else {
//            eMailIntent.putExtra(NotifierService.SUBJECT, "New message" + (success?" from: " + smses.get(0).first:": failed to recieve"));
//          }
//            StringBuilder sb = new StringBuilder();
//            sb.append("At ").append(now).append(SEP).append(SEP);
//            for (Pair<String, String> p : smses) {
//              boolean number = StringUtils.isNumeric(p.first) || (p.first.startsWith("+") && StringUtils.isNumeric(p.first.substring(1)));
//              sb.append("From: ");
//              if (number) {
//                sb.append("<a href=\"tel:").append(p.first).append("\">").append(p.first).append("</a>");
//                //sb.append(SEP).append("<a href=\"sms:").append(p.first).append("\">").append("[Reply]").append("</a>")
//              } else {
//                sb.append(p.first);
//              }
//              sb.append(SEP).append("Text:").append(SEP).append(p.second).append(SEP).append("---------").append(SEP);
//            }
//            eMailIntent.putExtra(NotifierService.BODY, sb.toString());
//        }
//        startService(eMailIntent);        
//      }
//    });
//    
//    findViewById(R.id.stopBtn).setOnClickListener(new OnClickListener() {
//      
//      @Override
//      public void onClick(View v) {
////        Intent intent = new Intent(MainActivity.this, NotifierService.class);
////        stopService(intent);
//        
//      }
//    });
    
    findViewById(R.id.sendBtn).setOnClickListener(new OnClickListener() {
      
      @Override
      public void onClick(View v) {
        Intent eMailIntent = new Intent(MainActivity.this, NotifierService.class);
        eMailIntent.putExtra(NotifierService.SUBJECT, "InfoMailer test mail");
        eMailIntent.putExtra(NotifierService.BODY, "[test body]");
        startService(eMailIntent);
        
      }
    });
  }

  @Override
  public boolean onCreateOptionsMenu(Menu menu) {
    // Inflate the menu; this adds items to the action bar if it is present.
    getMenuInflater().inflate(R.menu.main, menu);
    return true;
  }
  
}




Java Source Code List

com.android.internal.telephony.ITelephony.java
hu.thewolf.infomailer.CONSTANTS.java
hu.thewolf.infomailer.IncomingPhoneStateListener.java
hu.thewolf.infomailer.Mail.java
hu.thewolf.infomailer.MainActivity.java
hu.thewolf.infomailer.NotifierService.java
hu.thewolf.infomailer.SMSandPhoneReceiver.java