Added new resources + added security toggle in layouts

This commit is contained in:
Sylvain Berfini 2018-10-22 16:36:00 +02:00
parent 32d0e4bd85
commit b6e4dc4740
45 changed files with 166 additions and 32 deletions

View file

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_enabled="false"
android:color="@color/security_gray"/>
<item android:state_checked="true"
android:color="@color/security_green" />
<item android:color="@color/security_gray" />
</selector>

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 494 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 833 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 558 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 867 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 499 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 509 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 648 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB

View file

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="oval">
<solid android:color="@color/security_thumb"/>
</shape>

View file

@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item android:gravity="center_vertical|fill_horizontal">
<shape android:shape="rectangle">
<corners android:radius="20dp" />
<size android:height="20dp" />
<solid android:color="@color/security_switch_track_color" />
</shape>
</item>
</layer-list>

View file

@ -22,16 +22,52 @@
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_gravity="left"
android:layout_weight="0.2"
android:layout_weight="1"
android:background="@drawable/toolbar_button"
android:contentDescription="@string/content_description_back"
android:padding="18dp"
android:src="@drawable/back"/>
<RelativeLayout
<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="0.2">
android:layout_weight="2"
android:orientation="horizontal"
android:layout_marginLeft="5dp"
android:layout_marginRight="5dp"
android:gravity="center">
<ImageView
android:id="@+id/security_toogle_off"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:src="@drawable/security_toogle_icon_grey"/>
<Switch
android:id="@+id/security_toogle"
android:layout_width="50dp"
android:switchMinWidth="50dp"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:layout_height="match_parent"
android:track="@drawable/security_switch_track"
android:thumb="@drawable/security_switch_thumb"
android:textOff=""
android:textOn=""/>
<ImageView
android:id="@+id/security_toogle_on"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:src="@drawable/security_toogle_icon_green"/>
</LinearLayout>
<RelativeLayout
android:id="@+id/layout_all_contacts"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1">
<ImageView
android:id="@+id/all_contacts"
@ -51,9 +87,10 @@
</RelativeLayout>
<RelativeLayout
android:id="@+id/layout_linphone_contacts"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="0.2">
android:layout_weight="1">
<ImageView
android:id="@+id/linphone_contacts"
@ -76,10 +113,11 @@
<ImageView
android:id="@+id/next"
android:visibility="gone"
android:src="@drawable/chat_room_creation_next"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="0.2"
android:layout_weight="1"
android:background="@drawable/toolbar_button"
android:contentDescription="@string/content_description_valid"
android:padding="18dp"
@ -89,6 +127,7 @@
<RelativeLayout
android:id="@+id/layoutSearchField"
android:visibility="gone"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="10dp">

View file

@ -18,7 +18,17 @@
<ImageView
android:id="@+id/new_discussion"
android:src="@drawable/chat_add"
android:src="@drawable/chat_new"
android:background="@drawable/toolbar_button"
android:contentDescription="@string/content_description_new_discussion"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="0.2"
android:padding="15dp"/>
<ImageView
android:id="@+id/new_group_discussion"
android:src="@drawable/chat_group_new"
android:background="@drawable/toolbar_button"
android:contentDescription="@string/content_description_new_discussion"
android:layout_width="0dp"
@ -40,7 +50,7 @@
<View
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="0.4"/>
android:layout_weight="0.2"/>
<ImageView
android:id="@+id/edit"

View file

@ -41,7 +41,7 @@
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:orientation="vertical"
android:layout_toLeftOf="@+id/contact_linphone"
android:layout_marginRight="70dp"
android:layout_toRightOf="@id/avatar_layout"
android:layout_marginLeft="5dp"
android:layout_alignParentTop="true"
@ -68,16 +68,22 @@
</LinearLayout>
<ImageView
android:id="@id/contact_linphone"
android:layout_width="30dp"
android:layout_height="30dp"
android:layout_gravity="right"
android:paddingRight="10dp"
android:src="@drawable/linphone_user"
android:layout_centerVertical="true"
android:layout_toLeftOf="@+id/contact_is_select"
android:layout_toStartOf="@+id/contact_is_select"/>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_toLeftOf="@+id/contact_is_select">
<ImageView
android:id="@+id/contact_linphone"
android:layout_width="30dp"
android:layout_height="30dp"
android:layout_gravity="right"
android:paddingRight="10dp"
android:src="@drawable/linphone_user"
android:layout_centerVertical="true"
android:layout_alignParentRight="true"/>
</RelativeLayout>
<ImageView
android:id="@+id/contact_is_select"
@ -89,4 +95,5 @@
android:visibility="invisible"
android:paddingRight="20dp"
android:src="@drawable/check_selected"/>
</RelativeLayout>

