Adding new views
This commit is contained in:
parent
1806dcbf7c
commit
b3f4fd0f62
9 changed files with 259 additions and 38 deletions
|
@ -1,43 +1,49 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
android:background="@drawable/list_selector"
|
android:background="@drawable/list_selector"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="25dp"
|
||||||
android:layout_height="60dp"
|
android:layout_height="60dp"
|
||||||
android:padding="5dp"
|
android:padding="5dp"
|
||||||
android:gravity="center_vertical"
|
android:gravity="center_vertical"
|
||||||
android:orientation="vertical">
|
android:orientation="vertical">
|
||||||
|
|
||||||
<LinearLayout
|
<RelativeLayout
|
||||||
android:id="@+id/layout"
|
android:id="@+id/avatar_layout"
|
||||||
android:background="@drawable/list_selector"
|
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="match_parent"
|
||||||
|
android:gravity="center">
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/contact_picture"
|
||||||
|
android:src="@drawable/avatar"
|
||||||
|
android:contentDescription="@string/content_description_contact_picture"
|
||||||
|
android:layout_width="35dp"
|
||||||
|
android:layout_height="35dp"
|
||||||
|
android:adjustViewBounds="true"
|
||||||
|
android:layout_alignParentLeft="true"
|
||||||
|
android:layout_marginLeft="5dp"/>
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/mask"
|
||||||
|
android:src="@drawable/avatar_mask"
|
||||||
|
android:layout_width="35dp"
|
||||||
|
android:layout_height="35dp"
|
||||||
|
android:adjustViewBounds="true"
|
||||||
|
android:layout_alignParentLeft="true"
|
||||||
|
android:layout_marginLeft="5dp"/>
|
||||||
|
|
||||||
|
</RelativeLayout>
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/sip_uri"
|
||||||
|
style="@style/font6"
|
||||||
|
android:lines="1"
|
||||||
|
android:ellipsize="end"
|
||||||
|
android:maxLines="1"
|
||||||
android:gravity="center_vertical"
|
android:gravity="center_vertical"
|
||||||
android:orientation="vertical"
|
android:layout_width="wrap_content"
|
||||||
android:layout_toLeftOf="@+id/layout_admin"
|
android:layout_height="match_parent"
|
||||||
android:layout_toStartOf="@+id/layout_admin"
|
android:layout_marginLeft="10dp" />
|
||||||
android:layout_alignParentTop="true"
|
|
||||||
android:layout_alignParentBottom="true">
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/contact_name"
|
|
||||||
style="@style/font6"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_centerVertical="true"
|
|
||||||
android:gravity="top|left"
|
|
||||||
android:lines="1"/>
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/contact_address"
|
|
||||||
style="@style/font2"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_centerVertical="true"
|
|
||||||
android:gravity="bottom|left"
|
|
||||||
android:lines="1"/>
|
|
||||||
|
|
||||||
</LinearLayout>
|
|
||||||
|
|
||||||
<ImageView
|
<ImageView
|
||||||
android:id="@+id/remove"
|
android:id="@+id/remove"
|
||||||
|
@ -50,17 +56,15 @@
|
||||||
android:layout_toRightOf="@+id/layout_admin"/>
|
android:layout_toRightOf="@+id/layout_admin"/>
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:id="@+id/layout_admin"
|
android:id="@id/layout_admin"
|
||||||
android:background="@drawable/list_selector"
|
android:background="@drawable/list_selector"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:gravity="center_vertical"
|
android:gravity="center_vertical"
|
||||||
android:orientation="horizontal"
|
android:orientation="horizontal"
|
||||||
android:layout_toRightOf="@+id/layout"
|
|
||||||
android:layout_alignParentTop="true"
|
android:layout_alignParentTop="true"
|
||||||
android:layout_alignParentBottom="true"
|
android:layout_alignParentBottom="true"
|
||||||
android:layout_toLeftOf="@+id/remove"
|
android:layout_toLeftOf="@id/remove">
|
||||||
android:layout_toStartOf="@+id/remove">
|
|
||||||
|
|
||||||
<ImageView
|
<ImageView
|
||||||
android:id="@+id/contact_is_select"
|
android:id="@+id/contact_is_select"
|
||||||
|
|
|
@ -242,6 +242,11 @@ public class ChatCreationFragment extends Fragment implements View.OnClickListen
|
||||||
getFragmentManager().popBackStackImmediate();
|
getFragmentManager().popBackStackImmediate();
|
||||||
} else if (id == R.id.next) {
|
} else if (id == R.id.next) {
|
||||||
//TODO aller selon le nombre de selectionner en chat ou en groupe
|
//TODO aller selon le nombre de selectionner en chat ou en groupe
|
||||||
|
if (contactsSelected.size() == 1) {
|
||||||
|
LinphoneActivity.instance().displayChat(contactsSelected.get(0).getAddress(), "", "");
|
||||||
|
} else {
|
||||||
|
|
||||||
|
}
|
||||||
} else if (id == R.id.clearSearchField) {
|
} else if (id == R.id.clearSearchField) {
|
||||||
searchField.setText("");
|
searchField.setText("");
|
||||||
searchAdapter.searchContacts("", contactsList);
|
searchAdapter.searchContacts("", contactsList);
|
||||||
|
|
|
@ -307,10 +307,10 @@ public class ChatFragment extends Fragment implements OnClickListener, LinphoneC
|
||||||
keyboardListener = new ViewTreeObserver.OnGlobalLayoutListener() {
|
keyboardListener = new ViewTreeObserver.OnGlobalLayoutListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onGlobalLayout() {
|
public void onGlobalLayout() {
|
||||||
Rect visibleArea = new Rect();
|
Rect visibleArea = new Rect();
|
||||||
getActivity().getWindow().getDecorView().getWindowVisibleDisplayFrame(visibleArea);
|
getActivity().getWindow().getDecorView().getWindowVisibleDisplayFrame(visibleArea);
|
||||||
|
|
||||||
int heightDiff = getActivity().getWindow().getDecorView().getRootView().getHeight() - (visibleArea.bottom - visibleArea.top);
|
int heightDiff = getActivity().getWindow().getDecorView().getRootView().getHeight() - (visibleArea.bottom - visibleArea.top);
|
||||||
if (heightDiff > 200) {
|
if (heightDiff > 200) {
|
||||||
showKeyboardVisibleMode();
|
showKeyboardVisibleMode();
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -28,8 +28,17 @@ public class ContactAddress implements Serializable {
|
||||||
private String address;
|
private String address;
|
||||||
private boolean isLinphoneContact;
|
private boolean isLinphoneContact;
|
||||||
private boolean isSelect = false;
|
private boolean isSelect = false;
|
||||||
|
private boolean isAdmin = false;
|
||||||
private View view;
|
private View view;
|
||||||
|
|
||||||
|
public boolean isAdmin() {
|
||||||
|
return isAdmin;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setAdmin(boolean admin) {
|
||||||
|
isAdmin = admin;
|
||||||
|
}
|
||||||
|
|
||||||
public boolean isSelect() {
|
public boolean isSelect() {
|
||||||
return isSelect;
|
return isSelect;
|
||||||
}
|
}
|
||||||
|
|
|
@ -34,7 +34,9 @@ public enum FragmentsAvailable {
|
||||||
SETTINGS,
|
SETTINGS,
|
||||||
CHAT_LIST,
|
CHAT_LIST,
|
||||||
CHAT,
|
CHAT,
|
||||||
CREATE_CHAT;
|
CREATE_CHAT,
|
||||||
|
INFO_GROUP_CHAT,
|
||||||
|
GROUP_CHAT;
|
||||||
|
|
||||||
public boolean shouldAnimate() {
|
public boolean shouldAnimate() {
|
||||||
return true;
|
return true;
|
||||||
|
|
43
src/android/org/linphone/GroupChatFragment.java
Normal file
43
src/android/org/linphone/GroupChatFragment.java
Normal file
|
@ -0,0 +1,43 @@
|
||||||
|
package org.linphone;
|
||||||
|
|
||||||
|
import android.app.Fragment;
|
||||||
|
import android.os.Bundle;
|
||||||
|
import android.view.LayoutInflater;
|
||||||
|
import android.view.View;
|
||||||
|
import android.view.ViewGroup;
|
||||||
|
|
||||||
|
/*
|
||||||
|
GroupChatFragment.java
|
||||||
|
Copyright (C) 2017 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
|
*/
|
||||||
|
|
||||||
|
public class GroupChatFragment extends Fragment implements View.OnClickListener {
|
||||||
|
private LayoutInflater mInflater;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
|
||||||
|
mInflater = inflater;
|
||||||
|
View view = inflater.inflate(R.layout.create_chat, container, false);
|
||||||
|
|
||||||
|
return view;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onClick(View view) {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
94
src/android/org/linphone/GroupContactsListAdapter.java
Normal file
94
src/android/org/linphone/GroupContactsListAdapter.java
Normal file
|
@ -0,0 +1,94 @@
|
||||||
|
package org.linphone;
|
||||||
|
|
||||||
|
/*
|
||||||
|
GroupContactsListAdapter.java
|
||||||
|
Copyright (C) 2017 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
|
*/
|
||||||
|
|
||||||
|
import android.view.LayoutInflater;
|
||||||
|
import android.view.View;
|
||||||
|
import android.view.ViewGroup;
|
||||||
|
import android.widget.BaseAdapter;
|
||||||
|
import android.widget.ImageView;
|
||||||
|
import android.widget.TextView;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public class GroupContactsListAdapter extends BaseAdapter {
|
||||||
|
private class ViewHolder {
|
||||||
|
public TextView name;
|
||||||
|
public TextView admin;
|
||||||
|
public ImageView linphoneContact;
|
||||||
|
public ImageView isAdmin;
|
||||||
|
public ImageView photo;
|
||||||
|
|
||||||
|
public ViewHolder(View view) {
|
||||||
|
name = (TextView) view.findViewById(R.id.sip_uri);
|
||||||
|
linphoneContact = (ImageView) view.findViewById(R.id.contact_linphone);
|
||||||
|
isAdmin = (ImageView) view.findViewById(R.id.contact_is_select);
|
||||||
|
admin = (TextView) view.findViewById(R.id.admin);
|
||||||
|
photo = (ImageView) view.findViewById(R.id.contact_picture);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<ContactAddress> getGroupContacts() {
|
||||||
|
return groupContacts;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setGroupContacts(List<ContactAddress> groupContacts) {
|
||||||
|
this.groupContacts = groupContacts;
|
||||||
|
}
|
||||||
|
|
||||||
|
private List<ContactAddress> groupContacts;
|
||||||
|
private LayoutInflater mInflater;
|
||||||
|
|
||||||
|
public GroupContactsListAdapter(LayoutInflater inf) {
|
||||||
|
mInflater = inf;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getCount() {
|
||||||
|
return groupContacts.size();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Object getItem(int i) {
|
||||||
|
return groupContacts.get(i);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public long getItemId(int i) {
|
||||||
|
return i;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public View getView(int i, View convertView, ViewGroup parent) {
|
||||||
|
View view;
|
||||||
|
ViewHolder holder;
|
||||||
|
|
||||||
|
if (convertView != null) {
|
||||||
|
view = convertView;
|
||||||
|
holder = (ViewHolder) view.getTag();
|
||||||
|
} else {
|
||||||
|
view = mInflater.inflate(R.layout.search_contact_cell, parent, false);
|
||||||
|
holder = new ViewHolder(view);
|
||||||
|
view.setTag(holder);
|
||||||
|
}
|
||||||
|
|
||||||
|
return view;
|
||||||
|
}
|
||||||
|
}
|
43
src/android/org/linphone/InfoGroupChatFragment.java
Normal file
43
src/android/org/linphone/InfoGroupChatFragment.java
Normal file
|
@ -0,0 +1,43 @@
|
||||||
|
package org.linphone;
|
||||||
|
|
||||||
|
/*
|
||||||
|
InfoGroupChatFragment.java
|
||||||
|
Copyright (C) 2017 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
|
*/
|
||||||
|
|
||||||
|
import android.app.Fragment;
|
||||||
|
import android.os.Bundle;
|
||||||
|
import android.view.LayoutInflater;
|
||||||
|
import android.view.View;
|
||||||
|
import android.view.ViewGroup;
|
||||||
|
|
||||||
|
public class InfoGroupChatFragment extends Fragment implements View.OnClickListener {
|
||||||
|
private LayoutInflater mInflater;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
|
||||||
|
mInflater = inflater;
|
||||||
|
View view = inflater.inflate(R.layout.create_chat, container, false);
|
||||||
|
|
||||||
|
return view;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onClick(View view) {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
|
@ -409,6 +409,12 @@ public class LinphoneActivity extends LinphoneGenericActivity implements OnClick
|
||||||
case CREATE_CHAT:
|
case CREATE_CHAT:
|
||||||
fragment = new ChatCreationFragment();
|
fragment = new ChatCreationFragment();
|
||||||
break;
|
break;
|
||||||
|
case INFO_GROUP_CHAT:
|
||||||
|
fragment = new InfoGroupChatFragment();
|
||||||
|
break;
|
||||||
|
case GROUP_CHAT:
|
||||||
|
fragment = new GroupChatFragment();
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -650,6 +656,21 @@ public class LinphoneActivity extends LinphoneGenericActivity implements OnClick
|
||||||
return count;
|
return count;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void displayInfoChat(List<ContactAddress> list) {
|
||||||
|
Bundle extras = new Bundle();
|
||||||
|
ArrayList<String> listUri = new ArrayList<String>();
|
||||||
|
if (LinphoneManager.isInstanciated() && LinphoneManager.getLc() != null
|
||||||
|
&& LinphoneManager.getLc().getDefaultProxyConfig() != null
|
||||||
|
&& LinphoneManager.getLc().getDefaultProxyConfig().getIdentity() != null) {
|
||||||
|
listUri.add(LinphoneManager.getLc().getDefaultProxyConfig().getAddress().asStringUriOnly());
|
||||||
|
}
|
||||||
|
for (ContactAddress ca : list) {
|
||||||
|
listUri.add(ca.getAddress());
|
||||||
|
}
|
||||||
|
extras.putStringArrayList("contactsSelected", listUri);
|
||||||
|
changeCurrentFragment(FragmentsAvailable.INFO_GROUP_CHAT, extras);
|
||||||
|
}
|
||||||
|
|
||||||
private void displayChat(String sipUri, String message, String fileUri, String pictureUri, String thumbnailUri, String displayName, LinphoneAddress lAddress) {
|
private void displayChat(String sipUri, String message, String fileUri, String pictureUri, String thumbnailUri, String displayName, LinphoneAddress lAddress) {
|
||||||
Bundle extras = new Bundle();
|
Bundle extras = new Bundle();
|
||||||
extras.putString("SipUri", sipUri);
|
extras.putString("SipUri", sipUri);
|
||||||
|
|
Loading…
Reference in a new issue