當前位置: 首頁>>代碼示例>>Java>>正文


Java Result類代碼示例

本文整理匯總了Java中com.moodstocks.android.Result的典型用法代碼示例。如果您正苦於以下問題:Java Result類的具體用法?Java Result怎麽用?Java Result使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


Result類屬於com.moodstocks.android包,在下文中一共展示了Result類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: onResult

import com.moodstocks.android.Result; //導入依賴的package包/類
@Override
  public void onResult(Result result) {
  	//ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();  
  	//resultFrame.compress(Bitmap.CompressFormat.PNG, 80, byteArrayOutputStream);
  	//byte[] byteArray = byteArrayOutputStream .toByteArray();
  	//String encodedFrame = Base64.encodeToString(byteArray, Base64.DEFAULT);
  	
JSONObject obj = new JSONObject();
try {
	obj.put("format", result.getType() == Result.Type.IMAGE ? "Image" : "Barcode");
	obj.put("value", result.getValue());
	//obj.put("recognisedFrame", encodedFrame);
} catch (JSONException e) {
	e.printStackTrace();
}
 	
  	MS4Plugin.scanSuccess(obj);
  }
 
開發者ID:thomasforth,項目名稱:MS4Plugin,代碼行數:19,代碼來源:AutoScanFragment.java

示例2: onResult

import com.moodstocks.android.Result; //導入依賴的package包/類
@Override
public void onResult(Result result, Bitmap bitmap) {
	if (result != null) {		
		JSONObject obj = new JSONObject();
		try {
			obj.put("format", result.getType() == Result.Type.IMAGE ? "Image" : "Barcode");
			obj.put("value", result.getValue());
		} catch (JSONException e) {
			e.printStackTrace();
		}
		
		MS4Plugin.scanSuccess(obj);
	} else {
		MS4Plugin.scanNoResult();
	}
	// by default the ManualScanner pauses after it gets a result. This seems odd so I restart it immediately.
	resumeScan();
}
 
開發者ID:thomasforth,項目名稱:MS4Plugin,代碼行數:19,代碼來源:ManualScanFragment.java

示例3: run

import com.moodstocks.android.Result; //導入依賴的package包/類
/**
 * <i>Runnable method</i>
 */
@Override
public void run() {
  if (!cancelled) {
    startMessage();
    Result r = null;
    MoodstocksError err = null;
    try {
      r = search(Scanner.get(), qry);
    } catch (MoodstocksError e) {
      err = e;
    }
    qry.release();
    endMessage(r, err);
  }
  else
    qry.release();
}
 
開發者ID:kenhkan,項目名稱:TiMoodstocks-Android,代碼行數:21,代碼來源:ApiSearch.java

示例4: handleMessage

import com.moodstocks.android.Result; //導入依賴的package包/類
/**
 * <i>Internal message passing utility</i>
 */
@Override
public void handleMessage(Message msg) {
  Listener l = listener.get();

  switch(msg.what) {

    case MsgCode.SUCCESS:
      if (l != null)
        l.onScanComplete((Result)msg.obj);
      break;

    case MsgCode.FAILED:
      if (l != null)
        l.onScanFailed((MoodstocksError)msg.obj);
      break;

    default:
      break;

  }

}
 
開發者ID:kod3r,項目名稱:moodstocks-vuforia-android-demo-app,代碼行數:26,代碼來源:ScannerManager.java

示例5: scan

import com.moodstocks.android.Result; //導入依賴的package包/類
private void scan(byte[] data) {
  Result result = null;
  MoodstocksError error = null;
  int ori = OrientationListener.Orientation.UP;
  try {
    if (useDeviceOrientation)
      ori = OrientationListener.get().getOrientation();
    result = scan(new Image(data, img_w, img_h, img_stride, ori));
  } catch (MoodstocksError e) {
    error = e;
  }
  if (error != null) {
    manager.obtainMessage(MsgCode.FAILED, error).sendToTarget();
  }
  else {
    manager.obtainMessage(MsgCode.SUCCESS, result).sendToTarget();
  }
}
 
開發者ID:kod3r,項目名稱:moodstocks-vuforia-android-demo-app,代碼行數:19,代碼來源:ScannerManager.java

示例6: onScanComplete

import com.moodstocks.android.Result; //導入依賴的package包/類
@Override
public void onScanComplete(Result result) {
   if (result!=null) {
     HashMap data = new HashMap();
     data.put("value", result.getValue());
     fireEvent("scanHasCompleted", data);
   }
}
 
開發者ID:kenhkan,項目名稱:TiMoodstocks-Android,代碼行數:9,代碼來源:ScannerView.java

示例7: onApiSearchComplete

import com.moodstocks.android.Result; //導入依賴的package包/類
@Override
public void onApiSearchComplete(Result result) {
   if (result!=null) {
     HashMap data = new HashMap();
     data.put("value", result.getValue());
     fireEvent("searchHasCompleted", data);
   }
}
 
開發者ID:kenhkan,項目名稱:TiMoodstocks-Android,代碼行數:9,代碼來源:ScannerView.java

示例8: onResume

import com.moodstocks.android.Result; //導入依賴的package包/類
protected void onResume()
{
  super.onResume();

  // QCAR-specific resume operation
  QCAR.onResume();

  // Start Moodstocks Scanner
  scan_manager.setExtras(Result.Extra.HOMOGRAPHY | Result.Extra.DIMENSIONS);
  scan_manager.resume();
}
 
