Example #1
0
 /**
  * Launch intend for result.
  *
  * @param activity the parent activiuty.
  * @param image the image to use.
  * @param gpsLocation the position.
  * @param requestCode the return code.
  */
 public static void launchForResult(
     Activity activity, File image, double[] gpsLocation, int requestCode) {
   if (MarkersUtilities.appInstalled(activity)) {
     Intent sketchIntent = prepareIntent(activity, image, gpsLocation);
     activity.startActivityForResult(sketchIntent, requestCode);
   } else {
     MarkersUtilities.openMarketToInstall(activity);
   }
 }
Example #2
0
 /**
  * Opens Marker in new sketch mode, supplying a file to save to.
  *
  * <p>
  *
  * <p>If position data are supplied, they should be used to create a properties file.
  *
  * @param fragmentDetail the fragmentDetail to use.
  * @param image the image file to save to.
  * @param gpsLocation the position of the sketch or <code>null</code>.
  * @param requestCode if > 0, then the activity is started for a result (in which case the Context
  *     needs to be an activity..
  */
 public static void launch(
     FragmentDetail fragmentDetail, File image, double[] gpsLocation, int requestCode) {
   FragmentActivity activity = fragmentDetail.getActivity();
   if (MarkersUtilities.appInstalled(activity)) {
     Intent sketchIntent = prepareIntent(activity, image, gpsLocation);
     if (requestCode < 0) {
       fragmentDetail.startActivity(sketchIntent);
     } else {
       fragmentDetail.startActivityForResult(sketchIntent, requestCode);
     }
   } else {
     MarkersUtilities.openMarketToInstall(activity);
   }
 }
Example #3
0
 /**
  * Opens Marker in new sketch mode, supplying a file to save to.
  *
  * <p>
  *
  * <p>If position data are supplied, they should be used to create a properties file.
  *
  * @param context the context to use.
  * @param image the image file to save to.
  * @param gpsLocation the position of the sketch or <code>null</code>.
  * @param requestCode if > 0, then the activity is started for a result (in which case the Context
  *     needs to be an activity..
  */
 public static void launch(Context context, File image, double[] gpsLocation, int requestCode) {
   if (MarkersUtilities.appInstalled(context)) {
     Intent sketchIntent = prepareIntent(context, image, gpsLocation);
     if (requestCode < 0) {
       context.startActivity(sketchIntent);
     } else {
       if (context instanceof Activity) {
         Activity activity = (Activity) context;
         activity.startActivityForResult(sketchIntent, requestCode);
       }
     }
   } else {
     MarkersUtilities.openMarketToInstall(context);
   }
 }
Example #4
0
 /**
  * Launches Marker in edit mode on a given image, saving over the same image.
  *
  * @param context the context to use.
  * @param image the image to edit and save to.
  */
 public static void launchOnImage(final Context context, File image) {
   if (MarkersUtilities.appInstalled(context)) {
     Intent sketchIntent = null;
     if (MARKERS_IS_INTEGRATED) {
       try {
         sketchIntent = new Intent(context, Class.forName(APP_MAIN_ACTIVITY));
       } catch (ClassNotFoundException e) {
         throw new RuntimeException(e);
       }
     } else {
       sketchIntent = new Intent();
     }
     sketchIntent.setAction(ACTION_EDIT);
     sketchIntent.setDataAndType(Uri.fromFile(image), "image/*"); // $NON-NLS-1$
     sketchIntent.putExtra(MarkersUtilities.EXTRA_KEY, image.getAbsolutePath());
     context.startActivity(sketchIntent);
   } else {
     MarkersUtilities.openMarketToInstall(context);
   }
 }