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


Java LocusUtils.LocusVersion方法代码示例

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


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

示例1: onItemClicked

import locus.api.android.utils.LocusUtils; //导入方法依赖的package包/类
@Override
protected void onItemClicked(int itemId, LocusUtils.LocusVersion activeLocus)
		throws Exception {
	if (itemId == 1) {
		SampleCalls.callSendOneTrack(getActivity());
	} else if (itemId == 2) {
		SampleCalls.callSendMultipleTracks(getActivity());
	} else if (itemId == 8) {
		ActionTools.actionStartNavigation(getActivity(),
				SampleCalls.generateWaypoint(1));
	} else if (itemId == 9) {
		ActionTools.actionStartNavigation(getActivity(),
				"Řipská 20, Praha 2, ČR");
	} else if (itemId == 20) {
		// start track recording. Recording profile "Cycle" is optional parameter. If
		// this parameter is not used, last used profile is used for recording.
		ActionTools.actionTrackRecordStart(getActivity(), activeLocus, "Car");
	} else if (itemId == 21) {
		ActionTools.actionTrackRecordStop(getActivity(), activeLocus, true);
	}
}
 
开发者ID:asamm,项目名称:locus-api,代码行数:22,代码来源:PageTracksFragment.java

示例2: getCount

import locus.api.android.utils.LocusUtils; //导入方法依赖的package包/类
/**
 * Compute count of existing field notes.
 * @param ctx existing context
 * @param lv active Locus version
 * @return number of existing field notes
 */
public static int getCount(Context ctx, LocusUtils.LocusVersion lv)
        throws RequiredVersionMissingException {
    // get parameters for query
    Uri cpUri = getUriFieldNoteTable(lv);

    // execute request
    Cursor c = null;
    try {
        c = ctx.getContentResolver().query(cpUri,
                new String[] {ColFieldNote.ID},
                null, null, null);
        if (c == null) {
            return 0;
        } else {
            return c.getCount();
        }
    } finally {
        Utils.closeQuietly(c);
    }
}
 
开发者ID:asamm,项目名称:locus-api,代码行数:27,代码来源:FieldNotesHelper.java

示例3: delete

import locus.api.android.utils.LocusUtils; //导入方法依赖的package包/类
/**
 * Delete field note specified by it's ID
 * @param ctx existing context
 * @param lv active Locus version
 * @param fieldNoteId ID of field note to delete
 * @return <code>true</code> if deleted successfully, otherwise <code>false</code>
 */
public static boolean delete(Context ctx, LocusUtils.LocusVersion lv, long fieldNoteId)
        throws RequiredVersionMissingException {
    // get parameters for query
    Uri cpUri = getUriFieldNoteTable(lv);

    // execute request
    int res = ctx.getContentResolver().delete(cpUri,
            ColFieldNote.ID + "=?",
            new String[] {Long.toString(fieldNoteId)}
    );

    // delete images
    deleteImages(ctx, lv, fieldNoteId);

    // return result
    return res == 1;
}
 
开发者ID:asamm,项目名称:locus-api,代码行数:25,代码来源:FieldNotesHelper.java

示例4: insert

import locus.api.android.utils.LocusUtils; //导入方法依赖的package包/类
/**
  * Simple insert of one field note
  * @param ctx existing context
  * @param lv active Locus version
  * @param gcFn field note that should be inserted.
  * @return <code>true</code> if insert was successful, otherwise false
  */
 public static boolean insert(Context ctx, LocusUtils.LocusVersion lv,
FieldNote gcFn) throws RequiredVersionMissingException {
     // get parameters for query
     Uri cpUri = getUriFieldNoteTable(lv);

     // create data container
     ContentValues cv = createContentValues(gcFn);

     // execute request
     Uri newRow = ctx.getContentResolver().insert(cpUri, cv);
     if (newRow != null) {
         // set new ID to field note
         gcFn.setId(Utils.parseLong(newRow.getLastPathSegment()));

         // insert also images
         storeAllImages(ctx, lv, gcFn);

         // return result
         return true;
     }
     return false;
 }
 
开发者ID:asamm,项目名称:locus-api,代码行数:30,代码来源:FieldNotesHelper.java

示例5: storeAllImages

import locus.api.android.utils.LocusUtils; //导入方法依赖的package包/类
/**************************************************/

    private static void storeAllImages(Context ctx, LocusUtils.LocusVersion lv, FieldNote fn)
            throws RequiredVersionMissingException {
        Iterator<FieldNoteImage> images = fn.getImages();
        while (images.hasNext()) {
            FieldNoteImage img = images.next();
            img.setFieldNoteId(fn.getId());

            // update or insert image
            if (img.getId() >= 0) {
                updateImage(ctx, lv, img);
            } else {
                insertImage(ctx, lv, img);
            }
        }
    }
 
开发者ID:asamm,项目名称:locus-api,代码行数:18,代码来源:FieldNotesHelper.java

示例6: getImage

import locus.api.android.utils.LocusUtils; //导入方法依赖的package包/类
public static FieldNoteImage getImage(Context ctx, LocusUtils.LocusVersion lv, long imgId)
        throws RequiredVersionMissingException {
    // get parameters for query
    Uri cpUri = getUriFieldNoteImagesTable(lv);
    cpUri = ContentUris.withAppendedId(cpUri, imgId);

    // execute request
    Cursor c = null;
    try {
        c = ctx.getContentResolver().query(cpUri,
                null, null, null, null);
        if (c == null || c.getCount() != 1) {
            return null;
        }

        // get 'all' notes and return first
        return createFieldNoteImages(c).get(0);
    } finally {
        Utils.closeQuietly(c);
    }
}
 
开发者ID:asamm,项目名称:locus-api,代码行数:22,代码来源:FieldNotesHelper.java

示例7: logOnline

import locus.api.android.utils.LocusUtils; //导入方法依赖的package包/类
/**
   * Log list of defined field notes online on Geocaching server.
   *
* @param ctx existing context
* @param lv active Locus version
* @param ids list of FieldNote id's that should be logged
* @param createLog <code>true</code> if we wants to create a log directly, or
*                  <code>false</code> if note should be posted into FieldNotes section
* @throws RequiredVersionMissingException error in case, LocusVersion is not valid
*/
  public static void logOnline(Context ctx, LocusUtils.LocusVersion lv,
          long[] ids, boolean createLog) throws RequiredVersionMissingException {
      // check parameters
      if (ctx == null || lv == null || ids == null || ids.length == 0) {
          throw new IllegalArgumentException("logOnline(" + ctx + ", " + lv + ", " + ids + "), " +
                  "invalid parameters");
      }

      // check version
      if (!lv.isVersionValid(LocusUtils.VersionCode.UPDATE_05)) {
          throw new RequiredVersionMissingException(LocusUtils.VersionCode.UPDATE_05);
      }

      // execute request
      Intent intent = new Intent(LocusConst.ACTION_LOG_FIELD_NOTES);
      intent.putExtra(LocusConst.INTENT_EXTRA_FIELD_NOTES_IDS, ids);
intent.putExtra(LocusConst.INTENT_EXTRA_FIELD_NOTES_CREATE_LOG, createLog);
      ctx.startActivity(intent);
  }
 
开发者ID:asamm,项目名称:locus-api,代码行数:30,代码来源:FieldNotesHelper.java

示例8: onUpdate

import locus.api.android.utils.LocusUtils; //导入方法依赖的package包/类
@Override
public void onUpdate(LocusUtils.LocusVersion locusVersion, UpdateContainer update) {
    ControlSmartWatch2 control = ControlSmartWatch2.getInstance();
    if (control != null) {
        control.onUpdate(update);
    }
}
 
开发者ID:asamm,项目名称:locus-addon-smartwatch2,代码行数:8,代码来源:PeriodicUpdatesReceiver.java

示例9: onItemClicked

import locus.api.android.utils.LocusUtils; //导入方法依赖的package包/类
@Override
protected void onItemClicked(int itemId, LocusUtils.LocusVersion activeLocus) throws Exception {
	switch (itemId) {
		case 1:
			SampleCalls.callSendOnePoint(getActivity());
			break;
		case 2:
			SampleCalls.callSendMorePoints(getActivity());
			break;
		case 3:
			SampleCalls.callSendOnePointWithIcon(getActivity());
			break;
		case 4:
			SampleCalls.callSendMorePointsWithIcons(getActivity());
			break;
		case 5:
			SampleCalls.callSendOnePointGeocache(getActivity());
			break;
		case 6:
			SampleCalls.callSendMorePointsGeocacheIntentMethod(getActivity());
			break;
		case 7:
			SampleCalls.callSendMorePointsGeocacheFileMethod(getActivity());
			break;
		case 8:
			SampleCalls.callSendOnePointWithCallbackOnDisplay(getActivity());
			break;
		case 9:
			SampleCalls.callRequestPointIdByName(getActivity(), activeLocus);
			break;
		case 10:
			SampleCalls.callRequestDisplayPointScreen(getActivity(), activeLocus, 3);
			break;
	}
}
 
开发者ID:asamm,项目名称:locus-api,代码行数:36,代码来源:PagePointsFragment.java

示例10: 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

示例11: loadPointsFromLocus

