Skip to content
Snippets Groups Projects
Commit 06637f6c authored by Adrien Béraud's avatar Adrien Béraud
Browse files

conversation list: show all contacts

Tuleap: #327
Change-Id: I609c7dfe412c7c152774dbfd82c233e7234a66ce
parent 2246a834
Branches
Tags
No related merge requests found
......@@ -167,13 +167,6 @@ public class ContactsAdapter extends BaseAdapter implements StickyListHeadersAda
}));
}
convertView.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
parent.get().onTextContact(item);
}
});
return convertView;
}
......
......@@ -63,7 +63,6 @@ import cx.ring.adapters.ContactsAdapter;
import cx.ring.adapters.StarredContactsAdapter;
import cx.ring.client.ConversationActivity;
import cx.ring.client.HomeActivity;
import cx.ring.client.NewConversationActivity;
import cx.ring.loaders.ContactsLoader;
import cx.ring.loaders.LoaderConstants;
import cx.ring.model.CallContact;
......@@ -235,7 +234,6 @@ public class CallListFragment extends Fragment implements SearchView.OnQueryText
searchView.setInputType(EditorInfo.TYPE_CLASS_TEXT);
else
searchView.setInputType(EditorInfo.TYPE_CLASS_PHONE);
//searchMenuItem.expandActionView();
return true;
case R.id.menu_clear_history:
mCallbacks.getService().clearHistory();
......@@ -279,7 +277,7 @@ public class CallListFragment extends Fragment implements SearchView.OnQueryText
newconv_btn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
startActivity(new Intent().setClass(getActivity(), NewConversationActivity.class));
searchMenuItem.expandActionView();
}
});
......@@ -292,6 +290,13 @@ public class CallListFragment extends Fragment implements SearchView.OnQueryText
contactList = (StickyListHeadersListView) inflatedView.findViewById(R.id.contacts_stickylv);
contactList.setDivider(null);
contactList.addHeaderView(mHeader, null, false);
contactList.setOnItemClickListener(new OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
final CallContact item = (CallContact) parent.getItemAtPosition(position);
((HomeActivity)getActivity()).onTextContact(item);
}
});
mStarredGrid = (GridView) mHeader.findViewById(R.id.favorites_grid);
llMain = (LinearLayout) mHeader.findViewById(R.id.llMain);
......@@ -472,7 +477,7 @@ public class CallListFragment extends Fragment implements SearchView.OnQueryText
return;
calls.clear();
for (Conversation c : list) {
if (!c.getAccountsUsed().isEmpty() || c.getCurrentCall() != null)
if (!c.getContact().isUnknown() || !c.getAccountsUsed().isEmpty() || c.getCurrentCall() != null)
calls.add(c);
}
notifyDataSetChanged();
......@@ -569,59 +574,10 @@ public class CallListFragment extends Fragment implements SearchView.OnQueryText
infos_fetcher.execute(task);
}
}
convertView.setOnDragListener(dragListener);
return convertView;
}
}
OnDragListener dragListener = new OnDragListener() {
@SuppressWarnings("deprecation")
// deprecated in API 16....
@Override
public boolean onDrag(View v, DragEvent event) {
switch (event.getAction()) {
case DragEvent.ACTION_DRAG_STARTED:
// Do nothing
// Log.w(TAG, "ACTION_DRAG_STARTED");
break;
case DragEvent.ACTION_DRAG_ENTERED:
// Log.w(TAG, "ACTION_DRAG_ENTERED");
v.setBackgroundColor(Color.GREEN);
break;
case DragEvent.ACTION_DRAG_EXITED:
// Log.w(TAG, "ACTION_DRAG_EXITED");
v.setBackgroundDrawable(getResources().getDrawable(cx.ring.R.drawable.item_generic_selector));
break;
case DragEvent.ACTION_DROP:
// Log.w(TAG, "ACTION_DROP");
View view = (View) event.getLocalState();
Item i = event.getClipData().getItemAt(0);
Intent intent = i.getIntent();
intent.setExtrasClassLoader(Conference.class.getClassLoader());
Conversation initial = ((CallListAdapter.ViewHolder) view.getTag()).conv;
Conversation target = ((CallListAdapter.ViewHolder) v.getTag()).conv;
if (initial == target) {
return true;
}
break;
case DragEvent.ACTION_DRAG_ENDED:
// Log.w(TAG, "ACTION_DRAG_ENDED");
View view1 = (View) event.getLocalState();
view1.setVisibility(View.VISIBLE);
v.setBackgroundDrawable(getResources().getDrawable(cx.ring.R.drawable.item_generic_selector));
default:
break;
}
return true;
}
};
@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
......
......@@ -1014,6 +1014,12 @@ public class LocalService extends Service implements SharedPreferences.OnSharedP
}
for (Conversation c : ret.values())
Log.w(TAG, "Conversation : " + c.getContact().getId() + " " + c.getContact().getDisplayName() + " " + c.getLastNumberUsed(c.getLastAccountUsed()) + " " + c.getLastInteraction().toString());
for (int i=0; i<localContactCache.size(); i++) {
CallContact contact = localContactCache.valueAt(i);
String key = contact.getIds().get(0);
if (!ret.containsKey(key))
ret.put(key, new Conversation(contact));
}
} catch (RemoteException | SQLException e) {
e.printStackTrace();
}
......
......@@ -53,10 +53,8 @@ along with this program; if not, write to the Free Software
android:layout_height="match_parent"
android:layout_alignParentLeft="true"
android:layout_below="@+id/error_msg_pane"
android:background="@android:color/white"
android:clipToPadding="false"
android:divider="@null"
android:drawSelectorOnTop="true"
android:elevation="2dp"
android:fastScrollEnabled="true"
android:paddingBottom="8dp"
......@@ -72,7 +70,6 @@ along with this program; if not, write to the Free Software
android:layout_below="@+id/error_msg_pane"
android:layout_marginLeft="0dp"
android:layout_marginTop="0dp"
android:background="@android:color/white"
android:clipToPadding="false"
android:divider="@null"
android:elevation="2dp"
......@@ -90,7 +87,7 @@ along with this program; if not, write to the Free Software
android:layout_gravity="bottom|end"
android:layout_margin="@dimen/fab_compat_margin"
android:elevation="6dp"
android:src="@drawable/ic_add_white_24dp"
android:src="@drawable/ic_dialpad_white_24dp"
app:backgroundTint="@color/color_primary_light"
app:elevation="6dp"
app:pressedTranslationZ="12dp"
......
......@@ -16,7 +16,6 @@
android:id="@+id/fav_head_label"
android:layout_width="match_parent"
android:layout_height="48dp"
android:background="@android:color/white"
android:gravity="center_vertical"
android:paddingLeft="16dp"
android:paddingRight="16dp"
......@@ -36,7 +35,6 @@
android:id="@+id/llMain"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@android:color/white"
android:padding="8dp">
<GridView
......
......@@ -2,7 +2,6 @@
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="48dp"
android:background="@android:color/white"
android:clickable="false"
android:focusable="false"
android:orientation="vertical" >
......
......@@ -22,8 +22,8 @@ along with this program; if not, write to the Free Software
android:id="@+id/call_entry"
android:layout_width="match_parent"
android:layout_height="72dp"
android:background="@drawable/item_history_selector"
android:descendantFocusability="blocksDescendants">
android:descendantFocusability="blocksDescendants"
android:padding="16dp">
<ImageView
android:id="@+id/photo"
......
......@@ -23,7 +23,8 @@ along with this program; if not, write to the Free Software
android:id="@+id/contactview"
android:layout_width="match_parent"
android:layout_height="72dp"
android:minHeight="72dp">
android:minHeight="72dp"
android:descendantFocusability="blocksDescendants">
<ImageView
android:id="@+id/photo"
......@@ -52,14 +53,13 @@ along with this program; if not, write to the Free Software
<ImageButton
android:id="@+id/quick_call"
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:layout_centerVertical="true"
android:background="@null"
android:contentDescription="@string/contact_quick_call_description"
android:paddingLeft="32dp"
android:paddingRight="32dp"
android:src="@drawable/ic_call_white_24dp"
android:tint="@color/black" />
android:tint="@color/black"
android:background="?selectableItemBackgroundBorderless"
android:padding="16dp" />
</RelativeLayout>
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment