Java 类android.util.Config 实例源码

项目:Slide-RSS    文件:OnSingleClickListener.java   
@Override
public final void onClick(View v) {
    final long lastClickTime = mLastClickTime;
    final long now = SystemClock.uptimeMillis(); //guaranteed 100% monotonic

    if (now - lastClickTime < MIN_DELAY_MS && !override) {
        // Too fast: ignore
        if (Config.LOGD) {
            Log.d(TAG, "onClick Clicked too quickly: ignored");
        }
    } else {
        override = false;
        // Update mLastClickTime and register the click
        mLastClickTime = now;
        onSingleClick(v);
    }
}
项目:mobile-manager-tool    文件:Helpers.java   
/**
    * Checks whether this looks like a legitimate selection parameter
    */
   public static void validateSelection(String selection,
    Set<String> allowedColumns) {
try {
    if (selection == null || selection.length() == 0) {
    return;
    }
    Lexer lexer = new Lexer(selection, allowedColumns);
    parseExpression(lexer);
    if (lexer.currentToken() != Lexer.TOKEN_END) {
    throw new IllegalArgumentException("syntax error");
    }
} catch (RuntimeException ex) {
    if (Constants.LOGV) {
    Log.d(Constants.TAG, "invalid selection [" + selection
        + "] triggered " + ex);
    } else if (Config.LOGD) {
    Log.d(Constants.TAG, "invalid selection triggered " + ex);
    }
    throw ex;
}

   }
项目:Slide    文件:OnSingleClickListener.java   
@Override
public final void onClick(View v) {
    final long lastClickTime = mLastClickTime;
    final long now = SystemClock.uptimeMillis(); //guaranteed 100% monotonic

    if (now - lastClickTime < MIN_DELAY_MS && !override) {
        // Too fast: ignore
        if (Config.LOGD) {
            Log.d(TAG, "onClick Clicked too quickly: ignored");
        }
    } else {
        override = false;
        // Update mLastClickTime and register the click
        mLastClickTime = now;
        onSingleClick(v);
    }
}
项目:greendao-cipher    文件:AbstractCursor.java   
public int getColumnIndex(String columnName) {
    // Hack according to bug 903852
    final int periodIndex = columnName.lastIndexOf('.');
    if (periodIndex != -1) {
        Exception e = new Exception();
        Log.e(TAG, "requesting column name with table name -- " + columnName, e);
        columnName = columnName.substring(periodIndex + 1);
    }

    String columnNames[] = getColumnNames();
    int length = columnNames.length;
    for (int i = 0; i < length; i++) {
        if (columnNames[i].equalsIgnoreCase(columnName)) {
            return i;
        }
    }

    if (Config.LOGV) {
        if (getCount() > 0) {
            Log.w("AbstractCursor", "Unknown column " + columnName);
        }
    }
    return -1;
}
项目:greendao-cipher    文件:SQLiteCursor.java   
/**
 * Release the native resources, if they haven't been released yet.
 */
@Override
protected void finalize() {
    try {
        // if the cursor hasn't been closed yet, close it first
        if (mWindow != null) {
            int len = mQuery.mSql.length();
            Log.e(TAG, "Finalizing a Cursor that has not been deactivated or closed. " +
                    "database = " + mDatabase.getPath() + ", table = " + mEditTable +
                    ", query = " + mQuery.mSql.substring(0, (len > 100) ? 100 : len),
                    mStackTrace);
            close();
            SQLiteDebug.notifyActiveCursorFinalized();
        } else {
            if (Config.LOGV) {
                Log.v(TAG, "Finalizing cursor on database = " + mDatabase.getPath() +
                        ", table = " + mEditTable + ", query = " + mQuery.mSql);
            }
        }
    } finally {
        super.finalize();
    }
}
项目:wmc    文件:Helpers.java   
/**
 * Checks whether this looks like a legitimate selection parameter
 */
