當前位置: 首頁>>代碼示例>>Java>>正文


Java AccessibilityEvent.setCurrentItemIndex方法代碼示例

本文整理匯總了Java中android.view.accessibility.AccessibilityEvent.setCurrentItemIndex方法的典型用法代碼示例。如果您正苦於以下問題:Java AccessibilityEvent.setCurrentItemIndex方法的具體用法?Java AccessibilityEvent.setCurrentItemIndex怎麽用?Java AccessibilityEvent.setCurrentItemIndex使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在android.view.accessibility.AccessibilityEvent的用法示例。


在下文中一共展示了AccessibilityEvent.setCurrentItemIndex方法的11個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: dispatchPopulateAccessibilityEvent

import android.view.accessibility.AccessibilityEvent; //導入方法依賴的package包/類
public boolean dispatchPopulateAccessibilityEvent(AccessibilityEvent event) {
    boolean populated = false;
    if (event.getEventType() == 8) {
        event.setEventType(4);
    }
    View selectedView = getSelectedView();
    if (selectedView != null) {
        populated = selectedView.dispatchPopulateAccessibilityEvent(event);
    }
    if (!populated) {
        if (selectedView != null) {
            event.setEnabled(selectedView.isEnabled());
        }
        event.setItemCount(getCount());
        event.setCurrentItemIndex(getSelectedItemPosition());
    }
    return populated;
}
 
開發者ID:JackChan1999,項目名稱:boohee_v5.6,代碼行數:19,代碼來源:PLA_AdapterView.java

示例2: dispatchPopulateAccessibilityEvent

import android.view.accessibility.AccessibilityEvent; //導入方法依賴的package包/類
public boolean dispatchPopulateAccessibilityEvent(AccessibilityEvent event) {
    boolean populated = super.dispatchPopulateAccessibilityEvent(event);
    if (!populated) {
        int itemCount = 0;
        int currentItemIndex = getSelectedItemPosition();
        ListAdapter adapter = getAdapter();
        if (adapter != null) {
            int count = adapter.getCount();
            if (count < 15) {
                for (int i = 0; i < count; i++) {
                    if (adapter.isEnabled(i)) {
                        itemCount++;
                    } else if (i <= currentItemIndex) {
                        currentItemIndex--;
                    }
                }
            } else {
                itemCount = count;
            }
        }
        event.setItemCount(itemCount);
        event.setCurrentItemIndex(currentItemIndex);
    }
    return populated;
}
 
開發者ID:JackChan1999,項目名稱:boohee_v5.6,代碼行數:26,代碼來源:PLA_ListView.java

示例3: onInitializeAccessibilityEvent

import android.view.accessibility.AccessibilityEvent; //導入方法依賴的package包/類
/**
 */
@Override
@TargetApi(Build.VERSION_CODES.ICE_CREAM_SANDWICH)
public void onInitializeAccessibilityEvent(@NonNull AccessibilityEvent event) {
	super.onInitializeAccessibilityEvent(event);
	event.setClassName(BaseProgressBar.class.getName());
	event.setItemCount(mMax);
	event.setCurrentItemIndex(mProgress);
}
 
開發者ID:universum-studios,項目名稱:android_ui,代碼行數:11,代碼來源:BaseProgressBar.java

示例4: onInitializeAccessibilityEvent

import android.view.accessibility.AccessibilityEvent; //導入方法依賴的package包/類
@Override
public void onInitializeAccessibilityEvent(AccessibilityEvent event) {
    super.onInitializeAccessibilityEvent(event);
    event.setScrollable(isScrollableForAccessibility());
    View selectedView = getSelectedView();
    if (selectedView != null) {
        event.setEnabled(selectedView.isEnabled());
    }
    event.setCurrentItemIndex(getSelectedItemPosition());
    event.setFromIndex(getFirstVisiblePosition());
    event.setToIndex(getLastVisiblePosition());
    event.setItemCount(getCount());
}
 
開發者ID:treasure-lau,項目名稱:CSipSimple,代碼行數:14,代碼來源:IcsAdapterView.java

示例5: onInitializeAccessibilityEvent

import android.view.accessibility.AccessibilityEvent; //導入方法依賴的package包/類
@TargetApi(14)
public void onInitializeAccessibilityEvent(AccessibilityEvent event) {
    super.onInitializeAccessibilityEvent(event);
    event.setClassName(AdapterView.class.getName());
    event.setScrollable(isScrollableForAccessibility());
    View selectedView = getSelectedView();
    if (selectedView != null) {
        event.setEnabled(selectedView.isEnabled());
    }
    event.setCurrentItemIndex(getSelectedItemPosition());
    event.setFromIndex(getFirstVisiblePosition());
    event.setToIndex(getLastVisiblePosition());
    event.setItemCount(getCount());
}
 
開發者ID:JackChan1999,項目名稱:letv,代碼行數:15,代碼來源:AdapterView.java

示例6: onInitializeAccessibilityEvent

