diff --git a/res/layout/contact_cell.xml b/res/layout/contact_cell.xml index c61d6ad42..412c7f5c7 100644 --- a/res/layout/contact_cell.xml +++ b/res/layout/contact_cell.xml @@ -69,6 +69,7 @@ android:layout_height="wrap_content" android:layout_toRightOf="@id/avatar_layout" android:layout_centerVertical="true" + android:layout_toLeftOf="@id/delete" android:layout_marginLeft="10dp" /> ops = new ArrayList(); + ops.add(ContentProviderOperation.newDelete(ContactsContract.RawContacts.CONTENT_URI) + .withSelection(select, args) + .build() + ); + + try { + getActivity().getContentResolver().applyBatch(ContactsContract.AUTHORITY, ops); + ContactsManager.getInstance().removeAllFriends(contact); + } catch (Exception e) { + Log.w(e.getMessage() + ":" + e.getStackTrace()); + } + } + private void removeContacts(){ int size = contactsList.getAdapter().getCount(); for(int i=0; i 0) { missedCalls.setText(missedCallsCount + ""); missedCalls.setVisibility(View.VISIBLE); @@ -865,7 +865,7 @@ public class LinphoneActivity extends Activity implements OnClickListener, Conta } } - private void displayMissedChats(final int missedChatCount) {; + private void displayMissedChats(final int missedChatCount) { if (missedChatCount > 0) { missedChats.setText(missedChatCount + ""); missedChats.setVisibility(View.VISIBLE); @@ -1230,8 +1230,8 @@ public class LinphoneActivity extends Activity implements OnClickListener, Conta public boolean onKeyDown(int keyCode, KeyEvent event) { if (keyCode == KeyEvent.KEYCODE_BACK) { if (currentFragment == FragmentsAvailable.DIALER - || currentFragment == FragmentsAvailable.CONTACTS - || currentFragment == FragmentsAvailable.HISTORY + || currentFragment == FragmentsAvailable.CONTACTS_LIST + || currentFragment == FragmentsAvailable.HISTORY_LIST || currentFragment == FragmentsAvailable.CHATLIST) { boolean isBackgroundModeActive = LinphonePreferences.instance().isBackgroundModeEnabled(); if (!isBackgroundModeActive) { @@ -1332,24 +1332,37 @@ public class LinphoneActivity extends Activity implements OnClickListener, Conta private void displayMainAccount(){ defaultAccount.setVisibility(View.VISIBLE); - defaultAccount = (RelativeLayout) findViewById(R.id.default_account); ImageView status = (ImageView) defaultAccount.findViewById(R.id.status_led); TextView address = (TextView) defaultAccount.findViewById(R.id.address); TextView displayName = (TextView) defaultAccount.findViewById(R.id.display_name); + LinphoneProxyConfig proxy = LinphoneManager.getLc().getDefaultProxyConfig(); + if(proxy == null) { + displayName.setText(getString(R.string.no_account)); + status.setVisibility(View.GONE); - address.setText(proxy.getAddress().asStringUriOnly()); - displayName.setText(LinphoneUtils.getAddressDisplayName(proxy.getAddress())); - status.setImageResource(getStatusIconResource(proxy.getState())); + defaultAccount.setOnClickListener(new OnClickListener() { + @Override + public void onClick(View view) { + LinphoneActivity.instance().displayAccountSettings(0); + openOrCloseSideMenu(false); + } + }); + } else { + address.setText(proxy.getAddress().asStringUriOnly()); + displayName.setText(LinphoneUtils.getAddressDisplayName(proxy.getAddress())); + status.setImageResource(getStatusIconResource(proxy.getState())); + status.setVisibility(View.VISIBLE); - defaultAccount.setOnClickListener(new OnClickListener() { - @Override - public void onClick(View view) { - LinphoneActivity.instance().displayAccountSettings(LinphonePreferences.instance().getDefaultAccountIndex()); - openOrCloseSideMenu(false); - } - }); + defaultAccount.setOnClickListener(new OnClickListener() { + @Override + public void onClick(View view) { + LinphoneActivity.instance().displayAccountSettings(LinphonePreferences.instance().getDefaultAccountIndex()); + openOrCloseSideMenu(false); + } + }); + } } private void refreshAccounts(){ @@ -1373,11 +1386,7 @@ public class LinphoneActivity extends Activity implements OnClickListener, Conta accountsList = (ListView) findViewById(R.id.accounts_list); defaultAccount = (RelativeLayout) findViewById(R.id.default_account); - if (LinphoneManager.getLc().getDefaultProxyConfig() != null) { - displayMainAccount(); - } else { - defaultAccount.setVisibility(View.GONE); - } + displayMainAccount(); refreshAccounts(); } @@ -1424,7 +1433,7 @@ public class LinphoneActivity extends Activity implements OnClickListener, Conta view = getLayoutInflater().inflate(R.layout.accounts, parent, false); } - ImageView status = (ImageView) view.findViewById(R.id.statusLed); + ImageView status = (ImageView) view.findViewById(R.id.status_led); TextView address = (TextView) view.findViewById(R.id.address); String sipAddress = lpc.getAddress().asStringUriOnly();