Exemple #1
0
 @Override
 public void getError(int request, Integer errorCode, String callerStringID) {
   charsooActivityContext.hideWaitDialog();
   isGettingContacts = false;
   if (request == TAKE_CONTACTS_INT_CODE && ServerAnswer.canShowErrorLayout(errorCode)) {
     networkFailedLayout.setVisibility(View.VISIBLE);
   } else {
     if (!dialogMessage.isShowing()) {
       dialogMessage.show();
       dialogMessage.setMessage(
           ServerAnswer.getError(context, errorCode, callerStringID + ">" + TAG));
     }
   }
 }
Exemple #2
0
  @Override
  public void getResult(int request, Object result) {
    charsooActivityContext.hideWaitDialog();
    if (request == TAKE_CONTACTS_INT_CODE) {
      ArrayList<ContactEntry> tempResult = (ArrayList<ContactEntry>) result;
      for (int i = 0; i < tempResult.size(); i++) {
        ContactEntry contactEntry = tempResult.get(i);
        if (contactEntry.type == ContactEntry.ContactType.Email) {
          for (int j = 0; j < contactEntry.namesMatchThisContactData.size(); j++) {
            String str = contactEntry.namesMatchThisContactData.get(j);
            if (emailContactsTable.containsKey(
                str)) { // TODO : niazi be in if nist, mitavan bad az amade shodane webservice in if
                        // ra hazf kard
              for (int k = 0; k < emailContactsTable.get(str).size(); k++) {
                if (contactEntry.contactData.equals(emailContactsTable.get(str).get(k).contactData))
                  emailContactsTable.get(str).remove(k);
              }
            }
          }

        } else if (contactEntry.type == ContactEntry.ContactType.PhoneNumber) {
          for (int j = 0; j < contactEntry.namesMatchThisContactData.size(); j++) {
            String str = contactEntry.namesMatchThisContactData.get(j);
            if (numberContactsTable.containsKey(
                str)) { // TODO : niazi be in if nist, mitavan bad az amade shodane webservice in if
                        // ra hazf kard
              for (int k = 0; k < numberContactsTable.get(str).size(); k++) {
                if (contactEntry.contactData.equals(
                    numberContactsTable.get(str).get(k).contactData))
                  numberContactsTable.get(str).remove(k);
              }
            }
          }
        }
      }

      sortPhoneContacts();
      charsooContactsList = new ArrayList<>(tempResult);
      doOnContactsFriendsReady();
      isGettingContacts = false;
      networkFailedLayout.setVisibility(View.GONE);
    }
    //        else if (request==GET_REMAINING_SMS_COUNT_INT_CODE){
    //            adapterTabs.getFragments().fragSMS.remainingSMSCount=(Integer) result;
    //        }

  }
Exemple #3
0
  @Override
  public void onViewCreated(View view, Bundle savedInstanceState) {
    charsooActivityContext.hideWaitDialog();
    // BEGIN_INCLUDE (setup_viewpager)
    // Get the ViewPager and set it's PagerAdapter so that it can display items
    mViewPager = (CustomViewPager) view.findViewById(R.id.viewpager);
    if (isBusinessPromotion) {
      adapterTabs =
          new AdapterRegisterUserTabs(
              getChildFragmentManager(),
              context,
              firstChildTitle,
              secondChildTitle,
              thirdChildTitle,
              2);
      mViewPager.setOffscreenPageLimit(2);
      mViewPager.setScrollDurationFactor(0.5);
      //            new
      // GetRemainingBusinessSMSCount(getActivity(),userIntId,FragmentInvite.this,GET_REMAINING_SMS_COUNT_INT_CODE).execute();
    } else {
      adapterTabs =
          new AdapterRegisterUserTabs(
              getChildFragmentManager(),
              context,
              firstChildTitle,
              secondChildTitle,
              thirdChildTitle,
              3);
      mViewPager.setOffscreenPageLimit(3);
      mViewPager.setScrollDurationFactor(0.5);
      //            new
      // GetRemainingFriendshipSMSCount(getActivity(),userIntId,FragmentInvite.this,GET_REMAINING_SMS_COUNT_INT_CODE).execute();
    }
    mViewPager.setAdapter(adapterTabs);
    // END_INCLUDE (setup_viewpager)

    // BEGIN_INCLUDE (setup_slidingtablayout)
    // Give the SlidingTabLayout the ViewPager, this must be done AFTER the ViewPager has had
    // it's PagerAdapter set.
    tabs = (PagerSlidingTabStrip) view.findViewById(R.id.sliding_tabs);
    tabs.setViewPager(mViewPager);
    tabs.setBackgroundColor(getActivity().getResources().getColor(R.color.primaryColor));
    // TODO UNCOMMENT THIS
    //        userIntId = LoginInfo.getUserId(context);

    // END_INCLUDE (setup_slidingtablayout)
    if (applicationList != null) {
      adapterTabs.getFragments().fragInvite.setApplicationList(applicationList);
    } else {
      //                if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB)
      //                    new GetInstalledApps(getActivity(),
      // FragmentInvite.this).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
      //                else
      if (!GetInstalledApps.isRunning)
        new GetInstalledApps(getActivity(), FragmentInvite.this).execute();
      else GetInstalledApps.addDelegate(FragmentInvite.this);

      view.findViewById(R.id.progressBar).setVisibility(View.VISIBLE);
    }
    if ((emailContactsTable == null) || (numberContactsTable == null)) {
      //                if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB)
      //                    new GetContactData(getActivity(),
      // FragmentInvite.this).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
      //                else
      if (!GetContactData.isRunning)
        new GetContactData(getActivity(), FragmentInvite.this).execute();
      else GetContactData.addDelegate(FragmentInvite.this);
    } else if ((charsooContactsList == null) && (!isGettingContacts)) {
      doOnPhoneContactsReady(getActivity(), isBusinessPromotion);
    } else if (!isGettingContacts) doOnContactsFriendsReady();

    if ((applicationList != null) && (charsooContactsList != null))
      view.findViewById(R.id.progressBar).setVisibility(View.GONE);
  }