Skip to content
Snippets Groups Projects
Commit a458ba23 authored by Alexandre Lision's avatar Alexandre Lision
Browse files

* #36758: link with displayed name stored in history

parent 5dd430f5
No related branches found
No related tags found
No related merge requests found
......@@ -32,6 +32,7 @@ as that of the covered work.
-->
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:swipe="http://schemas.android.com/apk/res-auto"
android:id="@+id/drag_view"
android:layout_width="match_parent"
android:layout_height="match_parent"
......@@ -101,4 +102,5 @@ as that of the covered work.
android:textColor="@color/white"
android:textSize="30sp" />
</LinearLayout>
\ No newline at end of file
......@@ -40,6 +40,5 @@ as that of the covered work.
<dimen name="bubble_size">100dp</dimen>
<dimen name="header_history_detail">400dp</dimen>
</resources>
\ No newline at end of file
......@@ -86,6 +86,7 @@ import android.util.Log;
import android.view.Gravity;
import android.view.MenuItem;
import android.view.View;
import android.view.WindowManager;
import android.widget.RelativeLayout;
import android.widget.Toast;
......@@ -636,6 +637,14 @@ public class HomeActivity extends Activity implements DialingFragment.Callbacks,
mContactDrawer.collapsePane();
}
@Override
public void toggleForSearchDrawer() {
if (mContactDrawer.isExpanded()) {
mContactDrawer.collapsePane();
} else
mContactDrawer.expandPane();
}
@Override
public void confCreated(Intent intent) {
// TODO Auto-generated method stub
......
......@@ -127,6 +127,10 @@ public class ContactListFragment extends Fragment implements OnQueryTextListener
public void setDragView(RelativeLayout relativeLayout) {
}
@Override
public void toggleForSearchDrawer() {
}
};
public interface Callbacks {
......@@ -144,6 +148,8 @@ public class ContactListFragment extends Fragment implements OnQueryTextListener
void setDragView(RelativeLayout relativeLayout);
void toggleForSearchDrawer();
}
@Override
......@@ -185,7 +191,7 @@ public class ContactListFragment extends Fragment implements OnQueryTextListener
mQuickReturnSearchView.setOnQueryTextListener(ContactListFragment.this);
mQuickReturnSearchView.setIconified(false);
mQuickReturnSearchView.setFocusable(true);
mCallbacks.toggleDrawer();
mCallbacks.toggleForSearchDrawer();
}
});
......@@ -274,7 +280,7 @@ public class ContactListFragment extends Fragment implements OnQueryTextListener
@Override
public void onItemClick(AdapterView<?> arg0, View view, int pos, long id) {
Log.i(TAG, "Opening Item");
mSwipeLvTouchListener.openItem(view, pos, id);
}
});
......
......@@ -66,7 +66,6 @@ public class DetailsHistoryEntryFragment extends Fragment {
View mheaderView;
DetailHistoryAdapter mAdapter;
HistoryEntry toDisplay;
@SuppressWarnings("unused")
private static final String TAG = DetailsHistoryEntryFragment.class.getSimpleName();
ContactPictureTask tasker;
......@@ -120,6 +119,11 @@ public class DetailsHistoryEntryFragment extends Fragment {
super.onCreate(savedInstanceState);
toDisplay = (HistoryEntry) getArguments().get("entry");
Log.i(TAG, "Ok, we got " + toDisplay.getIncoming_sum() + " incoming calls");
Log.i(TAG, "Ok, we got " + toDisplay.getMissed_sum() + " missed calls");
Log.i(TAG, "Ok, we got " + toDisplay.getOutgoing_sum() + " outgoing calls");
mAdapter = new DetailHistoryAdapter(toDisplay.getCalls(), getActivity());
}
......
......@@ -220,7 +220,6 @@ public class HistoryFragment extends ListFragment implements LoaderCallbacks<Arr
// SipCall call = (SipCall) mCallList.values().toArray()[position];
entryView.displayName.setText(dataset.get(pos).getContact().getmDisplayName());
infos_fetcher.execute(new ContactPictureTask(mContext, entryView.photo, dataset.get(pos).getContact()));
entryView.incoming.setText(getString(R.string.hist_in_calls, dataset.get(pos).getIncoming_sum()));
......
......@@ -46,10 +46,15 @@ public class HistoryLoader extends AsyncTaskLoader<ArrayList<HistoryEntry>> {
ArrayList<HashMap<String, String>> history = (ArrayList<HashMap<String, String>>) service.getHistory();
for (HashMap<String, String> entry : history) {
CallContact contact = null;
String contactName = entry.get(ServiceConstants.history.DISPLAY_NAME_KEY);
String number_called = entry.get(ServiceConstants.history.PEER_NUMBER_KEY);
if (contactName.isEmpty()) {
contact = ContactBuilder.buildUnknownContact(number_called);
} else {
contact = ContactBuilder.getInstance().buildSimpleContact(contactName, number_called);
}
// Log.w(TAG, "----------------------Number" + number_called);
CallContact c = null;
if (historyEntries.containsKey(number_called)) {
// It's a direct match
historyEntries.get(number_called).addHistoryCall(new HistoryCall(entry));
......@@ -59,19 +64,17 @@ public class HistoryLoader extends AsyncTaskLoader<ArrayList<HistoryEntry>> {
Matcher m = p.matcher(number_called);
if (m.find()) {
// Log.i(TAG, "Pattern found:" + m.group(1));
if (historyEntries.containsKey(m.group(1) + "@" + m.group(2))) {
historyEntries.get(m.group(1) + "@" + m.group(2)).addHistoryCall(new HistoryCall(entry));
} else {
c = ContactBuilder.buildUnknownContact(m.group(1) + "@" + m.group(2));
HistoryEntry e = new HistoryEntry(entry.get(ServiceConstants.history.ACCOUNT_ID_KEY), c);
HistoryEntry e = new HistoryEntry(entry.get(ServiceConstants.history.ACCOUNT_ID_KEY), contact);
e.addHistoryCall(new HistoryCall(entry));
historyEntries.put(m.group(1) + "@" + m.group(2), e);
}
} else {
c = ContactBuilder.buildUnknownContact(number_called);
HistoryEntry e = new HistoryEntry(entry.get(ServiceConstants.history.ACCOUNT_ID_KEY), c);
HistoryEntry e = new HistoryEntry(entry.get(ServiceConstants.history.ACCOUNT_ID_KEY), contact);
e.addHistoryCall(new HistoryCall(entry));
historyEntries.put(number_called, e);
}
......
......@@ -182,6 +182,13 @@ public class CallContact implements Parcelable {
return result;
}
public CallContact buildSimpleContact(String name, String number_called) {
ArrayList<Phone> phones = new ArrayList<Phone>();
phones.add(new Phone(number_called, 0));
return new CallContact(-1, name, 0, phones, new ArrayList<CallContact.Phone>(), "", false);
}
}
@Override
......
......@@ -85,11 +85,13 @@ public class HistoryEntry implements Parcelable {
public void addHistoryCall(HistoryCall historyCall) {
calls.put(historyCall.call_start, historyCall);
if (historyCall.getDirection().contentEquals(ServiceConstants.history.OUTGOING_STRING)) {
++outgoing_sum;
} else if (historyCall.isIncoming()) {
if (historyCall.isIncoming()) {
++incoming_sum;
} else {
++outgoing_sum;
}
if (historyCall.isMissed())
missed_sum++;
}
public String getNumber() {
......@@ -134,7 +136,6 @@ public class HistoryEntry implements Parcelable {
dest.writeList(new ArrayList<HistoryCall>(calls.values()));
dest.writeList(new ArrayList<Long>(calls.keySet()));
dest.writeMap(calls);
dest.writeString(accountID);
dest.writeInt(missed_sum);
dest.writeInt(outgoing_sum);
......@@ -242,7 +243,7 @@ public class HistoryEntry implements Parcelable {
}
public String getDisplayName() {
return displayName;
return displayName.substring(0, displayName.indexOf('@'));
}
@Override
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment