public class FileList
extends android.widget.ListView
implements android.widget.AdapterView.OnItemClickListener
android.widget.ListView.FixedViewInfo
android.widget.AbsListView.LayoutParams, android.widget.AbsListView.OnScrollListener, android.widget.AbsListView.RecyclerListener
android.widget.AdapterView.AdapterContextMenuInfo, android.widget.AdapterView.OnItemClickListener, android.widget.AdapterView.OnItemLongClickListener, android.widget.AdapterView.OnItemSelectedListener
android.view.ViewGroup.MarginLayoutParams, android.view.ViewGroup.OnHierarchyChangeListener
android.view.View.BaseSavedState, android.view.View.MeasureSpec, android.view.View.OnClickListener, android.view.View.OnCreateContextMenuListener, android.view.View.OnFocusChangeListener, android.view.View.OnKeyListener, android.view.View.OnLongClickListener, android.view.View.OnTouchListener
Modifier and Type | Field and Description |
---|---|
protected com.lf.android.javainfo.view.FileList.FileArrayAdapter |
adapter
The callback object for the list item clicks.
|
protected java.io.File |
currentDir
The directory we are currently showing.
|
protected java.util.Vector<java.beans.PropertyChangeListener> |
listeners
The callback objects listening for selection/directory changes.
|
protected java.io.File |
parentDir
Special file to navigate one directory level up.
|
static java.lang.String |
PROP_DIRECTORY_CHANGED
A value for
PropertyChangeEvent s. |
static java.lang.String |
PROP_SELECTION_CHANGED
A value for
PropertyChangeEvent s. |
CHOICE_MODE_MULTIPLE, CHOICE_MODE_NONE, CHOICE_MODE_SINGLE
TRANSCRIPT_MODE_ALWAYS_SCROLL, TRANSCRIPT_MODE_DISABLED, TRANSCRIPT_MODE_NORMAL
INVALID_POSITION, INVALID_ROW_ID, ITEM_VIEW_TYPE_HEADER_OR_FOOTER, ITEM_VIEW_TYPE_IGNORE
CLIP_TO_PADDING_MASK, FLAG_USE_CHILD_DRAWING_ORDER, FOCUS_AFTER_DESCENDANTS, FOCUS_BEFORE_DESCENDANTS, FOCUS_BLOCK_DESCENDANTS, PERSISTENT_ALL_CACHES, PERSISTENT_ANIMATION_CACHE, PERSISTENT_NO_CACHE, PERSISTENT_SCROLLING_CACHE
DRAWING_CACHE_QUALITY_AUTO, DRAWING_CACHE_QUALITY_HIGH, DRAWING_CACHE_QUALITY_LOW, EMPTY_STATE_SET, ENABLED_FOCUSED_SELECTED_STATE_SET, ENABLED_FOCUSED_SELECTED_WINDOW_FOCUSED_STATE_SET, ENABLED_FOCUSED_STATE_SET, ENABLED_FOCUSED_WINDOW_FOCUSED_STATE_SET, ENABLED_SELECTED_STATE_SET, ENABLED_SELECTED_WINDOW_FOCUSED_STATE_SET, ENABLED_STATE_SET, ENABLED_WINDOW_FOCUSED_STATE_SET, FOCUS_BACKWARD, FOCUS_DOWN, FOCUS_FORWARD, FOCUS_LEFT, FOCUS_RIGHT, FOCUS_UP, FOCUSABLES_ALL, FOCUSABLES_TOUCH_MODE, FOCUSED_SELECTED_STATE_SET, FOCUSED_SELECTED_WINDOW_FOCUSED_STATE_SET, FOCUSED_STATE_SET, FOCUSED_WINDOW_FOCUSED_STATE_SET, GONE, HAPTIC_FEEDBACK_ENABLED, INVISIBLE, KEEP_SCREEN_ON, NO_ID, PRESSED_ENABLED_FOCUSED_SELECTED_STATE_SET, PRESSED_ENABLED_FOCUSED_SELECTED_WINDOW_FOCUSED_STATE_SET, PRESSED_ENABLED_FOCUSED_STATE_SET, PRESSED_ENABLED_FOCUSED_WINDOW_FOCUSED_STATE_SET, PRESSED_ENABLED_SELECTED_STATE_SET, PRESSED_ENABLED_SELECTED_WINDOW_FOCUSED_STATE_SET, PRESSED_ENABLED_STATE_SET, PRESSED_ENABLED_WINDOW_FOCUSED_STATE_SET, PRESSED_FOCUSED_SELECTED_STATE_SET, PRESSED_FOCUSED_SELECTED_WINDOW_FOCUSED_STATE_SET, PRESSED_FOCUSED_STATE_SET, PRESSED_FOCUSED_WINDOW_FOCUSED_STATE_SET, PRESSED_SELECTED_STATE_SET, PRESSED_SELECTED_WINDOW_FOCUSED_STATE_SET, PRESSED_WINDOW_FOCUSED_STATE_SET, SCROLLBARS_INSIDE_INSET, SCROLLBARS_INSIDE_OVERLAY, SCROLLBARS_OUTSIDE_INSET, SCROLLBARS_OUTSIDE_OVERLAY, SELECTED_STATE_SET, SELECTED_WINDOW_FOCUSED_STATE_SET, SOUND_EFFECTS_ENABLED, VIEW_LOG_TAG, VISIBLE, WINDOW_FOCUSED_STATE_SET
Constructor and Description |
---|
FileList(android.content.Context context)
Constructor of this view class.
|
FileList(android.content.Context context,
android.util.AttributeSet attrs)
Constructor of this view class.
|
FileList(android.content.Context context,
android.util.AttributeSet attrs,
int defStyle)
Constructor of this view class.
|
Modifier and Type | Method and Description |
---|---|
void |
addPropertyChangeListener(java.beans.PropertyChangeListener listener)
Adds a new callback object listening for selection/directory changes.
|
static boolean |
equalsNull(java.lang.Object obj1,
java.lang.Object obj2)
Convenience method to compare objects using
equals() which may be null . |
static java.lang.String |
generateShortKB(long value)
Generates the short forms of long numbers like '99 KB' (only kilo bytes).
|
java.io.File |
getDirectory()
Provides the current directory.
|
static java.lang.String |
getDRWX(java.io.File file)
Generates the accessibility string ("drwx") for files and directories.
|
void |
onItemClick(android.widget.AdapterView<?> parent,
android.view.View view,
int position,
long id)
Called when a file list entry is clicked.
|
void |
removePropertyChangeListener(java.beans.PropertyChangeListener listener)
Removes a callback object listening for selection/directory changes.
|
void |
setDirectory(java.io.File dir)
Sets the current directory.
|
static java.io.File[] |
sortFilesWindows(java.io.File[] unsorted,
boolean nameonly)
Sorts the given file/directory list alphabetically in Windows manner.
|
addFooterView, addFooterView, addHeaderView, addHeaderView, canAnimate, clearChoices, dispatchDraw, dispatchKeyEvent, dispatchPopulateAccessibilityEvent, findViewTraversal, findViewWithTagTraversal, getAdapter, getCheckedItemPosition, getCheckedItemPositions, getCheckItemIds, getChoiceMode, getDivider, getDividerHeight, getFooterViewsCount, getHeaderViewsCount, getItemsCanFocus, getMaxScrollAmount, isItemChecked, layoutChildren, onFinishInflate, onFocusChanged, onKeyDown, onKeyMultiple, onKeyUp, onMeasure, onRestoreInstanceState, onSaveInstanceState, onTouchEvent, performItemClick, removeFooterView, removeHeaderView, requestChildRectangleOnScreen, setAdapter, setCacheColorHint, setChoiceMode, setDivider, setDividerHeight, setFooterDividersEnabled, setHeaderDividersEnabled, setItemChecked, setItemsCanFocus, setSelection, setSelectionAfterHeaderView, setSelectionFromTop
addTouchables, afterTextChanged, beforeTextChanged, checkInputConnectionProxy, checkLayoutParams, clearTextFilter, computeVerticalScrollExtent, computeVerticalScrollOffset, computeVerticalScrollRange, dispatchSetPressed, draw, drawableStateChanged, generateLayoutParams, generateLayoutParams, getBottomFadingEdgeStrength, getCacheColorHint, getContextMenuInfo, getFocusedRect, getListPaddingBottom, getListPaddingLeft, getListPaddingRight, getListPaddingTop, getSelectedView, getSelector, getSolidColor, getTextFilter, getTopFadingEdgeStrength, getTranscriptMode, handleDataChanged, hasTextFilter, invalidateViews, isFastScrollEnabled, isInFilterMode, isScrollingCacheEnabled, isSmoothScrollbarEnabled, isStackFromBottom, isTextFilterEnabled, onAttachedToWindow, onCreateDrawableState, onCreateInputConnection, onDetachedFromWindow, onFilterComplete, onGlobalLayout, onInterceptTouchEvent, onLayout, onSizeChanged, onTextChanged, onTouchModeChanged, onWindowFocusChanged, pointToPosition, pointToRowId, reclaimViews, requestLayout, setDrawSelectorOnTop, setFastScrollEnabled, setFilterText, setOnScrollListener, setRecyclerListener, setScrollIndicators, setScrollingCacheEnabled, setSelector, setSelector, setSmoothScrollbarEnabled, setStackFromBottom, setTextFilterEnabled, setTranscriptMode, showContextMenuForChild, verifyDrawable
addView, addView, addView, addView, dispatchRestoreInstanceState, dispatchSaveInstanceState, getCount, getEmptyView, getFirstVisiblePosition, getItemAtPosition, getItemIdAtPosition, getLastVisiblePosition, getOnItemClickListener, getOnItemLongClickListener, getOnItemSelectedListener, getPositionForView, getSelectedItem, getSelectedItemId, getSelectedItemPosition, removeAllViews, removeView, removeViewAt, setEmptyView, setFocusable, setFocusableInTouchMode, setOnClickListener, setOnItemClickListener, setOnItemLongClickListener, setOnItemSelectedListener
addFocusables, addFocusables, addStatesFromChildren, addView, addViewInLayout, addViewInLayout, attachLayoutAnimationParameters, attachViewToParent, bringChildToFront, childDrawableStateChanged, cleanupLayoutState, clearChildFocus, clearDisappearingChildren, clearFocus, debug, detachAllViewsFromParent, detachViewFromParent, detachViewFromParent, detachViewsFromParent, dispatchFreezeSelfOnly, dispatchKeyEventPreIme, dispatchKeyShortcutEvent, dispatchSetSelected, dispatchThawSelfOnly, dispatchTouchEvent, dispatchTrackballEvent, dispatchUnhandledMove, dispatchWindowFocusChanged, dispatchWindowVisibilityChanged, drawChild, findFocus, fitSystemWindows, focusableViewAvailable, focusSearch, gatherTransparentRegion, generateDefaultLayoutParams, getChildAt, getChildCount, getChildDrawingOrder, getChildMeasureSpec, getChildStaticTransformation, getChildVisibleRect, getDescendantFocusability, getFocusedChild, getLayoutAnimation, getLayoutAnimationListener, getPersistentDrawingCache, hasFocus, hasFocusable, indexOfChild, invalidateChild, invalidateChildInParent, isAlwaysDrawnWithCacheEnabled, isAnimationCacheEnabled, isChildrenDrawnWithCacheEnabled, measureChild, measureChildren, measureChildWithMargins, offsetDescendantRectToMyCoords, offsetRectIntoDescendantCoords, onAnimationEnd, onAnimationStart, onRequestFocusInDescendants, recomputeViewAttributes, removeAllViewsInLayout, removeDetachedView, removeViewInLayout, removeViews, removeViewsInLayout, requestChildFocus, requestDisallowInterceptTouchEvent, requestFocus, requestTransparentRegion, scheduleLayoutAnimation, setAddStatesFromChildren, setAlwaysDrawnWithCacheEnabled, setAnimationCacheEnabled, setChildrenDrawingCacheEnabled, setChildrenDrawnWithCacheEnabled, setClipChildren, setClipToPadding, setDescendantFocusability, setLayoutAnimation, setLayoutAnimationListener, setOnHierarchyChangeListener, setPadding, setPersistentDrawingCache, setStaticTransformationsEnabled, startLayoutAnimation, updateViewLayout
bringToFront, buildDrawingCache, buildDrawingCache, cancelLongPress, clearAnimation, computeHorizontalScrollExtent, computeHorizontalScrollOffset, computeHorizontalScrollRange, computeScroll, createContextMenu, destroyDrawingCache, finalize, findViewById, findViewWithTag, focusSearch, forceLayout, getAnimation, getApplicationWindowToken, getBackground, getBaseline, getBottom, getBottomPaddingOffset, getContentDescription, getContext, getDefaultSize, getDrawableState, getDrawingCache, getDrawingCache, getDrawingCacheBackgroundColor, getDrawingCacheQuality, getDrawingRect, getDrawingTime, getFocusables, getGlobalVisibleRect, getGlobalVisibleRect, getHandler, getHeight, getHitRect, getHorizontalFadingEdgeLength, getHorizontalScrollbarHeight, getId, getKeepScreenOn, getLayoutParams, getLeft, getLeftFadingEdgeStrength, getLeftPaddingOffset, getLocalVisibleRect, getLocationInWindow, getLocationOnScreen, getMeasuredHeight, getMeasuredWidth, getNextFocusDownId, getNextFocusLeftId, getNextFocusRightId, getNextFocusUpId, getOnFocusChangeListener, getPaddingBottom, getPaddingLeft, getPaddingRight, getPaddingTop, getParent, getResources, getRight, getRightFadingEdgeStrength, getRightPaddingOffset, getRootView, getScrollBarStyle, getScrollX, getScrollY, getSuggestedMinimumHeight, getSuggestedMinimumWidth, getTag, getTag, getTop, getTopPaddingOffset, getTouchables, getTouchDelegate, getVerticalFadingEdgeLength, getVerticalScrollbarWidth, getViewTreeObserver, getVisibility, getWidth, getWindowAttachCount, getWindowToken, getWindowVisibility, getWindowVisibleDisplayFrame, hasWindowFocus, inflate, initializeFadingEdge, initializeScrollbars, invalidate, invalidate, invalidate, invalidateDrawable, isClickable, isDrawingCacheEnabled, isDuplicateParentStateEnabled, isEnabled, isFocusable, isFocusableInTouchMode, isFocused, isHapticFeedbackEnabled, isHorizontalFadingEdgeEnabled, isHorizontalScrollBarEnabled, isInEditMode, isInTouchMode, isLayoutRequested, isLongClickable, isPaddingOffsetRequired, isPressed, isSaveEnabled, isSelected, isShown, isSoundEffectsEnabled, isVerticalFadingEdgeEnabled, isVerticalScrollBarEnabled, layout, measure, mergeDrawableStates, offsetLeftAndRight, offsetTopAndBottom, onCheckIsTextEditor, onCreateContextMenu, onDraw, onFinishTemporaryDetach, onKeyPreIme, onKeyShortcut, onScrollChanged, onSetAlpha, onStartTemporaryDetach, onTrackballEvent, onWindowVisibilityChanged, performClick, performHapticFeedback, performHapticFeedback, performLongClick, playSoundEffect, post, postDelayed, postInvalidate, postInvalidate, postInvalidateDelayed, postInvalidateDelayed, refreshDrawableState, removeCallbacks, requestFocus, requestFocus, requestFocusFromTouch, requestRectangleOnScreen, requestRectangleOnScreen, resolveSize, restoreHierarchyState, saveHierarchyState, scheduleDrawable, scrollBy, scrollTo, sendAccessibilityEvent, sendAccessibilityEventUnchecked, setAnimation, setBackgroundColor, setBackgroundDrawable, setBackgroundResource, setClickable, setContentDescription, setDrawingCacheBackgroundColor, setDrawingCacheEnabled, setDrawingCacheQuality, setDuplicateParentStateEnabled, setEnabled, setFadingEdgeLength, setHapticFeedbackEnabled, setHorizontalFadingEdgeEnabled, setHorizontalScrollBarEnabled, setId, setKeepScreenOn, setLayoutParams, setLongClickable, setMeasuredDimension, setMinimumHeight, setMinimumWidth, setNextFocusDownId, setNextFocusLeftId, setNextFocusRightId, setNextFocusUpId, setOnCreateContextMenuListener, setOnFocusChangeListener, setOnKeyListener, setOnLongClickListener, setOnTouchListener, setPressed, setSaveEnabled, setScrollBarStyle, setScrollContainer, setSelected, setSoundEffectsEnabled, setTag, setTag, setTouchDelegate, setVerticalFadingEdgeEnabled, setVerticalScrollBarEnabled, setVisibility, setWillNotCacheDrawing, setWillNotDraw, showContextMenu, startAnimation, unscheduleDrawable, unscheduleDrawable, willNotCacheDrawing, willNotDraw
public static final java.lang.String PROP_DIRECTORY_CHANGED
PropertyChangeEvent
s.public static final java.lang.String PROP_SELECTION_CHANGED
PropertyChangeEvent
s.protected java.io.File currentDir
protected com.lf.android.javainfo.view.FileList.FileArrayAdapter adapter
protected java.io.File parentDir
protected java.util.Vector<java.beans.PropertyChangeListener> listeners
public FileList(android.content.Context context)
context
- The contextpublic FileList(android.content.Context context, android.util.AttributeSet attrs)
context
- The contextattrs
- The attributespublic FileList(android.content.Context context, android.util.AttributeSet attrs, int defStyle)
context
- The contextattrs
- The attributesdefStyle
- The definition stylepublic void setDirectory(java.io.File dir)
dir
- The directorypublic java.io.File getDirectory()
public void addPropertyChangeListener(java.beans.PropertyChangeListener listener)
listener
- The callback objectjava.lang.NullPointerException
- If a parameter is null
public void removePropertyChangeListener(java.beans.PropertyChangeListener listener)
listener
- The callback objectjava.lang.NullPointerException
- If a parameter is null
public static java.io.File[] sortFilesWindows(java.io.File[] unsorted, boolean nameonly)
sortFiles()
.
Normally (nameonly = false
) the files are considered be childs of ony directory
and therefore have the same absolute path. If you like to sort lists with entries from
different directories then it might be useful to have them sorted only by their short name
(nameonly = true
).
unsorted
- The files to be sortednameonly
- Sort only by file name instead of whole path?public void onItemClick(android.widget.AdapterView<?> parent, android.view.View view, int position, long id)
onItemClick
in interface android.widget.AdapterView.OnItemClickListener
parent
- The listview
- The viewposition
- The positionid
- The IDpublic static java.lang.String getDRWX(java.io.File file)
file
- The file to be checkedpublic static java.lang.String generateShortKB(long value)
value
- Numeric value to be shortenednull
if error occurspublic static boolean equalsNull(java.lang.Object obj1, java.lang.Object obj2)
equals()
which may be null
.
Returns true
only if the objects are equal or both null
.
obj1
- First object to be comparedobj2
- Second object to be comparedCopyright © 2005-2013 Leisenfels UG (haftungsbeschränkt). All rights reserved.