Search in sources :

Example 1 with GetProfile

use of co.krypt.krypton.silo.IdentityService.GetProfile in project krypton-android by kryptco.

the class MemberEnterEmail method onCreateView.

@Nullable
@Override
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
    final View v = inflater.inflate(R.layout.fragment_teams_invite_inperson_member_enter_email, container, false);
    email = v.findViewById(R.id.memberEmailInPerson);
    email.setText("loading...");
    email.setTextColor(getResources().getColor(R.color.appGray, null));
    email.setEnabled(false);
    Email.colorValidEmail(email);
    nextButton = v.findViewById(R.id.inpersonEmailNext);
    nextButton.setOnClickListener(b -> {
        EventBus.getDefault().unregister(this);
        nextButton.setEnabled(false);
        new Thread(() -> {
            try {
                new MeStorage(getContext()).setEmail(email.getText().toString().trim());
            } catch (CryptoException e) {
                co.krypt.krypton.uiutils.Error.shortToast(getContext(), "Failed to set email: " + e.getMessage());
                e.printStackTrace();
                return;
            }
            getActivity().runOnUiThread(() -> Transitions.beginSlide(this).replace(R.id.fragmentOverlay, new MemberQR()).addToBackStack(null).commitAllowingStateLoss());
        }).start();
    });
    nextButton.setEnabled(false);
    EventBus.getDefault().register(this);
    EventBus.getDefault().post(new GetProfile(getContext()));
    return v;
}
Also used : MeStorage(co.krypt.krypton.me.MeStorage) CryptoException(co.krypt.krypton.exception.CryptoException) View(android.view.View) GetProfile(co.krypt.krypton.silo.IdentityService.GetProfile) Nullable(android.support.annotation.Nullable)

Aggregations

Nullable (android.support.annotation.Nullable)1 View (android.view.View)1 CryptoException (co.krypt.krypton.exception.CryptoException)1 MeStorage (co.krypt.krypton.me.MeStorage)1 GetProfile (co.krypt.krypton.silo.IdentityService.GetProfile)1