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


Java LocusUtils.getActiveVersion方法代码示例

本文整理汇总了Java中locus.api.android.utils.LocusUtils.getActiveVersion方法的典型用法代码示例。如果您正苦于以下问题:Java LocusUtils.getActiveVersion方法的具体用法?Java LocusUtils.getActiveVersion怎么用?Java LocusUtils.getActiveVersion使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在locus.api.android.utils.LocusUtils的用法示例。


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

示例1: performLocusCheck

import locus.api.android.utils.LocusUtils; //导入方法依赖的package包/类
/**
 * Perform one time, single check and update of basic layout.
 */
private void performLocusCheck() {
    try {
        // read Locus info
        mLocusVersion = LocusUtils.getActiveVersion(mContext, MIN_LOCUS_MAP_VERSION);

        // check if object exists
        if (mLocusVersion == null) {
            mStartResult = StartTestResult.LOCUS_INVALID_01;
            return;
        }

        // handle info
        mLocusInfo = ActionTools.getLocusInfo(mContext, mLocusVersion);

        // load also track record profiles
        mTrackRecProfiles = ActionTools.getTrackRecordingProfiles(
                mContext, mLocusVersion);

        // set state of Locus
        mStartResult = StartTestResult.NO_PROBLEM;
    } catch (RequiredVersionMissingException e) {
        Logger.logE(TAG, "ControlSmartWatch2()", e);

        // clear data
        mLocusVersion = null;
        mStartResult = StartTestResult.LOCUS_INVALID_02;
    }

    // refresh layout
    refreshData();
}
 
开发者ID:asamm,项目名称:locus-addon-smartwatch2,代码行数:35,代码来源:ControlSmartWatch2.java

示例2: DeviceCommService

import locus.api.android.utils.LocusUtils; //导入方法依赖的package包/类
/**
 * Default constructor.
 *
 * @param ctx current context
 */
private DeviceCommService(Context ctx) {
	super(ctx);
	Logger.logD(TAG, "Device comm service started.");
	try {
		lv = LocusUtils.getActiveVersion(ctx);
		onUpdate(ActionTools.getDataUpdateContainer(ctx, lv));
	} catch (RequiredVersionMissingException e) {
		mLastUpdate = null;
	}
}
 
开发者ID:asamm,项目名称:locus-addon-wearables,代码行数:16,代码来源:DeviceCommService.java

示例3: loadTrackRecordProfiles

import locus.api.android.utils.LocusUtils; //导入方法依赖的package包/类
/**
 * @param ctx
 * @return A pair of lists. First lists contains track profiles and description.
 * Second list contains track profile icons. Both lists are the same lenght and order.
 */
private Pair<TrackProfileInfoValue.ValueList, TrackProfileIconValue.ValueList>
loadTrackRecordProfiles(Context ctx) {
	List<ActionTools.TrackRecordProfileSimple> trackRecProfiles = null;

	try {
		// read Locus info
		LocusUtils.LocusVersion lv = LocusUtils.getActiveVersion(
				ctx, DeviceCommService.this.lv.getVersionCode());

		// check if object exists
		if (lv != null) {
			// load also track record profiles
			trackRecProfiles = ActionTools.getTrackRecordingProfiles(
					ctx, lv);
		}
	} catch (RequiredVersionMissingException e) {
		Logger.logE(TAG, "loadTrackRecordProfiles()", e);

		// clear data
		trackRecProfiles = null;
	}

	Pair<TrackProfileInfoValue.ValueList, TrackProfileIconValue.ValueList> result =
			new Pair<>(new TrackProfileInfoValue.ValueList(), new TrackProfileIconValue.ValueList());

	if (trackRecProfiles != null && !trackRecProfiles.isEmpty()) {
		ArrayList<TrackProfileInfoValue> profiles = new ArrayList<>(trackRecProfiles.size());
		ArrayList<TrackProfileIconValue> icons = new ArrayList<>(trackRecProfiles.size());
		for (ActionTools.TrackRecordProfileSimple profile : trackRecProfiles) {
			profiles.add(new TrackProfileInfoValue(profile));
			icons.add(new TrackProfileIconValue(profile));
		}
		result.first.setStorables(profiles);
		result.second.setStorables(icons);
	}
	return result;
}
 
开发者ID:asamm,项目名称:locus-addon-wearables,代码行数:43,代码来源:DeviceCommService.java

示例4: computeTrack

import locus.api.android.utils.LocusUtils; //导入方法依赖的package包/类
@Override
public ParcelableContainer computeTrack(ParcelableContainer trackParams) throws RemoteException {
    try {
        // get track parameters from container
        byte[] containerData = trackParams.getData();
        ComputeTrackParameters params = new ComputeTrackParameters(containerData);

        // get active running Locus
        LocusUtils.LocusVersion lv = LocusUtils.getActiveVersion(ComputeTrackService.this);
        if (lv == null) {
            Logger.logW(TAG, "Problem with finding running Locus instance");
            return null;
        }

        // compute track itself
        Track track = ComputeTrackService.this.computeTrack(lv, params);
        if (track != null) {
            return new ParcelableContainer(track.getAsBytes());
        } else {
            return null;
        }
    } catch (Exception e) {
        Logger.logE(TAG, "computeTrack(" + trackParams + ")", e);
        return null;
    }

}
 