public static void validateSelection(String selection, Set<String> allowedColumns) {
    try {
        if (selection == null || selection.contentEquals("")) {
            return;
        }
        Lexer lexer = new Lexer(selection, allowedColumns);
        parseExpression(lexer);
        if (lexer.currentToken() != Lexer.TOKEN_END) {
            throw new IllegalArgumentException("syntax error");
        }
    } catch (RuntimeException ex) {
        if (Constants.LOGV) {
            Log.d(Constants.TAG, "invalid selection [" + selection + "] triggered " + ex);
        } else if (Config.LOGD) {
            Log.d(Constants.TAG, "invalid selection triggered " + ex);
        }
        throw ex;
    }

}
项目:NBAPlus    文件:DBHelper.java   
private DBHelper(Context context) {
    DaoMaster.DevOpenHelper helper = new DaoMaster.DevOpenHelper(context, DB_NAME, null);
    db = helper.getWritableDatabase();
    // 注意:该数据库连接属于 DaoMaster,所以多个 Session 指的是相同的数据库连接。
    DaoMaster daoMaster = new DaoMaster(db);
    daoSession = daoMaster.newSession();
    if(Config.DEBUG) {
        QueryBuilder.LOG_SQL = true;
        QueryBuilder.LOG_VALUES = true;
    }
}
项目:android-openvpn-settings    文件:OpenVpnStateListenerDispatcher.java   
public void binderDied()
{
    if (Config.LOGD) Log.d( TAG, "OpenVpnStateListener died" );

    synchronized (mListeners)
    {
        mListeners.remove( this );
    }
    if (mListener != null)
    {
        mListener.asBinder().unlinkToDeath( this, 0 );
    }
}
项目:FullRobolectricTestSample    文件:ShadowCursorAdapter.java   
/**
 * Called when the {@link ContentObserver} on the cursor receives a change notification.
 * The default implementation provides the auto-requery logic, but may be overridden by
 * sub classes.
 *
 * @see ContentObserver#onChange(boolean)
 */
// renamed from Android source so as not to conflict with RobolectricWiringTest
protected void onContentChangedInternal() {
  if (mAutoRequery && mCursor != null && !mCursor.isClosed()) {
    if (Config.LOGV) Log.v("Cursor", "Auto requerying " + mCursor + " due to update");
    mDataValid = mCursor.requery();
  }
}
项目:greendao-cipher    文件:SQLiteCursor.java   
/**
 * Execute a query and provide access to its result set through a Cursor
 * interface. For a query such as: {@code SELECT name, birth, phone FROM
 * myTable WHERE ... LIMIT 1,20 ORDER BY...} the column names (name, birth,
 * phone) would be in the projection argument and everything from
 * {@code FROM} onward would be in the params argument. This constructor
 * has package scope.
 *
 * @param db a reference to a Database object that is already constructed
 *     and opened
 * @param editTable the name of the table used for this query
 * @param query the rest of the query terms
 *     cursor is finalized
 */
