public View getContentView(LocalAccount account) {
    BaseAdapter adapter = initAdapter(account);
    GridView gvApp;

    View contentView = null;
    if (refView != null) {
      contentView = refView.get();
      if (Constants.DEBUG && contentView == null) {
        Log.v("AppChangeListener", "HomePage_App View recycle");
      }
    }
    if (contentView != null) {
      gvApp = (GridView) contentView.findViewById(R.id.gvApp);
    } else {
      LayoutInflater inflater =
          (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
      contentView = inflater.inflate(R.layout.home_page_content_app, null);
      ThemeUtil.setContentBackground(contentView);
      // refView = new WeakReference<View>(contentView);

      gvApp = (GridView) contentView.findViewById(R.id.gvApp);
      View emptyView = contentView.findViewById(R.id.llLoadingView);
      gvApp.setOnItemClickListener(itemClickListener);
      gvApp.setEmptyView(emptyView);
      if (Constants.DEBUG) {
        Log.v("AppChangeListener", "reclaim:" + this.getClass().getCanonicalName());
      }
    }
    gvApp.setAdapter(adapter);
    gvApp.setFastScrollEnabled(yibo.isSliderEnabled());

    return contentView;
  }
 public void showLoadingFooter() {
   if (listFooter != null) {
     lvUser.removeFooterView(listFooter);
   }
   listFooter = getLayoutInflater().inflate(R.layout.list_item_loading, null);
   ThemeUtil.setListViewLoading(listFooter);
   lvUser.addFooterView(listFooter);
 }
 public void showNoMoreFooter() {
   if (listFooter != null) {
     lvUser.removeFooterView(listFooter);
   }
   listFooter = getLayoutInflater().inflate(R.layout.list_item_more, null);
   ThemeUtil.setListViewMore(listFooter);
   TextView tvFooter = (TextView) listFooter.findViewById(R.id.tvFooter);
   tvFooter.setText(R.string.label_no_more);
   lvUser.addFooterView(listFooter);
 }
  public void showMoreFooter() {
    if (listFooter != null) {
      lvUser.removeFooterView(listFooter);
    }

    listFooter = getLayoutInflater().inflate(R.layout.list_item_more, null);
    ThemeUtil.setListViewMore(listFooter);
    listFooter.setOnClickListener(
        new View.OnClickListener() {
          @Override
          public void onClick(View v) {
            executeTask();
          }
        });
    lvUser.addFooterView(listFooter);
  }
  private void initComponent(Intent intent) {
    LinearLayout llHeaderBase = (LinearLayout) findViewById(R.id.llHeaderBase);
    ThemeUtil.setSecondaryImageHeader(llHeaderBase);

    if (intent == null) {
      return;
    }

    Bundle bundle = intent.getExtras();
    realPath = bundle.getString("image-path");
    imageUrl = Uri.fromFile(new File(realPath)).toString();

    String html = String.format(WEB_HTML, getMaxWidth(), imageUrl);

    webViewer = (WebView) findViewById(R.id.wvImageViewer);
    webViewer.getSettings().setSupportZoom(true);
    webViewer.getSettings().setBuiltInZoomControls(true);
    webViewer.setBackgroundColor(Color.BLACK);
    webViewer.setVerticalScrollBarEnabled(false);
    webViewer.setHorizontalScrollBarEnabled(false);
    // webViewer.setOnTouchListener(new ImageWebViewDoubleClickListener());

    webViewer.loadDataWithBaseURL("", html, "text/html", "UTF-8", "");
  }
  private void initComponents() {
    LinearLayout llRoot = (LinearLayout) this.findViewById(R.id.llRoot);
    LinearLayout llHeaderBase = (LinearLayout) this.findViewById(R.id.llHeaderBase);

    LinearLayout llHeaderUserSelector = (LinearLayout) this.findViewById(R.id.llHeaderUserSelector);
    EditText etFilterName = (EditText) this.findViewById(R.id.etFilterName);
    Button btnSearch = (Button) findViewById(R.id.btnSearch);
    btnFollowing = (Button) findViewById(R.id.btnFollowing);
    btnRecentContact = (Button) findViewById(R.id.btnRecentContact);
    lvUser = (ListView) this.findViewById(R.id.lvUser);

    LinearLayout llToolbar = (LinearLayout) this.findViewById(R.id.llToolbar);
    Button btnConfirm = (Button) this.findViewById(R.id.btnConfirm);
    Button btnCancel = (Button) this.findViewById(R.id.btnCancel);

    ThemeUtil.setRootBackground(llRoot);
    ThemeUtil.setSecondaryHeader(llHeaderBase);

    llHeaderUserSelector.setBackgroundDrawable(theme.getDrawable("bg_header_corner_search"));
    int padding6 = theme.dip2px(6);
    int padding8 = theme.dip2px(8);
    llHeaderUserSelector.setPadding(padding6, padding8, padding6, padding8);
    etFilterName.setBackgroundDrawable(theme.getDrawable("bg_input_frame_left_half"));
    btnSearch.setBackgroundDrawable(theme.getDrawable("selector_btn_search"));
    btnFollowing.setBackgroundDrawable(theme.getDrawable("selector_tab_toggle_left"));
    btnFollowing.setPadding(0, 0, 0, 0);
    ColorStateList selectorBtnTab = theme.getColorStateList("selector_btn_tab");
    btnFollowing.setTextColor(selectorBtnTab);
    btnFollowing.setGravity(Gravity.CENTER);
    btnRecentContact.setBackgroundDrawable(theme.getDrawable("selector_tab_toggle_right"));
    btnRecentContact.setPadding(0, 0, 0, 0);
    btnRecentContact.setTextColor(selectorBtnTab);
    btnRecentContact.setGravity(Gravity.CENTER);

    ThemeUtil.setListViewStyle(lvUser);
    llToolbar.setBackgroundDrawable(theme.getDrawable("bg_toolbar"));
    ThemeUtil.setBtnActionPositive(btnConfirm);
    ThemeUtil.setBtnActionNegative(btnCancel);

    TextView tvTitle = (TextView) this.findViewById(R.id.tvTitle);
    tvTitle.setText(title);

    selectorAdapter = new UserQuickSelectorListAdapter(this, account, selectMode);
    showLoadingFooter();
    lvUser.setAdapter(selectorAdapter);
    lvUser.setFastScrollEnabled(yibo.isSliderEnabled());
    setBack2Top(lvUser);

    recyclerListener = new UserSelectorRecyclerListener();
    lvUser.setRecyclerListener(recyclerListener);

    lvUser.setOnItemClickListener(
        new OnItemClickListener() {
          @Override
          public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
            if (position == parent.getCount() - 1) {
              view.performClick();
            } else {
              CheckBox checkBox = (CheckBox) view.findViewById(R.id.cbUser);
              checkBox.performClick();
              UserQuickSelectorActivity.this.updateButtonState();
            }
          }
        });
  }