Better History display
This commit is contained in:
parent
ec53982b3e
commit
aa3522b74c
7 changed files with 242 additions and 197 deletions
|
@ -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
|
|
|
@ -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 )
|
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
|
# As a memo, the config.h for zrtpcpp is generated using the command
|
||||||
# cmake -Denable-ccrtp=false submodules/externals/libzrtpcpp
|
# cmake -Denable-ccrtp=false submodules/externals/libzrtpcpp
|
||||||
|
|
BIN
res/drawable/in_call_mini.png
Normal file
BIN
res/drawable/in_call_mini.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 807 B |
Binary file not shown.
Before Width: | Height: | Size: 3.2 KiB After Width: | Height: | Size: 2.8 KiB |
BIN
res/drawable/out_call_mini.png
Normal file
BIN
res/drawable/out_call_mini.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 852 B |
|
@ -7,16 +7,19 @@
|
||||||
android:layout_alignParentTop="true"
|
android:layout_alignParentTop="true"
|
||||||
android:layout_alignParentBottom="true" android:layout_marginRight="6dip"
|
android:layout_alignParentBottom="true" android:layout_marginRight="6dip"
|
||||||
android:id="@+id/history_cell_icon">
|
android:id="@+id/history_cell_icon">
|
||||||
|
<ImageView android:id="@+id/history_cell_icon_contact"
|
||||||
|
android:layout_width="wrap_content" android:layout_height="fill_parent"
|
||||||
|
android:layout_alignParentTop="true"
|
||||||
|
android:layout_alignParentBottom="true" android:layout_marginRight="6dip"
|
||||||
|
android:scaleType="centerInside"/>
|
||||||
<ImageView android:id="@+id/history_cell_icon_in"
|
<ImageView android:id="@+id/history_cell_icon_in"
|
||||||
android:layout_width="wrap_content" android:layout_height="fill_parent"
|
android:layout_width="wrap_content" android:layout_height="wrap_content"
|
||||||
android:layout_alignParentTop="true"
|
android:layout_gravity="right|bottom" android:layout_marginRight="6dip"
|
||||||
android:layout_alignParentBottom="true" android:layout_marginRight="6dip"
|
android:src="@drawable/in_call_mini" android:scaleType="centerInside"/>
|
||||||
android:src="@drawable/in_call" android:scaleType="centerInside"/>
|
|
||||||
<ImageView android:id="@+id/history_cell_icon_out"
|
<ImageView android:id="@+id/history_cell_icon_out"
|
||||||
android:layout_width="wrap_content" android:layout_height="fill_parent"
|
android:layout_width="wrap_content" android:layout_height="wrap_content"
|
||||||
android:layout_alignParentTop="true"
|
android:layout_gravity="right|bottom" android:layout_marginRight="6dip"
|
||||||
android:layout_alignParentBottom="true" android:layout_marginRight="6dip"
|
android:src="@drawable/out_call_mini" android:scaleType="centerInside"/>
|
||||||
android:src="@drawable/out_call" android:scaleType="centerInside"/>
|
|
||||||
</FrameLayout>
|
</FrameLayout>
|
||||||
|
|
||||||
<TextView android:id="@+id/history_cell_second_line"
|
<TextView android:id="@+id/history_cell_second_line"
|
||||||
|
|
|
@ -31,7 +31,10 @@ import org.linphone.core.Log;
|
||||||
|
|
||||||
import android.app.ListActivity;
|
import android.app.ListActivity;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
|
import android.database.Cursor;
|
||||||
|
import android.net.Uri;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
|
import android.provider.ContactsContract;
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.Menu;
|
import android.view.Menu;
|
||||||
import android.view.MenuInflater;
|
import android.view.MenuInflater;
|
||||||
|
@ -45,10 +48,12 @@ import android.widget.TextView;
|
||||||
|
|
||||||
public class HistoryActivity extends ListActivity {
|
public class HistoryActivity extends ListActivity {
|
||||||
LayoutInflater mInflater;
|
LayoutInflater mInflater;
|
||||||
|
Cursor mContacts;
|
||||||
@Override
|
@Override
|
||||||
public void onCreate(Bundle savedInstanceState) {
|
public void onCreate(Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
mInflater = (LayoutInflater)getSystemService(Context.LAYOUT_INFLATER_SERVICE);
|
mInflater = (LayoutInflater)getSystemService(Context.LAYOUT_INFLATER_SERVICE);
|
||||||
|
mContacts = getContacts();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -100,6 +105,49 @@ public class HistoryActivity extends ListActivity {
|
||||||
return false;
|
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 {
|
class CallHistoryAdapter extends BaseAdapter {
|
||||||
final List<LinphoneCallLog> mLogs;
|
final List<LinphoneCallLog> mLogs;
|
||||||
|
@ -135,6 +183,7 @@ public class HistoryActivity extends ListActivity {
|
||||||
TextView lSecondLineView = (TextView) lView.findViewById(R.id.history_cell_second_line);
|
TextView lSecondLineView = (TextView) lView.findViewById(R.id.history_cell_second_line);
|
||||||
ImageView lDirectionImageIn = (ImageView) lView.findViewById(R.id.history_cell_icon_in);
|
ImageView lDirectionImageIn = (ImageView) lView.findViewById(R.id.history_cell_icon_in);
|
||||||
ImageView lDirectionImageOut = (ImageView) lView.findViewById(R.id.history_cell_icon_out);
|
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) {
|
if (lLog.getDirection() == CallDirection.Incoming) {
|
||||||
lAddress = lLog.getFrom();
|
lAddress = lLog.getFrom();
|
||||||
|
@ -146,16 +195,23 @@ public class HistoryActivity extends ListActivity {
|
||||||
lDirectionImageIn.setVisibility(View.GONE);
|
lDirectionImageIn.setVisibility(View.GONE);
|
||||||
lDirectionImageOut.setVisibility(View.VISIBLE);
|
lDirectionImageOut.setVisibility(View.VISIBLE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Uri uri = LinphoneUtils.findUriPictureOfContactAndSetDisplayName(lAddress, getContentResolver());
|
||||||
|
LinphoneUtils.setImagePictureFromUri(lView.getContext(), lContactPicture, uri, R.drawable.unknown_person);
|
||||||
|
|
||||||
LinphoneCore lc = LinphoneManager.getLc();
|
LinphoneCore lc = LinphoneManager.getLc();
|
||||||
LinphoneProxyConfig lProxyConfig = lc.getDefaultProxyConfig();
|
LinphoneProxyConfig lProxyConfig = lc.getDefaultProxyConfig();
|
||||||
String lDetailedName=null;
|
String lDetailedName=null;
|
||||||
String lDisplayName = lAddress.getDisplayName();
|
String lDisplayName = lAddress.getDisplayName();
|
||||||
|
if (lDisplayName == null)
|
||||||
|
lDisplayName = getContactNameIfExist(lAddress.asStringUriOnly());
|
||||||
|
|
||||||
if (lProxyConfig != null && lProxyConfig.getDomain().equals(lAddress.getDomain())) {
|
if (lProxyConfig != null && lProxyConfig.getDomain().equals(lAddress.getDomain())) {
|
||||||
lDetailedName = lAddress.getUserName();
|
lDetailedName = lAddress.getUserName();
|
||||||
} else {
|
} else {
|
||||||
lDetailedName = lAddress.asStringUriOnly();
|
lDetailedName = lAddress.asStringUriOnly();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (lDisplayName == null) {
|
if (lDisplayName == null) {
|
||||||
lFirstLineView.setText(lDetailedName);
|
lFirstLineView.setText(lDetailedName);
|
||||||
lSecondLineView.setVisibility(View.GONE);
|
lSecondLineView.setVisibility(View.GONE);
|
||||||
|
|
Loading…
Reference in a new issue