android.widget.AdapterView Java Examples

The following examples show how to use android.widget.AdapterView. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ListBtYearViewProvider.java    From BonetCalendarView with Apache License 2.0 6 votes vote down vote up
@Override
public View getView() {
	mListView = (ListView) LayoutInflater.from(getCalendar().getContext()).inflate(R.layout.month_list_view, null);
	mListView.setOnItemClickListener(new OnItemClickListener() {

		@Override
		public void onItemClick(AdapterView<?> arg0, View arg1, int position,long arg3) {
			if(! (getCalendar() ==null))
				getCalendar().notifyMonthChanged(new BtMonth(getYear(),position));
		}
	
	});

	mAdapter = new MonthListAdapter(getCalendar(),getYear());
	
	mListView.setAdapter(mAdapter);
	
	return mListView;
}
 
Example #2
Source File: RecycleUtils.java    From BLEChat with GNU General Public License v3.0 6 votes vote down vote up
public static void recursiveRecycle(View root) {
    if (root == null)
        return;
    
    // root.setBackgroundDrawable(null);		// Deprecated
    if (root instanceof ViewGroup) {
        ViewGroup group = (ViewGroup)root;
        int count = group.getChildCount();
        for (int i = 0; i < count; i++) {
            recursiveRecycle(group.getChildAt(i));
        }
 
        if (!(root instanceof AdapterView)) {
            group.removeAllViews();
        }
    }
   
    if (root instanceof ImageView) {
        ((ImageView)root).setImageDrawable(null);
    }
    root = null;
    
    return;
}
 
Example #3
Source File: SearchGroupActivity.java    From o2oa with GNU Affero General Public License v3.0 6 votes vote down vote up
private void initListener() {
    final Intent intent = new Intent();
    mLv_searchGroup.setOnItemClickListener(new AdapterView.OnItemClickListener() {
        @Override
        public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
            Object itemAtPosition = parent.getItemAtPosition(position);
            if (itemAtPosition instanceof UserInfo) {
                UserInfo info = ((UserInfo) itemAtPosition);
                if (info.isFriend()) {
                    intent.setClass(SearchGroupActivity.this, FriendInfoActivity.class);
                    intent.putExtra("fromSearch", true);
                } else {
                    intent.setClass(SearchGroupActivity.this, GroupNotFriendActivity.class);
                }
                intent.putExtra(JGApplication.TARGET_ID, info.getUserName());
                intent.putExtra(JGApplication.TARGET_APP_KEY, info.getAppKey());
                startActivity(intent);
            }
        }
    });
}
 
Example #4
Source File: AlbumActivity.java    From socialauth-android with MIT License 6 votes vote down vote up
public void getData(final List<Album> albumList) {
	final GridView view = new GridView(this);
	getGridProperties(view);

	view.setAdapter(new AlbumsAdapter(AlbumActivity.this, 0, albumList));

	String[] urls = new String[albumList.size()];
	for (int i = 0; i < albumList.size(); i++) {
		urls[i] = albumList.get(i).getCoverPhoto();
	}

	view.setOnItemClickListener(new OnItemClickListener() {
		@Override
		public void onItemClick(AdapterView<?> parent, View v, int position, long id) {
			showPhoto(view, albumList, position);
			photoListFlag = true;
		}
	});
	dataSectionView.addView(view);
}
 
Example #5
Source File: Page1.java    From MTransition with Apache License 2.0 6 votes vote down vote up
private void init() {
    genDatas();
    mPage.mListView.setAdapter(new Page1.DemoListAdapter());
    mPage.mListView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
        @Override
        public void onItemClick(AdapterView<?> parent, final View view, int position, long id) {
            final MTransition transition = MTransitionManager.getInstance().createTransition("example");
            transition.fromPage().setContainer(mPage, new ITransitPrepareListener() {
                @Override
                public void onPrepare(MTransitionView container) {
                    transition.fromPage().addTransitionView("icon", view.findViewById(R.id.item_icon));
                    transition.fromPage().addTransitionView("name", view.findViewById(R.id.item_name));
                    transition.fromPage().addTransitionView("snapshot", view.findViewById(R.id.item_snapshot));
                    transition.fromPage().addTransitionView("container", mPage);
                }
            });
            transition.getBundle().putObject("bean", mBeans.get(position));
            ((Example9Activity) getContext()).enterOtherPage();
        }
    });
}
 
