Search in sources :

Example 1 with GlyphTextView

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

the class SingleImageFragment method onCreateView.

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View view = inflater.inflate(R.layout.fragment_single_image, container, false);
    dragViewContainer = ViewUtils.getView(view, R.id.dvc__single_image_message__drag_container);
    dragViewContainer.setCallback(this);
    messageTouchImageView = ViewUtils.getView(view, R.id.tiv__single_image_message__image);
    messageTouchImageView.setOnClickListener(imageViewOnClickListener);
    messageTouchImageView.setOnZoomLevelChangedListener(new TouchImageView.OnZoomLevelListener() {

        @Override
        public void onZoomLevelChanged(float scale) {
            if (messageTouchImageView == null || dragViewContainer == null) {
                return;
            }
            boolean draggingEnabled = !messageTouchImageView.isZoomed();
            dragViewContainer.setDraggingEnabled(draggingEnabled);
        }
    });
    animatingImageView = ViewUtils.getView(view, R.id.tiv__single_image_message__animating_image);
    background = ViewUtils.getView(view, R.id.v__single_image_message__background);
    openAnimationDuration = getResources().getInteger(R.integer.single_image_message__open_animation__duration);
    openAnimationBackgroundDuration = getResources().getInteger(R.integer.framework_animation_duration_short);
    zoomOutAndRotateBackOnCloseDuration = getResources().getInteger(R.integer.single_image_message__zoom_out_and_rotate_back_on_close_animation__duration);
    closeAnimationBackgroundDelay = getResources().getInteger(R.integer.single_image_message__close_animation_background__delay);
    headerControls = ViewUtils.getView(view, R.id.ll__single_image_message__header);
    GlyphTextView closeGlyphText = ViewUtils.getView(view, R.id.gtv__single_image_message__close);
    closeGlyphText.setOnClickListener(actionButtonsOnClickListener);
    return view;
}
Also used : GlyphTextView(com.waz.zclient.ui.text.GlyphTextView) TouchImageView(com.waz.zclient.views.images.TouchImageView) TouchImageView(com.waz.zclient.views.images.TouchImageView) ImageView(android.widget.ImageView) View(android.view.View) GlyphTextView(com.waz.zclient.ui.text.GlyphTextView)

Example 2 with GlyphTextView

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

the class OptionsMenu method setMenuItems.

public void setMenuItems(List<OptionsMenuItem> optionsMenuItems, @NonNull final OptionsTheme optionsTheme) {
    titleTextView.setTextColor(optionsTheme.getTextColorPrimary());
    backgroundView.setBackgroundColor(optionsTheme.getOverlayColor());
    //important that items are in order
    Collections.sort(optionsMenuItems);
    // add regular items
    menuLayout.removeAllViews();
    final int rows = (int) Math.ceil(optionsMenuItems.size() / 3f);
    int itemNumber = 0;
    for (int i = 0; i < rows; i++) {
        LinearLayout row = new LinearLayout(getContext());
        row.setOrientation(LinearLayout.HORIZONTAL);
        row.setGravity(Gravity.CENTER);
        LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.WRAP_CONTENT);
        //int sideMargin = getResources().getDimensionPixelSize(R.dimen.options_menu_row_side_margin);
        int topMargin = getResources().getDimensionPixelSize(R.dimen.options_menu_row_top_margin);
        params.setMargins(0, topMargin, 0, 0);
        row.setLayoutParams(params);
        while (row.getChildCount() < MAX_ITEMS_PER_ROW) {
            if (itemNumber >= optionsMenuItems.size()) {
                break;
            }
            //logic for keeping the first row at 2 items if there are 4/5 total
            if ((optionsMenuItems.size() == TOTAL_ITEMS_FIVE || optionsMenuItems.size() == TOTAL_ITEMS_FOUR) && i == 0 && row.getChildCount() == MAX_ITEMS_PER_ROW - 1) {
                break;
            }
            final OptionsMenuItem item = optionsMenuItems.get(itemNumber);
            final View optionsMenuItemContainer = LayoutInflater.from(getContext()).inflate(R.layout.options_menu__item, this, false);
            final FrameLayout optionsMenuButton = ViewUtils.getView(optionsMenuItemContainer, R.id.fl_options_menu_button);
            final GlyphTextView optionsMenuItemGlyph = ViewUtils.getView(optionsMenuItemContainer, R.id.gtv__options_menu_button__glyph);
            optionsMenuItemGlyph.setText(item.resGlyphId);
            final TextView optionsMenuItemText = ViewUtils.getView(optionsMenuItemContainer, R.id.ttv__settings_box__item);
            optionsMenuItemText.setText(item.resTextId);
            optionsMenuItemText.setTextColor(optionsTheme.getTextColorPrimary());
            if (item.isToggled()) {
                if (optionsTheme.getType() == OptionsTheme.Type.DARK) {
                    optionsMenuItemGlyph.setTextColor(new OptionsLightTheme(getContext()).getTextColorPrimarySelector());
                    optionsMenuButton.setBackground(getResources().getDrawable(R.drawable.selector__icon_button__background__dark_toggled));
                } else {
                    optionsMenuItemGlyph.setTextColor(new OptionsDarkTheme(getContext()).getTextColorPrimarySelector());
                    optionsMenuButton.setBackground(getResources().getDrawable(R.drawable.selector__icon_button__background__light_toggled));
                }
            } else {
                if (optionsTheme.getType() == OptionsTheme.Type.DARK) {
                    optionsMenuButton.setBackground(getResources().getDrawable(R.drawable.selector__icon_button__background__dark));
                } else {
                    optionsMenuButton.setBackground(getResources().getDrawable(R.drawable.selector__icon_button__background__light));
                }
                optionsMenuItemGlyph.setTextColor(optionsTheme.getTextColorPrimarySelector());
            }
            optionsMenuItemText.setTextColor(optionsTheme.getTextColorPrimarySelector());
            optionsMenuItemContainer.setOnClickListener(new OnClickListener() {

                @Override
                public void onClick(View view) {
                    notifyOptionsMenuItemClicked(item);
                }
            });
            optionsMenuItemContainer.setOnLongClickListener(new OnLongClickListener() {

                @Override
                public boolean onLongClick(View v) {
                    return notifyOptionsMenuItemLongClicked(item);
                }
            });
            row.addView(optionsMenuItemContainer);
            itemNumber++;
        }
        menuLayout.addView(row);
    }
    //set cancel button
    cancelView.setText(getResources().getString(R.string.confirmation_menu__cancel));
    cancelView.setTextColor(optionsTheme.getTextColorPrimarySelector());
    cancelView.setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View view) {
            close();
        }
    });
    menuLayout.addView(cancelView);
    notifyOptionsMenuStateHasChanged(State.CLOSED);
    setVisibility(View.INVISIBLE);
}
Also used : OptionsDarkTheme(com.waz.zclient.ui.theme.OptionsDarkTheme) GlyphTextView(com.waz.zclient.ui.text.GlyphTextView) UserDetailsView(com.waz.zclient.ui.views.UserDetailsView) TextView(android.widget.TextView) GlyphTextView(com.waz.zclient.ui.text.GlyphTextView) TypefaceTextView(com.waz.zclient.ui.text.TypefaceTextView) View(android.view.View) OptionsLightTheme(com.waz.zclient.ui.theme.OptionsLightTheme) FrameLayout(android.widget.FrameLayout) TextView(android.widget.TextView) GlyphTextView(com.waz.zclient.ui.text.GlyphTextView) TypefaceTextView(com.waz.zclient.ui.text.TypefaceTextView) LinearLayout(android.widget.LinearLayout)