View file

@ -13,6 +13,9 @@
<color name="colorK">#3eb5c0</color>
<color name="colorL">#96c11f</color>
<color name="notification_color_led">#FF8000</color>
<color name="security_green">#96c11f</color>
<color name="security_gray">#c2c2c2</color>
<color name="security_thumb">#ffffff</color>
<color name="transparent">#00000000</color>
</resources>

View file

@ -683,7 +683,7 @@ public class LinphoneActivity extends LinphoneGenericActivity implements OnClick
}
}
public void goToChatCreator(String address, ArrayList<ContactAddress> selectedContacts, String subject, boolean isGoBack, Bundle shareInfos) {
public void goToChatCreator(String address, ArrayList<ContactAddress> selectedContacts, String subject, boolean isGoBack, Bundle shareInfos, boolean createGroupChat) {
if (currentFragment == FragmentsAvailable.INFO_GROUP_CHAT && isGoBack) {
getFragmentManager().popBackStackImmediate();
getFragmentManager().popBackStackImmediate();
@ -692,6 +692,7 @@ public class LinphoneActivity extends LinphoneGenericActivity implements OnClick
extras.putSerializable("selectedContacts", selectedContacts);
extras.putString("subject", subject);
extras.putString("groupChatRoomAddress", address);
extras.putBoolean("createGroupChatRoom", createGroupChat);
if (shareInfos != null) {
if (shareInfos.getString("fileSharedUri") != null)

View file

@ -36,6 +36,7 @@ import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.ProgressBar;
import android.widget.RelativeLayout;
import android.widget.Switch;
import android.widget.TextView;
import org.linphone.LinphoneManager;
@ -67,7 +68,7 @@ public class ChatCreationFragment extends Fragment implements View.OnClickListen
private ImageView mAllContactsButton, mLinphoneContactsButton, mClearSearchFieldButton, mBackButton, mNextButton;
private boolean mOnlyDisplayLinphoneContacts;
private View mAllContactsSelected, mLinphoneContactsSelected;
private RelativeLayout mSearchLayout, mWaitLayout;
private RelativeLayout mSearchLayout, mWaitLayout, mLinphoneContactsToggle, mAllContactsToggle;
private EditText mSearchField;
private ProgressBar mContactsFetchInProgress;
private SearchContactsListAdapter mSearchAdapter;
@ -75,6 +76,9 @@ public class ChatCreationFragment extends Fragment implements View.OnClickListen
private ChatRoom mChatRoom;
private ChatRoomListenerStub mChatRoomCreationListener;
private Bundle mShareInfos;
private ImageView mSecurityToggleOff, mSecurityToggleOn;
private Switch mSecurityToggle;
private boolean mCreateGroupChatRoom;
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
@ -84,12 +88,15 @@ public class ChatCreationFragment extends Fragment implements View.OnClickListen
mContactsSelected = new ArrayList<>();
mChatRoomSubject = null;
mChatRoomAddress = null;
mCreateGroupChatRoom = false;
if (getArguments() != null) {
if (getArguments().getSerializable("selectedContacts") != null) {
mContactsSelected = (ArrayList<ContactAddress>) getArguments().getSerializable("selectedContacts");
}
mChatRoomSubject = getArguments().getString("subject");
mChatRoomAddress = getArguments().getString("groupChatRoomAddress");
mCreateGroupChatRoom = getArguments().getBoolean("createGroupChatRoom", false);
}
mWaitLayout = view.findViewById(R.id.waitScreen);
@ -122,7 +129,7 @@ public class ChatCreationFragment extends Fragment implements View.OnClickListen
mContactsFetchInProgress = view.findViewById(R.id.contactsFetchInProgress);
mContactsFetchInProgress.setVisibility(View.VISIBLE);
mSearchAdapter = new SearchContactsListAdapter(null, mContactsFetchInProgress, this);
mSearchAdapter = new SearchContactsListAdapter(null, mContactsFetchInProgress, this, mCreateGroupChatRoom == false);
mSearchField = view.findViewById(R.id.searchField);
mSearchField.addTextChangedListener(new TextWatcher() {
@ -144,6 +151,25 @@ public class ChatCreationFragment extends Fragment implements View.OnClickListen
}
});
mLinphoneContactsToggle = view.findViewById(R.id.layout_linphone_contacts);
mAllContactsToggle = view.findViewById(R.id.layout_all_contacts);
mSecurityToggle = view.findViewById(R.id.security_toogle);
mSecurityToggleOn = view.findViewById(R.id.security_toogle_on);
mSecurityToggleOff = view.findViewById(R.id.security_toogle_off);
mSecurityToggleOn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
mSecurityToggle.setChecked(true);
}
});
mSecurityToggleOff.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
mSecurityToggle.setChecked(false);
}
});
LinearLayoutManager layoutManager = new LinearLayoutManager(getActivity().getApplicationContext());
mContactsList.setAdapter(mSearchAdapter);
@ -269,6 +295,18 @@ public class ChatCreationFragment extends Fragment implements View.OnClickListen
mLinphoneContactsButton.setEnabled(!mAllContactsButton.isEnabled());
}
if (mCreateGroupChatRoom) {
mLinphoneContactsToggle.setVisibility(View.GONE);
mAllContactsToggle.setVisibility(View.GONE);
mContactsSelectLayout.setVisibility(View.VISIBLE);
mNextButton.setVisibility(View.VISIBLE);
} else {
mLinphoneContactsToggle.setVisibility(View.VISIBLE);
mAllContactsToggle.setVisibility(View.VISIBLE);
mContactsSelectLayout.setVisibility(View.GONE);
mNextButton.setVisibility(View.GONE);
}
mContactsSelectedLayout.removeAllViews();
if (mContactsSelected.size() > 0) {
mSearchAdapter.setContactsSelectedList(mContactsSelected);
@ -440,7 +478,7 @@ public class ChatCreationFragment extends Fragment implements View.OnClickListen
ContactAddress ca = mSearchAdapter.getContacts().get(position);
Core lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull();
ProxyConfig lpc = lc.getDefaultProxyConfig();
if (lpc == null || lpc.getConferenceFactoryUri() == null) {
if (lpc == null || lpc.getConferenceFactoryUri() == null || mCreateGroupChatRoom == false) {
ChatRoom chatRoom = lc.getChatRoom(ca.getAddress());
LinphoneActivity.instance().goToChat(chatRoom.getPeerAddress().asStringUriOnly(), mShareInfos);
} else {

View file

@ -216,22 +216,22 @@ public class ChatEventsAdapter extends SelectableAdapter<ChatBubbleViewHolder> {
holder.imdmLabel.setTextColor(mContext.getResources().getColor(R.color.colorD));*/
} else if (status == ChatMessage.State.DeliveredToUser) {
holder.imdmLayout.setVisibility(View.VISIBLE);
holder.imdmIcon.setImageResource(R.drawable.chat_delivered);
holder.imdmIcon.setImageResource(R.drawable.imdn_received);
holder.imdmLabel.setText(R.string.delivered);
holder.imdmLabel.setTextColor(mContext.getResources().getColor(R.color.colorD));
} else if (status == ChatMessage.State.Displayed) {
holder.imdmLayout.setVisibility(View.VISIBLE);
holder.imdmIcon.setImageResource(R.drawable.chat_read);
holder.imdmIcon.setImageResource(R.drawable.imdn_read);
holder.imdmLabel.setText(R.string.displayed);
holder.imdmLabel.setTextColor(mContext.getResources().getColor(R.color.colorK));
} else if (status == ChatMessage.State.NotDelivered) {
holder.imdmLayout.setVisibility(View.VISIBLE);
holder.imdmIcon.setImageResource(R.drawable.chat_error);
holder.imdmIcon.setImageResource(R.drawable.imdn_error);
holder.imdmLabel.setText(R.string.error);
holder.imdmLabel.setTextColor(mContext.getResources().getColor(R.color.colorI));
} else if (status == ChatMessage.State.FileTransferError) {
holder.imdmLayout.setVisibility(View.VISIBLE);
holder.imdmIcon.setImageResource(R.drawable.chat_error);
holder.imdmIcon.setImageResource(R.drawable.imdn_error);
holder.imdmLabel.setText(R.string.file_transfer_error);
holder.imdmLabel.setTextColor(mContext.getResources().getColor(R.color.colorI));
}

View file

@ -55,7 +55,7 @@ import static org.linphone.fragments.FragmentsAvailable.CHAT_LIST;
public class ChatListFragment extends Fragment implements ContactsUpdatedListener, ChatRoomViewHolder.ClickListener, SelectableHelper.DeleteListener {
private RecyclerView mChatRoomsList;
private ImageView mNewDiscussionButton, mBackToCallButton;
private ImageView mNewDiscussionButton, mNewGroupDiscussionButton, mBackToCallButton;
private ChatRoomsAdapter mChatRoomsAdapter;
private CoreListenerStub mListener;
private RelativeLayout mWaitLayout;
@ -77,6 +77,7 @@ public class ChatListFragment extends Fragment implements ContactsUpdatedListene
mChatRoomsList = view.findViewById(R.id.chatList);
mWaitLayout = view.findViewById(R.id.waitScreen);
mNewDiscussionButton = view.findViewById(R.id.new_discussion);
mNewGroupDiscussionButton = view.findViewById(R.id.new_group_discussion);
mBackToCallButton = view.findViewById(R.id.back_in_call);
mSelectionHelper = new SelectableHelper(view, this);
@ -99,7 +100,14 @@ public class ChatListFragment extends Fragment implements ContactsUpdatedListene
mNewDiscussionButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
LinphoneActivity.instance().goToChatCreator(null, null, null, false, null);
LinphoneActivity.instance().goToChatCreator(null, null, null, false, null, false);
}
});
mNewGroupDiscussionButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
LinphoneActivity.instance().goToChatCreator(null, null, null, false, null, true);
}
});

