Example #1
0
 public void onResume() {
   //		if (Theme.getTaskVisible())
   //		{
   //			if (!mListViews.contains(m_TaskPage))
   //			{
   //				mListViews.add(m_TaskPage);
   //				btTask.setVisibility(View.VISIBLE);
   //
   //			}
   //		} else
   //		{
   //			if (mListViews.contains(m_TaskPage))
   //			{
   //				if (nLastKey != task)
   //				{
   //					myViewPager.setCurrentItem(Local);
   //				}
   //				mListViews.remove(m_TaskPage);
   //				btTask.setVisibility(View.GONE);
   //			}
   //		}
   if (Theme.getTabsVisible()) {
     lvTabs.setVisibility(View.VISIBLE);
   } else {
     lvTabs.setVisibility(View.GONE);
   }
   if (m_curPage != null) {
     m_curPage.onResume();
   }
 }
Example #2
0
  public void onCreate() {
    setContentView(R.layout.kmain);
    lvTabs = (View) findViewById(R.id.lvTabs);
    btLocal = findViewById(R.id.tab_local);
    // btRemote = findViewById(R.id.tab_network);
    btApps = findViewById(R.id.tab_apps);
    btFavorite = findViewById(R.id.tab_Favorite);
    // btFavorite.setVisibility(View.GONE);
    btTask = findViewById(R.id.tab_task);
    btTask.setVisibility(View.GONE);
    btTools = findViewById(R.id.tab_tools);
    btLocal.setOnClickListener(toolsOnClickListener);
    // btRemote.setOnClickListener(toolsOnClickListener);
    btFavorite.setOnClickListener(toolsOnClickListener);
    btApps.setOnClickListener(toolsOnClickListener);
    btTask.setOnClickListener(toolsOnClickListener);
    btTools.setOnClickListener(toolsOnClickListener);

    myViewPager = (ViewPager) findViewById(R.id.viewpagerLayout);

    m_localPage = new LocalPage(m_act);
    // m_RemotePage = new NetworkPage(m_act);
    m_FavoritePage = new FavoritePage(m_act);
    m_AppsPage = new AppsPage(m_act);
    //		m_TaskPage = new TaskPage(m_act);
    m_ToolsPage = new NetworkPage(m_act);
    m_SearchPage = new SearchResultPage(m_act);

    myViewPager.setAdapter(mAbsPageAdapter);
    mListViews = new ArrayList<AbsPage>();

    mListViews.add(m_SearchPage);
    mListViews.add(m_localPage);
    // mListViews.add(m_RemotePage);
    mListViews.add(m_FavoritePage);
    mListViews.add(m_AppsPage);
    //		mListViews.add(m_TaskPage);
    mListViews.add(m_ToolsPage);
    SwitchPage(Local);

    myViewPager.setOnPageChangeListener(
        new OnPageChangeListener() {

          public void onPageSelected(int arg0) {
            // P.v("king", "onPageSelected - " + arg0);
            // activity从1到2滑动,2被加载后掉用此方法
            // View v = mListViews.get(arg0);
            SwitchPage(arg0);
          }

          public void onPageScrolled(int arg0, float arg1, int arg2) {
            // P.v("king", "onPageScrolled:arg0=" + arg0);//+",arg1=" +
            // arg1+",arg2=" + arg2);
            // 从1到2滑动,在1滑动前调用
          }

          public void onPageScrollStateChanged(int arg0) {
            // P.v("king", "onPageScrollStateChanged - " + arg0);
            // 状态有三个0空闲,1是增在滑行中,2目标加载完毕
            /**
             * Indicates that the pager is in an idle, settled state. The current page is fully in
             * view and no animation is in progress.
             */
            // public static final int SCROLL_STATE_IDLE = 0;
            /** Indicates that the pager is currently being dragged by the user. */
            // public static final int SCROLL_STATE_DRAGGING = 1;
            /** Indicates that the pager is in the process of settling to a final position. */
            // public static final int SCROLL_STATE_SETTLING = 2;
          }
        });
    myViewPager.setCurrentItem(Local);
    T.SetScreenOrientation(m_act, Theme.getScreenOrientation());
  }