import android.view.accessibility.AccessibilityEvent; //導入方法依賴的package包/類
@TargetApi(14)
@Override
public void onInitializeAccessibilityEvent( AccessibilityEvent event ) {
	super.onInitializeAccessibilityEvent( event );
	event.setClassName( AdapterView.class.getName() );
	event.setScrollable( isScrollableForAccessibility() );
	View selectedView = getSelectedView();
	if ( selectedView != null ) {
		event.setEnabled( selectedView.isEnabled() );
	}
	event.setCurrentItemIndex( getSelectedItemPosition() );
	event.setFromIndex( getFirstVisiblePosition() );
	event.setToIndex( getLastVisiblePosition() );
	event.setItemCount( getCount() );
}
 
開發者ID:junchenChow,項目名稱:exciting-app,代碼行數:16,代碼來源:AdapterView.java

示例7: onInitializeAccessibilityEvent

import android.view.accessibility.AccessibilityEvent; //導入方法依賴的package包/類
public void onInitializeAccessibilityEvent(AccessibilityEvent paramAccessibilityEvent) {
	super.onInitializeAccessibilityEvent(paramAccessibilityEvent);
	paramAccessibilityEvent.setScrollable(isScrollableForAccessibility());
	View localView = getSelectedView();
	if (localView != null)
		paramAccessibilityEvent.setEnabled(localView.isEnabled());
	paramAccessibilityEvent.setCurrentItemIndex(getSelectedItemPosition());
	paramAccessibilityEvent.setFromIndex(getFirstVisiblePosition());
	paramAccessibilityEvent.setToIndex(getLastVisiblePosition());
	paramAccessibilityEvent.setItemCount(getCount());
}
 
開發者ID:Evan-Galvin,項目名稱:FreeStreams-TVLauncher,代碼行數:12,代碼來源:AdapterView.java

示例8: dispatchPopulateAccessibilityEvent

import android.view.accessibility.AccessibilityEvent; //導入方法依賴的package包/類
@Override
public boolean dispatchPopulateAccessibilityEvent(AccessibilityEvent event) {
    boolean populated = super.dispatchPopulateAccessibilityEvent(event);

    // If the item count is less than 15 then subtract disabled items from the count and
    // position. Otherwise ignore disabled items.
    if (!populated) {
        int itemCount = 0;
        int currentItemIndex = getSelectedItemPosition();

        ListAdapter adapter = getAdapter();
        if (adapter != null) {
            final int count = adapter.getCount();
            if (count < 15) {
                for (int i = 0; i < count; i++) {
                    if (adapter.isEnabled(i)) {
                        itemCount++;
                    } else if (i <= currentItemIndex) {
                        currentItemIndex--;
                    }
                }
            } else {
                itemCount = count;
            }
        }

        event.setItemCount(itemCount);
        event.setCurrentItemIndex(currentItemIndex);
    }

    return populated;
}
 
開發者ID:Shmilyz,項目名稱:Swap,代碼行數:33,代碼來源:PLA_ListView.java

示例9: dispatchPopulateAccessibilityEvent

import android.view.accessibility.AccessibilityEvent; //導入方法依賴的package包/類
@Override
public boolean dispatchPopulateAccessibilityEvent(AccessibilityEvent event) {
	boolean populated = false;
	// This is an exceptional case which occurs when a window gets the
	// focus and sends a focus event via its focused child to announce
	// current focus/selection. AdapterView fires selection but not focus
	// events so we change the event type here.
	if (event.getEventType() == AccessibilityEvent.TYPE_VIEW_FOCUSED) {
		event.setEventType(AccessibilityEvent.TYPE_VIEW_SELECTED);
	}
       
	// we send selection events only from AdapterView to avoid
	// generation of such event for each child
	View selectedView = getSelectedView();
	if (selectedView != null) {
		populated = selectedView.dispatchPopulateAccessibilityEvent(event);
	}
       
	if (!populated) {
		if (selectedView != null) {
			event.setEnabled(selectedView.isEnabled());
		}
		event.setItemCount(getCount());
		event.setCurrentItemIndex(getSelectedItemPosition());
	}
       
	return populated;
}
 
開發者ID:Shmilyz,項目名稱:Swap,代碼行數:29,代碼來源:PLA_AdapterView.java

示例10: onInitializeAccessibilityEvent

import android.view.accessibility.AccessibilityEvent; //導入方法依賴的package包/類
@Override
public void onInitializeAccessibilityEvent(AccessibilityEvent event) {
    super.onInitializeAccessibilityEvent(event);
    event.setItemCount(mMax);
    event.setCurrentItemIndex(mProgress);
}
 
開發者ID:treasure-lau,項目名稱:CSipSimple,代碼行數:7,代碼來源:IcsProgressBar.java

示例11: onInitializeAccessibilityEvent

import android.view.accessibility.AccessibilityEvent; //導入方法依賴的package包/類
@Override
public void onInitializeAccessibilityEvent(AccessibilityEvent event) {
    super.onInitializeAccessibilityEvent(event);
    event.setCurrentItemIndex((int) (mTargetProgress * 100));
    event.setItemCount(100);
}
 
開發者ID:rkshuai,項目名稱:chromium-for-android-56-debug-video,代碼行數:7,代碼來源:ToolbarProgressBar.java


注:本文中的android.view.accessibility.AccessibilityEvent.setCurrentItemIndex方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。