Replace generic ErrorFragment with specific one

when key agreement protocol doesn't match
parent 656ca8d6
......@@ -2,7 +2,6 @@ package org.briarproject.briar.android.keyagreement;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.annotation.StringRes;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
......@@ -29,10 +28,10 @@ public class ContactExchangeErrorFragment extends BaseFragment {
ContactExchangeErrorFragment.class.getName();
private static final String ERROR_MSG = "errorMessage";
public static ContactExchangeErrorFragment newInstance(@StringRes int res) {
public static ContactExchangeErrorFragment newInstance(String errorMsg) {
ContactExchangeErrorFragment f = new ContactExchangeErrorFragment();
Bundle args = new Bundle();
args.putInt(ERROR_MSG, res);
args.putString(ERROR_MSG, errorMsg);
f.setArguments(args);
return f;
}
......@@ -60,7 +59,7 @@ public class ContactExchangeErrorFragment extends BaseFragment {
if (args == null) {
throw new IllegalArgumentException("Use newInstance()");
}
explanation.setText(args.getInt(ERROR_MSG));
explanation.setText(args.getString(ERROR_MSG));
// make feedback link clickable
TextView sendFeedback = v.findViewById(R.id.sendFeedback);
......
......@@ -188,7 +188,8 @@ public abstract class KeyAgreementActivity extends BriarActivity implements
}
protected void showErrorFragment(@StringRes int errorResId) {
BaseFragment f = ContactExchangeErrorFragment.newInstance(errorResId);
String errorMsg = getString(errorResId);
BaseFragment f = ContactExchangeErrorFragment.newInstance(errorMsg);
showNextFragment(f);
}
......
......@@ -36,7 +36,6 @@ import org.briarproject.bramble.api.nullsafety.ParametersNotNullByDefault;
import org.briarproject.briar.R;
import org.briarproject.briar.android.activity.ActivityComponent;
import org.briarproject.briar.android.fragment.BaseEventFragment;
import org.briarproject.briar.android.fragment.ErrorFragment;
import org.briarproject.briar.android.view.QrCodeView;
import java.io.IOException;
......@@ -247,7 +246,7 @@ public class KeyAgreementFragment extends BaseEventFragment
reset();
String msg = getString(R.string.qr_code_unsupported,
getString(R.string.app_name));
showNextFragment(ErrorFragment.newInstance(msg));
showNextFragment(ContactExchangeErrorFragment.newInstance(msg));
} catch (CameraException e) {
logCameraExceptionAndFinish(e);
} catch (IOException | IllegalArgumentException e) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment