@Override public void onFailure(RegisteredUsersApiResponse registeredUsersApiResponse, String[] userIdArray, Exception exception) { if (footerView != null) { footerView.setVisibility(View.GONE); } String error = getString(Utils.isInternetAvailable(getActivity()) ? R.string.applozic_server_error : R.string.you_need_network_access_for_block_or_unblock); Toast toast = Toast.makeText(getActivity(), error, Toast.LENGTH_LONG); toast.setGravity(Gravity.CENTER, 0, 0); toast.show(); }
private int getListPreferredItemHeight() { final TypedValue typedValue = new TypedValue(); // Resolve list item preferred height theme attribute into typedValue getActivity().getTheme().resolveAttribute( android.R.attr.listPreferredItemHeight, typedValue, true); // Create a new DisplayMetrics object final DisplayMetrics metrics = new DisplayMetrics(); // Populate the DisplayMetrics getActivity().getWindowManager().getDefaultDisplay().getMetrics(metrics); // Return theme value based on DisplayMetrics return (int) typedValue.getDimension(metrics); }
@Override public void onSuccess(RegisteredUsersApiResponse registeredUsersApiResponse, String[] userIdArray) { if (footerView != null) { footerView.setVisibility(View.GONE); } if (registeredUsersApiResponse != null) { try { if (!Utils.isInternetAvailable(getActivity())) { Toast toast = Toast.makeText(getActivity(), getActivity().getString(R.string.applozic_contacts_loading_error), Toast.LENGTH_SHORT); toast.setGravity(Gravity.CENTER, 0, 0); toast.show(); } if (registeredUsersApiResponse != null && contactsGroupId == null) { getLoaderManager().restartLoader( ContactSelectionFragment.ContactsQuery.QUERY_ID, null, ContactSelectionFragment.this); } } catch (Exception e) { } } }
@Override public void onSuccess(Channel channel, Context context) { if (progressDialog != null && progressDialog.isShowing()) { progressDialog.dismiss(); } if (channel != null) { Intent intent = new Intent(getActivity(), ConversationActivity.class); if (ApplozicClient.getInstance(getActivity().getApplicationContext()).isContextBasedChat()) { intent.putExtra(ConversationUIService.CONTEXT_BASED_CHAT, true); } intent.putExtra(ConversationUIService.GROUP_ID, channel.getKey()); intent.putExtra(ConversationUIService.GROUP_NAME, channel.getName()); getActivity().startActivity(intent); } if (bundle != null && bundle.getString(CHANNEL) != null) { getActivity().sendBroadcast(new Intent(ChannelCreateActivity.ACTION_FINISH_CHANNEL_CREATE)); } if (getActivity() != null) { getActivity().finish(); } }
@Override public void onResume() { super.onResume(); if (refreshContactsScreenBroadcast != null) { LocalBroadcastManager.getInstance(getActivity()).registerReceiver(refreshContactsScreenBroadcast, new IntentFilter(BroadcastService.INTENT_ACTIONS.UPDATE_USER_DETAIL.toString())); } }
@Override public void onDestroy() { super.onDestroy(); if (refreshContactsScreenBroadcast != null) { LocalBroadcastManager.getInstance(getActivity()).unregisterReceiver(refreshContactsScreenBroadcast); } }
@Override public void onItemClick(AdapterView<?> adapterView, View view, int position, long l) { final Cursor cursor = mAdapter.getCursor(); cursor.moveToPosition(position); Contact contact = contactDatabase.getContact(cursor, "_id"); if (disableCheckBox) { isUserPresnt = ChannelService.getInstance(getActivity()).isUserAlreadyPresentInChannel(channel.getKey(), contact.getContactIds()); if (!isUserPresnt) { Intent intent = new Intent(); intent.putExtra(ChannelInfoActivity.USERID, contact.getUserId()); getActivity().setResult(getActivity().RESULT_OK, intent); getActivity().finish(); } } else { AppCompatCheckBox checkBox = (AppCompatCheckBox) view.findViewById(R.id.checkbox); checkBox.toggle(); if (checkBox.isChecked()) { userIdList.add(contact.getContactIds()); } else if (!checkBox.isChecked()) { userIdList.remove(contact.getContactIds()); } } }
@Override public void onScroll(AbsListView view, int firstVisibleItem, int visibleItemCount, int totalItemCount) { if (loading && ((alCustomizationSettings.isRegisteredUserContactListCall() || ApplozicSetting.getInstance(getActivity()).isRegisteredUsersContactCall()) && Utils.isInternetAvailable(getActivity().getApplicationContext()) && TextUtils.isEmpty(userPreference.getContactsGroupId())) && (totalItemCount > previousTotal)) { loading = false; previousTotal = totalItemCount; currentPage++; } if ((!loading && (totalItemCount - visibleItemCount) <= (firstVisibleItem + visibleThreshold)) && (!ContactSelectionActivity.isSearching)) { // I load the next page of gigs using a background task, // but you can call any function here. processDownloadRegisteredUsers(); loading = true; } }
if (id == R.id.Done) { if (userIdList != null && userIdList.size() == 0) { Toast.makeText(getActivity(), R.string.select_at_least, Toast.LENGTH_SHORT).show(); } else { final ProgressDialog progressDialog = ProgressDialog.show(getActivity(), "", getActivity().getString(TextUtils.isEmpty(channelName) ? R.string.broadcast_creating_info : R.string.group_creating_info), true); AlChannelCreateAsyncTask.TaskListenerInterface taskListenerInterface = new AlChannelCreateAsyncTask.TaskListenerInterface() { @Override if (MobiComUserPreference.getInstance(getActivity()).getParentGroupKey() != null && MobiComUserPreference.getInstance(getActivity()).getParentGroupKey() != 0) { channelInfo.setParentKey(MobiComUserPreference.getInstance(getActivity()).getParentGroupKey()); AlChannelCreateAsyncTask alChannelCreateAsyncTask = new AlChannelCreateAsyncTask(getActivity(), channelInfo, taskListenerInterface); alChannelCreateAsyncTask.execute((Void) null);
RegisteredUsersAsyncTask usersAsyncTask = new RegisteredUsersAsyncTask(getActivity(), usersAsyncTaskTaskListener, alCustomizationSettings.getTotalRegisteredUserToFetch(), userPreference.getRegisteredUsersLastFetchTime(), null, null, true); usersAsyncTask.execute((Void) null);
@Override public Loader<Cursor> onCreateLoader(int id, Bundle args) { if (Applozic.getInstance(getContext()).isDeviceContactSync()) { return contactDatabase.getPhoneContactCursorLoader(mSearchTerm, groupContacts, false); } else { return contactDatabase.getSearchCursorLoader(mSearchTerm, groupContacts, MobiComUserPreference.getInstance(getActivity()).getParentGroupKey()); } }
super.onCreate(savedInstanceState); bundle = getArguments(); String jsonString = FileUtils.loadSettingsJsonFile(getActivity().getApplicationContext()); if (!TextUtils.isEmpty(jsonString)) { alCustomizationSettings = (AlCustomizationSettings) GsonUtils.getObjectFromJson(jsonString, AlCustomizationSettings.class); alCustomizationSettings = new AlCustomizationSettings(); userPreference = MobiComUserPreference.getInstance(getActivity()); if (bundle != null) { channel = (Channel) bundle.getSerializable(CHANNEL_OBJECT); appContactService = new AppContactService(getActivity()); mAdapter = new ContactsAdapter(getActivity()); final Context context = getActivity().getApplicationContext(); mImageLoader = new ImageLoader(context, getListPreferredItemHeight()) { @Override mImageLoader.addImageCache(getActivity().getSupportFragmentManager(), 0.1f); mImageLoader.setImageFadeIn(false); if (contactsGroupId != null) { ApplozicGetMemberFromContactGroupTask applozicGetMemberFromContactGroupTask = new ApplozicGetMemberFromContactGroupTask(getActivity(), contactsGroupId, String.valueOf(Channel.GroupType.CONTACT_GROUP.getValue()), eventMemberListener); // pass GroupId whose contact Members you want to show, contactGroupType applozicGetMemberFromContactGroupTask.execute(); } else if (groupContacts != null) {