当前位置: 首页>>代码示例>>Java>>正文


Java TextView.VISIBLE属性代码示例

本文整理汇总了Java中android.widget.TextView.VISIBLE属性的典型用法代码示例。如果您正苦于以下问题:Java TextView.VISIBLE属性的具体用法?Java TextView.VISIBLE怎么用?Java TextView.VISIBLE使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在android.widget.TextView的用法示例。


在下文中一共展示了TextView.VISIBLE属性的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: update

public void update(RecyclerView referenceList, float dx, float dy) {
    if (indexList != null && indexList.getChildCount() > 2) {
        show();
        updatePosBasedOnReferenceList(referenceList);

        View firstVisibleView = indexList.getChildAt(0);
        View secondVisibleView = indexList.getChildAt(1);


        TextView firstRowIndex = (TextView) firstVisibleView.findViewById(R.id.section_title);
        TextView secondRowIndex = (TextView) secondVisibleView.findViewById(R.id.section_title);

        int visibleRange = indexList.getChildCount();
        int actual = indexList.getChildPosition(firstVisibleView);
        int next = actual + 1;
        int last = actual + visibleRange;

        Drawable drawable = activity.getResources().getDrawable(R.drawable.circle_white_bg);
        int backGroundColor = ToolbarContentTintHelper.toolbarTitleColor(activity, ThemeStore.primaryColor(activity));
        stickyIndex.setTextColor(MaterialValueHelper.getPrimaryTextColor(activity, ColorUtil.isColorLight(backGroundColor)));
        drawable.setColorFilter(backGroundColor, PorterDuff.Mode.SRC_IN);
        stickyIndex.setBackground(drawable);

        // RESET STICKY LETTER INDEX
        stickyIndex.setText(String.valueOf(getIndexContext(firstRowIndex)).toUpperCase());
        stickyIndex.setVisibility(TextView.VISIBLE);
        ViewCompat.setAlpha(firstRowIndex, 1);

        if (dy > 0) {
            // USER SCROLLING DOWN THE RecyclerView
            if (next <= last) {
                if (isHeader(firstRowIndex, secondRowIndex)) {
                    stickyIndex.setVisibility(TextView.INVISIBLE);
                    firstRowIndex.setVisibility(TextView.VISIBLE);
                    ViewCompat.setAlpha(firstRowIndex, (1 - (Math.abs(ViewCompat.getY(firstVisibleView)) / firstRowIndex.getHeight())));
                    secondRowIndex.setVisibility(TextView.VISIBLE);
                } else {
                    firstRowIndex.setVisibility(TextView.INVISIBLE);
                    stickyIndex.setVisibility(TextView.VISIBLE);
                }
            }
        } else if (dy < 0) {
            // USER IS SCROLLING UP THE RecyclerVIew
            if (next <= last) {
                // RESET FIRST ROW STATE
                firstRowIndex.setVisibility(TextView.INVISIBLE);
                if ((isHeader(firstRowIndex, secondRowIndex) || (getIndexContext(firstRowIndex) != getIndexContext(secondRowIndex))) && isHeader(firstRowIndex, secondRowIndex)) {
                    stickyIndex.setVisibility(TextView.INVISIBLE);
                    firstRowIndex.setVisibility(TextView.VISIBLE);
                    ViewCompat.setAlpha(firstRowIndex, 1 - (Math.abs(ViewCompat.getY(firstVisibleView) / firstRowIndex.getHeight())));
                    secondRowIndex.setVisibility(TextView.VISIBLE);
                } else {
                    secondRowIndex.setVisibility(TextView.INVISIBLE);
                }
            }
        }

        if (stickyIndex.getVisibility() == TextView.VISIBLE) {
            firstRowIndex.setVisibility(TextView.INVISIBLE);
        }
    } else {
        hide();
    }
}
 
开发者ID:aliumujib,项目名称:Orin,代码行数:64,代码来源:IndexLayoutManager.java

示例2: update

public void update(RecyclerView referenceList, float dx, float dy) {
    if (indexList != null && indexList.getChildCount() > 2) {
        show();
        //updatePosBasedOnReferenceList(referenceList);

        View firstVisibleView = indexList.getChildAt(0);
        View secondVisibleView = indexList.getChildAt(1);


        TextView firstRowIndex = (TextView) firstVisibleView.findViewById(R.id.section_title);
        TextView secondRowIndex = (TextView) secondVisibleView.findViewById(R.id.section_title);

        int visibleRange = indexList.getChildCount();
        int actual = indexList.getChildPosition(firstVisibleView);
        int next = actual + 1;
        int last = actual + visibleRange;

        // RESET STICKY LETTER INDEX
        stickyIndex.setText(String.valueOf(getIndexContext(firstRowIndex)).toUpperCase());
        stickyIndex.setVisibility(TextView.VISIBLE);
        ViewCompat.setAlpha(firstRowIndex, 1);

        if (dy > 0) {
            // USER SCROLLING DOWN THE RecyclerView
            if (next <= last) {
                if (isHeader(firstRowIndex, secondRowIndex)) {
                    stickyIndex.setVisibility(TextView.INVISIBLE);
                    firstRowIndex.setVisibility(TextView.VISIBLE);
                    ViewCompat.setAlpha(firstRowIndex, (1 - (Math.abs(ViewCompat.getY(firstVisibleView)) / firstRowIndex.getHeight())));
                    secondRowIndex.setVisibility(TextView.VISIBLE);
                } else {
                    firstRowIndex.setVisibility(TextView.INVISIBLE);
                    stickyIndex.setVisibility(TextView.VISIBLE);
                }
            }
        } else if (dy < 0) {
            // USER IS SCROLLING UP THE RecyclerVIew
            if (next <= last) {
                // RESET FIRST ROW STATE
                firstRowIndex.setVisibility(TextView.INVISIBLE);
                if ((isHeader(firstRowIndex, secondRowIndex) || (getIndexContext(firstRowIndex) != getIndexContext(secondRowIndex))) && isHeader(firstRowIndex, secondRowIndex)) {
                    stickyIndex.setVisibility(TextView.INVISIBLE);
                    firstRowIndex.setVisibility(TextView.VISIBLE);
                    ViewCompat.setAlpha(firstRowIndex, 1 - (Math.abs(ViewCompat.getY(firstVisibleView) / firstRowIndex.getHeight())));
                    secondRowIndex.setVisibility(TextView.VISIBLE);
                } else {
                    secondRowIndex.setVisibility(TextView.INVISIBLE);
                }
            }
        }

        if (stickyIndex.getVisibility() == TextView.VISIBLE) {
            firstRowIndex.setVisibility(TextView.INVISIBLE);
        }
    } else {
        hide();
    }
}
 
开发者ID:aliumujib,项目名称:Orin,代码行数:58,代码来源:IndexLayoutManager.java


注:本文中的android.widget.TextView.VISIBLE属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。