Java Code Examples for com.lidroid.xutils.util.LogUtils#d()

The following examples show how to use com.lidroid.xutils.util.LogUtils#d() . 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: BitmapCache.java    From android-open-project-demo with Apache License 2.0 6 votes vote down vote up
/**
 * Initializes the disk cache.  Note that this includes disk access so this should not be
 * executed on the main/UI thread. By default an ImageCache does not initialize the disk
 * cache when it is created, instead you should call initDiskCache() to initialize it on a
 * background thread.
 */
public void initDiskCache() {
    // Set up disk cache
    synchronized (mDiskCacheLock) {
        if (globalConfig.isDiskCacheEnabled() && (mDiskLruCache == null || mDiskLruCache.isClosed())) {
            File diskCacheDir = new File(globalConfig.getDiskCachePath());
            if (diskCacheDir.exists() || diskCacheDir.mkdirs()) {
                long availableSpace = OtherUtils.getAvailableSpace(diskCacheDir);
                long diskCacheSize = globalConfig.getDiskCacheSize();
                diskCacheSize = availableSpace > diskCacheSize ? diskCacheSize : availableSpace;
                try {
                    mDiskLruCache = LruDiskCache.open(diskCacheDir, 1, 1, diskCacheSize);
                    mDiskLruCache.setFileNameGenerator(globalConfig.getFileNameGenerator());
                    LogUtils.d("create disk cache success");
                } catch (Throwable e) {
                    mDiskLruCache = null;
                    LogUtils.e("create disk cache error", e);
                }
            }
        }
    }
}
 
Example 2
Source File: ColumnUtils.java    From android-open-project-demo with Apache License 2.0 6 votes vote down vote up
public static Method getColumnGetMethod(Class<?> entityType, Field field) {
    String fieldName = field.getName();
    Method getMethod = null;
    if (field.getType() == boolean.class) {
        getMethod = getBooleanColumnGetMethod(entityType, fieldName);
    }
    if (getMethod == null) {
        String methodName = "get" + fieldName.substring(0, 1).toUpperCase() + fieldName.substring(1);
        try {
            getMethod = entityType.getDeclaredMethod(methodName);
        } catch (NoSuchMethodException e) {
            LogUtils.d(methodName + " not exist");
        }
    }

    if (getMethod == null && !Object.class.equals(entityType.getSuperclass())) {
        return getColumnGetMethod(entityType.getSuperclass(), field);
    }
    return getMethod;
}
 
Example 3
Source File: ColumnUtils.java    From android-open-project-demo with Apache License 2.0 6 votes vote down vote up
public static Method getColumnSetMethod(Class<?> entityType, Field field) {
    String fieldName = field.getName();
    Method setMethod = null;
    if (field.getType() == boolean.class) {
        setMethod = getBooleanColumnSetMethod(entityType, field);
    }
    if (setMethod == null) {
        String methodName = "set" + fieldName.substring(0, 1).toUpperCase() + fieldName.substring(1);
        try {
            setMethod = entityType.getDeclaredMethod(methodName, field.getType());
        } catch (NoSuchMethodException e) {
            LogUtils.d(methodName + " not exist");
        }
    }

    if (setMethod == null && !Object.class.equals(entityType.getSuperclass())) {
        return getColumnSetMethod(entityType.getSuperclass(), field);
    }
    return setMethod;
}
 
Example 4
Source File: ColumnUtils.java    From android-open-project-demo with Apache License 2.0 5 votes vote down vote up
private static Method getBooleanColumnGetMethod(Class<?> entityType, final String fieldName) {
    String methodName = "is" + fieldName.substring(0, 1).toUpperCase() + fieldName.substring(1);
    if (isStartWithIs(fieldName)) {
        methodName = fieldName;
    }
    try {
        return entityType.getDeclaredMethod(methodName);
    } catch (NoSuchMethodException e) {
        LogUtils.d(methodName + " not exist");
    }
    return null;
}
 
Example 5
Source File: ColumnUtils.java    From android-open-project-demo with Apache License 2.0 5 votes vote down vote up
private static Method getBooleanColumnSetMethod(Class<?> entityType, Field field) {
    String fieldName = field.getName();
    String methodName = null;
    if (isStartWithIs(field.getName())) {
        methodName = "set" + fieldName.substring(2, 3).toUpperCase() + fieldName.substring(3);
    } else {
        methodName = "set" + fieldName.substring(0, 1).toUpperCase() + fieldName.substring(1);
    }
    try {
        return entityType.getDeclaredMethod(methodName, field.getType());
    } catch (NoSuchMethodException e) {
        LogUtils.d(methodName + " not exist");
    }
    return null;
}
 
Example 6
Source File: PriorityAsyncTask.java    From android-open-project-demo with Apache License 2.0 5 votes vote down vote up
/**
 * Creates a new asynchronous task. This constructor must be invoked on the UI thread.
 */
public PriorityAsyncTask() {
	//这一块为什么不直接使用Runnable, 我的见解是这种使用能获取返回值
    mWorker = new WorkerRunnable<Params, Result>() {  
        public Result call() throws Exception { //在子线程中运行
            mTaskInvoked.set(true);

            android.os.Process.setThreadPriority(android.os.Process.THREAD_PRIORITY_BACKGROUND);
            //noinspection unchecked
            return postResult(doInBackground(mParams));
        }
    };

    mFuture = new FutureTask<Result>(mWorker) { //
        @Override
        protected void done() {  
            try {
                postResultIfNotInvoked(get());
            } catch (InterruptedException e) {
                LogUtils.d(e.getMessage());
            } catch (ExecutionException e) {
                throw new RuntimeException("An error occured while executing doInBackground()",
                        e.getCause());
            } catch (CancellationException e) {
                postResultIfNotInvoked(null);
            }
        }
    };
}
 
Example 7
Source File: DbUtils.java    From android-open-project-demo with Apache License 2.0 4 votes vote down vote up
private void debugSql(String sql) {
    if (debug) {
        LogUtils.d(sql);
    }
}