Esempio n. 1
0
 private int getMaxWidth() {
   int maxWidth = 0;
   if (orientation == Configuration.ORIENTATION_PORTRAIT) {
     maxWidth = YiBoApplication.getDisplayWidth();
   } else {
     maxWidth = YiBoApplication.getDisplayHeight();
   }
   maxWidth =
       maxWidth * DisplayMetrics.DENSITY_DEFAULT / YiBoApplication.getDensityDpi()
           - INTERNAL_DISTANCE * 2;
   return maxWidth;
 }
  private void initParams() {
    Intent intent = this.getIntent();
    Bundle bundle = intent.getExtras();
    String mode = bundle.getString("SELECT_MODE");
    int titleId = bundle.getInt("TITLE_ID", R.string.title_select_mention_user);
    title = this.getString(titleId);
    try {
      selectMode = SelectMode.valueOf(mode);
    } catch (Exception e) {
      selectMode = SelectMode.Multiple;
    }

    account = yibo.getCurrentAccount();
  }
Esempio n. 3
0
  @Override
  public void onReceive(Context context, Intent intent) {
    yibo = (YiBoApplication) context.getApplicationContext();
    if (!yibo.isUpdatesEnabled()) {
      return;
    }
    if (ListUtil.isEmpty(accountList)) {
      return;
    }

    for (LocalAccount account : accountList) {
      Cache cache = CacheManager.getInstance().getCache(account);
      AdapterCollectionCache adapterCache = (AdapterCollectionCache) cache;
      if (adapterCache != null) {
        QueryRemindCountTask remindCountTask = new QueryRemindCountTask(adapterCache);
        remindCountTask.execute();
      }
    }
    if (Constants.DEBUG) Log.v(TAG, "auto update receiver");
  }
  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();
            }
          }
        });
  }