use of androidx.constraintlayout.widget.ConstraintSet in project FirebaseUI-Android by firebase.
the class AuthMethodPickerActivity method onCreate.
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
FlowParameters params = getFlowParams();
customLayout = params.authMethodPickerLayout;
mHandler = new ViewModelProvider(this).get(SocialProviderResponseHandler.class);
mHandler.init(params);
mProviders = new ArrayList<>();
if (customLayout != null) {
setContentView(customLayout.getMainLayout());
// Setup using custom layout
populateIdpListCustomLayout(params.providers);
} else {
setContentView(R.layout.fui_auth_method_picker_layout);
// UI only with default layout
mProgressBar = findViewById(R.id.top_progress_bar);
mProviderHolder = findViewById(R.id.btn_holder);
populateIdpList(params.providers);
int logoId = params.logoId;
if (logoId == AuthUI.NO_LOGO) {
findViewById(R.id.logo).setVisibility(View.GONE);
ConstraintLayout layout = findViewById(R.id.root);
ConstraintSet constraints = new ConstraintSet();
constraints.clone(layout);
constraints.setHorizontalBias(R.id.container, 0.5f);
constraints.setVerticalBias(R.id.container, 0.5f);
constraints.applyTo(layout);
} else {
ImageView logo = findViewById(R.id.logo);
logo.setImageResource(logoId);
}
}
boolean tosAndPpConfigured = getFlowParams().isPrivacyPolicyUrlProvided() && getFlowParams().isTermsOfServiceUrlProvided();
int termsTextId = customLayout == null ? R.id.main_tos_and_pp : customLayout.getTosPpView();
if (termsTextId >= 0) {
TextView termsText = findViewById(termsTextId);
// No ToS or PP provided, so we should hide the view entirely
if (!tosAndPpConfigured) {
termsText.setVisibility(View.GONE);
} else {
PrivacyDisclosureUtils.setupTermsOfServiceAndPrivacyPolicyText(this, getFlowParams(), termsText);
}
}
// Handler for both
mHandler.getOperation().observe(this, new ResourceObserver<IdpResponse>(this, R.string.fui_progress_dialog_signing_in) {
@Override
protected void onSuccess(@NonNull IdpResponse response) {
startSaveCredentials(mHandler.getCurrentUser(), response, null);
}
@Override
protected void onFailure(@NonNull Exception e) {
if (e instanceof UserCancellationException) {
// User pressed back, there is no error.
return;
}
if (e instanceof FirebaseAuthAnonymousUpgradeException) {
finish(ErrorCodes.ANONYMOUS_UPGRADE_MERGE_CONFLICT, ((FirebaseAuthAnonymousUpgradeException) e).getResponse().toIntent());
} else if (e instanceof FirebaseUiException) {
FirebaseUiException fue = (FirebaseUiException) e;
finish(RESULT_CANCELED, IdpResponse.from(fue).toIntent());
} else {
String text = getString(R.string.fui_error_unknown);
Toast.makeText(AuthMethodPickerActivity.this, text, Toast.LENGTH_SHORT).show();
}
}
});
}
use of androidx.constraintlayout.widget.ConstraintSet in project Signal-Android by signalapp.
the class CreatePaymentFragment method initializeConstraintSets.
private void initializeConstraintSets() {
cryptoConstraintSet = new ConstraintSet();
cryptoConstraintSet.clone(constraintLayout);
fiatConstraintSet = new ConstraintSet();
fiatConstraintSet.clone(getContext(), R.layout.create_payment_fragment_amount_toggle);
}
use of androidx.constraintlayout.widget.ConstraintSet in project Signal-Android by signalapp.
the class WebRtcCallView method layoutParticipants.
private void layoutParticipants() {
Transition transition = new AutoTransition().setDuration(TRANSITION_DURATION_MILLIS);
TransitionManager.beginDelayedTransition(participantsParent, transition);
ConstraintSet constraintSet = new ConstraintSet();
constraintSet.clone(participantsParent);
constraintSet.setMargin(R.id.call_screen_participants_pager, ConstraintSet.BOTTOM, ViewUtil.dpToPx(withControlsHeight(pagerBottomMarginDp)));
constraintSet.applyTo(participantsParent);
}
use of androidx.constraintlayout.widget.ConstraintSet in project Signal-Android by signalapp.
the class ConversationReactionOverlay method setupSelectedEmoji.
private void setupSelectedEmoji() {
final List<String> emojis = SignalStore.emojiValues().getReactions();
final String oldEmoji = getOldEmoji(messageRecord);
if (oldEmoji == null) {
selectedView.setVisibility(View.GONE);
}
boolean foundSelected = false;
for (int i = 0; i < emojiViews.length; i++) {
final EmojiImageView view = emojiViews[i];
view.setScaleX(1.0f);
view.setScaleY(1.0f);
view.setTranslationY(0);
boolean isAtCustomIndex = i == customEmojiIndex;
boolean isNotAtCustomIndexAndOldEmojiMatches = !isAtCustomIndex && oldEmoji != null && emojis.get(i).equals(EmojiUtil.getCanonicalRepresentation(oldEmoji));
boolean isAtCustomIndexAndOldEmojiExists = isAtCustomIndex && oldEmoji != null;
if (!foundSelected && (isNotAtCustomIndexAndOldEmojiMatches || isAtCustomIndexAndOldEmojiExists)) {
foundSelected = true;
selectedView.setVisibility(View.VISIBLE);
ConstraintSet constraintSet = new ConstraintSet();
constraintSet.clone(foregroundView);
constraintSet.clear(selectedView.getId(), ConstraintSet.LEFT);
constraintSet.clear(selectedView.getId(), ConstraintSet.RIGHT);
constraintSet.connect(selectedView.getId(), ConstraintSet.LEFT, view.getId(), ConstraintSet.LEFT);
constraintSet.connect(selectedView.getId(), ConstraintSet.RIGHT, view.getId(), ConstraintSet.RIGHT);
constraintSet.applyTo(foregroundView);
if (isAtCustomIndex) {
view.setImageEmoji(oldEmoji);
view.setTag(oldEmoji);
} else {
view.setImageEmoji(SignalStore.emojiValues().getPreferredVariation(emojis.get(i)));
}
} else if (isAtCustomIndex) {
view.setImageDrawable(ContextCompat.getDrawable(getContext(), R.drawable.ic_any_emoji_32));
view.setTag(null);
} else {
view.setImageEmoji(SignalStore.emojiValues().getPreferredVariation(emojis.get(i)));
}
}
}
Aggregations