本文整理汇总了Java中de.ub0r.android.logg0r.Log.d方法的典型用法代码示例。如果您正苦于以下问题:Java Log.d方法的具体用法?Java Log.d怎么用?Java Log.d使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类de.ub0r.android.logg0r.Log
的用法示例。
在下文中一共展示了Log.d方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: fixNumber
import de.ub0r.android.logg0r.Log; //导入方法依赖的package包/类
/**
* Fix a number with regex load from {@link SharedPreferences}.
*
* @param context {@link Context}
* @param number number
* @return fixed number
*/
static String fixNumber(final Context context, final String number) {
String ret = number;
final SharedPreferences p = PreferenceManager.getDefaultSharedPreferences(context);
for (int i = 1; i <= PREFS_REGEX_COUNT; i++) {
final String regex = p.getString(PREFS_REGEX + i, null);
if (!TextUtils.isEmpty(regex)) {
try {
Log.d(TAG, "search for '", regex, "' in ", ret);
ret = ret.replaceAll(regex, p.getString(PREFS_REPLACE + i, ""));
Log.d(TAG, "new number: ", ret);
} catch (PatternSyntaxException e) {
Toast.makeText(context, e.getMessage(), Toast.LENGTH_LONG).show();
}
}
}
return ret;
}
示例2: getConversation
import de.ub0r.android.logg0r.Log; //导入方法依赖的package包/类
/**
* Get a {@link Conversation}.
*
* @param context {@link Context}
* @param cursor {@link Cursor} to read the data from
* @param sync fetch of information
* @return {@link Conversation}
*/
public static Conversation getConversation(final Context context, final Cursor cursor,
final boolean sync) {
Log.d(TAG, "getConversation(", sync, ")");
synchronized (CACHE) {
Conversation ret = CACHE.get(cursor.getInt(INDEX_SIMPLE_ID));
if (ret == null) {
ret = new Conversation(context, cursor, sync);
CACHE.put(ret.getThreadId(), ret);
Log.d(TAG, "cachesize: ", CACHE.size());
while (CACHE.size() > CACHESIZE) {
Integer i = CACHE.keySet().iterator().next();
Log.d(TAG, "rm con. from cache: ", i);
Conversation cc = CACHE.remove(i);
if (cc == null) {
Log.w(TAG, "CACHE might be inconsistent!");
break;
}
}
} else {
ret.update(context, cursor, sync);
}
return ret;
}
}
示例3: getAllEntries
import de.ub0r.android.logg0r.Log; //导入方法依赖的package包/类
/**
* Get all entries from blacklist.
*
* @return array of entries
*/
public String[] getAllEntries() {
final Cursor cursor = db.query(DATABASE_TABLE, PROJECTION, null, null, null, null,
null);
if (cursor == null) {
return null;
}
final String[] ret = new String[cursor.getCount()];
if (cursor.moveToFirst()) {
int i = 0;
do {
ret[i] = cursor.getString(0);
Log.d(TAG, "spam: ", ret[i]);
++i;
} while (cursor.moveToNext());
}
if (!cursor.isClosed()) {
cursor.close();
}
return ret;
}
示例4: getAddress
import de.ub0r.android.logg0r.Log; //导入方法依赖的package包/类
/**
* @param context {@link Context} to query SMS DB for an address.
* @return the address
*/
public String getAddress(final Context context) {
if (address == null && context != null) {
final String select = Message.PROJECTION[Message.INDEX_THREADID] + " = '"
+ getThreadId() + "' and " + Message.PROJECTION[Message.INDEX_ADDRESS]
+ " != ''";
Log.d(TAG, "select: ", select);
final Cursor cur = context.getContentResolver().query(Uri.parse("content://sms/"),
Message.PROJECTION, select, null, null);
if (cur != null && cur.moveToFirst()) {
address = cur.getString(Message.INDEX_ADDRESS);
Log.d(TAG, "found address: ", address);
}
if (cur != null) {
cur.close();
}
}
return address;
}
示例5: onReceive
import de.ub0r.android.logg0r.Log; //导入方法依赖的package包/类
@Override
public void onReceive(Context context, Intent intent) {
Log.d(TAG, "onReceive(context, ", intent, ")");
if (ACTION_MARK_READ.equals(intent.getAction())) {
try {
Bundle extras = intent.getExtras();
if (extras == null) {
Log.w(TAG, "empty extras");
return;
}
// remember that we have to add the package here ..
String muri = extras.getString(EXTRA_MURI);
Log.d(TAG, "received uri: ", muri);
ConversationListActivity.markRead(context, Uri.parse(muri), 1);
} catch (Exception e) {
Log.e(TAG, "unable to mark message read", e);
}
}
}
示例6: showRows
import de.ub0r.android.logg0r.Log; //导入方法依赖的package包/类
/**
* Show all rows of a particular {@link Uri}.
*
* @param context {@link Context}
* @param u {@link Uri}
*/
@SuppressWarnings("UnusedDeclaration")
static void showRows(final Context context, final Uri u) {
Log.d(TAG, "-----GET HEADERS-----");
Log.d(TAG, "-- ", u.toString(), " --");
Cursor c = context.getContentResolver().query(u, null, null, null, null);
if (c != null) {
int l = c.getColumnCount();
StringBuilder buf = new StringBuilder();
for (int i = 0; i < l; i++) {
buf.append(i).append(":");
buf.append(c.getColumnName(i));
buf.append(" | ");
}
Log.d(TAG, buf.toString());
}
}
示例7: onNewIntent
import de.ub0r.android.logg0r.Log; //导入方法依赖的package包/类
/**
* {@inheritDoc}
*/
@Override
public void onNewIntent(final Intent intent) {
if (intent != null) {
Log.d(TAG, "got intent: ", intent.getAction());
Log.d(TAG, "got uri: ", intent.getData());
final Bundle b = intent.getExtras();
if (b != null) {
Log.d(TAG, "user_query: ", b.get("user_query"));
Log.d(TAG, "got extra: ", b);
}
final String query = intent.getStringExtra("user_query");
Log.d(TAG, "user query: ", query);
// TODO: do something with search query
}
}
示例8: markRead
import de.ub0r.android.logg0r.Log; //导入方法依赖的package包/类
/**
* Mark all messages with a given {@link Uri} as read.
*
* @param context {@link Context}
* @param uri {@link Uri}
* @param read read status
*/
static void markRead(final Context context, final Uri uri, final int read) {
Log.d(TAG, "markRead(", uri, ",", read, ")");
if (uri == null) {
return;
}
String[] sel = Message.SELECTION_UNREAD;
if (read == 0) {
sel = Message.SELECTION_READ;
}
final ContentResolver cr = context.getContentResolver();
final ContentValues cv = new ContentValues();
cv.put(Message.PROJECTION[Message.INDEX_READ], read);
try {
cr.update(uri, cv, Message.SELECTION_READ_UNREAD, sel);
} catch (IllegalArgumentException | SQLiteException e) {
Log.e(TAG, "failed update", e);
Toast.makeText(context, e.getMessage(), Toast.LENGTH_LONG).show();
}
SmsReceiver.updateNewMessageNotification(context, null);
}
示例9: handleSent
import de.ub0r.android.logg0r.Log; //导入方法依赖的package包/类
/**
* Handle sent message.
*
* @param context {@link Context}
* @param intent {@link Intent}
* @param resultCode message status
*/
private static void handleSent(final Context context, final Intent intent,
final int resultCode) {
final Uri uri = intent.getData();
Log.d(TAG, "sent message: ", uri, ", rc: ", resultCode);
if (uri == null) {
Log.w(TAG, "handleSent(null)");
return;
}
if (resultCode == Activity.RESULT_OK) {
final ContentValues cv = new ContentValues(1);
cv.put(SenderActivity.TYPE, Message.SMS_OUT);
context.getContentResolver().update(uri, cv, null, null);
} else {
updateFailedNotification(context, uri);
}
}
示例10: getMaxDate
import de.ub0r.android.logg0r.Log; //导入方法依赖的package包/类
/**
* Get maximum date of logs type %.
*
* @param cr {@link ContentResolver}
* @param type type
* @return maximum date found. -1 if nothing was found.
*/
private static long getMaxDate(final ContentResolver cr, final int type) {
Log.d(TAG, "getMaxDate(", type, ")");
final Cursor cursor = cr.query(DataProvider.Logs.CONTENT_URI,
new String[]{DataProvider.Logs.DATE}, DataProvider.Logs.TYPE + " = ?",
new String[]{String.valueOf(type)}, DataProvider.Logs.DATE + " DESC LIMIT 1");
long maxdate = deleteBefore;
if (cursor != null) {
if (cursor.moveToFirst()) {
maxdate = cursor.getLong(0);
Log.d(TAG, "maxdate=", maxdate);
}
cursor.close();
}
if (maxdate > dateStart) {
return maxdate;
}
Log.d(TAG, "getMaxDate(): dateStart=", dateStart);
return dateStart;
}
示例11: loadPrefsCall
import de.ub0r.android.logg0r.Log; //导入方法依赖的package包/类
private static void loadPrefsCall(final Editor e, final ContentResolver cr, final long planId,
final String postfix) {
Cursor c = cr.query(DataProvider.Plans.CONTENT_URI, DataProvider.Plans.PROJECTION,
SELECTION_ID, new String[]{String.valueOf(planId)}, null);
if (c.moveToFirst()) {
String billmode = c.getString(DataProvider.Plans.INDEX_BILLMODE);
Log.d(TAG, "billmode: ", billmode);
e.putString(PREFS_BILLMODE + postfix, billmode);
e.putString(PREFS_CUSTOM_BILLMODE + postfix, billmode);
int i = c.getInt(DataProvider.Plans.INDEX_LIMIT_TYPE);
if (i == DataProvider.LIMIT_TYPE_UNITS) {
e.putString(PREFS_FREEMIN + postfix, c.getString(DataProvider.Plans.INDEX_LIMIT));
} else {
e.putString(PREFS_FREEMIN + postfix, "");
}
e.putString(PREFS_COST_PER_CALL + postfix,
c.getString(DataProvider.Plans.INDEX_COST_PER_ITEM));
e.putString(PREFS_COST_PER_MIN + postfix,
c.getString(DataProvider.Plans.INDEX_COST_PER_AMOUNT1));
}
c.close();
}
示例12: save
import de.ub0r.android.logg0r.Log; //导入方法依赖的package包/类
/**
* Save Plan to {@link SharedPreferences} for caching.
*
* @param e {@link Editor}
* @return {@link Editor}
*/
public Editor save(final Editor e) {
Log.d(TAG, "save(): ", id);
e.putFloat(PREF_PREFIX + SUM_COST + id, cost);
e.putFloat(PREF_PREFIX + SUM_FREE + id, free);
e.putInt(PREF_PREFIX + SUM_TD_COUNT + id, tdCount);
e.putFloat(PREF_PREFIX + SUM_TD_BILLED_AMOUNT + id, tdBa);
e.putInt(PREF_PREFIX + SUM_BP_COUNT + id, bpCount);
e.putFloat(PREF_PREFIX + SUM_BP_BILLED_AMOUNT + id, bpBa);
e.putInt(PREF_PREFIX + SUM_AT_COUNT + id, atCount);
e.putFloat(PREF_PREFIX + SUM_AT_BILLED_AMOUNT + id, atBa);
e.putLong(PREF_PREFIX + SUM_NOW + id, now);
e.putLong(PREF_PREFIX + SUM_BILLDAY + id, billday);
e.putLong(PREF_PREFIX + SUM_NEXTBILLDAY + id, nextbillday);
e.putFloat(PREF_PREFIX + SUM_CPP + id, cpp);
return e;
}
示例13: setInProgress
import de.ub0r.android.logg0r.Log; //导入方法依赖的package包/类
/**
* Set progress indicator.
*
* @param add add number of running tasks
*/
public synchronized void setInProgress(final int add) {
Log.d(TAG, "setInProgress(", add, ")");
progressCount += add;
if (progressCount < 0) {
Log.w(TAG, "this.progressCount: " + progressCount);
progressCount = 0;
}
Log.d(TAG, "progressCount: ", progressCount);
if (progressCount == 0) {
setSupportProgressBarIndeterminateVisibility(false);
} else {
setSupportProgressBarIndeterminateVisibility(true);
}
}
示例14: reload
import de.ub0r.android.logg0r.Log; //导入方法依赖的package包/类
/**
* Reload backup into table.
*
* @param db {@link SQLiteDatabase}
* @param table table
* @param values {@link ContentValues}[] backed up with backup()
*/
private static void reload(final SQLiteDatabase db, final String table,
final ContentValues[] values) {
if (values == null || values.length == 0) {
return;
}
Log.d(TAG, "reload(db, ", table, ", cv[", values.length, "])");
db.beginTransaction();
try {
for (ContentValues cv : values) {
Log.d(TAG, "reload: ", table, " insert: ", cv);
db.insert(table, null, cv);
}
db.setTransactionSuccessful();
} catch (SQLException e) {
Log.e(TAG, "error reloading row: " + table, e);
} finally {
db.endTransaction();
}
}
示例15: schedNext
import de.ub0r.android.logg0r.Log; //导入方法依赖的package包/类
/**
* Schedule next update.
*
* @param context {@link Context}
* @param a action
*/
public static void schedNext(final Context context, final String a) {
Log.d(TAG, "schedNext(ctx, ", a, ")");
long delay;
if (a != null && a.equals(LogRunnerService.ACTION_SHORT_RUN)) {
delay = (long) (Utils.parseFloat(PreferenceManager.getDefaultSharedPreferences(context)
.getString(Preferences.PREFS_UPDATE_INTERVAL_DATA,
String.valueOf(DELAY_DATA)),
DELAY_DATA) * DELAY_FACTOR);
} else {
delay = Utils.parseLong(PreferenceManager.getDefaultSharedPreferences(context)
.getString(Preferences.PREFS_UPDATE_INTERVAL, String.valueOf(DELAY)), DELAY)
* DELAY_FACTOR;
}
Log.d(TAG, "schedNext(ctx, ", a, "): delay=", delay);
if (delay == 0L) {
return;
}
schedNext(context, delay, a);
}