use of android.support.v7.widget.AppCompatTextView in project krypton-android by kryptco.
the class MemberScan 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_scan, container, false);
lastScannedPayload.set(null);
barcodeView = v.findViewById(R.id.camera_preview_in_person_scan);
barcodeView.decodeContinuous(new BarcodeCallback() {
@Override
public void barcodeResult(BarcodeResult result) {
if (result.getText() != null) {
try {
Sigchain.AdminQRPayload qr = JSON.fromJson(result.getText(), Sigchain.QRPayload.class).adminQRPayload;
if (qr == null) {
Error.shortToast(getContext(), "Make sure you are scanning an admin that is already on a team.");
return;
}
if (lastScannedPayload.compareAndSet(null, qr)) {
Transitions.beginSlide(MemberScan.this).addToBackStack(null).replace(R.id.fragmentOverlay, new MemberEnterEmail()).commitAllowingStateLoss();
} else {
Log.i(TAG, "not first scan");
}
} catch (JsonParseException e) {
Log.e(TAG, "could not parse QR code", e);
Error.shortToast(getContext(), "Invalid QR code");
}
}
}
@Override
public void possibleResultPoints(List<ResultPoint> resultPoints) {
}
});
AppCompatTextView detailText = v.findViewById(R.id.inPersonScanDetail);
detailText.setText("Scan your team admin's QR code to join their team.");
return v;
}
use of android.support.v7.widget.AppCompatTextView in project krypton-android by kryptco.
the class LoaderOverlay method start.
public static void start(Activity a, String text) {
if (a == null) {
return;
}
new Handler(Looper.getMainLooper()).post(() -> {
ConstraintLayout globalContainer = a.findViewById(R.id.team_loader_overlay_container);
if (globalContainer == null) {
return;
}
View container = globalContainer.findViewById(R.id.teams_loader);
AppCompatTextView loaderText = container.findViewById(R.id.text);
ProgressBar progressBar = container.findViewById(R.id.progressBar);
progressBar.setAlpha(1f);
AppCompatImageView check = container.findViewById(R.id.check);
check.setAlpha(0f);
AppCompatImageView problem = container.findViewById(R.id.problem);
problem.setAlpha(0f);
loaderText.setTextColor(a.getColor(R.color.appBlack));
loaderText.setText(text);
container.setAlpha(0f);
container.animate().setDuration(500).alpha(1).start();
});
}
use of android.support.v7.widget.AppCompatTextView in project krypton-android by kryptco.
the class LoaderOverlay method success.
public static void success(Activity a, String text) {
if (a == null) {
return;
}
new Handler(Looper.getMainLooper()).post(() -> {
ConstraintLayout globalContainer = a.findViewById(R.id.team_loader_overlay_container);
if (globalContainer == null) {
return;
}
ConstraintLayout container = globalContainer.findViewById(R.id.teams_loader);
container.setAlpha(1f);
AppCompatTextView loaderText = container.findViewById(R.id.text);
ProgressBar progressBar = container.findViewById(R.id.progressBar);
AppCompatImageView check = container.findViewById(R.id.check);
AppCompatImageView problem = container.findViewById(R.id.problem);
progressBar.animate().setDuration(500).alpha(0f).start();
check.animate().setDuration(500).alpha(1f).start();
problem.setAlpha(0f);
loaderText.setTextColor(a.getColor(R.color.appBlack));
loaderText.setText(text);
progressBar.setAlpha(1);
progressBar.animate().setDuration(500).alpha(0);
container.animate().setStartDelay(1000).setDuration(500).alpha(0);
});
}
use of android.support.v7.widget.AppCompatTextView in project krypton-android by kryptco.
the class OnboardingVerifyEmailFragment method onCreateView.
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
final View rootView = inflater.inflate(R.layout.fragment_teams_onboarding_verify_email, container, false);
Button cancelButton = rootView.findViewById(R.id.cancelButton);
cancelButton.setOnClickListener(v -> {
progress.reset();
getActivity().finish();
});
ProgressBar progressBar = rootView.findViewById(R.id.progressBar);
progressBar.setAlpha(0);
Button changeButton = rootView.findViewById(R.id.changeButton);
changeButton.setEnabled(false);
Button resendButton = rootView.findViewById(R.id.resendButton);
resendButton.setEnabled(false);
ConstraintLayout checkYourEmailContainer = rootView.findViewById(R.id.checkYourEmailContainer);
checkYourEmailContainer.setAlpha(0);
AppCompatTextView teamName = rootView.findViewById(R.id.teamName);
teamName.setText(progress.getTeamOnboardingData().name);
emailEditText = rootView.findViewById(R.id.profileEmail);
InputMethodManager imm = (InputMethodManager) getContext().getSystemService(Context.INPUT_METHOD_SERVICE);
Runnable focusEmail = () -> {
emailEditText.setEnabled(true);
emailEditText.requestFocus();
if (imm != null) {
imm.toggleSoftInput(InputMethodManager.SHOW_FORCED, 0);
}
progressBar.animate().alpha(0).setDuration(500).start();
};
focusEmail.run();
Runnable requestEmailChallenge = () -> {
emailEditText.setEnabled(false);
emailEditText.clearFocus();
if (imm != null) {
imm.hideSoftInputFromWindow(emailEditText.getWindowToken(), 0);
}
progressBar.animate().alpha(1).setDuration(1000).start();
final String email = emailEditText.getEditableText().toString();
new Thread(() -> {
MeStorage meStorage = Silo.shared(getContext()).meStorage();
try {
meStorage.setEmail(email);
} catch (CryptoException e) {
Error.shortToast(getContext(), "Failed to set email: " + e.getMessage());
e.printStackTrace();
return;
}
Profile me = meStorage.load();
progress.updateTeamData((s, d) -> {
if (s.equals(CreateStage.VERIFY_EMAIL) || s.equals(CreateStage.EMAIL_CHALLENGE_SENT)) {
d.creatorProfile = me;
Log.i(TAG, "requesting email challenge...");
try {
final Sigchain.NativeResult<JsonObject> result = TeamDataProvider.requestEmailChallenge(getContext(), email);
emailEditText.post(() -> {
if (result.success != null) {
Log.i(TAG, "request email challenge success");
progressBar.animate().alpha(0).setDuration(500).start();
checkYourEmailContainer.animate().alpha(1).setDuration(1000).start();
changeButton.setEnabled(true);
resendButton.setEnabled(true);
} else {
Log.i(TAG, "request email challenge failure: " + result.error);
Error.shortToast(getContext(), "Error sending email: " + result.error);
focusEmail.run();
}
});
if (result.success != null) {
return CreateStage.EMAIL_CHALLENGE_SENT;
} else {
return s;
}
} catch (Native.NotLinked notLinked) {
notLinked.printStackTrace();
}
}
return s;
});
}).start();
};
emailEditText.setOnEditorActionListener((v, i, ev) -> {
requestEmailChallenge.run();
return false;
});
emailEditText.setOnFocusChangeListener((view, b) -> {
if (view.isEnabled() && !b) {
requestEmailChallenge.run();
}
});
resendButton.setOnClickListener(v -> {
requestEmailChallenge.run();
});
changeButton.setOnClickListener(v -> {
focusEmail.run();
});
Button submitButton = rootView.findViewById(R.id.submitButton);
submitButton.setEnabled(false);
submitButton.setAlpha(0);
submitButton.setOnClickListener(v -> {
FragmentManager fragmentManager = getFragmentManager();
if (fragmentManager != null) {
fragmentManager.beginTransaction().setCustomAnimations(R.anim.enter_from_right, R.anim.exit_to_left, R.anim.enter_from_right, R.anim.exit_to_left).replace(R.id.fragment_teams, new OnboardingLoadTeamFragment()).commitNowAllowingStateLoss();
}
});
EventBus.getDefault().register(this);
EventBus.getDefault().post(new IdentityService.GetProfile(getContext()));
return rootView;
}
use of android.support.v7.widget.AppCompatTextView in project krypton-android by kryptco.
the class OnboardingLoadInviteLinkFragment method onCreateView.
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
final View rootView = inflater.inflate(R.layout.fragment_teams_onboarding_load_team, container, false);
Button cancelButton = rootView.findViewById(R.id.cancelButton);
cancelButton.setOnClickListener(v -> {
progress.resetAndDeleteTeam(v.getContext());
getActivity().finish();
});
ProgressBar progressBar = rootView.findViewById(R.id.progressBar);
errorText = rootView.findViewById(R.id.errorText);
errorText.setAlpha(0);
AppCompatTextView progressText = rootView.findViewById(R.id.progressText);
progressText.setText("LOADING TEAM INVITE");
return rootView;
}
Aggregations