Exemplo n.º 1
0
 public void refresh(ContentResolver cr) {
   this.numbersOrAddresses = Compatibility.extractContactNumbersAndAddresses(id, cr);
   LinphoneCore lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull();
   if (lc != null && lc.getFriendList() != null) {
     for (LinphoneFriend friend : lc.getFriendList()) {
       if (id.equals(friend.getRefKey())) {
         hasFriends = true;
         this.numbersOrAddresses.add(friend.getAddress().asStringUriOnly());
       }
     }
   }
   this.name = Compatibility.refreshContactName(cr, id);
 }
Exemplo n.º 2
0
 private void copyTextMessageToClipboard(int id) {
   String msg = LinphoneActivity.instance().getChatStorage().getTextMessageForId(chatRoom, id);
   if (msg != null) {
     Compatibility.copyTextToClipboard(getActivity(), msg);
     LinphoneActivity.instance()
         .displayCustomToast(getString(R.string.text_copied_to_clipboard), Toast.LENGTH_SHORT);
   }
 }
 public void editContact(Contact contact) {
   if (getResources().getBoolean(R.bool.use_android_native_contact_edit_interface)) {
     Intent intent = Compatibility.prepareEditContactIntent(Integer.parseInt(contact.getID()));
     startActivity(intent);
   } else {
     Bundle extras = new Bundle();
     extras.putSerializable("Contact", contact);
     changeCurrentFragment(FragmentsAvailable.EDIT_CONTACT, extras);
   }
 }
 public void addContact(String displayName, String sipUri) {
   if (getResources().getBoolean(R.bool.use_android_native_contact_edit_interface)) {
     Intent intent = Compatibility.prepareAddContactIntent(displayName, sipUri);
     startActivity(intent);
   } else {
     Bundle extras = new Bundle();
     extras.putSerializable("NewSipAdress", sipUri);
     changeCurrentFragment(FragmentsAvailable.EDIT_CONTACT, extras);
   }
 }
  @Override
  public void onResume() {
    super.onResume();

    if (mVideoView != null) {
      ((GLSurfaceView) mVideoView).onResume();
    }

    if (androidVideoWindowImpl != null) {
      synchronized (androidVideoWindowImpl) {
        LinphoneManager.getLc().setVideoWindow(androidVideoWindowImpl);
      }
    }

    mGestureDetector = new GestureDetector(inCallActivity, this);
    mScaleDetector = Compatibility.getScaleGestureDetector(inCallActivity, this);
  }
Exemplo n.º 6
0
 private void removeVirtualKeyboardVisiblityListener() {
   Compatibility.removeGlobalLayoutListener(
       getActivity().getWindow().getDecorView().getViewTreeObserver(), keyboardListener);
 }
Exemplo n.º 7
0
 private void removeVirtualKeyboardVisiblityListener() {
   Compatibility.removeGlobalLayoutListener(view.getViewTreeObserver(), keyboardListener);
 }
Exemplo n.º 8
0
  private void displayContact(LayoutInflater inflater, View view) {
    AvatarWithShadow contactPicture = (AvatarWithShadow) view.findViewById(R.id.contactPicture);
    if (contact.getPhotoUri() != null) {
      InputStream input =
          Compatibility.getContactPictureInputStream(
              LinphoneActivity.instance().getContentResolver(), contact.getID());
      contactPicture.setImageBitmap(BitmapFactory.decodeStream(input));
    } else {
      contactPicture.setImageResource(R.drawable.unknown_small);
    }

    TextView contactName = (TextView) view.findViewById(R.id.contactName);
    contactName.setText(contact.getName());

    TableLayout controls = (TableLayout) view.findViewById(R.id.controls);
    controls.removeAllViews();
    for (String numberOrAddress : contact.getNumerosOrAddresses()) {
      View v = inflater.inflate(R.layout.contact_control_row, null);

      String displayednumberOrAddress = numberOrAddress;
      if (numberOrAddress.startsWith("sip:")) {
        displayednumberOrAddress = displayednumberOrAddress.replace("sip:", "");
      }

      TextView tv = (TextView) v.findViewById(R.id.numeroOrAddress);
      tv.setText(displayednumberOrAddress);
      tv.setSelected(true);

      if (!displayChatAddressOnly) {
        v.findViewById(R.id.dial).setOnClickListener(dialListener);
        v.findViewById(R.id.dial).setTag(displayednumberOrAddress);
      } else {
        v.findViewById(R.id.dial).setVisibility(View.GONE);
      }

      v.findViewById(R.id.start_chat).setOnClickListener(chatListener);
      LinphoneProxyConfig lpc = LinphoneManager.getLc().getDefaultProxyConfig();
      if (lpc != null) {
        if (!displayednumberOrAddress.startsWith("sip:")) {
          numberOrAddress = "sip:" + displayednumberOrAddress;
        }

        String tag = numberOrAddress;
        if (!numberOrAddress.contains("@")) {
          tag = numberOrAddress + "@" + lpc.getDomain();
        }
        v.findViewById(R.id.start_chat).setTag(tag);
      } else {
        v.findViewById(R.id.start_chat).setTag(numberOrAddress);
      }

      final String finalNumberOrAddress = numberOrAddress;
      ImageView friend = (ImageView) v.findViewById(R.id.addFriend);
      if (getResources().getBoolean(R.bool.enable_linphone_friends) && !displayChatAddressOnly) {
        friend.setVisibility(View.VISIBLE);

        boolean isAlreadyAFriend =
            LinphoneManager.getLc().findFriendByAddress(finalNumberOrAddress) != null;
        if (!isAlreadyAFriend) {
          friend.setImageResource(R.drawable.friend_add);
          friend.setOnClickListener(
              new OnClickListener() {
                @Override
                public void onClick(View v) {
                  if (LinphoneActivity.instance().newFriend(contact, finalNumberOrAddress)) {
                    displayContact(ContactFragment.this.inflater, ContactFragment.this.view);
                  }
                }
              });
        } else {
          friend.setImageResource(R.drawable.friend_remove);
          friend.setOnClickListener(
              new OnClickListener() {
                @Override
                public void onClick(View v) {
                  if (LinphoneActivity.instance().removeFriend(contact, finalNumberOrAddress)) {
                    displayContact(ContactFragment.this.inflater, ContactFragment.this.view);
                  }
                }
              });
        }
      }

      if (getResources().getBoolean(R.bool.disable_chat)) {
        v.findViewById(R.id.start_chat).setVisibility(View.GONE);
      }

      controls.addView(v);
    }
  }