本文整理汇总了Java中group.pals.android.lib.ui.filechooser.utils.Utils.doLog方法的典型用法代码示例。如果您正苦于以下问题:Java Utils.doLog方法的具体用法?Java Utils.doLog怎么用?Java Utils.doLog使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类group.pals.android.lib.ui.filechooser.utils.Utils
的用法示例。
在下文中一共展示了Utils.doLog方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onTouch
import group.pals.android.lib.ui.filechooser.utils.Utils; //导入方法依赖的package包/类
@Override
public boolean onTouch(View v, MotionEvent event) {
if (Utils.doLog())
Log.d(CLASSNAME,
"mImageIconOnTouchListener.onTouch() >> ACTION = "
+ event.getAction());
switch (event.getAction()) {
case MotionEvent.ACTION_DOWN:
v.setBackgroundResource(R.drawable.afc_image_button_dark_pressed);
break;
case MotionEvent.ACTION_UP:
case MotionEvent.ACTION_CANCEL:
v.setBackgroundResource(0);
break;
}
return false;
}
示例2: onKeyDown
import group.pals.android.lib.ui.filechooser.utils.Utils; //导入方法依赖的package包/类
@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
if (Utils.doLog())
Log.d(CLASSNAME, String.format("onKeyDown() >> %,d", keyCode));
if (keyCode == KeyEvent.KEYCODE_BACK) {
/*
* Use this hook instead of onBackPressed(), because onBackPressed()
* is not available in API 4.
*/
if (mFragmentFiles.isLoading()) {
if (Utils.doLog())
Log.d(CLASSNAME,
"onKeyDown() >> KEYCODE_BACK >> cancelling previous query...");
mFragmentFiles.cancelPreviousLoader();
Dlg.toast(this, R.string.afc_msg_cancelled, Dlg.LENGTH_SHORT);
return true;
}
}
return super.onKeyDown(keyCode, event);
}
示例3: FileObserverEx
import group.pals.android.lib.ui.filechooser.utils.Utils; //导入方法依赖的package包/类
/**
* Creates new instance.
*
* @param context
* the context.
* @param path
* the path to the directory that you want to watch for changes.
*/
public FileObserverEx(final Context context, final String path,
final Uri notificationUri) {
super(path, FILE_OBSERVER_MASK);
mHandlerThread.start();
mHandler = new Handler(mHandlerThread.getLooper()) {
@Override
public void handleMessage(Message msg) {
if (Utils.doLog())
Log.d(CLASSNAME,
String.format(
"mHandler.handleMessage() >> path = '%s' | what = %,d",
path, msg.what));
switch (msg.what) {
case MSG_NOTIFY_CHANGES:
context.getContentResolver().notifyChange(notificationUri,
null);
mLastEventTime = SystemClock.elapsedRealtime();
break;
}
}// handleMessage()
};
}
示例4: onEvent
import group.pals.android.lib.ui.filechooser.utils.Utils; //导入方法依赖的package包/类
@Override
public void onEvent(int event, String path) {
/*
* Some bugs of Android...
*/
if (!mWatching || event == FILE_OBSERVER_UNKNOWN_EVENT || path == null
|| mHandler.hasMessages(MSG_NOTIFY_CHANGES)
|| !mHandlerThread.isAlive() || mHandlerThread.isInterrupted())
return;
try {
if (SystemClock.elapsedRealtime() - mLastEventTime <= MIN_TIME_BETWEEN_EVENTS)
mHandler.sendEmptyMessageDelayed(
MSG_NOTIFY_CHANGES,
Math.max(
1,
MIN_TIME_BETWEEN_EVENTS
- (SystemClock.elapsedRealtime() - mLastEventTime)));
else
mHandler.sendEmptyMessage(MSG_NOTIFY_CHANGES);
} catch (Throwable t) {
mWatching = false;
if (Utils.doLog())
Log.e(CLASSNAME, "onEvent() >> " + t);
}
}
示例5: afterTextChanged
import group.pals.android.lib.ui.filechooser.utils.Utils; //导入方法依赖的package包/类
@Override
public void afterTextChanged(Editable s) {
if (Utils.doLog())
Log.d(CLASSNAME,
"afterTextChanged() >>> delayTimeSubmission = "
+ getDelayTimeSubmission());
if (TextUtils.isEmpty(mTextSearch.getText())) {
if (!isClosable())
mButtonClear.setVisibility(GONE);
} else
mButtonClear.setVisibility(VISIBLE);
if (getDelayTimeSubmission() > 0)
mAutoSubmissionHandler.postDelayed(mAutoSubmissionRunnable,
getDelayTimeSubmission());
}
示例6: getFileEntryCached
import group.pals.android.lib.ui.filechooser.utils.Utils; //导入方法依赖的package包/类
private FileEntry getFileEntryCached(String filename) {
//check if enry is cached:
FileEntry cachedEntry = fileEntryMap.get(filename);
if (cachedEntry != null)
{
if (Utils.doLog())
Log.d(CLASSNAME, "getFileEntryCached: from cache. " + filename);
return cachedEntry;
}
if (Utils.doLog())
Log.d(CLASSNAME, "getFileEntryCached: not in cache :-( " + filename);
FileEntry newEntry ;
try {
//it's not -> query the information.
newEntry = getFileEntry(filename, null);
} catch (Exception e) {
e.printStackTrace();
return null;
}
if (!cacheBlockedFiles.contains(filename))
updateFileEntryCache(newEntry);
return newEntry;
}
示例7: query
import group.pals.android.lib.ui.filechooser.utils.Utils; //导入方法依赖的package包/类
@Override
public Cursor query(Uri uri, String[] projection, String selection,
String[] selectionArgs, String sortOrder) {
if (Utils.doLog())
Log.d(CLASSNAME, String.format(
"query() >> uri = %s (%s) >> match = %s", uri,
uri.getLastPathSegment(), URI_MATCHER.match(uri)));
switch (URI_MATCHER.match(uri)) {
case URI_API: {
/*
* If there is no command given, return provider ID and name.
*/
MatrixCursor matrixCursor = new MatrixCursor(new String[] {
BaseFile.COLUMN_PROVIDER_ID, BaseFile.COLUMN_PROVIDER_NAME,
BaseFile.COLUMN_PROVIDER_ICON_ATTR });
matrixCursor.newRow().add(LocalFileContract._ID)
.add(getContext().getString(R.string.afc_phone))
.add(R.attr.afc_badge_file_provider_localfile);
return matrixCursor;
}
case URI_API_COMMAND: {
return doAnswerApiCommand(uri);
}// URI_API
case URI_DIRECTORY: {
return doListFiles(uri);
}// URI_DIRECTORY
case URI_FILE: {
return doRetrieveFileInfo(uri);
}// URI_FILE
default:
throw new IllegalArgumentException("UNKNOWN URI " + uri);
}
}
示例8: doCheckAncestor
import group.pals.android.lib.ui.filechooser.utils.Utils; //导入方法依赖的package包/类
/**
* Checks ancestor with {@link BaseFile#CMD_IS_ANCESTOR_OF},
* {@link BaseFile#PARAM_SOURCE} and {@link BaseFile#PARAM_TARGET}.
*
* @param uri
* the original URI from client.
* @return {@code null} if source is not ancestor of target; or a
* <i>non-null but empty</i> cursor if the source is.
*/
private MatrixCursor doCheckAncestor(Uri uri) {
String source = Uri.parse(
uri.getQueryParameter(BaseFile.PARAM_SOURCE)).toString();
String target = Uri.parse(
uri.getQueryParameter(BaseFile.PARAM_TARGET)).toString();
if (source == null || target == null)
return null;
boolean validate = ProviderUtils.getBooleanQueryParam(uri,
BaseFile.PARAM_VALIDATE, true);
if (validate) {
//not supported
}
if (!source.endsWith("/"))
source += "/";
String targetParent = getParentPath(target);
if (targetParent != null && targetParent.startsWith(source))
{
if (Utils.doLog())
Log.d("KP2A_FC_P", source+" is parent of "+target);
return BaseFileProviderUtils.newClosedCursor();
}
if (Utils.doLog())
Log.d("KP2A_FC_P", source+" is no parent of "+target);
return null;
}
示例9: extractFile
import group.pals.android.lib.ui.filechooser.utils.Utils; //导入方法依赖的package包/类
/**
* Extracts source file from request URI.
*
* @param uri
* the original URI.
* @return the filename.
*/
private static String extractFile(Uri uri) {
String fileName = Uri.parse(uri.getLastPathSegment()).toString();
if (uri.getQueryParameter(BaseFile.PARAM_APPEND_PATH) != null)
fileName += Uri.parse(
uri.getQueryParameter(BaseFile.PARAM_APPEND_PATH)).toString();
if (uri.getQueryParameter(BaseFile.PARAM_APPEND_NAME) != null)
fileName += "/" + uri.getQueryParameter(BaseFile.PARAM_APPEND_NAME);
if (Utils.doLog())
Log.d(CLASSNAME, "extractFile() >> " + fileName);
return fileName;
}
示例10: startWatching
import group.pals.android.lib.ui.filechooser.utils.Utils; //导入方法依赖的package包/类
@Override
public void startWatching() {
super.startWatching();
if (Utils.doLog())
Log.d(CLASSNAME, String.format("startWatching() >> %s", hashCode()));
mWatching = true;
}
示例11: stopWatching
import group.pals.android.lib.ui.filechooser.utils.Utils; //导入方法依赖的package包/类
@Override
public void stopWatching() {
super.stopWatching();
if (Utils.doLog())
Log.d(CLASSNAME, String.format("stopWatching() >> %s", hashCode()));
mWatching = false;
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ECLAIR)
HandlerThreadCompat_v5.quit(mHandlerThread);
mHandlerThread.interrupt();
}
示例12: beforeTextChanged
import group.pals.android.lib.ui.filechooser.utils.Utils; //导入方法依赖的package包/类
@Override
public void beforeTextChanged(CharSequence s, int start, int count,
int after) {
if (Utils.doLog())
Log.d(CLASSNAME, "beforeTextChanged()");
mAutoSubmissionHandler.removeCallbacksAndMessages(null);
}
示例13: query
import group.pals.android.lib.ui.filechooser.utils.Utils; //导入方法依赖的package包/类
@Override
public Cursor query(Uri uri, String[] projection, String selection,
String[] selectionArgs, String sortOrder) {
if (Utils.doLog())
Log.d("KP2A_FC_P", String.format(
"query() >> uri = %s (%s) >> match = %s", uri,
uri.getLastPathSegment(), URI_MATCHER.match(uri)));
switch (URI_MATCHER.match(uri)) {
case URI_API: {
/*
* If there is no command given, return provider ID and name.
*/
MatrixCursor matrixCursor = new MatrixCursor(new String[] {
BaseFile.COLUMN_PROVIDER_ID, BaseFile.COLUMN_PROVIDER_NAME,
BaseFile.COLUMN_PROVIDER_ICON_ATTR });
matrixCursor.newRow().add(_ID)
.add("KP2A")
.add(R.attr.afc_badge_file_provider_localfile);
return matrixCursor;
}
case URI_API_COMMAND: {
return doAnswerApiCommand(uri);
}// URI_API
case URI_DIRECTORY: {
return doListFiles(uri);
}// URI_DIRECTORY
case URI_FILE: {
return doRetrieveFileInfo(uri);
}// URI_FILE
default:
throw new IllegalArgumentException("UNKNOWN URI " + uri);
}
}
示例14: delete
import group.pals.android.lib.ui.filechooser.utils.Utils; //导入方法依赖的package包/类
@Override
public int delete(Uri uri, String selection, String[] selectionArgs) {
if (Utils.doLog())
Log.d(CLASSNAME, "delete() >> " + uri);
int count = 0;
switch (URI_MATCHER.match(uri)) {
case URI_FILE: {
int taskId = ProviderUtils.getIntQueryParam(uri,
BaseFile.PARAM_TASK_ID, 0);
boolean isRecursive = ProviderUtils.getBooleanQueryParam(uri,
BaseFile.PARAM_RECURSIVE, true);
File file = extractFile(uri);
if (file.canWrite()) {
File parentFile = file.getParentFile();
if (file.isFile() || !isRecursive) {
if (file.delete())
count = 1;
} else {
mMapInterruption.put(taskId, false);
count = deleteFile(taskId, file, isRecursive);
if (mMapInterruption.get(taskId))
if (Utils.doLog())
Log.d(CLASSNAME, "delete() >> cancelled...");
mMapInterruption.delete(taskId);
}
if (count > 0) {
getContext()
.getContentResolver()
.notifyChange(
BaseFile.genContentUriBase(
LocalFileContract
.getAuthority(getContext()))
.buildUpon()
.appendPath(
Uri.fromFile(parentFile)
.toString())
.build(), null);
}
}
break;// URI_FILE
}
default:
throw new IllegalArgumentException("UNKNOWN URI " + uri);
}
if (Utils.doLog())
Log.d(CLASSNAME, "delete() >> count = " + count);
if (count > 0)
getContext().getContentResolver().notifyChange(uri, null);
return count;
}
示例15: sortFiles
import group.pals.android.lib.ui.filechooser.utils.Utils; //导入方法依赖的package包/类
/**
* Sorts {@code files}.
*
* @param taskId
* the task ID.
* @param files
* list of files.
* @param ascending
* {@code true} or {@code false}.
* @param sortBy
* can be one of {@link BaseFile.#_SortByModificationTime},
* {@link BaseFile.#_SortByName}, {@link BaseFile.#_SortBySize}.
*/
private void sortFiles(final int taskId, final List<File> files,
final boolean ascending, final int sortBy) {
try {
Collections.sort(files, new Comparator<File>() {
@Override
public int compare(File lhs, File rhs) {
if (mMapInterruption.get(taskId))
throw new CancellationException();
if (lhs.isDirectory() && !rhs.isDirectory())
return -1;
if (!lhs.isDirectory() && rhs.isDirectory())
return 1;
/*
* Default is to compare by name (case insensitive).
*/
int res = mCollator.compare(lhs.getName(), rhs.getName());
switch (sortBy) {
case BaseFile.SORT_BY_NAME:
break;// SortByName
case BaseFile.SORT_BY_SIZE:
if (lhs.length() > rhs.length())
res = 1;
else if (lhs.length() < rhs.length())
res = -1;
break;// SortBySize
case BaseFile.SORT_BY_MODIFICATION_TIME:
if (lhs.lastModified() > rhs.lastModified())
res = 1;
else if (lhs.lastModified() < rhs.lastModified())
res = -1;
break;// SortByDate
}
return ascending ? res : -res;
}// compare()
});
} catch (CancellationException e) {
if (Utils.doLog())
Log.d(CLASSNAME, "sortFiles() >> cancelled...");
}
}