public SQLiteCursor(SQLiteDatabase db, SQLiteCursorDriver driver,
        String editTable, SQLiteQuery query) {
    // The AbstractCursor constructor needs to do some setup.
    super();
    mStackTrace = new DatabaseObjectNotClosedException().fillInStackTrace();
    mDatabase = db;
    mDriver = driver;
    mEditTable = editTable;
    mColumnNameMap = null;
    mQuery = query;

    try {
        db.lock();

        // Setup the list of columns
        int columnCount = mQuery.columnCountLocked();
        mColumns = new String[columnCount];

        // Read in all column names
        for (int i = 0; i < columnCount; i++) {
            String columnName = mQuery.columnNameLocked(i);
            mColumns[i] = columnName;
            if (Config.LOGV) {
                Log.v("DatabaseWindow", "mColumns[" + i + "] is "
                        + mColumns[i]);
            }

            // Make note of the row ID column index for quick access to it
            if ("_id".equals(columnName)) {
                mRowIdColumnIndex = i;
            }
        }
    } finally {
        db.unlock();
    }
}
项目:greendao-cipher    文件:SQLiteCursor.java   
private void deactivateCommon() {
    if (Config.LOGV) Log.v(TAG, "<<< Releasing cursor " + this);
    mCursorState = 0;
    if (mWindow != null) {
        mWindow.close();
        mWindow = null;
    }
    if (Config.LOGV) Log.v("DatabaseWindow", "closing window in release()");
}
项目:KitchenTimer    文件:Log.java   
public static void v(String TAG, String logMe) {
    if (Config.LOGV) android.util.Log.v(LOGTAG, TAG + ": " + logMe);
}
项目:KitchenTimer    文件:Log.java   
public static void d(String TAG, String logMe) {
    if (Config.LOGD) android.util.Log.d(LOGTAG, TAG + ": " + logMe);
}
项目:KitchenTimer    文件:Log.java   
public static void i(String TAG, String logMe) {
    if (Config.LOGD) android.util.Log.i(LOGTAG, TAG + ": " + logMe);
}
项目:qksms    文件:SmilHelper.java   
private static SMILDocument createSmilDocument(PduBody pb) {
    if (Config.LOGV) {
        Log.v(TAG, "Creating default SMIL document.");
    }

    SMILDocument document = new SmilDocumentImpl();

    // Create root element.
    // FIXME: Should we create root element in the constructor of document?
    SMILElement smil = (SMILElement) document.createElement("smil");
    smil.setAttribute("xmlns", "http://www.w3.org/2001/SMIL20/Language");
    document.appendChild(smil);

    // Create <head> and <layout> element.
    SMILElement head = (SMILElement) document.createElement("head");
    smil.appendChild(head);

    SMILLayoutElement layout = (SMILLayoutElement) document.createElement("layout");
    head.appendChild(layout);

    // Create <body> element and add a empty <par>.
    SMILElement body = (SMILElement) document.createElement("body");
    smil.appendChild(body);
    SMILParElement par = addPar(document);

    // Create media objects for the parts in PDU.
    int partsNum = pb.getPartsNum();
    if (partsNum == 0) {
        return document;
    }

    DrmManagerClient drmManagerClient = QKSMSApp.getApplication().getDrmManagerClient();

    boolean hasText = false;
    boolean hasMedia = false;
    for (int i = 0; i < partsNum; i++) {
        // Create new <par> element.
        if ((par == null) || (hasMedia && hasText)) {
            par = addPar(document);
            hasText = false;
            hasMedia = false;
        }

        PduPart part = pb.getPart(i);
        String contentType = new String(part.getContentType());

        if (ContentType.isDrmType(contentType)) {
            contentType = drmManagerClient.getOriginalMimeType(part.getDataUri());
        }

        if (contentType.equals(ContentType.TEXT_PLAIN)
                || contentType.equalsIgnoreCase(ContentType.APP_WAP_XHTML)
                || contentType.equals(ContentType.TEXT_HTML)) {
            SMILMediaElement textElement = createMediaElement(
                    ELEMENT_TAG_TEXT, document, part.generateLocation());
            par.appendChild(textElement);
            hasText = true;
        } else if (ContentType.isImageType(contentType)) {
            SMILMediaElement imageElement = createMediaElement(
                    ELEMENT_TAG_IMAGE, document, part.generateLocation());
            par.appendChild(imageElement);
            hasMedia = true;
        } else if (ContentType.isVideoType(contentType)) {
            SMILMediaElement videoElement = createMediaElement(
                    ELEMENT_TAG_VIDEO, document, part.generateLocation());
            par.appendChild(videoElement);
            hasMedia = true;
        } else if (ContentType.isAudioType(contentType)) {
            SMILMediaElement audioElement = createMediaElement(
                    ELEMENT_TAG_AUDIO, document, part.generateLocation());
            par.appendChild(audioElement);
            hasMedia = true;
        } else {
            // TODO: handle other media types.
            Log.w(TAG, "unsupport media type");
        }
    }

    return document;
}
项目:cInterphone    文件:CallerInfo.java   
/**
 * getCallerInfo given a Cursor.
 * @param context the context used to retrieve string constants
 * @param contactRef the URI to attach to this CallerInfo object
 * @param cursor the first object in the cursor is used to build the CallerInfo object.
 * @return the CallerInfo which contains the caller id for the given
 * number. The returned CallerInfo is null if no number is supplied.
 */
