本文整理汇总了Java中locus.api.utils.Logger类的典型用法代码示例。如果您正苦于以下问题:Java Logger类的具体用法?Java Logger怎么用?Java Logger使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Logger类属于locus.api.utils包,在下文中一共展示了Logger类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: callSendOnePointWithCallbackOnDisplay
import locus.api.utils.Logger; //导入依赖的package包/类
/**
* Display single point with special "onClick" event. Such point when shown, will call back to this application.
* You may use this for loading extra data. So you send simple point and when show, you display extra information.
* @param ctx current context
* @throws RequiredVersionMissingException exception in case of missing required app version
*/
public static void callSendOnePointWithCallbackOnDisplay(Context ctx) throws RequiredVersionMissingException {
// prepare data
PackWaypoints pd = new PackWaypoints("test2");
Waypoint p = generateWaypoint(0);
p.setExtraOnDisplay(
"com.asamm.locus.api.sample",
"com.asamm.locus.api.sample.MainActivity",
EXTRA_ON_DISPLAY_ACTION_ID,
"id01");
pd.addWaypoint(p);
// send point
boolean send = ActionDisplayPoints.sendPack(ctx, pd, ExtraAction.CENTER);
Logger.logD(TAG, "callSendOnePointWithCallbackOnDisplay(), " +
"send:" + send);
}
示例2: refreshMapView
import locus.api.utils.Logger; //导入依赖的package包/类
/**
* Refreshes map image view
*/
private void refreshMapView(MapContainer data) {
if (data != null && data.getLoadedMap() != null && data.getLoadedMap().getImage() != null) {
Bitmap map = data.getLoadedMap().getImage();
if (INVERT_MAP_IN_AMBIENT && isAmbient()) {
Bitmap bm = getMapAmbientBitmap(map.getWidth(), map.getHeight());
Canvas c = new Canvas(bm);
Paint paintInvertImage = new Paint();
paintInvertImage.setColorFilter(new ColorMatrixColorFilter(getInvertColorMatrix()));
c.drawBitmap(map, 0, 0, paintInvertImage);
mMapView.setImageBitmap(bm);
} else {
mMapView.setImageDrawable(new BitmapDrawable(getResources(), map));
}
if (data.getZoomWear() == mRequestedZoom && mIsScaled) {
mMapView.animate().cancel();
mMapView.setScaleX(1f);
mMapView.setScaleY(1f);
mZoomLock = false;
mIsScaled = false;
}
} else {
Logger.logE(TAG, (data == null ? "data" : data.getLoadedMap() == null ?
"data.loadedMap" : "data.loadedMap.image") + " is null.");
}
}
示例3: onActivityResult
import locus.api.utils.Logger; //导入依赖的package包/类
@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
if (requestCode == TrackRecordProfileSelectLayout.PICK_PROFILE_REQUEST && resultCode == Activity.RESULT_OK) {
byte[] profileBytes = data.getByteArrayExtra(ProfileListActivity.RESULT_PROFILES);
try {
mProfileSelect.setParameters(new TrackProfileInfoValue(profileBytes));
AppPreferencesManager.persistLastTrackRecProfile(this, mProfileSelect.getProfile());
} catch (IOException e) {
Logger.logE("TAG", "empty profile bytes", e);
}
} else {
// refresh profile select even after canceled -> force refresh icon
mProfileSelect.setParameters(mProfileSelect.getProfile());
}
}
示例4: destroyInstance
import locus.api.utils.Logger; //导入依赖的package包/类
/**
* Destroy instance of receiver.
*
* @param ctx current context
*/
static void destroyInstance(Context ctx) {
synchronized (TAG) {
final DeviceCommService s = mInstance;
if (s != null) {
s.mAboutToBeDestroyed = true;
s.destroy();
// disable watch periodic data timer
s.destroyPeriodicDataTimer();
// disable receiver
Logger.logD(TAG, "Destroying device comm instance");
PeriodicUpdatesReceiver.disableReceiver(ctx);
mInstance = null;
}
}
}
示例5: loadHandShake
import locus.api.utils.Logger; //导入依赖的package包/类
/**
* Load basic data from current Locus application.
*/
private HandShakeValue loadHandShake(Context ctx) {
LocusInfo locusInfo = null;
try {
// check if object exists
if (lv != null) {
// handle info
locusInfo = ActionTools.getLocusInfo(ctx, lv);
}
} catch (RequiredVersionMissingException e) {
Logger.logE(TAG, "loadHandShake", e);
// clear data
locusInfo = null;
}
// prepare container with data and send it
HandShakeValue value = lv == null ?
new HandShakeValue() :
new HandShakeValue(lv.getVersionCode(),
locusInfo != null && locusInfo.isRunning(),
locusInfo != null && locusInfo.isPeriodicUpdatesEnabled());
return value;
}
示例6: loadTrackRecordingValue
import locus.api.utils.Logger; //导入依赖的package包/类
private TrackRecordingValue loadTrackRecordingValue(Context ctx) {
boolean infoAvailable = mLastUpdate != null;
boolean myLocAvailable = infoAvailable && mLastUpdate.getLocMyLocation() != null;
boolean trackRec = infoAvailable && mLastUpdate.isTrackRecRecording();
boolean trackRecPause = infoAvailable && mLastUpdate.isTrackRecPaused();
String profileName = infoAvailable ? mLastUpdate.getTrackRecProfileName() : "";
Float speed = myLocAvailable ? mLastUpdate.getLocMyLocation().getSpeed() : null;
TrackStats stats = infoAvailable ? mLastUpdate.getTrackRecStats() : null;
LocusInfo locusInfo = null;
try {
locusInfo = ActionTools.getLocusInfo(ctx, lv);
} catch (RequiredVersionMissingException e) {
Logger.logW(TAG, "Missing required version, current version " + lv);
}
TrackRecordingValue trv = new TrackRecordingValue(infoAvailable, trackRec, trackRecPause,
profileName, stats, locusInfo, new TrackRecordingValue.ExtendedTrackInfo(speed));
return trv;
}
示例7: readObject
import locus.api.utils.Logger; //导入依赖的package包/类
@Override
protected void readObject(int version, DataReaderBigEndian dr) throws IOException {
super.readObject(version, dr);
mPeriodicActivityId = dr.readBytes(1)[0];
mPeriodMs = dr.readInt();
if (dr.readBoolean()) {
try {
if (mPeriodicActivityId == IDX_PERIODIC_MAP) {
mExtra = (MapPeriodicParams) dr.readStorable(MapPeriodicParams.class);
} else {
mExtra = (TimeStampStorable) dr.readStorable(TimeStampStorable.class);
}
} catch (Exception e) {
Logger.logE(TAG, "Failed to instantiate extra data.", e);
mExtra = null;
}
} else {
mExtra = null;
}
}
示例8: readObject
import locus.api.utils.Logger; //导入依赖的package包/类
@Override
protected void readObject(int version, DataReaderBigEndian dr) throws IOException {
super.readObject(version, dr);
mGuideType = dr.readBytes(1)[0];
mNavPointAction1Id = dr.readInt();
mNavPointAction2Id = dr.readInt();
mNavPoint1Dist = dr.readDouble();
mUnitsFormatLength = dr.readBytes(1)[0];
mZoomDevice = dr.readBytes(1)[0];
mZoomWear = dr.readBytes(1)[0];
mStatus = dr.readBytes(1)[0];
boolean isMap = dr.readBoolean();
try {
mLoadedMap = isMap ? (ActionTools.BitmapLoadResult) dr.readStorable(ActionTools.BitmapLoadResult.class) : null;
} catch (Exception e) {
mLoadedMap = null;
Logger.logE(TAG, "Could not read map image.", e);
}
}
示例9: sendTrack
import locus.api.utils.Logger; //导入依赖的package包/类
private static boolean sendTrack(String action, Context context, Track track,
boolean callImport, boolean centerOnData, boolean startNavigation)
throws RequiredVersionMissingException {
// check track
if (track == null || track.getPoints().size() == 0) {
Logger.logE(TAG, "sendTrack(" + action + ", " + context + ", " + track + ", " +
callImport + ", " + centerOnData + ", " + startNavigation + "), " +
"track is null or contain no points");
return false;
}
// create and start intent
Intent intent = new Intent();
intent.putExtra(LocusConst.INTENT_EXTRA_TRACKS_SINGLE, track.getAsBytes());
intent.putExtra(LocusConst.INTENT_EXTRA_START_NAVIGATION, startNavigation);
return sendData(action, context, intent, callImport, centerOnData);
}
示例10: getBitmap
import locus.api.utils.Logger; //导入依赖的package包/类
public static byte[] getBitmap(Bitmap bitmap, Bitmap.CompressFormat format) {
ByteArrayOutputStream baos = null;
try {
baos = new ByteArrayOutputStream();
// create compressed byte array. Value 80 is used for JPEG. PNG format ignore this value
if (bitmap.compress(format, 80, baos)) {
return baos.toByteArray();
} else {
Logger.logW(TAG, "Problem with converting image to byte[]");
return null;
}
} catch (Exception e) {
Logger.logE(TAG, "getBitmap(" + bitmap + ")", e);
return null;
} finally {
locus.api.utils.Utils.closeStream(baos);
}
}
示例11: createLocusVersion
import locus.api.utils.Logger; //导入依赖的package包/类
/**
* Get LocusVersion for specific, known packageName. This method should not be used
* in common work-flow. Better is receive list of versions and pick correct, or create
* LocusVersion from received intent.
* @param ctx current context
* @param packageName Locus package name
* @return generated Locus version
*/
public static LocusVersion createLocusVersion(Context ctx, String packageName) {
try {
// check package name
if (packageName == null || packageName.length() == 0 ||
!packageName.startsWith("menion.android.locus")) {
return null;
}
// get information about version
PackageManager pm = ctx.getPackageManager();
PackageInfo info = pm.getPackageInfo(packageName, 0);
if (info == null) {
return null;
}
// finally add item to list
return new LocusVersion(packageName, info.versionName, info.versionCode);
} catch (Exception e) {
Logger.logE(TAG, "getLocusVersion(" + ctx + ", " + packageName + ")", e);
return null;
}
}
示例12: setLatitude
import locus.api.utils.Logger; //导入依赖的package包/类
/**
* Sets the latitude of this fix.
* @param lat latitude value (in degrees)
* @return current object
*/
public Location setLatitude(double lat) {
// perform checks on range
if (lat < -90.0 ) {
Logger.logE(TAG, "setLatitude(" + lat + "), " +
"invalid latitude"); //, new Exception(""));
lat = -90.0;
} else if (lat > 90.0) {
Logger.logE(TAG, "setLatitude(" + lat + "), " +
"invalid latitude"); //, new Exception(""));
lat = 90.0;
}
// set value
this.latitude = lat;
return this;
}
示例13: getLocusInfo
import locus.api.utils.Logger; //导入依赖的package包/类
/**
* Return complete information about required LocusVersion. LocusInfo object
* contains all main parameters of existing Locus installation, together with
* some user preferences etc. More in LocusInfo object
* @param ctx current context
* @param lv version of Locus that's asked
* @return {@link LocusInfo} object or <code>null</code> if problem happen. It's
* always required to check that return value is correct!
* @throws RequiredVersionMissingException if Locus in required version is missing
*/
public static LocusInfo getLocusInfo(Context ctx, LocusVersion lv)
throws RequiredVersionMissingException {
// get scheme if valid Locus is available
Uri scheme = getProviderUriData(lv, VersionCode.UPDATE_01,
LocusConst.CONTENT_PROVIDER_PATH_INFO);
// get data
Cursor cursor = null;
try {
cursor = queryData(ctx, scheme, null);
if (cursor == null || !cursor.moveToFirst()) {
return null;
}
// return info container
return LocusInfo.create(cursor);
} catch (Exception e) {
Logger.logE(TAG, "getLocusInfo(" + ctx + ", " + lv + ")", e);
} finally {
Utils.closeQuietly(cursor);
}
return null;
}
示例14: getDataLocusInfo
import locus.api.utils.Logger; //导入依赖的package包/类
/**
* Get LocusInfo container with various Locus app parameters.
* @param ctx current context
* @param lv required Locus version
* @return loaded info container or 'null' in case of problem
* @throws RequiredVersionMissingException if Locus in required version is missing
*/
public static LocusInfo getDataLocusInfo(Context ctx, LocusVersion lv)
throws RequiredVersionMissingException {
// get scheme if valid Locus is available
Uri scheme = getProviderUriData(lv, VersionCode.UPDATE_13,
LocusConst.CONTENT_PROVIDER_PATH_DATA + "/" + LocusConst.VALUE_LOCUS_INFO);
// execute action
Cursor cursor = null;
try {
byte[] data = queryData(ctx, scheme, null, LocusConst.VALUE_LOCUS_INFO);
if (data != null && data.length > 0) {
return new LocusInfo(data);
}
} catch (Exception e) {
Logger.logE(TAG, "getDataLocusInfo(" + ctx + ", " + lv + ")", e);
}
return null;
}
示例15: setIconStyleHotSpot
import locus.api.utils.Logger; //导入依赖的package包/类
public void setIconStyleHotSpot(int hotspot) {
if (iconStyle == null) {
Logger.logW(TAG, "setIconStyleHotSpot(" + hotspot + "), " +
"initialize IconStyle before settings hotSpot!");
return;
}
if (hotspot == HOTSPOT_TOP_LEFT) {
iconStyle.hotSpot = new KmlVec2(
0.0f, KmlVec2.Units.FRACTION, 1.0f, KmlVec2.Units.FRACTION);
} else if (hotspot == HOTSPOT_CENTER_CENTER) {
iconStyle.hotSpot = new KmlVec2(
0.5f, KmlVec2.Units.FRACTION, 0.5f, KmlVec2.Units.FRACTION);
} else {
// hotspot == HOTSPOT_BOTTOM_CENTER
iconStyle.hotSpot = generateDefaultHotSpot();
}
}