Renamed some classes for harmonization purposes

This commit is contained in:
Sylvain Berfini 2018-11-22 17:09:03 +01:00
parent c913577f93
commit e48ec8219d
12 changed files with 126 additions and 106 deletions

View file

@ -63,16 +63,16 @@ import android.widget.TextView;
import android.widget.Toast;
import org.linphone.LinphoneManager.AddressType;
import org.linphone.chat.ChatMessagesFragment;
import org.linphone.chat.ChatRoomCreationFragment;
import org.linphone.chat.ChatRoomsFragment;
import org.linphone.settings.LinphonePreferences;
import org.linphone.assistant.AssistantActivity;
import org.linphone.assistant.RemoteProvisioningLoginActivity;
import org.linphone.call.CallActivity;
import org.linphone.call.CallIncomingActivity;
import org.linphone.call.CallOutgoingActivity;
import org.linphone.chat.ChatCreationFragment;
import org.linphone.chat.ChatListFragment;
import org.linphone.chat.DevicesFragment;
import org.linphone.chat.GroupChatFragment;
import org.linphone.chat.GroupInfoFragment;
import org.linphone.chat.ImdnFragment;
import org.linphone.compatibility.Compatibility;
@ -408,17 +408,17 @@ public class LinphoneActivity extends LinphoneGenericActivity implements OnClick
fragment = new EmptyFragment();
break;
case CHAT_LIST:
fragment = new ChatListFragment();
fragment = new ChatRoomsFragment();
break;
case CREATE_CHAT:
checkAndRequestWriteContactsPermission();
fragment = new ChatCreationFragment();
fragment = new ChatRoomCreationFragment();
break;
case INFO_GROUP_CHAT:
fragment = new GroupInfoFragment();
break;
case GROUP_CHAT:
fragment = new GroupChatFragment();
fragment = new ChatMessagesFragment();
break;
case MESSAGE_IMDN:
fragment = new ImdnFragment();
@ -442,7 +442,7 @@ public class LinphoneActivity extends LinphoneGenericActivity implements OnClick
((ContactsListFragment) fragment).displayFirstContact();
break;
case CHAT_LIST:
((ChatListFragment) fragment).displayFirstChat();
((ChatRoomsFragment) fragment).displayFirstChat();
break;
}
} else {
@ -506,7 +506,7 @@ public class LinphoneActivity extends LinphoneGenericActivity implements OnClick
if (newFragmentType == FragmentsAvailable.GROUP_CHAT && leftFragment != FragmentsAvailable.CHAT_LIST) {
leftFragment = FragmentsAvailable.CHAT_LIST;
transaction.replace(R.id.fragmentContainer, new ChatListFragment());
transaction.replace(R.id.fragmentContainer, new ChatRoomsFragment());
}
} else {
if (newFragmentType == FragmentsAvailable.EMPTY) {
@ -710,7 +710,7 @@ public class LinphoneActivity extends LinphoneGenericActivity implements OnClick
if (isTablet()) {
Fragment fragment2 = getFragmentManager().findFragmentById(R.id.fragmentContainer2);
if (fragment2 != null && fragment2.isVisible() && currentFragment == FragmentsAvailable.GROUP_CHAT && !emptyFragment) {
GroupChatFragment chatFragment = (GroupChatFragment) fragment2;
ChatMessagesFragment chatFragment = (ChatMessagesFragment) fragment2;
chatFragment.changeDisplayedChat(sipUri);
} else {
changeCurrentFragment(FragmentsAvailable.GROUP_CHAT, extras);
@ -788,7 +788,7 @@ public class LinphoneActivity extends LinphoneGenericActivity implements OnClick
if (currentFragment == FragmentsAvailable.CHAT_LIST || currentFragment == FragmentsAvailable.GROUP_CHAT) {
Fragment fragment2 = getFragmentManager().findFragmentById(R.id.fragmentContainer2);
if (fragment2 != null && fragment2.isVisible() && currentFragment == FragmentsAvailable.GROUP_CHAT && !emptyFragment) {
GroupChatFragment chatFragment = (GroupChatFragment) fragment2;
ChatMessagesFragment chatFragment = (ChatMessagesFragment) fragment2;
chatFragment.changeDisplayedChat(sipUri);
} else {
displayChat(sipUri, message, fileUri, pictureUri, thumbnailUri, displayName, lAddress);

View file

@ -1,5 +1,5 @@
/*
ChatBubbleViewHolder.java
ChatMessageViewHolder.java
Copyright (C) 2017 Belledonne Communications, Grenoble, France
This program is free software; you can redistribute it and/or
@ -33,7 +33,7 @@ import android.widget.TextView;
import org.linphone.R;
import org.linphone.core.ChatMessage;
public class ChatBubbleViewHolder extends RecyclerView.ViewHolder implements View.OnClickListener {
public class ChatMessageViewHolder extends RecyclerView.ViewHolder implements View.OnClickListener {
public String messageId;
public Context mContext;
public ChatMessage message;
@ -65,14 +65,14 @@ public class ChatBubbleViewHolder extends RecyclerView.ViewHolder implements Vie
public CheckBox delete;
private ClickListener mListener;
public ChatBubbleViewHolder(Context context, View view, ClickListener listener) {
public ChatMessageViewHolder(Context context, View view, ClickListener listener) {
this(view);
mContext = context;
mListener = listener;
view.setOnClickListener(this);
}
public ChatBubbleViewHolder(View view) {
public ChatMessageViewHolder(View view) {
super(view);
eventLayout = view.findViewById(R.id.event);
//eventTime = view.findViewById(R.id.event_date);

View file

@ -1,5 +1,5 @@
/*
ChatEventsAdapter.java
ChatMessagesAdapter.java
Copyright (C) 2017 Belledonne Communications, Grenoble, France
This program is free software; you can redistribute it and/or
@ -74,7 +74,7 @@ import java.util.List;
import static android.content.Intent.FLAG_GRANT_READ_URI_PERMISSION;
public class ChatEventsAdapter extends SelectableAdapter<ChatBubbleViewHolder> {
public class ChatMessagesAdapter extends SelectableAdapter<ChatMessageViewHolder> {
private static int MARGIN_BETWEEN_MESSAGES = 10;
private static int SIDE_MARGIN = 100;
@ -83,12 +83,12 @@ public class ChatEventsAdapter extends SelectableAdapter<ChatBubbleViewHolder> {
private List<LinphoneContact> mParticipants;
private int mItemResource;
private Bitmap mDefaultBitmap;
private GroupChatFragment mFragment;
private ChatMessagesFragment mFragment;
private ChatMessageListenerStub mListener;
private ChatBubbleViewHolder.ClickListener mClickListener;
private ChatMessageViewHolder.ClickListener mClickListener;
public ChatEventsAdapter(GroupChatFragment fragment, SelectableHelper helper, int itemResource, EventLog[] history, ArrayList<LinphoneContact> participants, ChatBubbleViewHolder.ClickListener clickListener) {
public ChatMessagesAdapter(ChatMessagesFragment fragment, SelectableHelper helper, int itemResource, EventLog[] history, ArrayList<LinphoneContact> participants, ChatMessageViewHolder.ClickListener clickListener) {
super(helper);
mFragment = fragment;
mContext = mFragment.getActivity();
@ -100,7 +100,7 @@ public class ChatEventsAdapter extends SelectableAdapter<ChatBubbleViewHolder> {
mListener = new ChatMessageListenerStub() {
@Override
public void onFileTransferProgressIndication(ChatMessage message, Content content, int offset, int total) {
ChatBubbleViewHolder holder = (ChatBubbleViewHolder) message.getUserData();
ChatMessageViewHolder holder = (ChatMessageViewHolder) message.getUserData();
if (holder == null) return;
if (offset == total) {
@ -136,10 +136,10 @@ public class ChatEventsAdapter extends SelectableAdapter<ChatBubbleViewHolder> {
}
@Override
public ChatBubbleViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
public ChatMessageViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
View v = LayoutInflater.from(parent.getContext())
.inflate(mItemResource, parent, false);
ChatBubbleViewHolder VH = new ChatBubbleViewHolder(mContext, v, mClickListener);
ChatMessageViewHolder VH = new ChatMessageViewHolder(mContext, v, mClickListener);
//Allows onLongClick ContextMenu on bubbles
mFragment.registerForContextMenu(v);
@ -148,7 +148,7 @@ public class ChatEventsAdapter extends SelectableAdapter<ChatBubbleViewHolder> {
}
@Override
public void onBindViewHolder(@NonNull final ChatBubbleViewHolder holder, int position) {
public void onBindViewHolder(@NonNull final ChatMessageViewHolder holder, int position) {
final EventLog event = mHistory.get(position);
holder.eventLayout.setVisibility(View.GONE);
holder.bubbleLayout.setVisibility(View.GONE);
@ -525,7 +525,7 @@ public class ChatEventsAdapter extends SelectableAdapter<ChatBubbleViewHolder> {
mContext.startActivity(intent);
}
private void displayAttachedFile(ChatMessage message, ChatBubbleViewHolder holder) {
private void displayAttachedFile(ChatMessage message, ChatMessageViewHolder holder) {
holder.fileName.setVisibility(View.VISIBLE);
String appData = message.getAppdata();

View file

@ -1,5 +1,5 @@
/*
GroupChatFragment.java
ChatMessagesFragment.java
Copyright (C) 2017 Belledonne Communications, Grenoble, France
This program is free software; you can redistribute it and/or
@ -91,7 +91,7 @@ import java.util.List;
import static android.content.Context.INPUT_METHOD_SERVICE;
import static org.linphone.fragments.FragmentsAvailable.CHAT;
public class GroupChatFragment extends Fragment implements ChatRoomListener, ContactsUpdatedListener, ChatBubbleViewHolder.ClickListener, SelectableHelper.DeleteListener {
public class ChatMessagesFragment extends Fragment implements ChatRoomListener, ContactsUpdatedListener, ChatMessageViewHolder.ClickListener, SelectableHelper.DeleteListener {
private static final int ADD_PHOTO = 1337;
private static final int MESSAGES_PER_PAGE = 20;
@ -107,7 +107,7 @@ public class GroupChatFragment extends Fragment implements ChatRoomListener, Con
private Context mContext;
private ViewTreeObserver.OnGlobalLayoutListener mKeyboardListener;
private Uri mImageToUploadUri;
private ChatEventsAdapter mEventsAdapter;
private ChatMessagesAdapter mEventsAdapter;
private String mRemoteSipUri;
private Address mRemoteSipAddress, mRemoteParticipantAddress;
private ChatRoom mChatRoom;
@ -413,7 +413,7 @@ public class GroupChatFragment extends Fragment implements ChatRoomListener, Con
public void onCreateContextMenu(ContextMenu menu, View v, ContextMenu.ContextMenuInfo menuInfo) {
super.onCreateContextMenu(menu, v, menuInfo);
ChatBubbleViewHolder holder = (ChatBubbleViewHolder) v.getTag();
ChatMessageViewHolder holder = (ChatMessageViewHolder) v.getTag();
mContextMenuMessagePosition = holder.getAdapterPosition();
EventLog event = (EventLog) mEventsAdapter.getItem(mContextMenuMessagePosition);
@ -672,9 +672,9 @@ public class GroupChatFragment extends Fragment implements ChatRoomListener, Con
private void displayChatRoomHistory() {
if (mChatRoom == null) return;
if (mChatRoom.hasCapability(ChatRoomCapabilities.OneToOne.toInt())) {
mEventsAdapter = new ChatEventsAdapter(this, mSelectionHelper, R.layout.chat_bubble, mChatRoom.getHistoryMessageEvents(MESSAGES_PER_PAGE), mParticipants, this);
mEventsAdapter = new ChatMessagesAdapter(this, mSelectionHelper, R.layout.chat_bubble, mChatRoom.getHistoryMessageEvents(MESSAGES_PER_PAGE), mParticipants, this);
} else {
mEventsAdapter = new ChatEventsAdapter(this, mSelectionHelper, R.layout.chat_bubble, mChatRoom.getHistoryEvents(MESSAGES_PER_PAGE), mParticipants, this);
mEventsAdapter = new ChatMessagesAdapter(this, mSelectionHelper, R.layout.chat_bubble, mChatRoom.getHistoryEvents(MESSAGES_PER_PAGE), mParticipants, this);
}
mSelectionHelper.setAdapter(mEventsAdapter);
mChatEventsList.setAdapter(mEventsAdapter);

View file

@ -1,5 +1,5 @@
/*
ChatCreationFragment.java
ChatRoomCreationFragment.java
Copyright (C) 2017 Belledonne Communications, Grenoble, France
This program is free software; you can redistribute it and/or
@ -59,7 +59,7 @@ import java.util.List;
import static android.content.Context.INPUT_METHOD_SERVICE;
public class ChatCreationFragment extends Fragment implements View.OnClickListener, SearchContactsListAdapter.ViewHolder.ClickListener, ContactsUpdatedListener {
public class ChatRoomCreationFragment extends Fragment implements View.OnClickListener, SearchContactsListAdapter.ViewHolder.ClickListener, ContactsUpdatedListener {
private RecyclerView mContactsList;
private LinearLayout mContactsSelectedLayout;
private HorizontalScrollView mContactsSelectLayout;

View file

@ -1,5 +1,5 @@
/*
ChatListFragment.java
ChatRoomsFragment.java
Copyright (C) 2017 Belledonne Communications, Grenoble, France
This program is free software; you can redistribute it and/or
@ -54,7 +54,7 @@ import java.util.List;
import static org.linphone.fragments.FragmentsAvailable.CHAT_LIST;
public class ChatListFragment extends Fragment implements ContactsUpdatedListener, ChatRoomViewHolder.ClickListener, SelectableHelper.DeleteListener {
public class ChatRoomsFragment extends Fragment implements ContactsUpdatedListener, ChatRoomViewHolder.ClickListener, SelectableHelper.DeleteListener {
private RecyclerView mChatRoomsList;
private ImageView mNewDiscussionButton, mNewGroupDiscussionButton, mBackToCallButton;

View file

@ -1,7 +1,7 @@
package org.linphone.chat;
/*
DeviceAdapter.java
DevicesAdapter.java
Copyright (C) 2010-2018 Belledonne Communications, Grenoble, France
This program is free software; you can redistribute it and/or
@ -38,12 +38,12 @@ import org.linphone.views.ContactAvatar;
import java.util.ArrayList;
import java.util.List;
public class DeviceAdapter extends BaseExpandableListAdapter {
public class DevicesAdapter extends BaseExpandableListAdapter {
private Context mContext;
private List<Participant> mParticipants;
private boolean mOnlyDisplayChildsAsGroups;
public DeviceAdapter(Context context) {
public DevicesAdapter(Context context) {
mContext = context;
mParticipants = new ArrayList<>();
mOnlyDisplayChildsAsGroups = false;

View file

@ -39,11 +39,8 @@ import org.linphone.core.Address;
import org.linphone.core.ChatRoom;
import org.linphone.core.ChatRoomCapabilities;
import org.linphone.core.Core;
import org.linphone.core.Factory;
import org.linphone.core.Participant;
import org.linphone.core.ParticipantDevice;
import org.linphone.fragments.FragmentsAvailable;
import org.linphone.mediastream.Log;
import java.util.Arrays;
@ -52,7 +49,7 @@ public class DevicesFragment extends Fragment {
private ImageView mBackButton;
private TextView mTitle;
private ExpandableListView mExpandableList;
private DeviceAdapter mAdapter;
private DevicesAdapter mAdapter;
private String mRoomUri;
private Address mRoomAddr;
@ -151,7 +148,7 @@ public class DevicesFragment extends Fragment {
private void initValues() {
if (mAdapter == null) {
mAdapter = new DeviceAdapter(getActivity());
mAdapter = new DevicesAdapter(getActivity());
mExpandableList.setAdapter(mAdapter);
}
if (mRoom == null) {

View file

@ -1,5 +1,5 @@
/*
GroupChatFragment.java
GroupInfoAdapter.java
Copyright (C) 2017 Belledonne Communications, Grenoble, France
This program is free software; you can redistribute it and/or

View file

@ -53,7 +53,7 @@ public class ImdnFragment extends Fragment {
private LayoutInflater mInflater;
private LinearLayout mRead, mReadHeader, mDelivered, mDeliveredHeader, mSent, mSentHeader, mUndelivered, mUndeliveredHeader;
private ImageView mBackButton;
private ChatBubbleViewHolder mBubble;
private ChatMessageViewHolder mBubble;
private ViewGroup mContainer;
private String mRoomUri, mMessageId;
@ -101,7 +101,7 @@ public class ImdnFragment extends Fragment {
mSentHeader = view.findViewById(R.id.sent_layout_header);
mUndeliveredHeader = view.findViewById(R.id.undelivered_layout_header);
mBubble = new ChatBubbleViewHolder(view.findViewById(R.id.bubble));
mBubble = new ChatMessageViewHolder(view.findViewById(R.id.bubble));
mBubble.eventLayout.setVisibility(View.GONE);
mBubble.bubbleLayout.setVisibility(View.VISIBLE);
mBubble.delete.setVisibility(View.GONE);

View file

@ -22,15 +22,9 @@ package org.linphone.history;
import android.annotation.SuppressLint;
import android.content.Context;
import android.support.annotation.NonNull;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.CheckBox;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;
import android.widget.TextView;
import org.linphone.utils.LinphoneUtils;
import org.linphone.R;
@ -48,61 +42,12 @@ import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.List;
public class HistoryAdapter extends SelectableAdapter<HistoryAdapter.ViewHolder> {
public static class ViewHolder extends RecyclerView.ViewHolder implements View.OnClickListener,
View.OnLongClickListener {
public TextView contact;
public ImageView detail;
public CheckBox select;
public ImageView callDirection;
public RelativeLayout avatarLayout;
public RelativeLayout CallContact;
public LinearLayout separator;
public TextView separatorText;
private HistoryAdapter.ViewHolder.ClickListener mListener;
public ViewHolder(View view, HistoryAdapter.ViewHolder.ClickListener listener) {
super(view);
contact = view.findViewById(R.id.sip_uri);
detail = view.findViewById(R.id.detail);
select = view.findViewById(R.id.delete);
callDirection = view.findViewById(R.id.icon);
avatarLayout = view.findViewById(R.id.avatar_layout);
CallContact = view.findViewById(R.id.history_click);
separator = view.findViewById(R.id.separator);
separatorText = view.findViewById(R.id.separator_text);
mListener = listener;
view.setOnClickListener(this);
view.setOnLongClickListener(this);
}
@Override
public void onClick(View view) {
if (mListener != null) {
mListener.onItemClicked(getAdapterPosition());
}
}
@Override
public boolean onLongClick(View view) {
if (mListener != null) {
return mListener.onItemLongClicked(getAdapterPosition());
}
return false;
}
public interface ClickListener {
void onItemClicked(int position);
boolean onItemLongClicked(int position);
}
}
public class HistoryAdapter extends SelectableAdapter<HistoryViewHolder> {
private List<CallLog> mLogs;
private Context mContext;
private HistoryAdapter.ViewHolder.ClickListener clickListener;
private HistoryViewHolder.ClickListener clickListener;
public HistoryAdapter(Context aContext, List<CallLog> logs, HistoryAdapter.ViewHolder.ClickListener listener, SelectableHelper helper) {
public HistoryAdapter(Context aContext, List<CallLog> logs, HistoryViewHolder.ClickListener listener, SelectableHelper helper) {
super(helper);
this.mLogs = logs;
this.mContext = aContext;
@ -119,14 +64,14 @@ public class HistoryAdapter extends SelectableAdapter<HistoryAdapter.ViewHolder>
@NonNull
@Override
public ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
public HistoryViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
View v = LayoutInflater.from(parent.getContext()).inflate(R.layout.history_cell, parent, false);
return new ViewHolder(v, clickListener);
return new HistoryViewHolder(v, clickListener);
}
@Override
public void onBindViewHolder(@NonNull final ViewHolder holder, final int position) {
public void onBindViewHolder(@NonNull final HistoryViewHolder holder, final int position) {
final CallLog log = mLogs.get(position);
long timestamp = log.getStartDate() * 1000;
Address address;

View file

@ -0,0 +1,78 @@
package org.linphone.history;
/*
HistoryViewHolder.java
Copyright (C) 2018 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.support.v7.widget.RecyclerView;
import android.view.View;
import android.widget.CheckBox;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;
import android.widget.TextView;
import org.linphone.R;
public class HistoryViewHolder extends RecyclerView.ViewHolder implements View.OnClickListener, View.OnLongClickListener {
public TextView contact;
public ImageView detail;
public CheckBox select;
public ImageView callDirection;
public RelativeLayout avatarLayout;
public RelativeLayout CallContact;
public LinearLayout separator;
public TextView separatorText;
private ClickListener mListener;
public HistoryViewHolder(View view, ClickListener listener) {
super(view);
contact = view.findViewById(R.id.sip_uri);
detail = view.findViewById(R.id.detail);
select = view.findViewById(R.id.delete);
callDirection = view.findViewById(R.id.icon);
avatarLayout = view.findViewById(R.id.avatar_layout);
CallContact = view.findViewById(R.id.history_click);
separator = view.findViewById(R.id.separator);
separatorText = view.findViewById(R.id.separator_text);
mListener = listener;
view.setOnClickListener(this);
view.setOnLongClickListener(this);
}
@Override
public void onClick(View view) {
if (mListener != null) {
mListener.onItemClicked(getAdapterPosition());
}
}
@Override
public boolean onLongClick(View view) {
if (mListener != null) {
return mListener.onItemLongClicked(getAdapterPosition());
}
return false;
}
public interface ClickListener {
void onItemClicked(int position);
boolean onItemLongClicked(int position);
}
}