public static CallerInfo getCallerInfo(Context context, Uri contactRef, Cursor cursor) {

    CallerInfo info = new CallerInfo();
    info.photoResource = 0;
    info.phoneLabel = null;
    info.numberType = 0;
    info.numberLabel = null;
    info.cachedPhoto = null;
    info.isCachedPhotoCurrent = false;

    if (Config.LOGV) Log.v(TAG, "construct callerInfo from cursor");

    if (cursor != null) {
        while (cursor.moveToNext()) {

            int columnIndex;

            // Look for the number
            columnIndex = cursor.getColumnIndex(ContactsContract.PhoneLookup.NUMBER);
            if (columnIndex != -1) {
                info.phoneNumber = cursor.getString(columnIndex);
            }

            // Look for the name
            columnIndex = cursor.getColumnIndex(ContactsContract.PhoneLookup.DISPLAY_NAME);
            if (columnIndex != -1) {
                info.name = cursor.getString(columnIndex);
            }

            // Look for the label/type combo
            columnIndex = cursor.getColumnIndex(ContactsContract.PhoneLookup.LABEL);
            if (columnIndex != -1) {
                int typeColumnIndex = cursor.getColumnIndex(ContactsContract.PhoneLookup.TYPE);
                if (typeColumnIndex != -1) {
                    info.numberType = cursor.getInt(typeColumnIndex);
                    info.numberLabel = cursor.getString(columnIndex);
                    info.phoneLabel = ContactsContract.CommonDataKinds.Phone.getTypeLabel(context.getResources(),
                            info.numberType, info.numberLabel)
                            .toString();
                }
            }

            // Look for the person ID
            columnIndex = cursor.getColumnIndex(Phone.CONTACT_ID);
            if (columnIndex != -1) {
                    info.person_id = cursor.getLong(columnIndex);
            }
        }
        cursor.close();
    }

    info.needUpdate = false;
    info.name = normalize(info.name);
    info.contactRefUri = contactRef;

    return info;
}
项目:greendao-cipher    文件:SQLiteDatabase.java   
/**
 * Runs the provided SQL and returns a cursor over the result set.
 *
 * @param cursorFactory the cursor factory to use, or null for the default factory
 * @param sql the SQL query. The SQL string must not be ; terminated
 * @param selectionArgs You may include ?s in where clause in the query,
 *     which will be replaced by the values from selectionArgs. The
 *     values will be bound as Strings.
 * @param editTable the name of the first table, which is editable
 * @return A {@link Cursor} object, which is positioned before the first entry. Note that
 * {@link Cursor}s are not synchronized, see the documentation for more details.
 */
