チェンジセット 2650

差分発生行の前後
無視リスト:
コミット日時:
2009/05/16 00:04:27 (3 年前)
コミッタ:
uwi
ログメッセージ:

未読管理の修正
表示の高速化

ファイル:

凡例:

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

    r2642 r2650  
    201201                                                scrollposid : -1, 
    202202                                                newestid : -1,  
    203                                                 unread : {}, 
    204203                                                numnotify : int(tab.@numnotify), 
    205204                                                numdisplay : int(tab.@numdisplay), 
     
    279278        // キーバインド 
    280279        var keybindkeywords : Array = [ 
    281           "isearchcontent", "isearchscreenname", "ifiltercontent", "ifilterscreenname", 
    282           "jumptotimeline", "jumptopostarea", "replyatpostarea", "replyattimeline", 
    283           "downatpostarea", "upatpostarea", "leftatpostarea", "rightatpostarea" 
     280          "isearchcontent", "isearchscreenname",  
     281          "ifiltercontent", "ifilterscreenname", 
     282          "jumptotimeline", "jumptopostarea",  
     283          "replyatpostarea", "replyattimeline", 
     284          "downatpostarea", "upatpostarea",  
     285          "sameuserbackwardatpostarea", "sameuserbackwardattimeline",  
     286          "sameuserforwardatpostarea", "sameuserforwardattimeline" 
    284287          ]; 
    285288        CommonData.keybindjudgers = { }; 
  • air/TLife/trunk/src/uwi/search/Searcher.as

    r2634 r2650  
    190190          rule : conds.join(" and "), 
    191191          type : 1, 
    192           unread : {}, 
    193192          numdisplay : 0, 
    194193          numnotify : 0, 
  • air/TLife/trunk/src/uwi/thread/TimelineThread.as

    r2634 r2650  
    6262      if (tabbar.SelectedIndex == -1) return; 
    6363       
    64       tabname = tabbar.titles.getItemAt(tabbar.SelectedIndex).toString()
     64      tabname = tabbar.selectedTabName
    6565      tabinfo = CommonData.tabmap[tabname]; 
    6666       
     
    145145          posteridset[obj.posterid] = null; 
    146146           
    147           if (manageunread == 1) { 
    148             if (tabinfo.unread[obj.postid] != null) { 
    149               // すでに既読未読が設定されていた場合tabinfoに従う 
    150               obj.unread = tabinfo.unread[obj.postid]; 
    151             }else { 
    152               // それ以外はすべて未読 
    153               obj.unread = true; 
    154               tabinfo.unread[obj.postid] = true; 
    155             } 
    156           } 
    157            
     147          // すべて未読リストに追加 
     148          if(tabinfo.type == 0){ 
     149            if (!CommonData.unreadset[obj.postid]) CommonData.unreadset[obj.postid] = 1; 
     150          } 
     151             
    158152          timeline.addItem(obj); 
    159153        } 
  • air/TLife/trunk/src/uwi/thread/event/ContextMenuItemEventThread.as

    r2634 r2650  
    387387          newestid : -1,  
    388388          rule : "", 
    389           unread : {}, 
    390389          numnotify : -1, 
    391390          manageunread : -1, 
  • air/TLife/trunk/src/uwi/thread/event/DataGridEventThread.as

    r2634 r2650  
    44  import flash.events.KeyboardEvent; 
    55  import flash.events.MouseEvent; 
    6   import flash.ui.Keyboard
     6  import flash.utils.getTimer
    77  import mx.collections.ArrayCollection; 
    88  import mx.controls.listClasses.IListItemRenderer; 
    99  import mx.core.Application; 
    10   import mx.events.FlexEvent; 
    1110  import mx.events.ScrollEvent; 
    1211  import org.libspark.thread.Thread; 
     
    1413  import uwi.ui.multipletabbar.MultipleTabBar; 
    1514  import uwi.util.CommonData; 
     15  import uwi.util.EventThread; 
     16  import uwi.util.Utility; 
    1617   
    1718  /** 
     
    2425    private var tabbar : MultipleTabBar = Application.application.tabbar; 
    2526    private var timeline : ArrayCollection = Application.application.timeline; 
     27    private var sub : EventThread; 
    2628     
    2729    public function DataGridEventThread()  
     
    3032    }  
    3133     
     34    protected override function finalize() : void 
     35    { 
     36      sub = null; 
     37    } 
     38     
    3239    protected override function run() : void  
    3340    {  
     41      sub = new EventThread(datagrid, Event.CHANGE, onChange); 
     42      sub.start(); 
     43      waitEvents(); 
     44    } 
     45     
     46    private function waitEvents() : void 
     47    { 
    3448      event(datagrid, MouseEvent.DOUBLE_CLICK, onDoubleClick); 
    3549      event(datagrid, MouseEvent.RIGHT_MOUSE_DOWN, onRightClick); 
    36       event(datagrid, Event.CHANGE, onChange); 
    3750      event(datagrid, KeyboardEvent.KEY_DOWN, onKeyDown); 
     51      event(datagrid, KeyboardEvent.KEY_UP, onKeyUp); 
    3852      event(datagrid, ScrollEvent.SCROLL, onScroll); 
    3953    } 
     
    4256    { 
    4357      CommonData.datagridroutineflag |= 1; 
    44       next(run); 
     58      next(waitEvents); 
    4559    } 
    4660     
     
    5569        Application.application.appendReply(datagrid.selectedItem); 
    5670      } 
    57       next(run); 
     71      next(waitEvents); 
    5872    } 
    5973 
     
    6983        CommonData.datagridroutineflag |= 3; 
    7084      } 
    71       next(run); 
     85      next(waitEvents); 
    7286    } 
    7387     
     
    7993    private function onKeyDown(e : KeyboardEvent) : void 
    8094    { 
    81       if (datagrid.selectedIndex != -1){ 
    82         switch(e.keyCode) { 
    83         case Keyboard.RIGHT: 
    84           datagrid.selectedIndex = searchSamePoster(datagrid.selectedIndex, 1); 
    85           datagrid.scrollToIndex(datagrid.selectedIndex); 
    86           CommonData.datagridroutineflag |= 3; 
    87           break; 
    88         case Keyboard.LEFT: 
    89           datagrid.selectedIndex = searchSamePoster(datagrid.selectedIndex, -1); 
    90           datagrid.scrollToIndex(datagrid.selectedIndex); 
    91           CommonData.datagridroutineflag |= 3; 
    92           break; 
    93         // up,downでscrollした場合、changeが打ち消されるため 
    94         case Keyboard.UP: 
    95         case Keyboard.DOWN: 
    96           CommonData.datagridroutineflag |= 3; 
    97           break; 
    98         default: 
    99           break; 
    100         } 
    101         CommonData.datagridsuspend = true; 
     95      if (datagrid.selectedIndex == -1) datagrid.selectedIndex = 0; 
     96       
     97      if (CommonData.keybindjudgers.jumptopostarea.apply(null, [e])) { 
     98        Application.application.postarea.setFocus(); 
     99        next(waitEvents); 
     100        return; 
    102101      } 
    103       event(datagrid, KeyboardEvent.KEY_UP, onKeyUp); 
    104 //      next(run); 
     102       
     103      if(CommonData.keybindjudgers.replyattimeline.apply(null, [e])){ 
     104        CommonData.in_reply_to_status_id = ""; 
     105        Application.application.appendReply(datagrid.selectedItem); 
     106      } 
     107       
     108      if (CommonData.keybindjudgers.sameuserforwardattimeline.apply(null, [e])) { 
     109        datagrid.selectedIndex = Utility.searchSamePoster(timeline, datagrid.selectedIndex, 1); 
     110        datagrid.scrollToIndex(datagrid.selectedIndex); 
     111        CommonData.datagridroutineflag |= 3; 
     112      } 
     113       
     114      if (CommonData.keybindjudgers.sameuserbackwardattimeline.apply(null, [e])) { 
     115        datagrid.selectedIndex = Utility.searchSamePoster(timeline, datagrid.selectedIndex, -1); 
     116        datagrid.scrollToIndex(datagrid.selectedIndex); 
     117        CommonData.datagridroutineflag |= 3; 
     118      } 
     119       
     120      CommonData.datagridsuspend = true; 
     121      next(waitEvents); 
    105122    } 
    106123     
    107124    private function onKeyUp(e : KeyboardEvent) : void 
    108125    { 
     126      trace("keyup"); 
    109127      CommonData.datagridsuspend = false; 
    110       CommonData.datagridroutineflag |= 3; 
    111       next(run); 
     128      next(waitEvents); 
    112129    } 
    113130     
     
    118135    { 
    119136      CommonData.datagridroutineflag |= 3; 
    120       next(run); 
    121     } 
    122      
    123     private function onDataChange(e : FlexEvent) : void 
    124     { 
    125       var tabname : String = tabbar.selectedTabName; 
    126       datagrid.selectedIndex = timeline.getItemIndex(CommonData.tabmap[tabname].postid); 
    127       next(run); 
    128     } 
    129      
    130     private function searchSamePoster(index : int, dir : int) : int 
    131     { 
    132       var oid : String = timeline.getItemAt(index).posterid; 
    133       var i : int = index + dir; 
    134       for (;; i += dir) { 
    135         if (i >= timeline.length) i = 0; 
    136         if (i < 0) i = timeline.length - 1; 
    137         if (timeline.getItemAt(i).posterid == oid) break; 
     137       
     138      var index : int = datagrid.selectedIndex; 
     139      if (Utility.getNumber("manageunread", Application.application.tabbar.selectedTabName) == 1) { 
     140        // 選択したpostをすべて既読に 
     141        for each(var ind : int in datagrid.selectedIndices) { 
     142          datagrid.mark(index, false); 
     143        } 
    138144      } 
    139       return i
     145      next(sub.waitEvents)
    140146    } 
    141147  } 
  • air/TLife/trunk/src/uwi/thread/event/DataGridRoutineThread.as

    r2634 r2650  
    5050      var index : int = datagrid.selectedIndex; 
    5151       
     52      /* 
    5253      if (Utility.getNumber("manageunread", Application.application.tabbar.selectedTabName) == 1) { 
    5354        // 選択したpostをすべて既読に 
     
    5657        } 
    5758      } 
     59      */ 
    5860           
    5961      if ((CommonData.datagridroutineflag & 2) != 0) { 
  • air/TLife/trunk/src/uwi/thread/event/PostEventThread.as

    r2642 r2650  
    2424  import uwi.util.EventThread; 
    2525  import uwi.util.OAuthUtility; 
     26  import uwi.util.Utility; 
    2627   
    2728  /** 
     
    8788      if (CommonData.keybindjudgers.jumptotimeline.apply(null, [e])) { 
    8889        Application.application.datagrid.setFocus(); 
     90        next(waitEvents); 
     91        return; 
     92      } 
     93       
     94      if(CommonData.keybindjudgers.replyatpostarea.apply(null, [e])){ 
     95        CommonData.in_reply_to_status_id = ""; 
     96        Application.application.appendReply(datagrid.selectedItem); 
     97        next(waitEvents); 
     98        return; 
    8999      } 
    90100       
     
    92102        if (datagrid.selectedIndex == -1) datagrid.selectedIndex = datagrid.verticalScrollPosition; 
    93103        datagrid.dispatchEvent(new KeyboardEvent(KeyboardEvent.KEY_DOWN, true, false, 0, Keyboard.DOWN)); 
    94         datagrid.dispatchEvent(new KeyboardEvent(KeyboardEvent.KEY_UP, true, false, 0, Keyboard.DOWN)); 
    95104      } 
    96105       
     
    98107        if (datagrid.selectedIndex == -1) datagrid.selectedIndex = datagrid.verticalScrollPosition; 
    99108        datagrid.dispatchEvent(new KeyboardEvent(KeyboardEvent.KEY_DOWN, true, false, 0, Keyboard.UP)); 
     109      } 
     110       
     111      if (CommonData.keybindjudgers.sameuserforwardatpostarea.apply(null, [e])) { 
     112        datagrid.selectedIndex = Utility.searchSamePoster(Application.application.timeline, datagrid.selectedIndex, 1); 
     113        datagrid.scrollToIndex(datagrid.selectedIndex); 
     114        CommonData.datagridroutineflag |= 3; 
     115      } 
     116       
     117      if (CommonData.keybindjudgers.sameuserbackwardatpostarea.apply(null, [e])) { 
     118        datagrid.selectedIndex = Utility.searchSamePoster(Application.application.timeline, datagrid.selectedIndex, -1); 
     119        datagrid.scrollToIndex(datagrid.selectedIndex); 
     120        CommonData.datagridroutineflag |= 3; 
     121      } 
     122       
     123      CommonData.datagridsuspend = true; 
     124      event(postarea, KeyboardEvent.KEY_UP, onKeyUp); 
     125//      next(waitEvents); 
     126    } 
     127     
     128    private function onKeyUp(e : KeyboardEvent) : void 
     129    { 
     130      CommonData.datagridsuspend = false; 
     131       
     132      if (CommonData.keybindjudgers.downatpostarea.apply(null, [e])) { 
     133        datagrid.dispatchEvent(new KeyboardEvent(KeyboardEvent.KEY_UP, true, false, 0, Keyboard.DOWN)); 
     134      } 
     135       
     136      if (CommonData.keybindjudgers.upatpostarea.apply(null, [e])) { 
    100137        datagrid.dispatchEvent(new KeyboardEvent(KeyboardEvent.KEY_UP, true, false, 0, Keyboard.UP)); 
    101       } 
    102        
    103       if (CommonData.keybindjudgers.leftatpostarea.apply(null, [e])) { 
    104         if (datagrid.selectedIndex == -1) datagrid.selectedIndex = datagrid.verticalScrollPosition; 
    105         datagrid.dispatchEvent(new KeyboardEvent(KeyboardEvent.KEY_DOWN, true, false, 0, Keyboard.LEFT)); 
    106         datagrid.dispatchEvent(new KeyboardEvent(KeyboardEvent.KEY_UP, true, false, 0, Keyboard.LEFT)); 
    107       } 
    108        
    109       if (CommonData.keybindjudgers.rightatpostarea.apply(null, [e])) { 
    110         if (datagrid.selectedIndex == -1) datagrid.selectedIndex = datagrid.verticalScrollPosition; 
    111         datagrid.dispatchEvent(new KeyboardEvent(KeyboardEvent.KEY_DOWN, true, false, 0, Keyboard.RIGHT)); 
    112         datagrid.dispatchEvent(new KeyboardEvent(KeyboardEvent.KEY_UP, true, false, 0, Keyboard.RIGHT)); 
    113138      } 
    114139       
  • air/TLife/trunk/src/uwi/ui/DataGridEx.as

    r2634 r2650  
    22{ 
    33  import mx.controls.DataGrid; 
     4  import mx.controls.dataGridClasses.DataGridItemRenderer; 
    45  import mx.controls.listClasses.IListItemRenderer; 
    56  import mx.core.Application; 
     
    3233      if (index < 0 || index >= dataProvider.length)return; 
    3334      var item : Object = dataProvider.getItemAt(index); 
    34       item.unread = unread; 
    35       dataProvider.setItemAt(item, index); 
    36       CommonData.tabmap[Application.application.tabbar.selectedTabName].unread[item.postid] = unread; 
     35//      item.unread = unread; 
     36//      dataProvider.setItemAt(item, index); 
     37//      CommonData.tabmap[Application.application.tabbar.selectedTabName].unread[item.postid] = unread; 
     38      CommonData.unreadset[item.postid] = unread ? 1 : 0; 
     39      for (var j : int = 0; j < columnCount;j++){ 
     40        var ir : TimelineRenderer = rowcolToItemRenderer(index, j) as TimelineRenderer; 
     41        if (!(ir is TimelineRenderer)) continue; 
     42        ir.validateFast(); 
     43      } 
    3744    } 
    3845     
  • air/TLife/trunk/src/uwi/ui/TimelineRenderer.as

    r2634 r2650  
    22{ 
    33  import flash.text.TextFormat; 
     4  import flash.utils.getTimer; 
    45  import mx.controls.dataGridClasses.DataGridColumn; 
    56  import mx.controls.dataGridClasses.DataGridItemRenderer; 
     
    89  import mx.core.Application; 
    910  import uwi.util.CommonData; 
     11  import uwi.util.Utility; 
    1012   
    1113  /** 
     
    2426      super.data = value; 
    2527       
     28      validateFast(); 
     29    } 
     30     
     31    public function validateFast() : void 
     32    { 
    2633      var datagrid : DataGridEx = owner as DataGridEx; 
    2734      var index : int = datagrid.ItemRendererToIndex(this); 
     
    2936 
    3037      var status : Object = datagrid.dataProvider.getItemAt(index); 
    31       var tfmt : TextFormat = CommonData.tfmt_timelines[(status.fav ? 2 : 0) | (status.unread ? 1 : 0)]; 
     38       
     39      var manageunread : int = Utility.getNumber("manageunread", Application.application.tabbar.selectedTabName); 
     40      var tfmt : TextFormat = CommonData.tfmt_timelines[(status.fav ? 2 : 0) | (manageunread == 1 ? (CommonData.unreadset[status.postid] || 0) : 0)]; 
     41//      var tfmt : TextFormat = CommonData.tfmt_timelines[(status.fav ? 2 : 0) | (manageunread & (CommonData.unreadset[status.postid] || 0)))]; 
    3242      this.defaultTextFormat = tfmt; 
    3343      this.setTextFormat(tfmt); 
     
    4454      } 
    4555      */ 
     56       
     57    } 
     58     
     59    public override function validateNow() : void 
     60    { 
    4661    } 
    4762  } 
  • air/TLife/trunk/src/uwi/ui/tabconfig/TabConfigEventThread.as

    r2634 r2650  
    126126        newestid : -1,  
    127127        rule : "", 
    128         unread : {}, 
    129128        numnotify : -1, 
    130129        manageunread : -1, 
  • air/TLife/trunk/src/uwi/util/CommonData.as

    r2642 r2650  
    100100    // タブ関連 
    101101    public static var tabrules : Array;// タブの抽出ルール 
     102     
     103    public static var unreadset : Object = { }; // 未読リスト 1 : 未読, 0 : 既読 
     104     
    102105    public static var tabmap : Object = { }; // タブごとのデータへのMap 
    103106    // <tabtitle : String, data : Object> 
     
    107110    // type : int タブの種類 (0 : 通常のタブ, 1 : 検索結果タブ) 
    108111    // cache : Object 検索結果のキャッシュ 
    109     // unread : Object 未読リスト(set) 
    110112    // --------以下はconfigxmlに格納-------- 
    111113    // numnotify : int  新着通知件数 (0 : 新着通知しない, 負 : グローバル設定に従う) 
  • air/TLife/trunk/src/uwi/util/Utility.as

    r2634 r2650  
    181181      return ar.join("&"); 
    182182    } 
     183     
     184    public static function searchSamePoster(col : ListCollectionView, index : int, dir : int) : int 
     185    { 
     186      var oid : String = col.getItemAt(index).posterid; 
     187      var i : int = index + dir; 
     188      for (;; i += dir) { 
     189        if (i >= col.length) i = 0; 
     190        if (i < 0) i = col.length - 1; 
     191        if (col.getItemAt(i).posterid == oid) break; 
     192      } 
     193      return i; 
     194    } 
     195     
    183196  } 
    184197