Fix UI in History call log

This commit is contained in:
Erwan Croze 2017-03-02 10:34:16 +01:00
parent f9a716add1
commit 160b0c3b8b
2 changed files with 80 additions and 65 deletions

View file

@ -33,6 +33,35 @@
android:layout_margin="5dp" android:layout_margin="5dp"
android:gravity="center_vertical"> android:gravity="center_vertical">
<ImageView
android:id="@+id/detail"
android:src="@drawable/list_detail"
android:contentDescription="@string/content_description_detail"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_alignParentRight="true"
android:adjustViewBounds="true"
android:paddingLeft="5dp"
android:paddingRight="5dp"/>
<CheckBox
android:id="@+id/delete"
android:button="@drawable/checkbox"
android:contentDescription="@string/content_description_delete"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_centerInParent="true"
android:visibility="gone"
android:padding="5dp" />
<RelativeLayout
android:id="@+id/history_click"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_toLeftOf="@id/detail"
android:gravity="center_vertical">
<RelativeLayout <RelativeLayout
android:id="@+id/avatar_layout" android:id="@+id/avatar_layout"
android:layout_width="wrap_content" android:layout_width="wrap_content"
@ -71,28 +100,6 @@
android:adjustViewBounds="true" android:adjustViewBounds="true"
android:layout_marginLeft="5dp"/> android:layout_marginLeft="5dp"/>
<ImageView
android:id="@+id/detail"
android:src="@drawable/list_detail"
android:contentDescription="@string/content_description_detail"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_alignParentRight="true"
android:adjustViewBounds="true"
android:paddingLeft="5dp"
android:paddingRight="5dp"/>
<CheckBox
android:id="@+id/delete"
android:button="@drawable/checkbox"
android:contentDescription="@string/content_description_delete"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_centerInParent="true"
android:visibility="gone"
android:padding="5dp" />
<TextView <TextView
android:id="@+id/sip_uri" android:id="@+id/sip_uri"
style="@style/font6" style="@style/font6"
@ -103,8 +110,8 @@
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="match_parent" android:layout_height="match_parent"
android:layout_toRightOf="@id/icon" android:layout_toRightOf="@id/icon"
android:layout_toLeftOf="@id/detail"
android:layout_marginLeft="10dp" /> android:layout_marginLeft="10dp" />
</RelativeLayout>
</RelativeLayout> </RelativeLayout>

View file

@ -47,6 +47,7 @@ import android.widget.CompoundButton;
import android.widget.ImageView; import android.widget.ImageView;
import android.widget.LinearLayout; import android.widget.LinearLayout;
import android.widget.ListView; import android.widget.ListView;
import android.widget.RelativeLayout;
import android.widget.TextView; import android.widget.TextView;
/** /**
@ -322,17 +323,6 @@ public class HistoryListFragment extends Fragment implements OnClickListener, On
LinphoneCallLog log = mLogs.get(position); LinphoneCallLog log = mLogs.get(position);
LinphoneManager.getLc().removeCallLog(log); LinphoneManager.getLc().removeCallLog(log);
mLogs = Arrays.asList(LinphoneManager.getLc().getCallLogs()); mLogs = Arrays.asList(LinphoneManager.getLc().getCallLogs());
} else {
if (LinphoneActivity.isInstanciated()) {
LinphoneCallLog log = mLogs.get(position);
LinphoneAddress address;
if (log.getDirection() == CallDirection.Incoming) {
address = log.getFrom();
} else {
address = log.getTo();
}
LinphoneActivity.instance().setAddresGoToDialerAndCall(address.asStringUriOnly(), address.getDisplayName(), null);
}
} }
} }
@ -358,6 +348,7 @@ public class HistoryListFragment extends Fragment implements OnClickListener, On
public CheckBox select; public CheckBox select;
public ImageView callDirection; public ImageView callDirection;
public ImageView contactPicture; public ImageView contactPicture;
public RelativeLayout CallContact;
public ViewHolder(View view) { public ViewHolder(View view) {
contact = (TextView) view.findViewById(R.id.sip_uri); contact = (TextView) view.findViewById(R.id.sip_uri);
@ -365,6 +356,7 @@ public class HistoryListFragment extends Fragment implements OnClickListener, On
select = (CheckBox) view.findViewById(R.id.delete); select = (CheckBox) view.findViewById(R.id.delete);
callDirection = (ImageView) view.findViewById(R.id.icon); callDirection = (ImageView) view.findViewById(R.id.icon);
contactPicture = (ImageView) view.findViewById(R.id.contact_picture); contactPicture = (ImageView) view.findViewById(R.id.contact_picture);
CallContact = (RelativeLayout) view.findViewById(R.id.history_click);
} }
} }
@ -487,6 +479,7 @@ public class HistoryListFragment extends Fragment implements OnClickListener, On
} }
if (isEditMode) { if (isEditMode) {
holder.CallContact.setOnClickListener(null);
holder.select.setVisibility(View.VISIBLE); holder.select.setVisibility(View.VISIBLE);
holder.select.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { holder.select.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override @Override
@ -526,6 +519,21 @@ public class HistoryListFragment extends Fragment implements OnClickListener, On
} }
} }
}); });
holder.CallContact.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
if (LinphoneActivity.isInstanciated()) {
LinphoneCallLog log = mLogs.get(position);
LinphoneAddress address;
if (log.getDirection() == CallDirection.Incoming) {
address = log.getFrom();
} else {
address = log.getTo();
}
LinphoneActivity.instance().setAddresGoToDialerAndCall(address.asStringUriOnly(), address.getDisplayName(), null);
}
}
});
} }
return view; return view;
} }