Example #6
Source File: OverlayActivity.java    From android with Apache License 2.0 6 votes vote down vote up
@Override
public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
  switch (position) {
    case 0:
      // do nothing
      break;
    case 1:
      enableTransitOverlay();
      break;
    case 2:
      enableBikeOverlay();
      break;
    case 3:
      enablePathOverlay();
      break;
    case 4:
      disableOverlays();
    default:
      break;
  }
}
 
Example #7
Source File: HeaderGridView.java    From AnimatedGridView with Apache License 2.0 6 votes vote down vote up
@Override
public int getItemViewType(int position) {
    int numHeadersAndPlaceholders = getHeadersCount() * mNumColumns;
    if (position < numHeadersAndPlaceholders && (position % mNumColumns != 0)) {
        // Placeholders get the last view type number
        return mAdapter != null ? mAdapter.getViewTypeCount() : 1;
    }
    if (mAdapter != null && position >= numHeadersAndPlaceholders) {
        int adjPosition = position - numHeadersAndPlaceholders;
        int adapterCount = mAdapter.getCount();
        if (adjPosition < adapterCount) {
            return mAdapter.getItemViewType(adjPosition);
        }
    }

    return AdapterView.ITEM_VIEW_TYPE_HEADER_OR_FOOTER;
}
 
Example #8
Source File: BrowseBookListener.java    From ZXing-Standalone-library with Apache License 2.0 6 votes vote down vote up
@Override
public void onItemClick(AdapterView<?> parent, View v, int position, long id) {
  if (position < 1) {
    // Clicked header, ignore it
    return;
  }
  int itemOffset = position - 1;
  if (itemOffset >= items.size()) {
    return;
  }
  String pageId = items.get(itemOffset).getPageId();
  String query = SearchBookContentsResult.getQuery();
  if (LocaleManager.isBookSearchUrl(activity.getISBN()) && !pageId.isEmpty()) {
    String uri = activity.getISBN();
    int equals = uri.indexOf('=');
    String volumeId = uri.substring(equals + 1);
    String readBookURI = "http://books.google." +
        LocaleManager.getBookSearchCountryTLD(activity) +
        "/books?id=" + volumeId + "&pg=" + pageId + "&vq=" + query;
    Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(readBookURI));
    intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET);                    
    activity.startActivity(intent);
  }
}
 
Example #9
Source File: LiveTVFragment.java    From video-player with MIT License 6 votes vote down vote up
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
                         Bundle savedInstanceState) {
    View view = inflater.inflate(R.layout.fragment_livetv, container, false);

    progressBar = (ProgressBar) view.findViewById(R.id.livetv_progress_bar);

    progressBar.setVisibility(ProgressBar.VISIBLE);
    // Set the adapter
    mListView = (AbsListView) view.findViewById(android.R.id.list);
    ((AdapterView<ListAdapter>) mListView).setAdapter(adapter);

    // Set OnItemClickListener so we can be notified on item clicks
    mListView.setOnItemClickListener(this);

    return view;
}
 
Example #10
Source File: UnidentifiedMovies.java    From Mizuu with Apache License 2.0 6 votes vote down vote up
@Override
public void onCreate(Bundle savedInstanceState) {
	super.onCreate(savedInstanceState);

	mList = (ListView) findViewById(R.id.listView1);
	mList.setChoiceMode(ListView.CHOICE_MODE_NONE);
	mList.setOnItemClickListener(new OnItemClickListener() {
		@Override
		public void onItemClick(AdapterView<?> arg0, View arg1, int arg2, long arg3) {
			Intent intent = new Intent(UnidentifiedMovies.this, IdentifyMovie.class);
			intent.putExtra("fileName", mFilepaths.get(arg2).getFullFilepath());
			startActivityForResult(intent, 0);
		}
	});

	loadData();

	LocalBroadcastManager.getInstance(this).registerReceiver(mMessageReceiver, new IntentFilter(LocalBroadcastUtils.UPDATE_MOVIE_LIBRARY));
}
 
Example #11
Source File: NavigationDrawerFragment.java    From Passbook with Apache License 2.0 6 votes vote down vote up
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
    NavMenuItem item = null;
    if(id == mCategory) {
        return;
    }
    if(mMenuList!=null) {
        item = (NavMenuItem)mMenuList.getItemAtPosition(position);
        if(item.mType == NavMenuItem.MENU_SELECTION) {
            mAdapter.selectItem(view, position);
            mCategory = (int)id;
        }
        mMenuList.setItemChecked(mCategory2Navigation.get(mCategory),  true);
    }

    if (mDrawerLayout != null) {
        mDrawerLayout.closeDrawer(mFragmentContainerView);
    }
    if (mCallback != null && item !=null) {
        mCallback.onNavigationDrawerItemSelected(item.mType, item.mId);
    }
}
 
Example #12
Source File: BrowseBookListener.java    From zxingfragmentlib with Apache License 2.0 6 votes vote down vote up
@Override
public void onItemClick(AdapterView<?> parent, View v, int position, long id) {
  if (position < 1) {
    // Clicked header, ignore it
    return;
  }
  int itemOffset = position - 1;
  if (itemOffset >= items.size()) {
    return;
  }
  String pageId = items.get(itemOffset).getPageId();
  String query = SearchBookContentsResult.getQuery();
  if (LocaleManager.isBookSearchUrl(activity.getISBN()) && !pageId.isEmpty()) {
    String uri = activity.getISBN();
    int equals = uri.indexOf('=');
    String volumeId = uri.substring(equals + 1);
    String readBookURI = "http://books.google." +
        LocaleManager.getBookSearchCountryTLD(activity) +
        "/books?id=" + volumeId + "&pg=" + pageId + "&vq=" + query;
    Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(readBookURI));
    intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET);                    
    activity.startActivity(intent);
  }
}
 
Example #13
Source File: BookmarkFolderSelectActivity.java    From delion with Apache License 2.0 6 votes vote down vote up
/**
 * Moves bookmark from original parent to selected folder. In creation mode, directly add the
 * new bookmark to selected folder instead of moving.
 */
@Override
public void onItemClick(AdapterView<?> adapter, View view, int position, long id) {
    FolderListEntry entry = (FolderListEntry) adapter.getItemAtPosition(position);
    if (mIsCreatingFolder) {
        BookmarkId selectedFolder = null;
        if (entry.mType == FolderListEntry.TYPE_NORMAL) {
            selectedFolder = entry.mId;
        } else {
            assert false : "New folder items should not be clickable in creating mode";
        }
        Intent intent = new Intent();
        intent.putExtra(INTENT_SELECTED_FOLDER, selectedFolder.toString());
        setResult(RESULT_OK, intent);
        finish();
    } else if (entry.mType == FolderListEntry.TYPE_NEW_FOLDER) {
        BookmarkAddEditFolderActivity.startAddFolderActivity(this, mBookmarksToMove);
    } else if (entry.mType == FolderListEntry.TYPE_NORMAL) {
        mModel.moveBookmarks(mBookmarksToMove, entry.mId);
        BookmarkUtils.setLastUsedParent(this, entry.mId);
        finish();
    }
}
 
Example #14
Source File: LibPersonAboutActivity.java    From FimiX8-RE with MIT License 5 votes vote down vote up
public void onItemClick(AdapterView<?> adapterView, View view, int position, long id) {
    State positionIndex = ((PersonSetting) LibPersonAboutActivity.this.mThirdPersonSettings.get(position)).getThirdAdapt();
    if (positionIndex == State.USER_PRIVACY) {
        LibPersonAboutActivity.this.goWebActivity(ComonStaticURL.getPrivacyUrl(), LibPersonAboutActivity.this.getString(R.string.person_setting_user_privacy));
    } else if (positionIndex == State.USER_AGREEMENT) {
        LibPersonAboutActivity.this.goWebActivity(ComonStaticURL.getPolicyUrl(), LibPersonAboutActivity.this.getString(R.string.person_setting_user_agreement));
    } else if (positionIndex == State.USER_RIGHT) {
        LibPersonAboutActivity.this.readyGo(LibPersonRightApplyActivity.class);
    }
}
 
