当前位置: 首页>>代码示例>>Java>>正文


Java Log类代码示例

本文整理汇总了Java中de.ub0r.android.logg0r.Log的典型用法代码示例。如果您正苦于以下问题:Java Log类的具体用法?Java Log怎么用?Java Log使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


Log类属于de.ub0r.android.logg0r包,在下文中一共展示了Log类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: fillConversation

import de.ub0r.android.logg0r.Log; //导入依赖的package包/类
/**
 * Fill Conversations data. If needed: spawn threads.
 *
 * @param context {@link Context}
 * @param c       {@link Conversation}
 * @param sync    fetch of information
 */
public static void fillConversation(final Context context, final Conversation c,
        final boolean sync) {
    Log.d(TAG, "fillConversation(ctx, conv, ", sync, ")");
    if (context == null || c == null || c.getThreadId() < 0) {
        return;
    }
    AsyncHelper helper = new AsyncHelper(context, c);
    if (sync) {
        helper.doInBackground((Void) null);
    } else {
        try {
            helper.execute((Void) null);
        } catch (RejectedExecutionException e) {
            Log.e(TAG, "rejected execution", e);
        }
    }
}
 
开发者ID:andrewxu10,项目名称:Upkeep,代码行数:25,代码来源:AsyncHelper.java

示例2: 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;
}
 
开发者ID:andrewxu10,项目名称:Upkeep,代码行数:25,代码来源:SenderActivity.java

示例3: 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();
            }
        }
    };
}
 
开发者ID:andrewxu10,项目名称:Upkeep,代码行数:25,代码来源:SMSdroid.java

示例4: isDefaultApp

import de.ub0r.android.logg0r.Log; //导入依赖的package包/类
static boolean isDefaultApp(final Context context) {
    // there is no default sms app before android 4.4
    if (Build.VERSION.SDK_INT < Build.VERSION_CODES.KITKAT) {
        return true;
    }

    try {
        // check if this is the default sms app.
        // If the device doesn't support Telephony.Sms (i.e. tablet) getDefaultSmsPackage() will
        // be null.
        final String smsPackage = Telephony.Sms.getDefaultSmsPackage(context);
        return smsPackage == null || smsPackage.equals(BuildConfig.APPLICATION_ID);
    } catch (SecurityException e) {
        // some samsung devices/tablets want permission GET_TASKS o.O
        Log.e(TAG, "failed to query default SMS app", e);
        return true;
    }
}
 
开发者ID:andrewxu10,项目名称:Upkeep,代码行数:19,代码来源:SMSdroid.java

示例5: 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;
    }
}
 
开发者ID:andrewxu10,项目名称:Upkeep,代码行数:33,代码来源:Conversation.java

示例6: 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;
}
 
开发者ID:andrewxu10,项目名称:Upkeep,代码行数:26,代码来源:SpamDB.java

示例7: 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;
}
 
开发者ID:andrewxu10,项目名称:Upkeep,代码行数:23,代码来源:Message.java

示例8: 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);
        }
    }
}
 
开发者ID:andrewxu10,项目名称:Upkeep,代码行数:23,代码来源:NotificationBroadcastReceiver.java

示例9: getRemoteViews

import de.ub0r.android.logg0r.Log; //导入依赖的package包/类
/**
 * Get {@link RemoteViews}.
 *
 * @param context {@link Context}
 * @param count   number of unread messages
 * @param pIntent {@link PendingIntent}
 * @return {@link RemoteViews}
 */
static RemoteViews getRemoteViews(final Context context, final int count,
        final PendingIntent pIntent) {
    final SharedPreferences p = PreferenceManager.getDefaultSharedPreferences(context);
    RemoteViews views = new RemoteViews(context.getPackageName(), R.layout.widget);
    views.setTextViewText(R.id.text1, String.valueOf(count));
    if (count == 0) {
        views.setViewVisibility(R.id.text1, View.GONE);
    } else {
        views.setViewVisibility(R.id.text1, View.VISIBLE);
    }
    if (p.getBoolean(PreferencesActivity.PREFS_HIDE_WIDGET_LABEL, false)) {
        views.setViewVisibility(R.id.label, View.GONE);
    } else {
        views.setViewVisibility(R.id.label, View.VISIBLE);
    }
    if (pIntent != null) {
        views.setOnClickPendingIntent(R.id.widget, pIntent);
        Log.d(TAG, "set pending intent: ", pIntent.toString());
    }
    return views;
}
 
开发者ID:andrewxu10,项目名称:Upkeep,代码行数:30,代码来源:WidgetProvider.java

示例10: 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());
    }

}
 
开发者ID:andrewxu10,项目名称:Upkeep,代码行数:24,代码来源:ConversationListActivity.java

示例11: 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
    }
}
 
开发者ID:andrewxu10,项目名称:Upkeep,代码行数:19,代码来源:ConversationListActivity.java

示例12: 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);
}
 
开发者ID:andrewxu10,项目名称:Upkeep,代码行数:28,代码来源:ConversationListActivity.java

示例13: getComposeIntent

import de.ub0r.android.logg0r.Log; //导入依赖的package包/类
/**
 * Get a {@link Intent} for sending a new message.
 *
 * @param context     {@link Context}
 * @param address     address
 * @param showChooser show chooser
 * @return {@link Intent}
 */
static Intent getComposeIntent(final Context context, final String address,
        final boolean showChooser) {
    Intent i = null;

    if (!showChooser && Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
        // Search for WebSMS
        PackageManager pm = context.getPackageManager();
        i = pm == null ? null : pm.getLaunchIntentForPackage("de.ub0r.android.websms");
    }

    if (i == null) {
        Log.d(TAG, "WebSMS is not installed!");
        i = new Intent(Intent.ACTION_SENDTO);
    }

    i.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);

    if (address == null) {
        i.setData(Uri.parse("sms:"));
    } else {
        i.setData(Uri.parse("smsto:" + PreferencesActivity.fixNumber(context, address)));
    }

    return i;
}
 
开发者ID:andrewxu10,项目名称:Upkeep,代码行数:34,代码来源:ConversationListActivity.java

示例14: onItemClick

import de.ub0r.android.logg0r.Log; //导入依赖的package包/类
/**
 * {@inheritDoc}
 */
public void onItemClick(final AdapterView<?> parent, final View view, final int position,
        final long id) {
    final Conversation c = Conversation.getConversation(this,
            (Cursor) parent.getItemAtPosition(position), false);
    final Uri target = c.getUri();
    final Intent i = new Intent(this, MessageListActivity.class);
    i.setData(target);
    try {
        startActivity(i);
    } catch (ActivityNotFoundException e) {
        Log.e(TAG, "error launching intent: ", i.getAction(), ", ", i.getData());
        Toast.makeText(this,
                "error launching messaging app!\n" + "Please contact the developer.",
                Toast.LENGTH_LONG).show();
    }
}
 
开发者ID:andrewxu10,项目名称:Upkeep,代码行数:20,代码来源:ConversationListActivity.java

示例15: 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;
}
 
开发者ID:andrewxu10,项目名称:Upkeep,代码行数:25,代码来源:PreferencesActivity.java


注:本文中的de.ub0r.android.logg0r.Log类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。