开发者ID:asamm,项目名称:locus-api,代码行数:28,代码来源:ComputeTrackService.java

示例5: sendData

import locus.api.android.utils.LocusUtils; //导入方法依赖的package包/类
static boolean sendData(String action, Context ctx, Intent intent,
		boolean callImport, boolean center, VersionCode vc) throws RequiredVersionMissingException {
	// get valid version
	LocusVersion lv = LocusUtils.getActiveVersion(ctx, vc);
	if (lv == null) {
		throw new RequiredVersionMissingException(vc.vcFree);
	}
	
	// check intent firstly
	if (!hasData(intent)) {
		Logger.logW(TAG, "Intent 'null' or not contain any data");
		return false;
	}
	
	// create intent with right calling method
	intent.setAction(action);

	// set centering tag
	intent.putExtra(LocusConst.INTENT_EXTRA_CENTER_ON_DATA, center);
	
	// set import tag
	if (action.equals(LocusConst.ACTION_DISPLAY_DATA_SILENTLY)) {
		// send broadcast
		LocusUtils.sendBroadcast(ctx, intent, lv);
	} else {
		// set import tag
		intent.putExtra(LocusConst.INTENT_EXTRA_CALL_IMPORT, callImport);
		// finally start activity
		ctx.startActivity(intent);
	}
	
	return true;
}
 
开发者ID:asamm,项目名称:locus-api,代码行数:34,代码来源:ActionDisplay.java

示例6: handleUpdate

import locus.api.android.utils.LocusUtils; //导入方法依赖的package包/类
/**
 * Handle fresh data.
 * @param data received data
 */
private void handleUpdate(UpdateContainer data) {
	// check if data exists
	if (data == null) {
		LocusVersion activeVersion = LocusUtils.getActiveVersion(this);

		// prepare text info
		StringBuilder sb = new StringBuilder();
		sb.append("UpdateContainer not valid\n\n");
		sb.append("- active version: ").
				append(activeVersion.getVersionName()).
				append(" | ").
				append(activeVersion.getVersionCode()).
				append("\n");
		sb.append("- Locus Map is running: ").
				append(SampleCalls.isRunning(this, activeVersion) ? "running" : "stopped").
				append("\n");
		sb.append("- periodic updates: ").
				append(SampleCalls.isPeriodicUpdateEnabled(this, activeVersion) ? "enabled" : "disabled").
				append("\n");

		// set text to field
		tvInfo.setText(sb);
		return;
	}
	
	// refresh content
	tvInfo.setText("Fresh data received at " +
			SimpleDateFormat.getTimeInstance().format(new Date()));
	tv01.setText(String.valueOf(data.getLocMyLocation().getLatitude()));
	tv02.setText(String.valueOf(data.getLocMyLocation().getLongitude()));
	tv03.setText(String.valueOf(data.getGpsSatsUsed()));
	tv04.setText(String.valueOf(data.getGpsSatsAll()));
	tv05.setText(String.valueOf(data.isMapVisible()));
	tv06.setText(String.valueOf(data.getLocMyLocation().getAccuracy()));
	tv07.setText(String.valueOf(data.getLocMyLocation().getBearing()));
	tv08.setText(String.valueOf(data.getLocMyLocation().getSpeed()));
}
 
开发者ID:asamm,项目名称:locus-api,代码行数:42,代码来源:ActivityDashboard.java

示例7: setOnUpdateListener

import locus.api.android.utils.LocusUtils; //导入方法依赖的package包/类
/**
 * Register listener for an updates.
 * @param ctx current context
 * @param onUpdateListener listener
 * @throws RequiredVersionMissingException exception in case of invalid Locus Map app
 */
public static void setOnUpdateListener(Context ctx, PeriodicUpdatesHandler.OnUpdate onUpdateListener)
		throws RequiredVersionMissingException {
	// register listener
	mOnUpdateListener = onUpdateListener;

	// enable/disable receiver
	LocusVersion lv = LocusUtils.getActiveVersion(ctx);
	if (mOnUpdateListener != null) {
		ActionTools.enablePeriodicUpdatesReceiver(ctx, lv, PeriodicUpdateReceiver.class);
	} else {
		ActionTools.disablePeriodicUpdatesReceiver(ctx, lv, PeriodicUpdateReceiver.class);
	}
}
 
开发者ID:asamm,项目名称:locus-api,代码行数:20,代码来源:PeriodicUpdateReceiver.java


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