Java Code Examples for android.widget.TextView#VISIBLE

The following examples show how to use android.widget.TextView#VISIBLE . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: IndexLayoutManager.java    From Orin with GNU General Public License v3.0 4 votes vote down vote up
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();
    }
}
 
Example 2
Source File: IndexLayoutManager.java    From Orin with GNU General Public License v3.0 4 votes vote down vote up
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();
    }
}
 
Example 3
Source File: RichEditorView.java    From Spyglass with Apache License 2.0 4 votes vote down vote up
/**
 * @return true if the text counter view is currently visible to the user
 */
public boolean isDisplayingTextCounter() {
    return mTextCounterView != null && mTextCounterView.getVisibility() == TextView.VISIBLE;
}
 
Example 4
Source File: Main.java    From SMP with GNU General Public License v3.0 4 votes vote down vote up
@Override
public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
    if (seekbar.getVisibility() == TextView.VISIBLE) {
        currDuration.setText(RowSong.secondsToMinutes(seekBar.getProgress()));
    }
}
 
Example 5
Source File: DisplayTeaserListFragment.java    From coolreader with MIT License 4 votes vote down vote up
public void setMessageDialog(ICallbackEventData message) {
	// if(dialog.isShowing())
	// dialog.setMessage(message.getMessage());
	if (loadingText.getVisibility() == TextView.VISIBLE)
		loadingText.setText(message.getMessage());
}
 
Example 6
Source File: DisplayOriginalListFragment.java    From coolreader with MIT License 4 votes vote down vote up
public void setMessageDialog(ICallbackEventData message) {
	// if(dialog.isShowing())
	// dialog.setMessage(message.getMessage());
	if (loadingText.getVisibility() == TextView.VISIBLE)
		loadingText.setText(message.getMessage());
}
 
Example 7
Source File: DisplaySynopsisFragment.java    From coolreader with MIT License 4 votes vote down vote up
public void setMessageDialog(ICallbackEventData message) {
	if (loadingText.getVisibility() == TextView.VISIBLE)
		loadingText.setText(message.getMessage());
}
 
Example 8
Source File: DisplayLightNovelListFragment.java    From coolreader with MIT License 4 votes vote down vote up
public void setMessageDialog(ICallbackEventData message) {
	// if(dialog.isShowing())
	// dialog.setMessage(message.getMessage());
	if (loadingText.getVisibility() == TextView.VISIBLE)
		loadingText.setText(message.getMessage());
}
 
Example 9
Source File: DisplayLightNovelListActivity.java    From coolreader with MIT License 4 votes vote down vote up
public void setMessageDialog(ICallbackEventData message) {
	if (loadingText.getVisibility() == TextView.VISIBLE)
		loadingText.setText(message.getMessage());
}
 
Example 10
Source File: DisplayAlternativeNovelListActivity.java    From coolreader with MIT License 4 votes vote down vote up
public void setMessageDialog(ICallbackEventData message) {
	if (loadingText.getVisibility() == TextView.VISIBLE)
		loadingText.setText(message.getMessage());
}
 
Example 11
Source File: DisplayOriginalListActivity.java    From coolreader with MIT License 4 votes vote down vote up
public void setMessageDialog(ICallbackEventData message) {
	if (loadingText.getVisibility() == TextView.VISIBLE)
		loadingText.setText(message.getMessage());
}
 
Example 12
Source File: DisplayTeaserListActivity.java    From coolreader with MIT License 4 votes vote down vote up
public void setMessageDialog(ICallbackEventData message) {
	if (loadingText.getVisibility() == TextView.VISIBLE)
		loadingText.setText(message.getMessage());
}
 
Example 13
Source File: Main.java    From SMP with GNU General Public License v3.0 4 votes vote down vote up
@Override
public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
    if (seekbar.getVisibility() == TextView.VISIBLE) {
        currDuration.setText(RowSong.secondsToMinutes(seekBar.getProgress()));
    }
}