Example #15
Source File: BrowserWeiboMsgFragment.java    From iBeebo with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
    getListView().clearChoices();

    if (position - listView.getHeaderViewsCount() >= commentList.getSize()) {
        loadOldCommentData();
    }
}
 
Example #16
Source File: MenuList.java    From commcare-android with Apache License 2.0 5 votes vote down vote up
/**
 * Stores the path of selected form and finishes.
 */
@Override
public void onItemClick(AdapterView listView, View view, int position, long id) {
    Object value = listView.getAdapter().getItem(position);
    if (value == null) {
        // Probably means that we clicked on the header view, so just ignore it
        return;
    }

    String commandId;
    if (value instanceof Entry) {
        commandId = ((Entry)value).getCommandId();
    } else {
        commandId = ((Menu)value).getId();
    }

    Intent i = new Intent(activity.getIntent());
    i.putExtra(SessionFrame.STATE_COMMAND_ID, commandId);
    if (beingUsedInHomeScreen) {
        // If this MenuList is on our home screen, that means we can't finish() here because we
        // are already in our home activity. Instead, just manually launch the same code path
        // that would have been initiated by onActivityResult of HomeScreenBaseActivity
        HomeScreenBaseActivity homeActivity = (HomeScreenBaseActivity)activity;
        if (homeActivity.processReturnFromGetCommand(Activity.RESULT_OK, i)) {
            homeActivity.startNextSessionStepSafe();
        }
    } else {
        activity.setResult(Activity.RESULT_OK, i);
        activity.finish();
    }
}
 
Example #17
Source File: Animation2.java    From codeexamples-android with Eclipse Public License 1.0 5 votes vote down vote up
public void onItemSelected(AdapterView<?> parent, View v, int position, long id) {
    switch (position) {

    case 0:
        mFlipper.setInAnimation(AnimationUtils.loadAnimation(this,
                R.anim.push_up_in));
        mFlipper.setOutAnimation(AnimationUtils.loadAnimation(this,
                R.anim.push_up_out));
        break;
    case 1:
        mFlipper.setInAnimation(AnimationUtils.loadAnimation(this,
                R.anim.push_left_in));
        mFlipper.setOutAnimation(AnimationUtils.loadAnimation(this,
                R.anim.push_left_out));
        break;
    case 2:
        mFlipper.setInAnimation(AnimationUtils.loadAnimation(this,
                android.R.anim.fade_in));
        mFlipper.setOutAnimation(AnimationUtils.loadAnimation(this,
                android.R.anim.fade_out));
        break;
    default:
        mFlipper.setInAnimation(AnimationUtils.loadAnimation(this,
                R.anim.hyperspace_in));
        mFlipper.setOutAnimation(AnimationUtils.loadAnimation(this,
                R.anim.hyperspace_out));
        break;
    }
}
 
Example #18
Source File: NavigationDrawerFragment.java    From RedEnvelopeAssistant with MIT License 5 votes vote down vote up
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
	mDrawerListView = (ListView) inflater.inflate(R.layout.fragment_navigation_drawer, container, false);
	mDrawerListView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
		@Override
		public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
			selectItem(position);
		}
	});
	mDrawerListView.setAdapter(new ArrayAdapter<String>(getActionBar().getThemedContext(), android.R.layout.simple_list_item_1, android.R.id.text1, new String[] { getString(R.string.title_section1),
			getString(R.string.title_section2), getString(R.string.title_section3), }));
	mDrawerListView.setItemChecked(mCurrentSelectedPosition, true);
	return mDrawerListView;
}
 
Example #19
Source File: RippleView.java    From MaterialPageStateLayout with MIT License 5 votes vote down vote up
/**
 * Send a click event if parent view is a Listview instance
 *
 * @param isLongClick Is the event a long click ?
 */
private void sendClickEvent(final Boolean isLongClick) {
    if (getParent() instanceof AdapterView) {
        final AdapterView adapterView = (AdapterView) getParent();
        final int position = adapterView.getPositionForView(this);
        final long id = adapterView.getItemIdAtPosition(position);
        if (isLongClick) {
            if (adapterView.getOnItemLongClickListener() != null)
                adapterView.getOnItemLongClickListener().onItemLongClick(adapterView, this, position, id);
        } else {
            if (adapterView.getOnItemClickListener() != null)
                adapterView.getOnItemClickListener().onItemClick(adapterView, this, position, id);
        }
    }
}
 
