Search in sources :

Example 1 with ZetaButton

use of com.waz.zclient.ui.views.ZetaButton in project wire-android by wireapp.

the class FirstTimeAssignUsernameFragment method onCreateView.

@Nullable
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
    View view = inflater.inflate(R.layout.fragment_username_first_launch, container, false);
    nameTextView = ViewUtils.getView(view, R.id.ttv__name);
    usernameTextView = ViewUtils.getView(view, R.id.ttv__username);
    backgroundImageView = ViewUtils.getView(view, R.id.iaiv__user_photo);
    final ImageView vignetteOverlay = ViewUtils.getView(view, R.id.iv_background_vignette_overlay);
    ZetaButton chooseYourOwnButton = ViewUtils.getView(view, R.id.zb__username_first_assign__choose);
    ZetaButton keepButton = ViewUtils.getView(view, R.id.zb__username_first_assign__keep);
    TypefaceTextView summaryTextView = ViewUtils.getView(view, R.id.ttv__username_first_assign__summary);
    AccentColor accentColor = getControllerFactory().getAccentColorController().getAccentColor();
    final int color = accentColor != null ? accentColor.getColor() : Color.TRANSPARENT;
    final int darkenColor = ColorUtils.injectAlpha(ResourceUtils.getResourceFloat(getResources(), R.dimen.background_solid_black_overlay_opacity), Color.BLACK);
    backgroundImageView.setDisplayType(ImageAssetImageView.DisplayType.REGULAR);
    vignetteOverlay.setImageBitmap(BitmapUtils.getVignetteBitmap(getResources()));
    vignetteOverlay.setColorFilter(darkenColor, PorterDuff.Mode.DARKEN);
    selfModelObserver.setAndUpdate(getStoreFactory().getZMessagingApiStore().getApi().getSelf());
    chooseYourOwnButton.setIsFilled(true);
    chooseYourOwnButton.setAccentColor(color);
    chooseYourOwnButton.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View view) {
            getContainer().onChooseUsernameChosen();
        }
    });
    suggestedUsername = getArguments().getString(ARG_SUGGESTED_USERNAME, "");
    keepButton.setIsFilled(false);
    keepButton.setAccentColor(color);
    keepButton.setTextColor(getResources().getColor(R.color.white));
    keepButton.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View view) {
            getContainer().onKeepUsernameChosen(suggestedUsername);
        }
    });
    nameTextView.setText(getArguments().getString(ARG_NAME, ""));
    usernameTextView.setText(StringUtils.formatHandle(suggestedUsername));
    if (TextUtils.isEmpty(suggestedUsername)) {
        usernameTextView.setVisibility(View.INVISIBLE);
        keepButton.setVisibility(View.GONE);
    }
    TextViewUtils.linkifyText(summaryTextView, Color.WHITE, com.waz.zclient.ui.R.string.wire__typeface__light, false, new Runnable() {

        @Override
        public void run() {
            ((BaseScalaActivity) getActivity()).injectJava(GlobalTrackingController.class).tagEvent(new OpenedUsernameFAQEvent());
            getContainer().onOpenUrl(getString(R.string.usernames__learn_more__link));
        }
    });
    return view;
}
Also used : AccentColor(com.waz.api.AccentColor) TypefaceTextView(com.waz.zclient.ui.text.TypefaceTextView) BaseScalaActivity(com.waz.zclient.BaseScalaActivity) OpenedUsernameFAQEvent(com.waz.zclient.core.controllers.tracking.events.onboarding.OpenedUsernameFAQEvent) ZetaButton(com.waz.zclient.ui.views.ZetaButton) ImageView(android.widget.ImageView) ImageAssetImageView(com.waz.zclient.views.images.ImageAssetImageView) ImageView(android.widget.ImageView) ImageAssetImageView(com.waz.zclient.views.images.ImageAssetImageView) TypefaceTextView(com.waz.zclient.ui.text.TypefaceTextView) View(android.view.View) Nullable(android.support.annotation.Nullable)

Example 2 with ZetaButton

use of com.waz.zclient.ui.views.ZetaButton in project wire-android by wireapp.

the class UpdateFragment method onCreateView.

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View view = inflater.inflate(R.layout.fragment_update, container, false);
    ZetaButton zetaButton = ViewUtils.getView(view, R.id.zb__update__download);
    zetaButton.setAccentColor(getResources().getColor(R.color.forced_update__button__background_color));
    zetaButton.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            launchDownloadLink();
        }
    });
    return view;
}
Also used : ZetaButton(com.waz.zclient.ui.views.ZetaButton) View(android.view.View)

Aggregations

View (android.view.View)2 ZetaButton (com.waz.zclient.ui.views.ZetaButton)2 Nullable (android.support.annotation.Nullable)1 ImageView (android.widget.ImageView)1 AccentColor (com.waz.api.AccentColor)1 BaseScalaActivity (com.waz.zclient.BaseScalaActivity)1 OpenedUsernameFAQEvent (com.waz.zclient.core.controllers.tracking.events.onboarding.OpenedUsernameFAQEvent)1 TypefaceTextView (com.waz.zclient.ui.text.TypefaceTextView)1 ImageAssetImageView (com.waz.zclient.views.images.ImageAssetImageView)1