Установка подписи SignatureField

<ru.mobnius.core.ui.component.signature.SignatureField
 android:id="@+id/control_signature"
 android:layout_width="match_parent"
 android:layout_height="wrap_content"
 app:signatureLabel="Подпись потребителя"
 android:layout_marginTop="@dimen/indent_small"
 app:layout_constraintTop_toBottomOf="@id/control_notice"/>
public class ControlMeterReadingsFragment extends BaseFormFragment implements OnSignatureListener {
   private SignatureField mSignatureField;
   ...
   @Override
   public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
   mSignatureField = view.findViewById(R.id.control_signature);
   mSignatureField.setOnSignatureListener(this);

   if(savedInstanceState != null) {
      updateSignature(savedInstanceState.getString(Names.SIGNATURE), false);
   }
   ...
   }
   
@Override
public void onClickSignature(int mode, String signature) {
Intent intent = new Intent(getContext(), SignatureActivity.class);
intent.putExtra(OnSignatureListener.MODE_NAME, mode);
intent.putExtra(OnSignatureListener.TITLE, "Подпись потребителя");

switch (mode) {
case OnSignatureListener.ADD:
startActivityForResult(intent, SignatureActivity.SIGNATURE_REQUEST_CODE);
break;

case OnSignatureListener.UPDATE:
intent.putExtra(OnSignatureListener.IMAGE, signature);
startActivityForResult(intent, SignatureActivity.SIGNATURE_REQUEST_CODE);
break;

case OnSignatureListener.REMOVE:
confirmDialog(new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
// таким образом очищаем содержимое
 updateSignature(null, true);
}
});
break;
}
}
Print Friendly, PDF & Email

Добавить комментарий