Example 3 with GlyphTextView

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

the class VoiceFilterGridLayout method createItemView.

public View createItemView(final int r, final int c) {
    LayoutInflater inflater = LayoutInflater.from(getContext());
    FrameLayout frameLayout = (FrameLayout) inflater.inflate(R.layout.voice_filter_grid_icon, this, false);
    GlyphTextView glyphTextView = ViewUtils.getView(frameLayout, R.id.gtv__voice_filter_icon);
    glyphTextView.setText(getResource(r, c));
    frameLayout.setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View v) {
            setSelectedView((GlyphTextView) ViewUtils.getView(v, R.id.gtv__voice_filter_icon));
            controller.applyEffectAndPlay(getAudioEffect(r, c));
        }
    });
    if (r == 0 && c == 0) {
        setSelectedView(glyphTextView);
    }
    return frameLayout;
}
Also used : GlyphTextView(com.waz.zclient.ui.text.GlyphTextView) LayoutInflater(android.view.LayoutInflater) FrameLayout(android.widget.FrameLayout) TextView(android.widget.TextView) GlyphTextView(com.waz.zclient.ui.text.GlyphTextView) View(android.view.View)

Example 4 with GlyphTextView

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

the class TabIndicatorLayout method setGlyphLabels.

public void setGlyphLabels(List<String> lables) {
    anchorPositions = new int[lables.size()];
    textViewContainer.removeAllViews();
    for (int i = 0; i < lables.size(); i++) {
        String label = lables.get(i);
        LayoutInflater inflater = LayoutInflater.from(getContext());
        GlyphTextView textView = (GlyphTextView) inflater.inflate(R.layout.tab_glyphtextview, textViewContainer, false);
        textViewContainer.addView(textView);
        textView.setText(label);
        textView.setId(i);
    }
    requestLayout();
}
Also used : GlyphTextView(com.waz.zclient.ui.text.GlyphTextView) LayoutInflater(android.view.LayoutInflater)

Aggregations

GlyphTextView (com.waz.zclient.ui.text.GlyphTextView)4 View (android.view.View)3 LayoutInflater (android.view.LayoutInflater)2 FrameLayout (android.widget.FrameLayout)2 TextView (android.widget.TextView)2 ImageView (android.widget.ImageView)1 LinearLayout (android.widget.LinearLayout)1 TypefaceTextView (com.waz.zclient.ui.text.TypefaceTextView)1 OptionsDarkTheme (com.waz.zclient.ui.theme.OptionsDarkTheme)1 OptionsLightTheme (com.waz.zclient.ui.theme.OptionsLightTheme)1 UserDetailsView (com.waz.zclient.ui.views.UserDetailsView)1 TouchImageView (com.waz.zclient.views.images.TouchImageView)1