import locus.api.android.utils.LocusUtils; //导入方法依赖的package包/类
private static void loadPointsFromLocus(MainActivity act, LocusUtils.LocusVersion lv, long[] wptsIds) {
	if (wptsIds == null || wptsIds.length == 0) {
		Toast.makeText(act, "No points to load", Toast.LENGTH_SHORT).show();
		return;
	}

	for (long wptId : wptsIds) {
		try {
			Waypoint wpt = ActionTools.getLocusWaypoint(act, lv, wptId);
			if (wpt != null) {
				Logger.logD(TAG, "loadPointsFromLocus(), wptId:" + wptId + ", vs:" + wpt.id);
				// do some modifications
				wpt.addParameter(GeoDataExtra.PAR_DESCRIPTION, "UPDATED!");
				wpt.getLocation().setLatitude(wpt.getLocation().getLatitude() + 0.001);
				wpt.getLocation().setLongitude(wpt.getLocation().getLongitude() + 0.001);

				// update waypoint in Locus database
				if (ActionTools.updateLocusWaypoint(act, lv, wpt, false) == 1) {
					Toast.makeText(act, "Loaded and updated (" + wpt.getName() + ")",
							Toast.LENGTH_SHORT).show();
				} else {
					Toast.makeText(act, "Loaded, but problem with update (" + wpt.getName() + ")",
							Toast.LENGTH_SHORT).show();
				}
			} else {
				Toast.makeText(act, "Waypoint: " + wptId + ", not loaded", Toast.LENGTH_SHORT).show();
			}
		} catch (Exception e) {
			Logger.logE(TAG, "loadPointsFromLocus(" + wptsIds + ")", e);
		}
	}
}
 
开发者ID:asamm,项目名称:locus-api,代码行数:33,代码来源:MainActivityIntentHandler.java

示例12: deleteAll

import locus.api.android.utils.LocusUtils; //导入方法依赖的package包/类
/**
 * Delete all field notes in Locus
 * @param ctx existing context
 * @param lv active Locus version
 * @return number of deleted field notes
 */
public static int deleteAll(Context ctx, LocusUtils.LocusVersion lv)
        throws RequiredVersionMissingException {
    // get parameters for query
    Uri cpUri = getUriFieldNoteTable(lv);

    // execute request (logs and also images)
    int count = ctx.getContentResolver().delete(cpUri, null, null);
    deleteImagesAll(ctx, lv);
    return count;
}
 
开发者ID:asamm,项目名称:locus-api,代码行数:17,代码来源:FieldNotesHelper.java

示例13: update

import locus.api.android.utils.LocusUtils; //导入方法依赖的package包/类
/**
 * Update single field note define by it's ID
 * @param ctx existing context
 * @param lv active Locus version
 * @param gcFn field note, that should be updated
 * @return <code>true</code> if update was successful, otherwise false
 */
public static boolean update(Context ctx, LocusUtils.LocusVersion lv,
        FieldNote gcFn) throws RequiredVersionMissingException {
    // create data container
    ContentValues cv = createContentValues(gcFn);

    // execute request
    if (update(ctx, lv, gcFn, cv)) {
        storeAllImages(ctx, lv, gcFn);
        return true;
    } else {
        return false;
    }
}
 
开发者ID:asamm,项目名称:locus-api,代码行数:21,代码来源:FieldNotesHelper.java

示例14: insertImage

import locus.api.android.utils.LocusUtils; //导入方法依赖的package包/类
private static boolean insertImage(Context ctx, LocusUtils.LocusVersion lv, FieldNoteImage img)
        throws RequiredVersionMissingException {
    // get parameters for query
    Uri cpUri = getUriFieldNoteImagesTable(lv);

    // create data container
    ContentValues cv = createContentValues(img, true);

    // execute request
    Uri newRow = ctx.getContentResolver().insert(cpUri, cv);
    return newRow != null;
}
 
开发者ID:asamm,项目名称:locus-api,代码行数:13,代码来源:FieldNotesHelper.java

示例15: getImages

import locus.api.android.utils.LocusUtils; //导入方法依赖的package包/类
/**
 * Get attached images from database and add it to FieldNote object. Keep in mind,
 * that this function only grab images ID's, not whole content. So for later use,
 * you need to request specific image by 'getImage' function with it's ID.
 * @param ctx existing context
 * @param lv active Locus version
 * @param fn Field Note for which we wants images
 * @throws RequiredVersionMissingException
 */
private static void getImages(Context ctx, LocusUtils.LocusVersion lv, FieldNote fn)
        throws RequiredVersionMissingException {
    // get parameters for query
    Uri cpUri = getUriFieldNoteImagesTable(lv);

    // execute request
    Cursor c = null;
    try {
        // perform request based on 'cacheCode'
        c = ctx.getContentResolver().query(cpUri,
                new String[] {ColFieldNoteImage.ID},
                ColFieldNoteImage.FIELD_NOTE_ID + "=?",
                new String[] {Long.toString(fn.getId())},
                null);

        // handle result
        if (c != null) {
            List<FieldNoteImage> images = createFieldNoteImages(c);
            for (int i = 0, m = images.size(); i < m; i++) {
                fn.addImage(images.get(i));
            }
        }
    } finally {
        Utils.closeQuietly(c);
    }
}
 
开发者ID:asamm,项目名称:locus-api,代码行数:36,代码来源:FieldNotesHelper.java


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