public Cursor rawQueryWithFactory(
                                  CursorFactory cursorFactory, String sql, String[] selectionArgs,
                                  String editTable) {
    if (!isOpen()) {
        throw new IllegalStateException("database not open");
    }
    long timeStart = 0;

    if (Config.LOGV || mSlowQueryThreshold != -1) {
        timeStart = System.currentTimeMillis();
    }

    SQLiteCursorDriver driver = new SQLiteDirectCursorDriver(this, sql, editTable);

    Cursor cursor = null;
    try {
        cursor = driver.query(
                              cursorFactory != null ? cursorFactory : mFactory,
                              selectionArgs);
    } finally {
        if (Config.LOGV || mSlowQueryThreshold != -1) {

            // Force query execution
            int count = -1;
            if (cursor != null) {
                count = cursor.getCount();
            }

            long duration = System.currentTimeMillis() - timeStart;

            if (Config.LOGV || duration >= mSlowQueryThreshold) {
                Log.v(TAG,
                      "query (" + duration + " ms): " + driver.toString() + ", args are "
                      + (selectionArgs != null
                         ? TextUtils.join(",", selectionArgs)
                         : "<null>")  + ", count is " + count);
            }
        }
    }
    return new CrossProcessCursorWrapper(cursor);
}
项目:greendao-cipher    文件:SQLiteCursor.java   
@Override
public boolean requery() {
    if (isClosed()) {
        return false;
    }
    long timeStart = 0;
    if (Config.LOGV) {
        timeStart = System.currentTimeMillis();
    }
    /*
     * Synchronize on the database lock to ensure that mCount matches the
     * results of mQuery.requery().
     */
    mDatabase.lock();
    try {
        if (mWindow != null) {
            mWindow.clear();
        }
        mPos = -1;
        // This one will recreate the temp table, and get its count
        mDriver.cursorRequeried(this);
        mCount = NO_COUNT;
        mCursorState++;
        queryThreadLock();
        try {
            mQuery.requery();
        } finally {
            queryThreadUnlock();
        }
    } finally {
        mDatabase.unlock();
    }

    if (Config.LOGV) {
        Log.v("DatabaseWindow", "closing window in requery()");
        Log.v(TAG, "--- Requery()ed cursor " + this + ": " + mQuery);
    }

    boolean result = super.requery();
    if (Config.LOGV) {
        long timeEnd = System.currentTimeMillis();
        Log.v(TAG, "requery (" + (timeEnd - timeStart) + " ms): " + mDriver.toString());
    }
    return result;
}
项目:android-aosp-mms    文件:SmilHelper.java   
private static SMILDocument createSmilDocument(PduBody pb) {
    if (Config.LOGV) {
        Log.v(TAG, "Creating default SMIL document.");
    }

    SMILDocument document = new SmilDocumentImpl();

    // Create root element.
    // FIXME: Should we create root element in the constructor of document?
    SMILElement smil = (SMILElement) document.createElement("smil");
    smil.setAttribute("xmlns", "http://www.w3.org/2001/SMIL20/Language");
    document.appendChild(smil);

    // Create <head> and <layout> element.
    SMILElement head = (SMILElement) document.createElement("head");
    smil.appendChild(head);

    SMILLayoutElement layout = (SMILLayoutElement) document.createElement("layout");
    head.appendChild(layout);

    // Create <body> element and add a empty <par>.
    SMILElement body = (SMILElement) document.createElement("body");
    smil.appendChild(body);
    SMILParElement par = addPar(document);

    // Create media objects for the parts in PDU.
    int partsNum = pb.getPartsNum();
    if (partsNum == 0) {
        return document;
    }

    DrmManagerClient drmManagerClient = MmsApp.getApplication().getDrmManagerClient();

    boolean hasText = false;
    boolean hasMedia = false;
    for (int i = 0; i < partsNum; i++) {
        // Create new <par> element.
        if ((par == null) || (hasMedia && hasText)) {
            par = addPar(document);
            hasText = false;
            hasMedia = false;
        }

        PduPart part = pb.getPart(i);
        String contentType = new String(part.getContentType());

        if (ContentType.isDrmType(contentType)) {
            contentType = drmManagerClient.getOriginalMimeType(part.getDataUri());
        }

        if (contentType.equals(ContentType.TEXT_PLAIN)
                || contentType.equalsIgnoreCase(ContentType.APP_WAP_XHTML)
                || contentType.equals(ContentType.TEXT_HTML)) {
            SMILMediaElement textElement = createMediaElement(
                    ELEMENT_TAG_TEXT, document, part.generateLocation());
            par.appendChild(textElement);
            hasText = true;
        } else if (ContentType.isImageType(contentType)) {
            SMILMediaElement imageElement = createMediaElement(
                    ELEMENT_TAG_IMAGE, document, part.generateLocation());
            par.appendChild(imageElement);
            hasMedia = true;
        } else if (ContentType.isVideoType(contentType)) {
            SMILMediaElement videoElement = createMediaElement(
                    ELEMENT_TAG_VIDEO, document, part.generateLocation());
            par.appendChild(videoElement);
            hasMedia = true;
        } else if (ContentType.isAudioType(contentType)) {
            SMILMediaElement audioElement = createMediaElement(
                    ELEMENT_TAG_AUDIO, document, part.generateLocation());
            par.appendChild(audioElement);
            hasMedia = true;
        } else {
            // TODO: handle other media types.
            Log.w(TAG, "unsupport media type");
        }
    }

    return document;
}