mdpreference/src/main/java/io/github/xhinliang/mdpreference/TwoStatePreference.java
void syncSummaryView() {
        Log.d(TAG, "syncSummaryView");
        // Sync the summary view
        boolean useDefaultSummary = true;
        if (isChecked && !TextUtils.isEmpty(summaryOn)) {
            summaryText.setText(summaryOn);
            useDefaultSummary = false;
        } else if (!isChecked && !TextUtils.isEmpty(summaryOff)) {
            summaryText.setText(summaryOff);
            useDefaultSummary = false;
        }
        if (useDefaultSummary) {
            CharSequence summary = getSummary();
            if (!TextUtils.isEmpty(summary)) {
                summaryText.setText(summary);
                useDefaultSummary = false;
            }
        }
        int newVisibility = View.GONE;
        if (!useDefaultSummary) {
            // Someone has written to it
            newVisibility = View.VISIBLE;
        }
        if (newVisibility != summaryText.getVisibility()) {
            summaryText.setVisibility(newVisibility);
        }
    }
/**
     * Sync a summary view contained within view's sub hierarchy with the correct summary text.
     */
Sync a summary view contained within view's sub hierarchy with the correct summary text.
Sync a summary view contained within view ' s sub hierarchy with the correct summary text .
void syncSummaryView() {
        Log.d(TAG, "syncSummaryView");
        boolean useDefaultSummary = true;
        if (isChecked && !TextUtils.isEmpty(summaryOn)) {
            summaryText.setText(summaryOn);
            useDefaultSummary = false;
        } else if (!isChecked && !TextUtils.isEmpty(summaryOff)) {
            summaryText.setText(summaryOff);
            useDefaultSummary = false;
        }
        if (useDefaultSummary) {
            CharSequence summary = getSummary();
            if (!TextUtils.isEmpty(summary)) {
                summaryText.setText(summary);
                useDefaultSummary = false;
            }
        }
        int newVisibility = View.GONE;
        if (!useDefaultSummary) {
            newVisibility = View.VISIBLE;
        }
        if (newVisibility != summaryText.getVisibility()) {
            summaryText.setVisibility(newVisibility);
        }
    }
void syncSummaryView ( ) { Log . d ( TAG , "syncSummaryView" ) ; boolean useDefaultSummary = true ; if ( isChecked && ! TextUtils . isEmpty ( summaryOn ) ) { summaryText . setText ( summaryOn ) ; useDefaultSummary = false ; } else if ( ! isChecked && ! TextUtils . isEmpty ( summaryOff ) ) { summaryText . setText ( summaryOff ) ; useDefaultSummary = false ; } if ( useDefaultSummary ) { CharSequence summary = getSummary ( ) ; if ( ! TextUtils . isEmpty ( summary ) ) { summaryText . setText ( summary ) ; useDefaultSummary = false ; } } int newVisibility = View . GONE ; if ( ! useDefaultSummary ) { newVisibility = View . VISIBLE ; } if ( newVisibility != summaryText . getVisibility ( ) ) { summaryText . setVisibility ( newVisibility ) ; } }
Sync a summary view contained within view's sub hierarchy with the correct summary text.
Sync a summary view contained within view ' s sub hierarchy with the correct summary text .
// Sync the summary view // Someone has written to it