Search in sources :

Example 1 with TypefaceTextView

use of com.waz.zclient.ui.text.TypefaceTextView 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 TypefaceTextView

use of com.waz.zclient.ui.text.TypefaceTextView in project wire-android by wireapp.

the class ChatheadImageView method init.

private void init() {
    chatHeadState = ChatHeadState.IDLE;
    imageView = new ImageView(getContext());
    typefaceTextView = new TypefaceTextView(getContext());
    addView(imageView, new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT));
    addView(typefaceTextView, new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT));
    paint = new Paint(Paint.ANTI_ALIAS_FLAG);
}
Also used : TypefaceTextView(com.waz.zclient.ui.text.TypefaceTextView) FrameLayout(android.widget.FrameLayout) ImageView(android.widget.ImageView) Paint(android.graphics.Paint)

Example 3 with TypefaceTextView

use of com.waz.zclient.ui.text.TypefaceTextView in project wire-android by wireapp.

the class DrawingFragment method onCreateView.

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View rootView = inflater.inflate(R.layout.fragment_drawing, container, false);
    drawingCanvasView = ViewUtils.getView(rootView, R.id.dcv__canvas);
    drawingCanvasView.setDrawingCanvasCallback(this);
    drawingCanvasView.setDrawingColor(getControllerFactory().getAccentColorController().getColor());
    drawingCanvasView.setOnTouchListener(drawingCanvasViewOnTouchListener);
    colorPickerScrollContainer = ViewUtils.getView(rootView, R.id.hsv_color_picker_scroll_view);
    colorLayout = ViewUtils.getView(rootView, R.id.cpdl__color_layout);
    colorLayout.setOnColorSelectedListener(this);
    int[] colors = getResources().getIntArray(R.array.draw_color);
    colorLayout.setAccentColors(colors, getControllerFactory().getAccentColorController().getColor());
    colorLayout.getViewTreeObserver().addOnScrollChangedListener(this);
    // TODO uncomment once AN-4649 is fixed
    //        colorPickerScrollBar = ViewUtils.getView(rootView, R.id.cpsb__color_picker_scrollbar);
    //        colorPickerScrollBar.setScrollBarColor(getControllerFactory().getAccentColorController().getColor());
    TypefaceTextView conversationTitle = ViewUtils.getView(rootView, R.id.tv__drawing_toolbar__title);
    conversationTitle.setText(getStoreFactory().getConversationStore().getCurrentConversation().getName().toUpperCase(Locale.getDefault()));
    toolbar = ViewUtils.getView(rootView, R.id.t_drawing_toolbar);
    toolbar.inflateMenu(R.menu.toolbar_sketch);
    toolbar.setOnMenuItemClickListener(toolbarOnMenuItemClickListener);
    toolbar.setNavigationOnClickListener(toolbarNavigationClickListener);
    toolbar.setNavigationIcon(R.drawable.toolbar_action_undo_disabled);
    actionButtonText = ViewUtils.getView(rootView, R.id.gtv__drawing_button__text);
    actionButtonText.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            onTextClick();
        }
    });
    actionButtonEmoji = ViewUtils.getView(rootView, R.id.gtv__drawing_button__emoji);
    actionButtonEmoji.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            onEmojiClick();
        }
    });
    actionButtonSketch = ViewUtils.getView(rootView, R.id.gtv__drawing_button__sketch);
    actionButtonSketch.setTextColor(getControllerFactory().getAccentColorController().getColor());
    actionButtonSketch.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            onSketchClick();
        }
    });
    galleryButton = ViewUtils.getView(rootView, R.id.gtv__drawing__gallery_button);
    galleryButton.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View view) {
            if (PermissionUtils.hasSelfPermissions(getContext(), SKETCH_FROM_GALLERY_PERMISSION)) {
                sketchEditTextView.destroyDrawingCache();
                assetIntentsManager.openGalleryForSketch();
            } else {
                ActivityCompat.requestPermissions(getActivity(), SKETCH_FROM_GALLERY_PERMISSION, OPEN_SKETCH_FROM_GALLERY);
            }
        }
    });
    drawingTipBackground = ViewUtils.getView(rootView, R.id.v__tip_background);
    drawingViewTip = ViewUtils.getView(rootView, R.id.ttv__drawing__view__tip);
    drawingTipBackground.setVisibility(View.INVISIBLE);
    sendDrawingButton = ViewUtils.getView(rootView, R.id.tv__send_button);
    sendDrawingButton.setOnClickListener(sketchButtonsOnClickListener);
    sendDrawingButton.setClickable(false);
    sketchEditTextView = ViewUtils.getView(rootView, R.id.et__sketch_text);
    sketchEditTextView.setAlpha(TEXT_ALPHA_INVISIBLE);
    sketchEditTextView.setVisibility(View.INVISIBLE);
    sketchEditTextView.setCustomHint(getString(R.string.drawing__text_hint));
    currentBackgroundColor = getControllerFactory().getAccentColorController().getColor();
    sketchEditTextView.setBackground(ColorUtils.getTransparentDrawable());
    sketchEditTextView.setHintFontId(R.string.wire__typeface__medium);
    sketchEditTextView.setTextFontId(R.string.wire__typeface__regular);
    sketchEditTextView.setSketchScale(1.0f);
    sketchEditTextView.setOnTouchListener(sketchEditTextOnTouchListener);
    if (savedInstanceState != null) {
        Bitmap savedBitmap = savedInstanceState.getParcelable(SAVED_INSTANCE_BITMAP);
        if (savedBitmap != null) {
            // Use saved background image if exists
            drawingCanvasView.setBackgroundBitmap(savedBitmap);
        } else {
            setBackgroundBitmap(true);
        }
    } else {
        setBackgroundBitmap(true);
    }
    return rootView;
}
Also used : Bitmap(android.graphics.Bitmap) TypefaceTextView(com.waz.zclient.ui.text.TypefaceTextView) HorizontalScrollView(android.widget.HorizontalScrollView) TypefaceTextView(com.waz.zclient.ui.text.TypefaceTextView) View(android.view.View) DrawingCanvasView(com.waz.zclient.ui.sketch.DrawingCanvasView) TextView(android.widget.TextView)

Aggregations

TypefaceTextView (com.waz.zclient.ui.text.TypefaceTextView)3 View (android.view.View)2 ImageView (android.widget.ImageView)2 Bitmap (android.graphics.Bitmap)1 Paint (android.graphics.Paint)1 Nullable (android.support.annotation.Nullable)1 FrameLayout (android.widget.FrameLayout)1 HorizontalScrollView (android.widget.HorizontalScrollView)1 TextView (android.widget.TextView)1 AccentColor (com.waz.api.AccentColor)1 BaseScalaActivity (com.waz.zclient.BaseScalaActivity)1 OpenedUsernameFAQEvent (com.waz.zclient.core.controllers.tracking.events.onboarding.OpenedUsernameFAQEvent)1 DrawingCanvasView (com.waz.zclient.ui.sketch.DrawingCanvasView)1 ZetaButton (com.waz.zclient.ui.views.ZetaButton)1 ImageAssetImageView (com.waz.zclient.views.images.ImageAssetImageView)1