Android Open Source - RTwicuDROID R Twicudroid_ F U N C






From Project

Back to project page RTwicuDROID.

License

The source code is released under:

GNU General Public License

If you think the Android project RTwicuDROID 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 2012 Faisal Mooraby/* w w  w  .j  a v  a 2s . com*/

    This file is part of RTwicudroid.

    RTwicudroid 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.

    RTwicudroid 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 RTwicudroid.  If not, see <http://www.gnu.org/licenses/>
*/
package com.QualbSoft.RTwicudroid;

import java.text.DecimalFormat;
import java.util.Iterator;
import java.util.List;

import winterwell.jtwitter.Twitter;
import winterwell.jtwitter.Status;

public class RTwicudroid_FUNC {

public static class TweetSet{
  public Status[] twitterstatus;
  public String[] twittertext;
  
  public TweetSet(List<Status> ts_tweetlist){
    Status[] tstatuses=new Status[ts_tweetlist.size()];
    
    Iterator itrtr = ts_tweetlist.iterator();
    String screenname;
    String tweeps;
    int tweethr;
    int tweetmin;
    int tweetsec;
    String tweettime_s;
    String[] tweetlist = new String[ts_tweetlist.size()];

    DecimalFormat dbldigit = new DecimalFormat("00");

    int numtweets = 0;
    while (itrtr.hasNext()) {

      Status tstatus = (Status) itrtr.next();
      
      screenname = tstatus.user.screenName;
      tweeps = tstatus.text;
      tweethr = tstatus.createdAt.getHours();
      tweetmin = tstatus.createdAt.getMinutes();
      tweetsec = tstatus.createdAt.getSeconds();

      tweettime_s = dbldigit.format(tweethr) + ":"
          + dbldigit.format(tweetmin) + ":"
          + dbldigit.format(tweetsec);

      String toreplace = "&quot";
      String replacewith = "'";

      if (tweeps.startsWith("RT @", 0) == false) {
        tweetlist[numtweets] = screenname + ": \n" + tweeps + "\nposted at " + tweettime_s;
        tweetlist[numtweets].replaceAll(toreplace, replacewith);
        tstatuses[numtweets]=tstatus;
        numtweets += 1;
      }
    }

    twittertext = new String[numtweets];
    twitterstatus = new Status[numtweets];
    int i;
    for (i = 0; i < numtweets; i++) {
      twittertext[i] = tweetlist[i];
      twitterstatus[i]=tstatuses[i];
    }

  }
  public TweetSet(List<Status> ts_tweetlist, String s_user){
    Status[] tstatuses=new Status[ts_tweetlist.size()];
    
    Iterator itrtr = ts_tweetlist.iterator();
    String screenname;
    String tweeps;
    int tweethr;
    int tweetmin;
    int tweetsec;
    String tweettime_s;
    String[] tweetlist = new String[ts_tweetlist.size()];

    DecimalFormat dbldigit = new DecimalFormat("00");

    int numtweets = 0;
    while (itrtr.hasNext()) {

      Status tstatus = (Status) itrtr.next();
      
      screenname = tstatus.user.screenName;
      tweeps = tstatus.text;
      tweethr = tstatus.createdAt.getHours();
      tweetmin = tstatus.createdAt.getMinutes();
      tweetsec = tstatus.createdAt.getSeconds();

      tweettime_s = dbldigit.format(tweethr) + ":"
          + dbldigit.format(tweetmin) + ":"
          + dbldigit.format(tweetsec);

      String toreplace = "&quot";
      String replacewith = "'";

      if (tweeps.startsWith("RT @", 0) == false) {
        if(screenname.equals(s_user)){
          tweetlist[numtweets] = screenname + ": \n" + tweeps + "\nposted at " + tweettime_s;
          tweetlist[numtweets].replaceAll(toreplace, replacewith);
          tstatuses[numtweets]=tstatus;
          numtweets += 1;
        }
      }
    }

    if (numtweets==0){
      twittertext=null;
      twitterstatus=null;
    }else{
      twittertext = new String[numtweets];
      twitterstatus = new Status[numtweets];
      int i;
      for (i = 0; i < numtweets; i++) {
        twittertext[i] = tweetlist[i];
        twitterstatus[i]=tstatuses[i];
      }
    }
  }
}


}




Java Source Code List

com.QualbSoft.RTwicudroid.CloseALL.java
com.QualbSoft.RTwicudroid.CreateOauth.java
com.QualbSoft.RTwicudroid.RTwicudroidActivity.java
com.QualbSoft.RTwicudroid.RTwicudroid_DisplayRTMenu.java
com.QualbSoft.RTwicudroid.RTwicudroid_FUNC.java
com.QualbSoft.RTwicudroid.RTwicudroid_Indv.java
com.QualbSoft.RTwicudroid.RTwicudroid_STATIC.java
com.QualbSoft.RTwicudroid.RTwicudroid_TAB.java
com.QualbSoft.RTwicudroid.RTwicudroid_TimeLine.java
com.QualbSoft.RTwicudroid.RTwicudroid_Tweetit.java
com.QualbSoft.RTwicudroid.TwitterRegister.java