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

conversation: cleanup

Change-Id: I45db2595c1c708fbb189fbd752ae29961ed5cc56
parent 5ee9d418
No related branches found
No related tags found
No related merge requests found
......@@ -328,8 +328,6 @@ public class ConversationFragment extends BaseSupportFragment<ConversationPresen
if (animator != null)
animator.setSupportsChangeAnimations(false);
binding.histList.setAdapter(mAdapter);
}
@Override
......@@ -356,6 +354,7 @@ public class ConversationFragment extends BaseSupportFragment<ConversationPresen
}
mAdapter = null;
super.onDestroyView();
binding = null;
}
@Override
......@@ -382,10 +381,6 @@ public class ConversationFragment extends BaseSupportFragment<ConversationPresen
presenter.sendTextMessage(binding.emojiSend.getText().toString());
}
public void selectFile() {
presenter.selectFile();
}
@SuppressLint("RestrictedApi")
public void expandMenu(View v) {
Context context = requireContext();
......@@ -428,7 +423,7 @@ public class ConversationFragment extends BaseSupportFragment<ConversationPresen
break;
}
case R.id.conv_send_file:
selectFile();
presenter.selectFile();
break;
case R.id.conv_share_location:
shareLocation();
......@@ -473,7 +468,6 @@ public class ConversationFragment extends BaseSupportFragment<ConversationPresen
/**
* Used to update with the past adapter position when a long click was registered
* @param position
*/
public void updatePosition(int position) {
mSelectedPosition = position;
......@@ -1142,23 +1136,19 @@ public class ConversationFragment extends BaseSupportFragment<ConversationPresen
showErrorPanel(R.string.error_no_network, null);
}
public void showErrorPanel(final int textResId, @Nullable View.OnClickListener clickListener) {
if (binding.errorMsgPane == null || binding.errorMsgPane.getVisibility() == View.VISIBLE) {
return;
}
private void showErrorPanel(final int textResId, @Nullable View.OnClickListener clickListener) {
if (binding != null) {
binding.errorMsgPane.setVisibility(View.VISIBLE);
binding.errorMsgPane.setOnClickListener(clickListener);
if (binding.errorMsgTxt != null) {
binding.errorMsgTxt.setText(textResId);
}
}
@Override
public void hideErrorPanel() {
if (binding.errorMsgPane == null || binding.errorMsgPane.getVisibility() == View.GONE) {
return;
}
if (binding != null) {
binding.errorMsgPane.setVisibility(View.GONE);
}
}
}
......@@ -75,7 +75,7 @@ public abstract class BaseSupportFragment<T extends RootPresenter> extends Fragm
break;
}
Toast.makeText(getActivity(), errorString, Toast.LENGTH_LONG).show();
Toast.makeText(requireContext(), errorString, Toast.LENGTH_LONG).show();
}
protected void initPresenter(T presenter) {
......
......@@ -84,12 +84,12 @@ public class ConversationPresenter extends RootPresenter<ConversationView> {
ConversationFacade conversationFacade,
VCardService vCardService,
DeviceRuntimeService deviceRuntimeService) {
this.mContactService = contactService;
this.mAccountService = accountService;
this.mHardwareService = hardwareService;
this.mConversationFacade = conversationFacade;
this.mVCardService = vCardService;
this.mDeviceRuntimeService = deviceRuntimeService;
mContactService = contactService;
mAccountService = accountService;
mHardwareService = hardwareService;
mConversationFacade = conversationFacade;
mVCardService = vCardService;
mDeviceRuntimeService = deviceRuntimeService;
}
@Override
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment