@Override public void onClick(View v) { if (selectorWindow.isShowing()) { selectorWindow.dismiss(); } else { selectorWindow.show(); } }
public EditMicroBlogAccountSelectorClickListener(EditMicroBlogActivity context) { this.context = context; listUpdateAccount = context.getListUpdateAccount(); listAllAccount = GlobalVars.getAccountList(context, false); View llHeaderBase = context.findViewById(R.id.llHeaderBase); this.selectorWindow = new AccountSelectorWindow(context, llHeaderBase, SelectMode.Multiple, true); EditMicroBlogAccountSelectorItemClickListener itemClickListener = new EditMicroBlogAccountSelectorItemClickListener(selectorWindow); selectorWindow.setOnItemClickListener(itemClickListener); selectorWindow.addSelectedAccounts(listUpdateAccount); }
@Override public void onItemClick(AdapterView<?> parent, View view, int position, long id) { BaseAdapter adapter = AdapterUtil.getAdapter(parent.getAdapter()); LocalAccount account = (LocalAccount) adapter.getItem(position); if (selectorWindow.isSelected(account)) { selectorWindow.removeSelectedAccount(account); } else { selectorWindow.addSelectedAccount(account); } Context context = view.getContext(); SheJiaoMaoApplication sheJiaoMao = (SheJiaoMaoApplication) context.getApplicationContext(); sheJiaoMao.setCurrentAccount(account); HomePageActivity activity = (HomePageActivity) context; Skeleton skeleton = activity.getSkeleton(); if (skeleton != null) { skeleton.setCurrentAccount(account, true); skeleton.setContentType(skeleton.getContentType()); } selectorWindow.dismiss(); }