チェンジセット 2324

差分発生行の前後
無視リスト:
コミット日時:
2009/03/08 20:30:33 (3 年前)
コミッタ:
uwi
ログメッセージ:

TwitterAPIからの取得
表示行への自動移動
パフォーマンスちょっと改善

ファイル:

凡例:

変更無し
追加
削除
更新
コピー
移動
  • air/TLife/src/Main.mxml

    r2323 r2324  
    9292                                this.nativeWindow.addEventListener(Event.CLOSING, onClosing); 
    9393                                 
    94                                 // debug 
    95                                 //var b : Balloon = new Balloon(); 
    96                                 //b.text = "にゃんにゃん"; 
    97                                 //b.timeout = 3000; 
    98                                 //b.open(true); 
    99                                  
    10094                                new MainThread().start(); 
    10195                        } 
     
    156150                                for each(var tab : XML in CommonData.configxml.main.tabbar.tab) { 
    157151                                        ar.push(tab.@name.toString()); 
    158                                         CommonData.tabmap[tab.@name.toString()] = {postid : -1, newestid : -1, notify : Boolean(tab.@notify)}; 
    159                                 } 
    160 //                              tabbar.titles.source = ["Recent", "Reply"]; 
     152                                        CommonData.tabmap[tab.@name.toString()] = {selectedid : -1, scrollposid : -1, newestid : -1, notify : Boolean(tab.@notify)}; 
     153                                } 
    161154                                tabbar.titles = new ArrayCollection(ar); 
    162155                                tabbar.changeLayout(); 
     
    281274                        } 
    282275                         
    283                         public function saveSelectedRow() : void 
     276                        /** 
     277                         * 選択行と表示行を保存 
     278                         */ 
     279                        public function saveRowInfo() : void 
    284280                        { 
    285281                                var tabname : String = tabbar.selectedTabName; 
    286282                                if (tabname == null) return; 
    287                                 CommonData.tabmap[tabname].postid = dg.selectedItem ? dg.selectedItem.postid : -1; 
    288                         } 
    289                          
     283                                CommonData.tabmap[tabname].selectedid = dg.selectedItem ? dg.selectedItem.postid : -1; 
     284                                if (timeline.length == 0) { 
     285                                        CommonData.tabmap[tabname].scrollposid = -1; 
     286                                }else{ 
     287                                        CommonData.tabmap[tabname].scrollposid = timeline.getItemAt(dg.verticalScrollPosition).postid; 
     288                                } 
     289                        } 
     290                         
     291                        /** 
     292                         * postidから行を検索 
     293                         * @param       query 
     294                         * @return 
     295                         */ 
    290296                        public function searchByPostID(query : Number) : int 
    291297                        { 
  • air/TLife/src/uwi/thread/ContextMenuItemEventThread.as

    r2323 r2324  
    2020        import uwi.db.SimpleTransactionThread; 
    2121        import uwi.twitter.TwitterPostThread; 
    22         import uwi.twitter.TwitterReloadThread; 
    2322        import uwi.twitter.TwitterAPI; 
     23        import uwi.twitter.TwitterScrapeThread; 
    2424        import uwi.ui.MultipleTabBar; 
    2525        import uwi.ui.TabConfig; 
     
    276276                                        // タイムラインをtwitterから取得 
    277277                                        var se : SerialExecutor = new SerialExecutor(); 
    278                                         se.addThread(new TwitterReloadThread(1, 2, title)); 
     278                                        se.addThread(new TwitterScrapeThread(1, title)); 
    279279                                        se.addThread(new TimelineThread(20)); 
    280280                                        se.start(); 
     
    308308                                        // タイムラインをtwitterから取得 
    309309                                        var se : SerialExecutor = new SerialExecutor(); 
    310                                         se.addThread(new TwitterReloadThread(1, 2, posterid)); 
    311                                         se.addThread(new TwitterReloadThread(1, 2, replyerid)); 
     310                                        se.addThread(new TwitterScrapeThread(1, posterid)); 
     311                                        se.addThread(new TwitterScrapeThread(1, replyerid)); 
    312312                                        se.addThread(new TimelineThread(20)); 
    313313                                        se.start(); 
  • air/TLife/src/uwi/thread/DataGridRoutineThread.as

    r2294 r2324  
    3434                public var flag : int = 0; 
    3535                public var suspended : Boolean = false; 
     36                public var suspended2 : Boolean = false; 
    3637                 
    3738                public function DataGridRoutineThread()  
    3839                {  
    3940                        super(CommonData.configxml.main.dg.interval, false); 
     41                        CommonData.dgrt = this; 
    4042                }  
    4143                 
    4244                protected override function onTimer() : void 
    4345                { 
    44                         if (flag == 0 || suspended) return; 
     46                        if (flag == 0 || suspended || suspended2) return; 
    4547                         
    4648                        var obj : Object = dg.selectedItem; 
     
    5153                        var index : int = dg.selectedIndex; 
    5254                         
    53                         if((flag & 2) != 0){ 
     55                        if ((flag & 2) != 0) { 
     56                                 
    5457                                // friendpost欄に表示 
    5558                                friendname.text = obj.postername + " / " + obj.posterid; 
  • air/TLife/src/uwi/thread/InitialMovementThread.as

    r2323 r2324  
    55        import org.libspark.thread.Thread; 
    66        import org.libspark.thread.utils.SerialExecutor; 
     7        import uwi.twitter.TwitterFriendsTimelineGetThread; 
    78        import uwi.twitter.TwitterLoginThread; 
    8         import uwi.twitter.TwitterReloadThread; 
     9        import uwi.twitter.TwitterScrapeThread; 
    910        import uwi.util.CommonData; 
    1011        import uwi.util.Utility; 
     
    5253                                // ログイン成功時 
    5354                                var se : SerialExecutor = new SerialExecutor(); 
    54                                 se.addThread(new TwitterReloadThread(1, int(CommonData.configxml.numpageget.recent) + 1)); 
    55 //                              se.addThread(new TimelineThread(CommonData.configxml.numstatusprint.recent)); 
    56                                 se.addThread(new NotifyNewThread()); 
     55                                se.addThread(new TwitterFriendsTimelineGetThread()); 
     56//                              se.addThread(new TwitterScrapeThread(int(CommonData.configxml.numpageget.recent))); 
     57                                se.addThread(new TimelineThread(CommonData.configxml.numstatusprint.recent)); 
     58//                              se.addThread(new NotifyNewThread()); 
    5759                                se.start(); 
    5860                                se.join(); 
  • air/TLife/src/uwi/thread/PostEventThread.as

    r2264 r2324  
    1111        import org.libspark.thread.Thread; 
    1212        import uwi.twitter.TwitterPostThread; 
    13         import uwi.twitter.TwitterReloadThread; 
     13        import uwi.twitter.TwitterScrapeThread; 
    1414        import uwi.util.CommonData; 
    1515         
     
    6868                         
    6969                        var tpt : TwitterPostThread = new TwitterPostThread( 
    70                                 "http://twitter.com/statuses/update.xml",  
     70                                "http://twitter.com/statuses/update.xml", 
    7171                                "status=" + decodeURI(postarea.text + footer) +  
    7272                                (CommonData.in_reply_to_status_id != "" ? "&in_reply_to_status_id=" + CommonData.in_reply_to_status_id : "") 
     
    8484                        charleft.text = CommonData.LIMLEN_POST.toString(); 
    8585                         
    86                         new TwitterReloadThread().start(); 
     86                        new TwitterScrapeThread().start(); 
    8787                        postbtn.enabled = true; 
    8888                        next(run); 
  • air/TLife/src/uwi/thread/ReloadEventThread.as

    r2264 r2324  
    66        import org.libspark.thread.Thread; 
    77        import org.libspark.thread.utils.SerialExecutor; 
    8         import uwi.twitter.TwitterReloadThread; 
     8        import uwi.twitter.TwitterScrapeThread; 
    99        import uwi.util.CommonData; 
    1010         
     
    3131                         
    3232                        var se : SerialExecutor = new SerialExecutor(); 
    33                         se.addThread(new TwitterReloadThread(1, int(CommonData.configxml.numpageget.recent) + 1)); 
     33                        se.addThread(new TwitterScrapeThread(int(CommonData.configxml.numpageget.recent))); 
    3434                        se.addThread(new TimelineThread(CommonData.configxml.numstatusprint.recent)); 
    3535                        se.start(); 
  • air/TLife/src/uwi/thread/ReloadTimerThread.as

    r2323 r2324  
    77        import org.libspark.thread.Thread; 
    88        import org.libspark.thread.utils.SerialExecutor; 
    9         import uwi.twitter.TwitterReloadThread; 
     9        import uwi.twitter.TwitterFriendsTimelineGetThread; 
     10        import uwi.twitter.TwitterScrapeThread; 
    1011        import uwi.util.CommonData; 
    1112         
     
    4849                         
    4950                        var se : SerialExecutor = new SerialExecutor(); 
    50                         se.addThread(new TwitterReloadThread(1, int(CommonData.configxml.numpageget.recent) + 1)); 
    51 //                      se.addThread(new TimelineThread(CommonData.configxml.numstatusprint.recent)); 
    52                         se.addThread(new NotifyNewThread()); 
     51                        se.addThread(new TwitterFriendsTimelineGetThread()); 
     52//                      se.addThread(new TwitterScrapeThread(int(CommonData.configxml.numpageget.recent))); 
     53                        se.addThread(new TimelineThread(CommonData.configxml.numstatusprint.recent)); 
     54//                      se.addThread(new NotifyNewThread()); 
    5355                        se.start(); 
    5456                        se.join(); 
  • air/TLife/src/uwi/thread/ReplyGetThread.as

    r2221 r2324  
    99        import org.libspark.thread.ThreadState; 
    1010        import uwi.db.DBSelectThread; 
     11        import uwi.twitter.TwitterBitScrapeThread; 
    1112        import uwi.twitter.TwitterBitStatusGetThread; 
    1213        import uwi.util.CommonData; 
     
    7374                        var ar : Array = ret.data; 
    7475                        if (ar == null) { 
    75                                 // DBに存在しない場合はとりに行く 
     76                                // postがDBに存在しない場合はとりに行く 
    7677                                if (retryct == 1) { 
     78//                                      tbsgt = new TwitterBitScrapeThread(posterid, postid); 
    7779                                        tbsgt = new TwitterBitStatusGetThread(posterid, postid); 
    7880                                        tbsgt.start(); 
     
    8183                                } 
    8284                        }else { 
    83                                 // DB存在している場合はreply欄に表示 
     85                                // postがDBに存在している場合はreply欄に表示 
    8486                                var obj : Object = ar[0]; 
    8587                                replyname.text = posterid; 
  • air/TLife/src/uwi/thread/StatusInsertThread.as

    r2221 r2324  
    5151                                stmt_rep_status.parameters[":content"] = status.content; 
    5252                                stmt_rep_status.parameters[":postedtime"] = status.postedtime; 
    53                                 stmt_rep_status.parameters[":replyid"] = status.replyid
     53                                stmt_rep_status.parameters[":replyid"] = status.replyid != "" ? status.replyid : 0
    5454                                stmt_rep_status.parameters[":fav"] = status.fav; 
    5555                                try { 
  • air/TLife/src/uwi/thread/TimelineThread.as

    r2323 r2324  
    77        import mx.core.Application; 
    88        import org.libspark.thread.Thread; 
     9        import org.libspark.thread.utils.ParallelExecutor; 
    910        import org.libspark.thread.utils.SerialExecutor; 
    1011        import uwi.db.DBSelectThread; 
     
    2829                 
    2930                private var dbst : DBSelectThread = null; 
    30                 private var se : SerialExecutor = null; 
     31                private var pe : ParallelExecutor = null; 
    3132                 
    3233                private var posterdata : Object; // <ID, poster> 
     
    3536                        this.prefetch = prefetch; 
    3637                        this.query = query; 
    37                         Application.application.saveSelectedRow(); 
    3838                } 
    3939                 
     
    4646                protected override function run() : void 
    4747                { 
     48                        // 選択行を保存 
     49                        Application.application.saveRowInfo(); 
     50                         
    4851                        if (tabbar.SelectedIndex == -1) return; 
    4952                         
     
    9699                        } 
    97100                         
     101                        timeline.disableAutoUpdate(); 
    98102                        timeline.removeAll(); 
    99103                         
     
    118122                                        }); 
    119123                                } 
     124                                 
     125                                // 行を選択、スクロールを移動 
    120126                                dg.callLater(function() : void {  
    121                                         var postid : Number = CommonData.tabmap[tabbar.selectedTabName].postid; 
    122                                         if (postid != -1) { 
    123                                                 dg.selectedIndex = Application.application.searchByPostID(postid); 
     127                                        var selectedid : Number = CommonData.tabmap[tabbar.selectedTabName].selectedid; 
     128                                        var scrollposid : Number = CommonData.tabmap[tabbar.selectedTabName].scrollposid; 
     129                                         
     130                                        if (selectedid != -1) { 
     131                                                dg.selectedIndex = Application.application.searchByPostID(selectedid); 
    124132                                        } 
     133                                         
     134                                        var scrollpos : int = Application.application.searchByPostID(scrollposid); 
     135                                        if (scrollpos != -1) { 
     136                                                dg.verticalScrollPosition = scrollpos; 
     137                                        } 
     138                                                 
    125139//                                      trace("state : " + CommonData.dget.state); 
    126140                                        CommonData.dget.flagChange(); 
    127141                                } ); 
    128142                                 
    129                                 se = new SerialExecutor(); 
     143                                pe = new ParallelExecutor(); 
    130144                                for (var posterid : String in posterdata) { 
    131145                                        var sql : String = "select screenname, iconurl from " + CommonData.TABLE_POSTER + " where posterid = '" + posterid + "'"; 
    132146                                        var ddbst : DBSelectThread = new DBSelectThread(CommonData.db_memory.conn, sql, prefetch); 
    133147                                        posterdata[posterid] = ddbst; 
    134                                         se.addThread(ddbst); 
    135                                 } 
    136                                 se.start(); 
    137                                 se.join(); 
     148                                        pe.addThread(ddbst); 
     149                                } 
     150                                pe.start(); 
     151                                pe.join(); 
    138152                                next(onSelectPosterComplete); 
    139153                        } 
     154                        timeline.enableAutoUpdate(); 
     155                        dg.offscreenExtraRowsOrColumns = dg.rowCount; 
     156                         
     157                        // timelineを書き換えている間はRoutineThreadをsuspendedに 
     158                        CommonData.dgrt.suspended2 = true; 
     159                         
    140160                        interrupted(onInterrupted); 
    141161                } 
     
    149169                        for (var posterid : String in posterdata) { 
    150170                                var ddbst : DBSelectThread = posterdata[posterid]; 
     171                                if (ddbst == null) { 
     172                                        trace("超なぞのエラー : " + posterid); 
     173                                } 
    151174                                var ret : SQLResult = ddbst.Result; 
    152175                                var ar : Array = ret.data; 
     
    166189                                } 
    167190                        } 
     191                         
     192                        // RoutineThreadのsuspendedを解除 
     193                        CommonData.dgrt.suspended2 = false; 
    168194                } 
    169195                 
     
    171197                { 
    172198                        if (dbst != null) dbst.interrupt(); 
    173                         if (se != null) se.interrupt(); 
     199                        if (pe != null) pe.interrupt(); 
    174200                } 
    175201        } 
  • air/TLife/src/uwi/twitter/TwitterBitStatusGetThread.as

    r2294 r2324  
    22{ 
    33        import flash.net.URLRequest; 
     4        import flash.net.URLRequestMethod; 
    45        import org.libspark.thread.Thread; 
    56        import org.libspark.thread.threads.net.URLLoaderThread; 
    67        import org.libspark.thread.utils.ParallelExecutor; 
     8        import org.libspark.thread.utils.SerialExecutor; 
    79        import uwi.bean.Status; 
    810        import uwi.db.SimpleTransactionThread; 
     
    1012        import uwi.thread.StatusInsertThread; 
    1113        import uwi.util.CommonData; 
    12         import uwi.util.StatusScraper; 
    1314         
    1415        /** 
    15          * Twitter単一ステータス取得用Thread 
     16         * ... 
    1617         * @author Uwi 
    1718         */ 
     
    2021                private var ult : URLLoaderThread = null; 
    2122                private var lrt : LinkResolveThread = null; 
    22                 private var pe : ParallelExecutor = null; 
    2323                 
    2424                private var s : Status = null; 
    25                  
     25                private var followers : int; 
    2626                private var posterid : String; 
    27                 private var postid : String; 
    2827                 
    2928                public function TwitterBitStatusGetThread(posterid : String, postid : String)  
    3029                { 
    3130                        this.posterid = posterid; 
    32                         this.postid = postid; 
     31                        var req : URLRequest = new URLRequest("http://twitter.com/statuses/show/" + postid + ".xml"); 
     32                        req.method = URLRequestMethod.POST; 
     33                        ult = new URLLoaderThread(req); 
    3334                } 
    3435                 
    3536                protected override function run() : void 
    3637                { 
    37                         trace("replyget : " + "https://twitter.com/" + posterid + "/status/" + postid); 
    38                         ult = new URLLoaderThread(new URLRequest("https://twitter.com/" + posterid + "/status/" + postid)); 
    3938                        ult.start(); 
    4039                        ult.join(); 
     
    4544                private function onGetComplete() : void 
    4645                { 
    47                         trace("getcomplete"); 
    48                         // スクレイピング 
    49                         var ret : Object = StatusScraper.scrapeBit(ult.loader.data); 
    50                         switch(ret.code) { 
    51                                 case 0: 
    52                                         // 正常 
    53                                         s = ret.status; 
    54                                         // リンク解決用Threadを走らせる 
    55                                         lrt = new LinkResolveThread(s.content); 
    56                                         lrt.start(); 
    57                                         lrt.join(); 
    58                                         next(resolveComplete); 
    59                                         break; 
    60                                 case 1: 
    61                                         // protected 
    62                                         // protected情報をDBにreplace 
    63                                         pe = new ParallelExecutor(); 
    64                                         var sql : String = "replace into " + CommonData.TABLE_RELATION + " (userid, posterid, following, protected, lastupdated) values ('" + CommonData.configxml.userid + "', '" + posterid + "', false, true, '" + new Date() + "')"; 
    65                                         pe.addThread(new SimpleTransactionThread(CommonData.db_memory.conn, sql)); 
    66                                         pe.addThread(new SimpleTransactionThread(CommonData.db_disk.conn, sql)); 
    67                                         pe.start(); 
    68                                         pe.join(); 
    69                                         break; 
    70                                 default: 
    71                                         break; 
    72                         } 
    73                         interrupted(onInterrupted); 
     46                        var status : XML = XML(ult.loader.data); 
     47                        // "Sun Mar 08 00:03:44 +0000 2009" 
     48                        var datestr : String = status.created_at; 
     49                        // "Sun Mar 08 00:03:44 UTC+0000 2009" にすればDateで読める。 
     50                        var postedtime : Date = new Date(datestr.substring(0, 20) + "UTC" + datestr.substring(20)); 
     51                         
     52                        followers = int(status.user.followers_count); 
     53                         
     54                        s = new Status(status.id, status.user.name, status.user.screen_name, status.text, status.in_reply_to_status_id, postedtime, status.user.profile_image_url, status.favorited == "true"); 
     55                        trace(s); 
     56                        lrt = new LinkResolveThread(s.content); 
     57                        lrt.start(); 
     58                        lrt.join(); 
     59                        next(onResolveComplete); 
    7460                } 
    7561                 
    76                 private function resolveComplete() : void 
     62                private function onResolveComplete() : void 
    7763                { 
    7864                        // リンク解決 
    79                         trace("resolvecomplete"); 
    8065                        s.content = lrt.dst; 
     66                         
     67                        // DBにinsert(replace, update) 
     68                        var se : SerialExecutor = new SerialExecutor(); 
     69                        var pe1 : ParallelExecutor = new ParallelExecutor(); 
     70                        var pe2 : ParallelExecutor = new ParallelExecutor(); 
     71                         
    8172                        var v : Vector.<Status> = Vector.<Status>([s]); 
     73                        pe1.addThread(new StatusInsertThread(CommonData.db_memory.conn, v, false)); 
     74                        pe1.addThread(new StatusInsertThread(CommonData.db_disk.conn, v, false)); 
     75                        se.addThread(pe1); 
    8276                         
    83                         // DBにinsert 
    84                         pe = new ParallelExecutor(); 
    85                         pe.addThread(new StatusInsertThread(CommonData.db_memory.conn, v, false)); 
    86                         pe.addThread(new StatusInsertThread(CommonData.db_disk.conn, v, false)); 
    87                         pe.start(); 
    88                         pe.join(); 
    89                         interrupted(onInterrupted); 
     77                        var sql : String = "update " + CommonData.TABLE_POSTER + " set" +  
     78                                " follower = " + followers +  
     79                                " where posterid = '" + posterid + "'"; 
     80                        pe2.addThread(new SimpleTransactionThread(CommonData.db_memory.conn, sql)); 
     81                        pe2.addThread(new SimpleTransactionThread(CommonData.db_disk.conn, sql)); 
     82                        se.addThread(pe2); 
     83                                 
     84                        se.start(); 
     85                        se.join(); 
    9086                } 
    9187                 
    9288                private function onInterrupted() : void 
    9389                { 
    94                         if (pe != null) pe.interrupt(); 
    9590                        if (ult != null) ult.interrupt(); 
    9691                        if (lrt != null) lrt.interrupt(); 
  • air/TLife/src/uwi/twitter/TwitterPostThread.as

    r2294 r2324  
    3838                { 
    3939                        if (eventname != null) { 
    40                                 Alert.show("なぞのエラー", "Login"); 
     40                                Alert.show("なぞのエラー", eventname); 
    4141                                StatusBarUtility.write(eventname + "失敗!"); 
    4242                        } 
  • air/TLife/src/uwi/util/CommonData.as

    r2323 r2324  
    1111        import uwi.migemo.AIRMigemo; 
    1212        import uwi.thread.DataGridEventThread; 
     13        import uwi.thread.DataGridRoutineThread; 
    1314        import uwi.thread.ReplyGetThread; 
    1415        import uwi.tinysegmenter.TinySegmenter; 
     
    3435                 
    3536                public static var dget : DataGridEventThread = null; 
     37                public static var dgrt : DataGridRoutineThread = null; 
    3638                 
    3739                public static const FILE_DB_MIGEMODICT : File = new File("app:/migemo-dict.db"); 
     
    7880                public static var dateformatter_timeline : DateFormatter; 
    7981                 
    80 //              public static var balloons : Vector.<Balloon> = new Vector.<Balloon>(); 
    8182                public static var balloons : Dictionary = new Dictionary(true); 
    8283                 
  • air/TLife/src/uwi/util/StatusScraper.as

    r2323 r2324  
    7777                                         
    7878                                        // replyid 
    79                                         var replyid : String = "0"; 
     79                                        var replyid : String = ""; 
    8080                                        var replytobase : int = str.indexOf(">in reply to"); 
    8181                                        if (replytobase != -1) { 
     
    214214                                 
    215215                                // replyid 
    216                                 var replyid : String = "0"; 
     216                                var replyid : String = ""; 
    217217                                var replytobase : int = entrymeta.indexOf(">in reply to"); 
    218218                                if (replytobase != -1) { 
     
    234234                { 
    235235                        try { 
    236                                 var following : int = StringUtility.pinch(src, "<span id=\"following_count\" class=\"stats_count numeric\">", "</span>") as int
    237                                 var follower : int = StringUtility.pinch(src, "<span id=\"follower_count\" class=\"stats_count numeric\">", "</span>") as int
    238                                 var update : int = StringUtility.pinch(src, "<span id=\"update_count\" class=\"stats_count numeric\">", "</span>") as int
     236                                var following : int = int(StringUtility.pinch(src, "<span id=\"following_count\" class=\"stats_count numeric\">", "</span>").replace(/,/g, ""))
     237                                var follower : int = int(StringUtility.pinch(src, "<span id=\"follower_count\" class=\"stats_count numeric\">", "</span>").replace(/,/g, ""))
     238                                var update : int = int(StringUtility.pinch(src, "<span id=\"update_count\" class=\"stats_count numeric\">", "</span>").replace(/,/g, ""))
    239239                        }catch (e : Error) { 
    240240                                trace(e.getStackTrace()); 
    241241                                return null; 
    242242                        } 
     243                        trace("fing : " + following + ", " + follower + ", " + update); 
     244                         
    243245                        return new PageData(following, follower, update); 
    244246                } 
  • air/TLife/src/uwi/util/StatusUtility.as

    r2323 r2324  
    6868                } 
    6969                 
    70                 public static const PREFIX_CUSTOMICONURL : String = "https://s3.amazonaws.com/twitter_production/profile_images/"; 
    71                 public static const PREFIX_DEFAULTICONURL : String = "https://static.twitter.com/images/default_profile"; 
     70                public static const PREFIX_CUSTOMICONURL : String = "http://s3.amazonaws.com/twitter_production/profile_images/"; 
     71                public static const PREFIX_CUSTOMICONURL2 : String = "https://s3.amazonaws.com/twitter_production/profile_images/"; 
     72                public static const PREFIX_DEFAULTICONURL : String = "http://static.twitter.com/images/default_profile"; 
     73                public static const PREFIX_DEFAULTICONURL2 : String = "https://static.twitter.com/images/default_profile"; 
    7274                 
    7375                /** 
     
    7981                public static function compressIconUrl(src : String) : String 
    8082                { 
    81                         if (src.substr(0, PREFIX_DEFAULTICONURL.length) == PREFIX_DEFAULTICONURL) { 
     83                        if (src.substr(0, PREFIX_DEFAULTICONURL.length) == PREFIX_DEFAULTICONURL || 
     84                                src.substr(0, PREFIX_DEFAULTICONURL2.length) == PREFIX_DEFAULTICONURL2 
     85                        ) { 
    8286                                return ""; 
    8387                        } 
    84                         if (src.substr(0, PREFIX_CUSTOMICONURL.length) == PREFIX_CUSTOMICONURL) { 
     88                        if (src.substr(0, PREFIX_CUSTOMICONURL.length) == PREFIX_CUSTOMICONURL || 
     89                                src.substr(0, PREFIX_CUSTOMICONURL2.length) == PREFIX_CUSTOMICONURL2 
     90                        ){ 
    8591                                var dot : int = src.lastIndexOf("."); 
    8692                                if (dot == -1) return ""; 
  • air/TLife/src/uwi/util/URLPostThread.as

    r2294 r2324  
    11package uwi.util  
    22{ 
     3        import flash.events.Event; 
    34        import flash.events.HTTPStatusEvent; 
    45        import flash.net.URLRequest; 
     
    1314        public class URLPostThread extends Thread  
    1415        { 
     16                protected var ult : URLLoaderThread; 
    1517                protected var url : String; 
    1618                protected var poststr : String; 
    17                 protected var time : int; 
     19                protected var timeout_ : int; 
     20                protected var response : Boolean; 
    1821                 
    19                 public function URLPostThread(url : String, poststr : String, time : int = 0) 
     22                /** 
     23                 *  
     24                 * @param       url 
     25                 * @param       poststr 
     26                 * @param       response trueならresponseを、falseならcontentをlistenする。 
     27                 * @param       timeout_ 
     28                 */ 
     29                public function URLPostThread(url : String, poststr : String, response : Boolean = true, timeout_ : int = 0) 
    2030                {  
    2131                        this.url = url; 
    2232                        this.poststr = poststr; 
    23                         this.time = time
     33                        this.timeout_ = timeout_
    2434                }  
    2535                 
     
    3040                        req.data = encodeURI(poststr); 
    3141                         
    32                         var ult : URLLoaderThread = new URLLoaderThread(req); 
     42                        ult = new URLLoaderThread(req); 
    3343                        ult.start(); 
    34                         ult.join(time); 
    35                         event(ult.loader, HTTPStatusEvent.HTTP_RESPONSE_STATUS, onResponse); 
     44                        ult.join(timeout_); 
     45                        if(response){ 
     46                                event(ult.loader, HTTPStatusEvent.HTTP_RESPONSE_STATUS, onResponse); 
     47                        }else { 
     48                                event(ult.loader, Event.COMPLETE, onComplete); 
     49                        } 
    3650                        error(Error, onError); 
    3751                        timeout(onTimeout); 
     
    5165                        trace(e.status); 
    5266                } 
     67                 
     68                protected function onComplete(e : Event) : void 
     69                { 
     70                        trace(ult.loader.data); 
     71                } 
    5372        } 
    5473