Fix back action in group chat + get friend in search conctacts
This commit is contained in:
parent
bb208448cb
commit
a085e6424e
2 changed files with 21 additions and 22 deletions
|
@ -240,7 +240,7 @@ public class LinphoneActivity extends LinphoneGenericActivity implements OnClick
|
|||
@Override
|
||||
public void onRegistrationStateChanged(Core lc, ProxyConfig proxy, RegistrationState state, String smessage) {
|
||||
AuthInfo authInfo = lc.findAuthInfo(proxy.getRealm(), proxy.getIdentityAddress().getUsername(), proxy.getDomain());
|
||||
|
||||
|
||||
refreshAccounts();
|
||||
|
||||
if(getResources().getBoolean(R.bool.use_phone_number_validation)
|
||||
|
@ -424,6 +424,7 @@ public class LinphoneActivity extends LinphoneGenericActivity implements OnClick
|
|||
fragment = new ChatListFragment();
|
||||
break;
|
||||
case CREATE_CHAT:
|
||||
checkAndRequestWriteContactsPermission();
|
||||
fragment = new ChatCreationFragment();
|
||||
break;
|
||||
case INFO_GROUP_CHAT:
|
||||
|
@ -1275,7 +1276,8 @@ public class LinphoneActivity extends LinphoneGenericActivity implements OnClick
|
|||
int readContactsI = -1;
|
||||
for (int i = 0; i < permissions.length; i++) {
|
||||
Log.i("[Permission] " + permissions[i] + " is " + (grantResults[i] == PackageManager.PERMISSION_GRANTED ? "granted" : "denied"));
|
||||
if (permissions[i].compareTo(Manifest.permission.READ_CONTACTS) == 0)
|
||||
if (permissions[i].compareTo(Manifest.permission.READ_CONTACTS) == 0 ||
|
||||
permissions[i].compareTo(Manifest.permission.WRITE_CONTACTS) == 0)
|
||||
readContactsI = i;
|
||||
}
|
||||
|
||||
|
@ -1548,17 +1550,24 @@ public class LinphoneActivity extends LinphoneGenericActivity implements OnClick
|
|||
|
||||
public boolean onKeyDown(int keyCode, KeyEvent event) {
|
||||
if (keyCode == KeyEvent.KEYCODE_BACK) {
|
||||
if (currentFragment == FragmentsAvailable.DIALER
|
||||
|| currentFragment == FragmentsAvailable.CONTACTS_LIST
|
||||
|| currentFragment == FragmentsAvailable.HISTORY_LIST
|
||||
|| currentFragment == FragmentsAvailable.CHAT_LIST) {
|
||||
boolean isBackgroundModeActive = LinphonePreferences.instance().isBackgroundModeEnabled();
|
||||
if (!isBackgroundModeActive) {
|
||||
stopService(new Intent(Intent.ACTION_MAIN).setClass(this, LinphoneService.class));
|
||||
finish();
|
||||
} else if (LinphoneUtils.onKeyBackGoHome(this, keyCode, event)) {
|
||||
switch(currentFragment) {
|
||||
case DIALER :
|
||||
case CONTACTS_LIST:
|
||||
case HISTORY_LIST:
|
||||
case CHAT_LIST:
|
||||
boolean isBackgroundModeActive = LinphonePreferences.instance().isBackgroundModeEnabled();
|
||||
if (!isBackgroundModeActive) {
|
||||
stopService(new Intent(Intent.ACTION_MAIN).setClass(this, LinphoneService.class));
|
||||
finish();
|
||||
} else if (LinphoneUtils.onKeyBackGoHome(this, keyCode, event)) {
|
||||
return true;
|
||||
}
|
||||
break;
|
||||
case GROUP_CHAT:
|
||||
LinphoneActivity.instance().goToChatList();
|
||||
return true;
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
return super.onKeyDown(keyCode, event);
|
||||
|
|
|
@ -165,16 +165,6 @@ public class SearchContactsListAdapter extends BaseAdapter {
|
|||
}
|
||||
|
||||
public void searchContacts(String search, ListView resultContactsSearch) {
|
||||
if (search == null || search.length() == 0 || search.trim().length() == 0) {
|
||||
contacts = getContactsList();
|
||||
resultContactsSearch.setAdapter(this);
|
||||
if (ContactsManager.getInstance() != null) {
|
||||
ContactsManager.getInstance().getMagicSearch().resetSearchCache();
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
search = search.trim();
|
||||
List<ContactAddress> result = new ArrayList<>();
|
||||
|
||||
String domain = "";
|
||||
|
|
Loading…
Reference in a new issue