チェンジセット 2135

差分発生行の前後
無視リスト:
コミット日時:
2009/01/12 02:40:12 (3 年前)
コミッタ:
uwi
ログメッセージ:

TwitterAPIまわりとfavの色つけ

ファイル:

凡例:

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

    r2134 r2135  
    162162                                                </mx:DataGridColumn> 
    163163                                                --> 
    164                                                 <mx:DataGridColumn headerText="Name" dataField="postername" width="70" /> 
    165                                                 <mx:DataGridColumn headerText="ID" dataField="posterid" width="40" /> 
     164                                                <mx:DataGridColumn headerText="Name" dataField="postername" width="70" showDataTips="true" dataTipField="postername" itemRenderer="uwi.ui.TimelineRenderer" /> 
     165                                                <mx:DataGridColumn headerText="ID" dataField="posterid" width="40" showDataTips="true" dataTipField="posterid" itemRenderer="uwi.ui.TimelineRenderer" /> 
    166166                                                <mx:DataGridColumn headerText="Content" dataField="content" width="100" showDataTips="true" dataTipField="content" itemRenderer="uwi.ui.TimelineRenderer" /> 
    167                                                 <mx:DataGridColumn headerText="Time" dataField="postedtime" width="60" /> 
     167                                                <mx:DataGridColumn headerText="Time" dataField="postedtime" width="60" showDataTips="true" dataTipField="postedtime" itemRenderer="uwi.ui.TimelineRenderer" /> 
    168168                                        </uwi:columns> 
    169169                                </uwi:DataGridEx> 
  • air/TLife/src/uwi/db/DB.as

    r2134 r2135  
    3737                                "postedtime date not null," +  
    3838                                "replyid integer not null check(replyid >= 0)," + 
     39                                "fav boolean not null," +  
    3940                                "primary key(userid, postid)" +  
    4041                                ")"); 
  • air/TLife/src/uwi/thread/ContextMenuItemEventThread.as

    r2134 r2135  
    3535                private var item_follow : ContextMenuItem; 
    3636                private var item_remove : ContextMenuItem; 
    37                 private var item_block : ContextMenuItem; 
    3837                private var item_personalTL : ContextMenuItem; 
    3938                private var item_pairTL : ContextMenuItem; 
     
    5857                        item_follow = new ContextMenuItem("follow"); 
    5958                        item_remove = new ContextMenuItem("remove"); 
    60                         item_block = new ContextMenuItem("block"); 
    6159                        item_personalTL = new ContextMenuItem("パーソナルタイムライン"); 
    6260                        item_pairTL = new ContextMenuItem("ペアタイムライン"); 
     
    7068                        dgcm.customItems.push(item_follow); 
    7169                        dgcm.customItems.push(item_remove); 
    72                         dgcm.customItems.push(item_block); 
    7370                        dgcm.customItems.push(item_personalTL); 
    7471                        dgcm.customItems.push(item_pairTL); 
     
    9491                        event(item_follow, ContextMenuEvent.MENU_ITEM_SELECT, onFollow); 
    9592                        event(item_remove, ContextMenuEvent.MENU_ITEM_SELECT, onRemove); 
    96                         event(item_block, ContextMenuEvent.MENU_ITEM_SELECT, onBlock); 
    9793                        event(item_personalTL, ContextMenuEvent.MENU_ITEM_SELECT, onPersonalTL); 
    9894                        event(item_pairTL, ContextMenuEvent.MENU_ITEM_SELECT, onPairTL); 
     
    125121                        if (dg.selectedIndex != -1) { 
    126122                                for each(var ind : int in dg.selectedIndices) { 
    127                                         var postid : String = CommonData.timeline.getItemAt(ind).postid
    128                                         new TwitterPostThread("http://twitter.com/favorites/create/" + postid + ".json", "id=" + postid, "Fav").start(); 
     123                                        TwitterUtility.fav(CommonData.timeline.getItemAt(ind).postid)
     124                                        // favのチェックと更新 
    129125                                } 
    130126                        } 
     
    136132                        if (dg.selectedIndex != -1) { 
    137133                                for each(var ind : int in dg.selectedIndices) { 
    138                                         var postid : String  = CommonData.timeline.getItemAt(ind).postid
    139                                         new TwitterPostThread("http://twitter.com/favorites/destroy/" + postid + ".json", "id=" + postid, "Fav削除").start(); 
     134                                        TwitterUtility.favdel(CommonData.timeline.getItemAt(ind).postid)
     135                                        // favのチェックと更新 
    140136                                } 
    141137                        } 
     
    145141                private function onFollow(e : ContextMenuEvent) : void 
    146142                { 
     143                        if (dg.selectedIndex != -1) { 
     144                                for each(var ind : int in dg.selectedIndices) { 
     145                                        TwitterUtility.follow(CommonData.timeline.getItemAt(ind).posterid); 
     146                                        // followのチェックと更新 
     147                                } 
     148                        } 
    147149                        next(run); 
    148150                } 
     
    150152                private function onRemove(e : ContextMenuEvent) : void 
    151153                { 
    152                         next(run); 
    153                 } 
    154                  
     154                        if (dg.selectedIndex != -1) { 
     155                                for each(var ind : int in dg.selectedIndices) { 
     156                                        TwitterUtility.remove(CommonData.timeline.getItemAt(ind).posterid); 
     157                                        // followのチェックと更新 
     158                                } 
     159                        } 
     160                        next(run); 
     161                } 
     162                 
     163                /* 
    155164                private function onBlock(e : ContextMenuEvent) : void 
    156165                { 
    157                         next(run); 
    158                 } 
     166                        if (dg.selectedIndex != -1) { 
     167                                for each(var ind : int in dg.selectedIndices) { 
     168                                        TwitterUtility.block(CommonData.timeline.getItemAt(ind).posterid); 
     169                                } 
     170                        } 
     171                        next(run); 
     172                } 
     173                 
     174                private function onBlockDel(e : ContextMenuEvent) : void 
     175                { 
     176                        if (dg.selectedIndex != -1) { 
     177                                for each(var ind : int in dg.selectedIndices) { 
     178                                        TwitterUtility.blockdel(CommonData.timeline.getItemAt(ind).posterid); 
     179                                } 
     180                        } 
     181                        next(run); 
     182                } 
     183                */ 
    159184                 
    160185                // TODO debug 
  • air/TLife/src/uwi/thread/StatusInsertThread.as

    r2128 r2135  
    3737                        var stmt : SQLStatement = new SQLStatement(); 
    3838                        stmt.sqlConnection = conn; 
    39                         stmt.text = "replace into " + CommonData.TABLE_STATUS + " (userid, postid, posterid, content, postedtime, replyid) values (:userid, :postid, :posterid, :content, :postedtime, :replyid)"; 
     39                        stmt.text = "replace into " + CommonData.TABLE_STATUS + " (userid, postid, posterid, content, postedtime, replyid, fav) values (:userid, :postid, :posterid, :content, :postedtime, :replyid, :fav)"; 
    4040                        var postermap : Object = {}; 
    4141                         
     
    4848                                stmt.parameters[":postedtime"] = status.postedtime; 
    4949                                stmt.parameters[":replyid"] = status.replyid; 
     50                                stmt.parameters[":fav"] = status.fav; 
    5051                                try { 
    5152                                        stmt.execute(); 
  • air/TLife/src/uwi/thread/TimelineThread.as

    r2134 r2135  
    3333                { 
    3434                        var tabname : String = tabbar.titles.getItemAt(tabbar.SelectedIndex) as String; 
    35                         var sqlbase : String = "select postid, posterid, content, postedtime, replyid from " +  
     35                        var sqlbase : String = "select postid, posterid, content, postedtime, replyid, fav from " +  
    3636                                                                        CommonData.TABLE_STATUS +  
    3737                                                                        " where userid = '" + CommonData.username + "'"; 
     
    8787                                                replyid : obj.replyid, 
    8888                                                rawcontent : obj.content, 
    89                                                 fav : false 
     89                                                fav : obj.fav 
    9090                                        }); 
    9191                                } 
  • air/TLife/src/uwi/twitter/TwitterUtility.as

    r1957 r2135  
    1010        public class TwitterUtility  
    1111        { 
    12                 public static function fav(to : String) : void 
     12                public static function fav(postid : String) : void 
    1313                { 
    14                         new URLLoaderThread(new URLRequest("http://twitter.com/favourings/create/" + to)).start(); 
     14                        new TwitterPostThread("http://twitter.com/favorites/create/" + postid + ".xml", "id=" + postid, "Fav").start(); 
    1515                } 
    1616                 
    17                 public static function favdel(to : String) : void 
     17                public static function favdel(postid : String) : void 
    1818                { 
    19                         new URLLoaderThread(new URLRequest("http://twitter.com/favourings/destroy/" + to)).start(); 
     19                        new TwitterPostThread("http://twitter.com/favorites/destroy/" + postid + ".xml", "id=" + postid, "Fav削除").start(); 
    2020                } 
    2121                 
     22                public static function follow(posterid : String) : void 
     23                { 
     24                        new TwitterPostThread("http://twitter.com/friendships/create/" + posterid + ".xml", "id=" + posterid, "follow").start(); 
     25                } 
     26                 
     27                public static function remove(posterid : String) : void 
     28                { 
     29                        new TwitterPostThread("http://twitter.com/friendships/destroy/" + posterid + ".xml", "id=" + posterid, "remove").start(); 
     30                } 
     31                 
     32                public static function block(posterid : String) : void 
     33                { 
     34                        new TwitterPostThread("http://twitter.com/blocks/create/" + posterid + ".xml", "id=" + posterid, "block").start(); 
     35                } 
     36                 
     37                public static function blockdel(posterid : String) : void 
     38                { 
     39                        new TwitterPostThread("http://twitter.com/blocks/destroy/" + posterid + ".xml", "id=" + posterid, "blockdel").start(); 
     40                } 
    2241        } 
    2342         
  • air/TLife/src/uwi/ui/TimelineRenderer.as

    r2109 r2135  
    22{ 
    33        import mx.controls.dataGridClasses.DataGridItemRenderer; 
     4        import mx.controls.dataGridClasses.DataGridListData; 
     5        import uwi.util.CommonData; 
    46         
    57        /** 
     
    1719                { 
    1820                        super.data = value; 
    19 //                      var dgld : DataGridListData = super.listData as DataGridListData; 
    2021                         
    21 //                      if(dgld.columnIndex == 2){ 
    22                                 if (value.fav == true) { 
    23                                         setStyle("color", 0xff0000); 
    24                                 }else { 
    25                                         setStyle("color", 0x000000); 
    26                                 } 
    27 //                      } 
     22                        var status : Object = CommonData.timeline.getItemAt((super.listData as DataGridListData).rowIndex); 
     23                        if (status.fav == true) { 
     24                                setStyle("color", 0xff0000); 
     25                        }else { 
     26                                setStyle("color", 0x000000); 
     27                        } 
    2828                } 
    2929        }