diff --git a/default.properties b/default.properties
deleted file mode 100644
index e735ffa56..000000000
--- a/default.properties
+++ /dev/null
@@ -1,13 +0,0 @@
-# This file is automatically generated by Android Tools.
-# Do not modify this file -- YOUR CHANGES WILL BE ERASED!
-#
-# This file must be checked in Version Control Systems.
-#
-# To customize properties used by the Ant build system use,
-# "build.properties", and override values to adapt the script to your
-# project structure.
-
-# Indicates whether an apk should be generated for each density.
-split.density=false
-# Project target.
-target=android-13
diff --git a/prepare_sources.sh b/prepare_sources.sh
index 0546614cd..70b5b4357 100755
--- a/prepare_sources.sh
+++ b/prepare_sources.sh
@@ -15,6 +15,5 @@ cd $topdir/submodules/externals/build/libvpx && ./asm_conversion.sh && cp *.asm
cd $topdir/submodules/mssilk && ./autogen.sh && ./configure MEDIASTREAMER_CFLAGS=" " MEDIASTREAMER_LIBS=" " && cd sdk && make extract-sources || ( echo "SILK audio plugin prepare state failed." ; exit 1 )
-
# As a memo, the config.h for zrtpcpp is generated using the command
# cmake -Denable-ccrtp=false submodules/externals/libzrtpcpp
diff --git a/res/drawable/in_call_mini.png b/res/drawable/in_call_mini.png
new file mode 100644
index 000000000..e307d23e3
Binary files /dev/null and b/res/drawable/in_call_mini.png differ
diff --git a/res/drawable/out_call.png b/res/drawable/out_call.png
index 7fef2b4ae..80640c31a 100644
Binary files a/res/drawable/out_call.png and b/res/drawable/out_call.png differ
diff --git a/res/drawable/out_call_mini.png b/res/drawable/out_call_mini.png
new file mode 100644
index 000000000..a3abd2de9
Binary files /dev/null and b/res/drawable/out_call_mini.png differ
diff --git a/res/layout/history_cell.xml b/res/layout/history_cell.xml
index f5149806d..108d35b06 100644
--- a/res/layout/history_cell.xml
+++ b/res/layout/history_cell.xml
@@ -4,19 +4,22 @@
android:padding="6dip">
+
+ android:layout_width="wrap_content" android:layout_height="wrap_content"
+ android:layout_gravity="right|bottom" android:layout_marginRight="6dip"
+ android:src="@drawable/in_call_mini" android:scaleType="centerInside"/>
+ android:layout_width="wrap_content" android:layout_height="wrap_content"
+ android:layout_gravity="right|bottom" android:layout_marginRight="6dip"
+ android:src="@drawable/out_call_mini" android:scaleType="centerInside"/>
mLogs;
-
- @SuppressWarnings("unchecked")
- CallHistoryAdapter(Context aContext) {
- mLogs = LinphoneManager.getLc().getCallLogs();
- }
- public int getCount() {
- return mLogs.size();
- }
-
- public Object getItem(int position) {
- return position;
- }
-
- public long getItemId(int position) {
-
- return position;
- }
-
- public View getView(int position, View convertView, ViewGroup parent) {
- View lView=null;
- if (convertView !=null) {
- lView = convertView;
- } else {
- lView = mInflater.inflate(R.layout.history_cell, parent,false);
-
- }
- LinphoneCallLog lLog = mLogs.get(position);
- LinphoneAddress lAddress;
- TextView lFirstLineView = (TextView) lView.findViewById(R.id.history_cell_first_line);
- TextView lSecondLineView = (TextView) lView.findViewById(R.id.history_cell_second_line);
- ImageView lDirectionImageIn = (ImageView) lView.findViewById(R.id.history_cell_icon_in);
- ImageView lDirectionImageOut = (ImageView) lView.findViewById(R.id.history_cell_icon_out);
-
- if (lLog.getDirection() == CallDirection.Incoming) {
- lAddress = lLog.getFrom();
- lDirectionImageIn.setVisibility(View.VISIBLE);
- lDirectionImageOut.setVisibility(View.GONE);
-
- } else {
- lAddress = lLog.getTo();
- lDirectionImageIn.setVisibility(View.GONE);
- lDirectionImageOut.setVisibility(View.VISIBLE);
- }
- LinphoneCore lc = LinphoneManager.getLc();
- LinphoneProxyConfig lProxyConfig = lc.getDefaultProxyConfig();
- String lDetailedName=null;
- String lDisplayName = lAddress.getDisplayName();
-
- if (lProxyConfig != null && lProxyConfig.getDomain().equals(lAddress.getDomain())) {
- lDetailedName = lAddress.getUserName();
- } else {
- lDetailedName = lAddress.asStringUriOnly();
- }
- if (lDisplayName == null) {
- lFirstLineView.setText(lDetailedName);
- lSecondLineView.setVisibility(View.GONE);
- } else {
- lFirstLineView.setText(lDisplayName);
- lSecondLineView.setText(lDetailedName);
- lSecondLineView.setVisibility(View.VISIBLE);
- }
-
- return lView;
-
- }
-
- }
-}
+/*
+DialerActivity.java
+Copyright (C) 2010 Belledonne Communications, Grenoble, France
+
+This program is free software; you can redistribute it and/or
+modify it under the terms of the GNU General Public License
+as published by the Free Software Foundation; either version 2
+of the License, or (at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+*/
+package org.linphone;
+
+
+
+import java.util.List;
+
+import org.linphone.core.CallDirection;
+import org.linphone.core.LinphoneAddress;
+import org.linphone.core.LinphoneCallLog;
+import org.linphone.core.LinphoneCore;
+import org.linphone.core.LinphoneProxyConfig;
+import org.linphone.core.Log;
+
+import android.app.ListActivity;
+import android.content.Context;
+import android.database.Cursor;
+import android.net.Uri;
+import android.os.Bundle;
+import android.provider.ContactsContract;
+import android.view.LayoutInflater;
+import android.view.Menu;
+import android.view.MenuInflater;
+import android.view.MenuItem;
+import android.view.View;
+import android.view.ViewGroup;
+import android.widget.BaseAdapter;
+import android.widget.ImageView;
+import android.widget.ListView;
+import android.widget.TextView;
+
+public class HistoryActivity extends ListActivity {
+ LayoutInflater mInflater;
+ Cursor mContacts;
+ @Override
+ public void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ mInflater = (LayoutInflater)getSystemService(Context.LAYOUT_INFLATER_SERVICE);
+ mContacts = getContacts();
+ }
+
+
+ @Override
+ protected void onListItemClick(ListView l, View v, int position, long id) {
+ super.onListItemClick(l, v, position, id);
+ TextView lFirstLineView = (TextView) v.findViewById(R.id.history_cell_first_line);
+ TextView lSecondLineView = (TextView) v.findViewById(R.id.history_cell_second_line);
+ ContactPicked parent = (ContactPicked) getParent();
+ if (lSecondLineView.getVisibility() == View.GONE) {
+ // no display name
+ parent.setAddressAndGoToDialer(lFirstLineView.getText().toString(), null, null);
+ } else {
+ parent.setAddressAndGoToDialer(
+ lSecondLineView.getText().toString(),
+ lFirstLineView.getText().toString(),
+ null);
+ }
+ }
+
+
+ @Override
+ protected void onResume() {
+ super.onResume();
+ setListAdapter(new CallHistoryAdapter(this));
+ }
+
+ @Override
+ public boolean onCreateOptionsMenu(Menu menu) {
+ // Inflate the currently selected menu XML resource.
+ MenuInflater inflater = getMenuInflater();
+ inflater.inflate(R.menu.history_activity_menu, menu);
+ return true;
+ }
+
+ @Override
+ public boolean onOptionsItemSelected(MenuItem item) {
+ switch (item.getItemId()) {
+ case R.id.menu_clear_history:
+ LinphoneManager.getLc().clearCallLogs();
+ setListAdapter(new CallHistoryAdapter(this));
+
+ break;
+ default:
+ Log.e("Unknown menu item [",item,"]");
+ break;
+ }
+
+ return false;
+ }
+
+ /**
+ * Obtains the contact list for the currently selected account.
+ *
+ * @return A cursor for for accessing the contact list.
+ */
+ private Cursor getContacts()
+ {
+ // Run query
+ Uri uri = ContactsContract.Data.CONTENT_URI;
+ String[] projection = new String[] {
+ ContactsContract.Data._ID,
+ ContactsContract.Data.DISPLAY_NAME,
+ ContactsContract.CommonDataKinds.SipAddress.SIP_ADDRESS,
+ ContactsContract.CommonDataKinds.Phone.NUMBER
+ };
+ String selection =
+ ContactsContract.Data.MIMETYPE+" ='"
+ +ContactsContract.CommonDataKinds.SipAddress.CONTENT_ITEM_TYPE+"'";
+ String[] selectionArgs = null;
+ String sortOrder = ContactsContract.Contacts.DISPLAY_NAME + " COLLATE LOCALIZED ASC";
+
+ return managedQuery(uri, projection, selection, selectionArgs, sortOrder);
+ }
+
+ private String getContactNameIfExist(String sipUri)
+ {
+ String contactName = null;
+ if (mContacts != null && mContacts.moveToFirst())
+ {
+ int displayNameColumnIndex = mContacts.getColumnIndex(ContactsContract.Contacts.DISPLAY_NAME);
+ int sipAdressColumnIndex = mContacts.getColumnIndex(ContactsContract.CommonDataKinds.SipAddress.SIP_ADDRESS);
+ int phoneNumberColumnIndex = mContacts.getColumnIndex(ContactsContract.CommonDataKinds.Phone.NUMBER);
+ do
+ {
+ String sipAdress = mContacts.getString(sipAdressColumnIndex);
+ String phoneNumber = mContacts.getString(phoneNumberColumnIndex);
+ if (sipUri.toLowerCase().contains(sipAdress.toLowerCase()) || sipUri.toLowerCase().contains(phoneNumber.toLowerCase()))
+ contactName = mContacts.getString(displayNameColumnIndex);
+ }
+ while (contactName == null && mContacts.moveToNext());
+ }
+ return contactName;
+ }
+
+ class CallHistoryAdapter extends BaseAdapter {
+ final List mLogs;
+
+ @SuppressWarnings("unchecked")
+ CallHistoryAdapter(Context aContext) {
+ mLogs = LinphoneManager.getLc().getCallLogs();
+ }
+ public int getCount() {
+ return mLogs.size();
+ }
+
+ public Object getItem(int position) {
+ return position;
+ }
+
+ public long getItemId(int position) {
+
+ return position;
+ }
+
+ public View getView(int position, View convertView, ViewGroup parent) {
+ View lView=null;
+ if (convertView !=null) {
+ lView = convertView;
+ } else {
+ lView = mInflater.inflate(R.layout.history_cell, parent,false);
+
+ }
+ LinphoneCallLog lLog = mLogs.get(position);
+ LinphoneAddress lAddress;
+ TextView lFirstLineView = (TextView) lView.findViewById(R.id.history_cell_first_line);
+ TextView lSecondLineView = (TextView) lView.findViewById(R.id.history_cell_second_line);
+ ImageView lDirectionImageIn = (ImageView) lView.findViewById(R.id.history_cell_icon_in);
+ ImageView lDirectionImageOut = (ImageView) lView.findViewById(R.id.history_cell_icon_out);
+ ImageView lContactPicture = (ImageView) lView.findViewById(R.id.history_cell_icon_contact);
+
+ if (lLog.getDirection() == CallDirection.Incoming) {
+ lAddress = lLog.getFrom();
+ lDirectionImageIn.setVisibility(View.VISIBLE);
+ lDirectionImageOut.setVisibility(View.GONE);
+
+ } else {
+ lAddress = lLog.getTo();
+ lDirectionImageIn.setVisibility(View.GONE);
+ lDirectionImageOut.setVisibility(View.VISIBLE);
+ }
+
+ Uri uri = LinphoneUtils.findUriPictureOfContactAndSetDisplayName(lAddress, getContentResolver());
+ LinphoneUtils.setImagePictureFromUri(lView.getContext(), lContactPicture, uri, R.drawable.unknown_person);
+
+ LinphoneCore lc = LinphoneManager.getLc();
+ LinphoneProxyConfig lProxyConfig = lc.getDefaultProxyConfig();
+ String lDetailedName=null;
+ String lDisplayName = lAddress.getDisplayName();
+ if (lDisplayName == null)
+ lDisplayName = getContactNameIfExist(lAddress.asStringUriOnly());
+
+ if (lProxyConfig != null && lProxyConfig.getDomain().equals(lAddress.getDomain())) {
+ lDetailedName = lAddress.getUserName();
+ } else {
+ lDetailedName = lAddress.asStringUriOnly();
+ }
+
+ if (lDisplayName == null) {
+ lFirstLineView.setText(lDetailedName);
+ lSecondLineView.setVisibility(View.GONE);
+ } else {
+ lFirstLineView.setText(lDisplayName);
+ lSecondLineView.setText(lDetailedName);
+ lSecondLineView.setVisibility(View.VISIBLE);
+ }
+
+ return lView;
+
+ }
+
+ }
+}