本文整理汇总了Java中android.support.v4.BuildConfig.DEBUG属性的典型用法代码示例。如果您正苦于以下问题:Java BuildConfig.DEBUG属性的具体用法?Java BuildConfig.DEBUG怎么用?Java BuildConfig.DEBUG使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类android.support.v4.BuildConfig
的用法示例。
在下文中一共展示了BuildConfig.DEBUG属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: sendBroadcast
private void sendBroadcast(@NonNull Context context,
@Nullable String messageFrom,
@Nullable String smsMessage) {
Intent broadcastIntent = new Intent(INTENT_ACTION_SMS);
String smsCode = null;
if (smsMessage != null) {
try {
smsCode = getSmsCode(smsMessage);
} catch (StringIndexOutOfBoundsException e) {
if (BuildConfig.DEBUG) {
Log.d(SmsReceiver.class.getName(), e.getMessage());
}
}
}
broadcastIntent.putExtra(KEY_SMS_SENDER, messageFrom);
broadcastIntent.putExtra(KEY_SMS_MESSAGE, smsCode);
LocalBroadcastManager.getInstance(context).sendBroadcast(broadcastIntent);
}
示例2: removeDoc
/**
* Handles deleting a document in a collection.
* Override if you want to use your own collection data store.
* @param collName collection name
* @param docId document ID
* @return true if doc was deleted, false otherwise
*/
public boolean removeDoc(String collName, String docId) {
if (mCollections.containsKey(collName)) {
// remove IDs from collection
Map<String, Map<String,Object>> collection = mCollections.get(collName);
if (BuildConfig.DEBUG) {
log.debug("Removed doc: " + docId);
}
collection.remove(docId);
return true;
} else {
log.warn("Received invalid removed msg for collection "
+ collName);
return false;
}
}
示例3: addDoc
/**
* Handles adding a document to collection.
* Override if you want to use your own collection data store.
* @param jsonFields fields for document
* @param collName collection name
* @param docId document ID
*/
@SuppressWarnings("unchecked")
public void addDoc(Map<String, Object> jsonFields, String collName,
String docId) {
if (!mCollections.containsKey(collName)) {
// add new collection
log.debug("Added collection " + collName);
mCollections.put(collName, new ConcurrentHashMap<String, Map<String,Object>>());
}
Map<String, Map<String,Object>> collection = mCollections.get(collName);
Map<String, Object> fields;
if(jsonFields.get(DdpMessageField.FIELDS) == null) {
fields = new ConcurrentHashMap<>();
} else {
fields = (Map<String, Object>) jsonFields.get(DdpMessageField.FIELDS);
}
collection.put(docId, fields);
if (BuildConfig.DEBUG) {
log.debug("Added docid " + docId + " to collection " + collName);
}
}
示例4: onCreate
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// active StrictMode when debug
if (BuildConfig.DEBUG) {
StrictMode.setThreadPolicy(new StrictMode.ThreadPolicy.Builder().detectAll().penaltyLog().build());
StrictMode.setVmPolicy(new StrictMode.VmPolicy.Builder().detectAll().penaltyLog().build());
}
if (this.getNavigationItemSelectedListener() != null) {
this.mNavigationView.setNavigationItemSelectedListener(this.getNavigationItemSelectedListener());
}
this.mDrawerLayout.addDrawerListener(new BaseDrawerListener());
this.mMenuItems = new ArrayMap<>();
int[] menuItemIds = this.getMenuItemIds();
if (menuItemIds.length > 0) {
for (int id : menuItemIds) {
MenuItem menuItem = this.mNavigationView.getMenu().findItem(id);
if (menuItem != null)
this.mMenuItems.put(id, menuItem);
}
}
this.mDrawerToggle = new ActionBarDrawerToggle(this,
this.mDrawerLayout,
R.string.navigation_drawer_open,
R.string.navigation_drawer_close);
View v = mNavigationView.getHeaderView(0);
mNickname = (TextView) v.findViewById(R.id.tv_name);
mSignature = (TextView) v.findViewById(R.id.tv_sign);
}
示例5: getUUID
/**
* 获取全局UUID
*
* @param context 上下文容器
* @return UUID
*/
public static String getUUID(Context context) {
String uuid = null;
SharedPreferences preferences =
PreferenceManager.getDefaultSharedPreferences(context);
if (preferences != null)
uuid = preferences.getString("uuid", "");
if (TextUtils.isEmpty(uuid)) {
uuid = UUID.randomUUID().toString();
if (preferences != null)
preferences.edit().putString("uuid", uuid).commit();
}
if (BuildConfig.DEBUG) Log.d(TAG, "getUUID : " + uuid); //DEBUG
return uuid;
}
示例6: onCreate
@Override
public void onCreate(final SQLiteDatabase db) {
db.execSQL(CREATE);
try {
addOrigin(db, new HttpOrigin("localhost", 80), "Manager (HTTP)", System.currentTimeMillis());
} catch (OriginDBException e) {
if (BuildConfig.DEBUG) {
Log.e("Origin", "error.");
}
}
}
示例7: onManagerEventTransmitDisconnected
@Override
protected void onManagerEventTransmitDisconnected(final String origin) {
if (BuildConfig.DEBUG) {
mLogger.info("Plug-in : onManagerEventTransmitDisconnected");
}
if (origin != null) {
EventManager.INSTANCE.removeEvents(origin);
} else {
EventManager.INSTANCE.removeAll();
}
}
示例8: onDevicePluginReset
@Override
protected void onDevicePluginReset() {
if (BuildConfig.DEBUG) {
mLogger.info("Plug-in : onDevicePluginReset");
}
resetPluginResource();
}
示例9: onCreate
@Override
public void onCreate() {
super.onCreate();
BlueteethManager.getInstance().initialize(this);
if (BuildConfig.DEBUG) {
Timber.plant(new DebugTree());
} else {
Timber.plant(new CrashReportingTree());
}
}
示例10: v
public static void v(final String tag, String message) {
// include logging only in debug versions
if (BuildConfig.DEBUG || mTesting) {
Log.v(tag, message);
}
}
示例11: onUpgrade
@Override
public final void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
if (oldVersion < LAST_DATABASE_NUKE_VERSION) {
if (BuildConfig.DEBUG) {
Timber.d(TAG + " Nuking Database. Old Version: " + oldVersion);
}
cupboard().withDatabase(db).dropAllTables();
onCreate(db);
} else {
// This will upgrade tables, adding columns and new tables.
// Note that existing columns will not be converted
cupboard().withDatabase(db).upgradeTables();
}
}
示例12: setVersionName
private void setVersionName() {
try {
PackageInfo pInfo = getActivity().getPackageManager().getPackageInfo(getActivity().getPackageName(), 0);
String versionNameText = pInfo.versionName;
if (BuildConfig.DEBUG) {
versionNameText += ".dev";
}
mVersionName.setText(getString(R.string.dialog_about_version, versionNameText));
} catch (PackageManager.NameNotFoundException e) {
mVersionName.setText(getString(R.string.dialog_about_unknown_version));
}
}
示例13: sendOAuthHTTPRequest
/**
* Login with OAuth utilities
*/
/*
* Login with OAuth requires the priming of "pending credentials" on the server to receive a secret
*/
private void sendOAuthHTTPRequest(String serviceName, String accessToken, String credentialToken, Response.Listener listener) {
RequestQueue queue = Volley.newRequestQueue(mContext);
String url = "http://" + getServerHostname() + ":" + getServerPort() + "/_oauth/" + serviceName + "/";
//as far as I know, Facebook is the only one that only returns a long-lived token on mobile login
String params;
if (accessTokenServices.contains(serviceName)) {
params = "?accessToken=" + accessToken + "&state=" + generateState(credentialToken);
} else {
params = "?code=" + accessToken + "&state=" + generateState(credentialToken);
}
StringRequest request = new StringRequest(Request.Method.GET, url + params,
listener, new Response.ErrorListener() {
@Override
public void onErrorResponse(VolleyError error) {
error.printStackTrace();
if (BuildConfig.DEBUG) {
log.debug("If you're getting a weird error, " +
"this could be because you haven't configured " +
"your server for ddp loginWithOAuth yet. " +
"For Facebook login, remove accounts-facebook " +
"and add jasperlu:accounts-facebook-ddp instead.");
}
}
});
queue.add(request);
}
示例14: generateState
private String generateState(String credentialToken) {
JSONObject json = new JSONObject();
try {
json.put("credentialToken", credentialToken);
json.put("loginStyle", "popup");
} catch(Exception e) {
log.warn(e.getMessage());
}
if (BuildConfig.DEBUG) {
log.debug(json.toString());
}
return Base64.encodeToString(json.toString().getBytes(), Base64.URL_SAFE|Base64.NO_WRAP|Base64.NO_PADDING);
}
示例15: d
public static void d(final String tag, String message) {
// include logging only in debug versions
if (BuildConfig.DEBUG || mTesting) {
Log.d(tag, message);
}
}