View file

@ -160,7 +160,7 @@ public class GroupInfoFragment extends Fragment implements ChatRoomListener {
getFragmentManager().popBackStack();
}
} else {
LinphoneActivity.instance().goToChatCreator(null, mParticipants, null, true, mShareInfos);
LinphoneActivity.instance().goToChatCreator(null, mParticipants, null, true, mShareInfos, true);
}
}
});
@ -205,7 +205,7 @@ public class GroupInfoFragment extends Fragment implements ChatRoomListener {
@Override
public void onClick(View view) {
if (mIsEditionEnabled) {
LinphoneActivity.instance().goToChatCreator(mGroupChatRoomAddress != null ? mGroupChatRoomAddress.asString() : null, mParticipants, mSubject, !mIsAlreadyCreatedGroup, null);
LinphoneActivity.instance().goToChatCreator(mGroupChatRoomAddress != null ? mGroupChatRoomAddress.asString() : null, mParticipants, mSubject, !mIsAlreadyCreatedGroup, null, true);
}
}
});
@ -213,7 +213,7 @@ public class GroupInfoFragment extends Fragment implements ChatRoomListener {
mAddParticipantsButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
LinphoneActivity.instance().goToChatCreator(mGroupChatRoomAddress != null ? mGroupChatRoomAddress.asString() : null, mParticipants, mSubject, !mIsAlreadyCreatedGroup, null);
LinphoneActivity.instance().goToChatCreator(mGroupChatRoomAddress != null ? mGroupChatRoomAddress.asString() : null, mParticipants, mSubject, !mIsAlreadyCreatedGroup, null, true);
}
});

View file

@ -85,6 +85,7 @@ public class SearchContactsListAdapter extends RecyclerView.Adapter<SearchContac
private ProgressBar progressBar;
private boolean mOnlySipContact = false;
private ViewHolder.ClickListener mListener;
private boolean mHideSelectionMark = false;
public List<ContactAddress> getContacts() {
return contacts;
@ -98,7 +99,8 @@ public class SearchContactsListAdapter extends RecyclerView.Adapter<SearchContac
mListener = listener;
}
public SearchContactsListAdapter(List<ContactAddress> contactsList, ProgressBar pB, ViewHolder.ClickListener clickListener) {
public SearchContactsListAdapter(List<ContactAddress> contactsList, ProgressBar pB, ViewHolder.ClickListener clickListener, boolean hideSelectionMark) {
mHideSelectionMark = hideSelectionMark;
mListener = clickListener;
progressBar = pB;
setContactsSelectedList(null);
@ -158,6 +160,9 @@ public class SearchContactsListAdapter extends RecyclerView.Adapter<SearchContac
} else {
holder.isSelect.setVisibility(View.INVISIBLE);
}
if (mHideSelectionMark) {
holder.isSelect.setVisibility(View.GONE);
}
}
}