開發者ID:kod3r,項目名稱:moodstocks-vuforia-android-demo-app,代碼行數:12,代碼來源:Main.java

示例9: doInBackground

import com.moodstocks.android.Result; //導入依賴的package包/類
@Override
protected Texture doInBackground(Result...rs) {
  r = rs[0];
  if (_mode == Mode.ID)
    return Texture.textureFromText(stringToDisplay(r), r.getDimensions());
  else
    return Texture.borders(r.getDimensions());
}
 
開發者ID:kod3r,項目名稱:moodstocks-vuforia-android-demo-app,代碼行數:9,代碼來源:ResultManager.java

示例10: ApiSearchMsg

import com.moodstocks.android.Result; //導入依賴的package包/類
private ApiSearchMsg(Result r, MoodstocksError e) {
  super();
  this.result = r;
  this.error = e;
}
 
開發者ID:kenhkan,項目名稱:TiMoodstocks-Android,代碼行數:6,代碼來源:ApiSearch.java

示例11: onScanComplete

import com.moodstocks.android.Result; //導入依賴的package包/類
/** {@link ScannerManager.Listener} implementation */
@Override
public void onScanComplete(Result result) {
  manager.newResult(result);
  requireNewFrame();
}
 
開發者ID:kod3r,項目名稱:moodstocks-vuforia-android-demo-app,代碼行數:7,代碼來源:Main.java

示例12: newResult

import com.moodstocks.android.Result; //導入依賴的package包/類
/**
 * Handles a new {@link com.moodstocks.android.Result}
 * <p>
 * Switching to Build mode and creating a new target cannot be done
 * at the same time, as the native part of the code is scheduled by the
 * camera frames. The idea here is that if we find a new result, we 
 * switch to build mode, then if the next frame still matches this new
 * result, the target is built.
 * @param result the result 
 */
public void newResult(Result result) {
  // first case: result is null
  if (result == null) {
    // if we were currently expecting a result, reset it and exit building mode.
    if (_expected != null)  {
      _expected = null;
      parent.stopBuildingMode();
    }
    return;
  }
  // second case: result is non-null
  // is it the result currently being tracked? If yes, ignore.
  if (result.equals(_tracked))
    return;
  // non null result while we were expecting one.
  if (_expected != null) {
    // it's the second time we meet this result, so we're already in building mode
    if (result.equals(_expected)) {
      // try building:
      float homog[] = new float[9];
      result.getHomography().getValues(homog);
      // Reminder: for now we can't display 3D-models, we choose to display the texture on a simple plane.
      // Scale this plane so it fits the whole reference image:
      int dims[] = result.getDimensions();
      float scale[] = {1.0f, 1.0f, 1.0f};
      if (dims[0] > dims[1]) scale[0] *= ((float)dims[0])/dims[1];
      if (dims[0] < dims[1]) scale[1] *= ((float)dims[1])/dims[0];
      if (parent.tryBuild(result.getValue(), homog, dims, null, _default, scale)) {
        new TextureUpdater().execute(result);
        _tracked = _expected;
        _expected = null;
      }
    }
    // it's a new result: replace previous expected result.
    else {
      _expected = result;
      parent.startBuildingMode();    
    }
  }
  // it's a new result: store it as expected result.
  else {
    _expected = result;
    parent.startBuildingMode();
  }
}
 
開發者ID:kod3r,項目名稱:moodstocks-vuforia-android-demo-app,代碼行數:56,代碼來源:ResultManager.java

示例13: endMessage

import com.moodstocks.android.Result; //導入依賴的package包/類
/**
 * Used to send the {@link com.moodstocks.android.Scanner.ApiSearchListener#onApiSearchComplete(Result)} 
 * and {@link com.moodstocks.android.Scanner.ApiSearchListener#onApiSearchFailed(MoodstocksError)} callbacks from the thread.
 * @param r   The {@link Result} found by the ApiSearch, if any.
 * @param e   The {@link MoodstocksError} returned by the ApiSearch, if any.
 */
private void endMessage(Result r, MoodstocksError e) {
  Message.obtain(this, MsgCode.END, new ApiSearchMsg(r, e)).sendToTarget();
}
 
開發者ID:kenhkan,項目名稱:TiMoodstocks-Android,代碼行數:10,代碼來源:ApiSearch.java

示例14: search

import com.moodstocks.android.Result; //導入依賴的package包/類
/**
 * Native function performing the actual ApiSearch synchronously.
 * <p>
 * This function is blocking and should be run asynchronously. 
 * @param s     The {@link Scanner} currently in use.
 * @param qry   The {@link Image} to use as a query.
 * @return      The found {@link Result} if any, null otherwise.
 * @throws MoodstocksError  if any error occurs during the operation.
 */
private native Result search(Scanner s, Image qry)
    throws MoodstocksError;
 
開發者ID:kenhkan,項目名稱:TiMoodstocks-Android,代碼行數:12,代碼來源:ApiSearch.java

示例15: onScanComplete

import com.moodstocks.android.Result; //導入依賴的package包/類
/**
 * Notifies the listener that a scan has ended.
 * @param result the {@link com.moodstocks.android.Result} if any, null otherwise.
 */
public void onScanComplete(Result result);
 
開發者ID:kod3r,項目名稱:moodstocks-vuforia-android-demo-app,代碼行數:6,代碼來源:ScannerManager.java


注:本文中的com.moodstocks.android.Result類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。