本文整理汇总了Java中de.ub0r.android.logg0r.Log.w方法的典型用法代码示例。如果您正苦于以下问题:Java Log.w方法的具体用法?Java Log.w怎么用?Java Log.w使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类de.ub0r.android.logg0r.Log
的用法示例。
在下文中一共展示了Log.w方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: send
import de.ub0r.android.logg0r.Log; //导入方法依赖的package包/类
/**
* Send a message.
*
* @return true, if message was sent
*/
private boolean send() {
if (TextUtils.isEmpty(to) || TextUtils.isEmpty(text)) {
return false;
}
for (String r : to.split(",")) {
r = MobilePhoneAdapter.cleanRecipient(r);
if (TextUtils.isEmpty(r)) {
Log.w(TAG, "skip empty recipient: ", r);
continue;
}
try {
send(r, text);
} catch (Exception e) {
Log.e(TAG, "unable to send message: ", to, e);
Toast.makeText(this, R.string.error_sending_failed,Toast.LENGTH_LONG).show();
}
}
return true;
}
示例2: getOnClickStartActivity
import de.ub0r.android.logg0r.Log; //导入方法依赖的package包/类
/**
* Get an {@link OnClickListener} for stating an Activity for given {@link Intent}.
*
* @param context {@link Context}
* @param intent {@link Intent}
* @return {@link OnClickListener}
*/
static OnClickListener getOnClickStartActivity(final Context context, final Intent intent) {
if (intent == null) {
return null;
}
return new OnClickListener() {
@Override
public void onClick(final View v) {
try {
context.startActivity(intent);
} catch (ActivityNotFoundException e) {
Log.w(TAG, "activity not found", e);
Toast.makeText(context, "no activity for data: " + intent.getType(),
Toast.LENGTH_LONG).show();
}
}
};
}
示例3: 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;
}
}
示例4: 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);
}
}
}
示例5: 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);
}
}
示例6: contains
import de.ub0r.android.logg0r.Log; //导入方法依赖的package包/类
public boolean contains(final String url) {
Log.v(TAG, "contains(", url, ")");
if (mDiskCache == null) {
Log.w(TAG, "disk cache does not exist");
return false;
}
final String key = getKey(url);
DiskLruCache.Snapshot snapshot = null;
try {
snapshot = mDiskCache.get(key);
return snapshot != null;
} catch (IOException e) {
Log.e(TAG, "contains failed", e);
} finally {
if (snapshot != null) {
snapshot.close();
}
}
return false;
}
示例7: onUpgrade
import de.ub0r.android.logg0r.Log; //导入方法依赖的package包/类
/**
* Upgrade table.
*
* @param db {@link SQLiteDatabase}
* @throws IOException IOException
*/
public static void onUpgrade(final Context context, final SQLiteDatabase db)
throws IOException {
Log.w(TAG, "Upgrading table: " + TABLE);
String fn = TABLE + ".bak";
context.deleteFile(fn);
ObjectOutputStream os = new ObjectOutputStream(context.openFileOutput(fn,
Context.MODE_PRIVATE));
backup(db, TABLE, PROJECTION, null, null, null, os);
os.close();
ObjectInputStream is = new ObjectInputStream(context.openFileInput(fn));
onCreate(db);
reload(db, TABLE, is);
is.close();
}
示例8: checkSmsSimIdColumn
import de.ub0r.android.logg0r.Log; //导入方法依赖的package包/类
/**
* Check, if there is dual sim support.
*/
public static boolean checkSmsSimIdColumn(final ContentResolver cr) {
try {
String where = BuildConfig.DEBUG_LOG ? null : "1=2";
Cursor c = cr.query(URI_SMS, null, where, null, null);
boolean check = false;
if (c != null) {
check = SimIdColumnFinder.getsInstance().getSimIdColumn(cr, URI_SMS, c) >= 0;
c.close();
}
Log.i(TAG, "sim_id column found in sms database: " + check);
return check;
} catch (SQLiteException e) {
Log.w(TAG, "sim_id check for sms failed", e);
return false;
}
}
示例9: 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);
}
}
示例10: parseIntent
import de.ub0r.android.logg0r.Log; //导入方法依赖的package包/类
/**
* Parse data pushed by {@link Intent}.
*
* @param intent {@link Intent}
* @return true if message is ready to send
*/
private boolean parseIntent(final Intent intent) {
Log.d(TAG, "parseIntent(", intent, ")");
if (intent == null) {
return false;
}
Log.d(TAG, "got action: ", intent.getAction());
to = null;
String u = intent.getDataString();
try {
if (!TextUtils.isEmpty(u) && u.contains(":")) {
String t = u.split(":")[1];
if (t.startsWith("+")) {
to = "+" + URLDecoder.decode(t.substring(1));
} else {
to = URLDecoder.decode(t);
}
}
} catch (IndexOutOfBoundsException e) {
Log.w(TAG, "could not split at :", e);
}
CharSequence cstext = intent.getCharSequenceExtra(Intent.EXTRA_TEXT);
text = null;
if (cstext != null) {
text = cstext.toString();
}
if (TextUtils.isEmpty(text)) {
Log.i(TAG, "text missing");
return false;
}
if (TextUtils.isEmpty(to)) {
Log.i(TAG, "recipient missing");
return false;
}
return true;
}
示例11: onUpgrade
import de.ub0r.android.logg0r.Log; //导入方法依赖的package包/类
@Override
public void onUpgrade(final SQLiteDatabase db, final int oldVersion, final int newVersion) {
Log.w(TAG, "Upgrading database from version ", oldVersion, " to ", newVersion
+ ", which will destroy all old data");
db.execSQL("DROP TABLE IF EXISTS numbers");
onCreate(db);
}
示例12: getMessage
import de.ub0r.android.logg0r.Log; //导入方法依赖的package包/类
/**
* Get a {@link Message} from cache or {@link Cursor}.
*
* @param context {@link Context}
* @param cursor {@link Cursor}
* @return {@link Message}
*/
public static Message getMessage(final Context context, final Cursor cursor) {
synchronized (CACHE) {
String body = cursor.getString(INDEX_BODY);
int id = cursor.getInt(INDEX_ID);
if (body == null) { // MMS
id *= -1;
}
Message ret = CACHE.get(id);
if (ret == null) {
ret = new Message(context, cursor);
CACHE.put(id, ret);
Log.d(TAG, "cachesize: ", CACHE.size());
while (CACHE.size() > CAHCESIZE) {
Integer i = CACHE.keySet().iterator().next();
Log.d(TAG, "rm msg. from cache: ", i);
Message cc = CACHE.remove(i);
if (cc == null) {
Log.w(TAG, "CACHE might be inconsistent!");
break;
}
}
} else {
ret.update(cursor);
}
return ret;
}
}
示例13: showSelectedItem
import de.ub0r.android.logg0r.Log; //导入方法依赖的package包/类
private void showSelectedItem() {
if (!mIsTwoPane) {
return;
}
Log.d(TAG, "showSelectedItem(): ", mSelectedHash);
int l = mContainer.size();
Log.d(TAG, "#mContainer: ", l);
if (mSelectedHash == null) {
Fragment f = getActiveFragment();
if (f != null && f instanceof ShareFragment) {
mSelectedHash = ((ShareFragment) f).getHash();
Log.d(TAG, "fragment's hash: ", mSelectedHash);
}
}
if (mSelectedHash != null && l > 0) {
boolean found = false;
for (int i = 0; i < l; ++i) {
if (mSelectedHash.equals(mContainer.get(i).getHash())) {
showItem(i);
found = true;
break;
}
}
if (!found) {
Log.w(TAG, "selected item not found!");
showItem(0);
}
} else if (l > 0) {
Log.d(TAG, "show first item");
showItem(0);
} else {
hideItem();
}
}
示例14: getBitmap
import de.ub0r.android.logg0r.Log; //导入方法依赖的package包/类
@Override
public Bitmap getBitmap(final String url) {
Log.v(TAG, "get(", url, ")");
if (mDiskCache == null) {
Log.w(TAG, "disk cache does not exist");
return null;
}
final String key = getKey(url);
Bitmap bitmap = null;
DiskLruCache.Snapshot snapshot = null;
try {
snapshot = mDiskCache.get(key);
if (snapshot == null) {
return null;
}
final InputStream in = snapshot.getInputStream(0);
if (in != null) {
final BufferedInputStream buffIn = new BufferedInputStream(in, IO_BUFFER_SIZE);
bitmap = BitmapFactory.decodeStream(buffIn);
buffIn.close();
Log.v(TAG, "image read from disk: ", key);
}
} catch (IOException e) {
Log.e(TAG, "get failed", e);
} finally {
if (snapshot != null) {
snapshot.close();
}
}
return bitmap;
}
示例15: putBitmap
import de.ub0r.android.logg0r.Log; //导入方法依赖的package包/类
@Override
public void putBitmap(final String url, final Bitmap data) {
Log.v(TAG, "put(", url, ")");
if (mDiskCache == null) {
Log.w(TAG, "disk cache does not exist");
return;
}
final String key = getKey(url);
DiskLruCache.Editor editor = null;
try {
editor = mDiskCache.edit(key);
if (editor == null) {
return;
}
if (writeBitmapToFile(data, editor)) {
mDiskCache.flush();
editor.commit();
Log.v(TAG, "image put on disk cache ", key);
} else {
editor.abort();
Log.w(TAG, "ERROR on: image put on disk cache ", key);
}
} catch (IOException e) {
Log.e(TAG, "put failed: ", key, e);
try {
if (editor != null) {
editor.abort();
}
} catch (IOException ignored) {
}
}
}