|
@@ -21,7 +21,6 @@
|
|
|
|
|
|
package com.owncloud.android.ui.dialog;
|
|
|
|
|
|
-import android.annotation.SuppressLint;
|
|
|
import android.app.Dialog;
|
|
|
import android.content.DialogInterface;
|
|
|
import android.os.Bundle;
|
|
@@ -30,9 +29,8 @@ import android.view.View;
|
|
|
import android.view.Window;
|
|
|
import android.view.WindowManager.LayoutParams;
|
|
|
|
|
|
-import com.google.android.material.textfield.TextInputEditText;
|
|
|
-import com.google.android.material.textfield.TextInputLayout;
|
|
|
import com.owncloud.android.R;
|
|
|
+import com.owncloud.android.databinding.NoteDialogBinding;
|
|
|
import com.owncloud.android.lib.resources.shares.OCShare;
|
|
|
import com.owncloud.android.ui.activity.ComponentsGetter;
|
|
|
import com.owncloud.android.utils.DisplayUtils;
|
|
@@ -42,9 +40,6 @@ import androidx.annotation.NonNull;
|
|
|
import androidx.annotation.Nullable;
|
|
|
import androidx.appcompat.app.AlertDialog;
|
|
|
import androidx.fragment.app.DialogFragment;
|
|
|
-import butterknife.BindView;
|
|
|
-import butterknife.ButterKnife;
|
|
|
-import butterknife.Unbinder;
|
|
|
|
|
|
/**
|
|
|
* Dialog to input a multiline note for a share
|
|
@@ -56,13 +51,7 @@ public class NoteDialogFragment extends DialogFragment implements DialogInterfac
|
|
|
public static final String NOTE_FRAGMENT = "NOTE_FRAGMENT";
|
|
|
|
|
|
private OCShare share;
|
|
|
- private Unbinder unbinder;
|
|
|
-
|
|
|
- @BindView(R.id.user_input_container)
|
|
|
- public TextInputLayout noteEditTextInputLayout;
|
|
|
-
|
|
|
- @BindView(R.id.user_input)
|
|
|
- public TextInputEditText noteEditText;
|
|
|
+ private NoteDialogBinding binding;
|
|
|
|
|
|
public static NoteDialogFragment newInstance(OCShare share) {
|
|
|
NoteDialogFragment frag = new NoteDialogFragment();
|
|
@@ -103,15 +92,14 @@ public class NoteDialogFragment extends DialogFragment implements DialogInterfac
|
|
|
|
|
|
// Inflate the layout for the dialog
|
|
|
LayoutInflater inflater = requireActivity().getLayoutInflater();
|
|
|
- @SuppressLint("InflateParams") View view = inflater.inflate(R.layout.note_dialog, null, false);
|
|
|
-
|
|
|
- unbinder = ButterKnife.bind(this, view);
|
|
|
+ binding = NoteDialogBinding.inflate(inflater, null, false);
|
|
|
+ View view = binding.getRoot();
|
|
|
|
|
|
// Setup layout
|
|
|
- noteEditText.setText(share.getNote());
|
|
|
- noteEditText.setHighlightColor(ThemeUtils.primaryColor(getActivity()));
|
|
|
- noteEditText.requestFocus();
|
|
|
- ThemeUtils.colorTextInputLayout(noteEditTextInputLayout, accentColor);
|
|
|
+ binding.noteText.setText(share.getNote());
|
|
|
+ binding.noteText.setHighlightColor(ThemeUtils.primaryColor(getActivity()));
|
|
|
+ binding.noteText.requestFocus();
|
|
|
+ ThemeUtils.colorTextInputLayout(binding.noteContainer, accentColor);
|
|
|
|
|
|
// Build the dialog
|
|
|
AlertDialog.Builder builder = new AlertDialog.Builder(requireActivity());
|
|
@@ -138,8 +126,8 @@ public class NoteDialogFragment extends DialogFragment implements DialogInterfac
|
|
|
if (componentsGetter != null) {
|
|
|
String note = "";
|
|
|
|
|
|
- if (noteEditText.getText() != null) {
|
|
|
- note = noteEditText.getText().toString().trim();
|
|
|
+ if (binding.noteText.getText() != null) {
|
|
|
+ note = binding.noteText.getText().toString().trim();
|
|
|
}
|
|
|
|
|
|
componentsGetter.getFileOperationsHelper().updateNoteToShare(share, note);
|
|
@@ -150,9 +138,8 @@ public class NoteDialogFragment extends DialogFragment implements DialogInterfac
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public void onStop() {
|
|
|
- unbinder.unbind();
|
|
|
-
|
|
|
- super.onStop();
|
|
|
+ public void onDestroyView() {
|
|
|
+ super.onDestroyView();
|
|
|
+ binding = null;
|
|
|
}
|
|
|
}
|