Example #20
Source File: HeaderScrollHelper.java    From RichWebList with Apache License 2.0 5 votes vote down vote up
private boolean isAdapterViewTop(AdapterView adapterView) {
    if (adapterView != null) {
        int firstVisiblePosition = adapterView.getFirstVisiblePosition();
        View childAt = adapterView.getChildAt(0);
        if (childAt == null || (firstVisiblePosition == 0 && childAt.getTop() == 0)) {
            return true;
        }
    }
    return false;
}
 
Example #21
Source File: CallLogListFragment.java    From CSipSimple with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void onViewCreated(View view, Bundle savedInstanceState) {
    super.onViewCreated(view, savedInstanceState);

    // View management
    mDualPane = getResources().getBoolean(R.bool.use_dual_panes);


    // Modify list view
    ListView lv = getListView();
    lv.setVerticalFadingEdgeEnabled(true);
    // lv.setCacheColorHint(android.R.color.transparent);
    if (mDualPane) {
        lv.setChoiceMode(ListView.CHOICE_MODE_SINGLE);
        lv.setItemsCanFocus(false);
    } else {
        lv.setChoiceMode(ListView.CHOICE_MODE_NONE);
        lv.setItemsCanFocus(true);
    }
    
    // Map long press
    lv.setLongClickable(true);
    lv.setOnItemLongClickListener(new OnItemLongClickListener() {

        @Override
        public boolean onItemLongClick(AdapterView<?> ad, View v, int pos, long id) {
            turnOnActionMode();
            getListView().setItemChecked(pos, true);
            mMode.invalidate();
            return true;
        }
    });
}
 
Example #22
Source File: BluetoothDevicesFragment.java    From openvidonn with GNU General Public License v3.0 5 votes vote down vote up
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    Log.d(TAG, "onCreateView()");
    View view = inflater.inflate(R.layout.fragment_bluetoothdevices, container, false);

    // Set the adapter
    mListView = (AbsListView) view.findViewById(android.R.id.list);
    ((AdapterView<ListAdapter>) mListView).setAdapter(devicesList);

    return view;
}
 
Example #23
Source File: ContactsFragment.java    From NIM_Android_UIKit with MIT License 5 votes vote down vote up
@Override
public boolean onItemLongClick(AdapterView<?> parent, View view,
                               int position, long id) {
    AbsContactItem item = (AbsContactItem) adapter.getItem(position);
    if (item == null) {
        return false;
    }

    if (item instanceof ContactItem && NimUIKitImpl.getContactEventListener() != null) {
        NimUIKitImpl.getContactEventListener().onItemLongClick(getActivity(), (((ContactItem) item).getContact()).getContactId());
    }

    return true;
}
 
Example #24
Source File: MaterialRippleLayout.java    From UltimateAndroid with Apache License 2.0 5 votes vote down vote up
private void clickAdapterView(AdapterView parent) {
    final int position = parent.getPositionForView(MaterialRippleLayout.this);
    final long itemId = parent.getAdapter() != null
        ? parent.getAdapter().getItemId(position)
        : 0;
    if (position != AdapterView.INVALID_POSITION) {
        parent.performItemClick(MaterialRippleLayout.this, position, itemId);
    }
}
 
Example #25
Source File: PaletteFragment.java    From color-picker with Apache License 2.0 5 votes vote down vote up
@Override
public void onItemClick(AdapterView<?> gridView, View View, int position, long id)
{
    // pass the click event to the parent fragment
    Fragment parent = getParentFragment();
    if (parent instanceof OnColorSelectedListener)
    {
        OnColorSelectedListener listener = (OnColorSelectedListener) parent;
        listener.onColorSelected(mPalette.colorAt(position), mPalette.id(), mPalette.nameOfColorAt(position), mPalette.name());
    }
}
 
Example #26
Source File: StandaloneActivity.java    From FireFiles with Apache License 2.0 5 votes vote down vote up
@Override
public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
    if (mIgnoreNextNavigation) {
        mIgnoreNextNavigation = false;
        return;
    }
    while (mState.stack.size() > position + 1) {
        mState.stackTouched = true;
        mState.stack.pop();
    }
    onCurrentDirectoryChanged(ANIM_UP);
}
 
Example #27
Source File: HeaderFooterViewListAdapter.java    From ProjectX with Apache License 2.0 5 votes vote down vote up
@Override
public int getItemViewType(int position) {
    int numHeaders = getHeaderItemsCount() + getHeaderViewsCount();
    if (mAdapter != null && position >= numHeaders) {
        int adjPosition = position - numHeaders;
        int adapterCount = mAdapter.getCount();
        if (adjPosition < adapterCount) {
            return mAdapter.getItemViewType(adjPosition);
        }
    }

    return AdapterView.ITEM_VIEW_TYPE_HEADER_OR_FOOTER;
}
 
Example #28
Source File: AppListActivity.java    From Android-PreferencesManager with Apache License 2.0 5 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    setTheme(App.theme.theme);
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_app_list);
    Utils.checkBackups(getApplicationContext());
    ActionBar actionBar = getActionBar();
    if (actionBar != null) {
        actionBar.setTitle(Ui.applyCustomTypeFace(getString(R.string.app_name), this));
    }

    loadingView = findViewById(R.id.loadingView);
    emptyView = findViewById(R.id.emptyView);
    listView = (StickyListHeadersListView) findViewById(R.id.listView);
    listView.setDrawingListUnderStickyHeader(false);
    listView.setOnItemClickListener(new OnItemClickListener() {
        @Override
        public void onItemClick(AdapterView<?> arg0, View arg1, int arg2, long arg3) {
            if (isRootAccessGiven) {
                startPreferencesActivity((AppEntry) mAdapter.getItem(arg2));
            } else {
                checkRoot();
            }
        }
    });

    if (savedInstanceState == null) {
        checkRoot();
    }

    if (savedInstanceState == null || Utils.getPreviousApps() == null) {
        startTask();
    } else {
        updateListView(Utils.getPreviousApps());
    }
}
 
Example #29
Source File: AmapBusFragment.java    From BmapLite with Apache License 2.0 5 votes vote down vote up
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
    BusPath bus = mAmapBusRouteAdapter.getList().get(position);

    Bundle bundle = new Bundle();
    bundle.putParcelable("bus", bus);
    bundle.putParcelable("route", mBusRouteResult);
    openActivity(RouteAmapBusActivity.class, bundle);

}
 
Example #30
Source File: ShareCardContactActivity.java    From Android with MIT License 5 votes vote down vote up
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
    final ContactBean contactBean = (ContactBean) parent.getAdapter().getItem(position);
    DialogUtil.showAlertTextView(mActivity,
            mActivity.getResources().getString(R.string.Chat_Share_contact),
            mActivity.getString(R.string.Chat_Share_contact_to,friendEntity.getUsername(),contactBean.getName()),
            "", "", false, new DialogUtil.OnItemClickListener() {
                @Override
                public void confirm(String value) {
                    BaseChat baseChat;
                    if (contactBean.getStatus() == 2) {
                        GroupEntity groupEntity = ContactHelper.getInstance().loadGroupEntity(contactBean.getPub_key());
                        baseChat=new GroupChat(groupEntity);
                    }else{
                        ContactEntity acceptFriend = ContactHelper.getInstance().loadFriendEntity(contactBean.getPub_key());
                        baseChat=new FriendChat(acceptFriend);
                    }
                    MsgEntity msgEntity = (MsgEntity) baseChat.cardMsg(friendEntity);
                    baseChat.sendPushMsg(msgEntity);
                    MessageHelper.getInstance().insertToMsg(msgEntity.getMsgDefinBean());
                    baseChat.updateRoomMsg(null, BaseApplication.getInstance().getBaseContext().getString(R.string.Chat_Visting_card), msgEntity.getMsgDefinBean().getSendtime());

                    List<Activity> list = BaseApplication.getInstance().getActivityList();
                    for (Activity activity : list) {
                        if (activity.getClass().getName().equals(ShareCardActivity.class.getName())){
                            activity.finish();
                        }
                    }
                    ActivityUtil.goBack(mActivity);
                }

                @Override
                public void cancel() {

                }
            });
}