本文整理汇总了Java中com.sonyericsson.extras.liveware.aef.control.Control类的典型用法代码示例。如果您正苦于以下问题:Java Control类的具体用法?Java Control怎么用?Java Control使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Control类属于com.sonyericsson.extras.liveware.aef.control包,在下文中一共展示了Control类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: showImage
import com.sonyericsson.extras.liveware.aef.control.Control; //导入依赖的package包/类
/**
* Show an image on the accessory.
*
* @param resourceId The image resource id.
*/
protected void showImage(final int resourceId) {
if (Dbg.DEBUG) {
Dbg.d("showImage: " + resourceId);
}
Intent intent = new Intent();
intent.setAction(Control.Intents.CONTROL_DISPLAY_DATA_INTENT);
Bitmap bitmap = BitmapFactory.decodeResource(mContext.getResources(), resourceId,
mBitmapOptions);
ByteArrayOutputStream os = new ByteArrayOutputStream(256);
bitmap.compress(CompressFormat.PNG, 100, os);
byte[] buffer = os.toByteArray();
intent.putExtra(Control.Intents.EXTRA_DATA, buffer);
sendToHostApp(intent);
}
示例2: sendListItem
import com.sonyericsson.extras.liveware.aef.control.Control; //导入依赖的package包/类
/**
* Update a list item.
* @param item List item.
*/
protected void sendListItem(ControlListItem item) {
Intent intent = new Intent(Control.Intents.CONTROL_LIST_ITEM_INTENT);
intent.putExtra(Control.Intents.EXTRA_LAYOUT_REFERENCE, item.layoutReference);
intent.putExtra(Control.Intents.EXTRA_DATA_XML_LAYOUT, item.dataXmlLayout);
if (item.listItemId != -1) {
intent.putExtra(Control.Intents.EXTRA_LIST_ITEM_ID, item.listItemId);
}
if (item.listItemPosition != -1) {
intent.putExtra(Control.Intents.EXTRA_LIST_ITEM_POSITION, item.listItemPosition);
}
if (item.layoutData != null && item.layoutData.length > 0) {
intent.putExtra(Control.Intents.EXTRA_LAYOUT_DATA, item.layoutData);
}
sendToHostApp(intent);
}
示例3: handleMessage
import com.sonyericsson.extras.liveware.aef.control.Control; //导入依赖的package包/类
@Override
public void handleMessage(Message msg) {
switch (msg.what) {
case Tunnel.Messages.TUNNEL_INTENT:
{
Intent intent = (Intent)msg.obj;
handleIntentFromHostApp(intent);
break;
}
case Tunnel.Messages.SETUP_MESSENGER:
{
Bundle b = msg.getData();
b.setClassLoader(getClassLoader());
String hostAppPkgName = b.getString(Control.Intents.EXTRA_AHA_PACKAGE_NAME);
mHostAppMessengers.put(hostAppPkgName, msg.replyTo);
Log.d(LOG_TAG, "Setup messenger.");
break;
}
default:
super.handleMessage(msg);
}
}
示例4: onStop
import com.sonyericsson.extras.liveware.aef.control.Control; //导入依赖的package包/类
@Override
public void onStop() {
super.onStop();
Logger.logD(TAG, "onStop()");
// disable receiver
PeriodicUpdatesReceiver.disableReceiver(mContext);
// clear instance
mInstance = null;
// disable screen state
setScreenState(Control.Intents.SCREEN_STATE_AUTO);
// store current values
SharedPreferences.Editor editor = mPrefs.edit();
editor.putInt(KEY_I_LAST_SCREEN_MODE, mScreenMode.ordinal());
editor.putInt(KEY_I_LAST_SCREEN_GUIDANCE_MODE, mGuidingMode.ordinal());
editor.commit();
}
示例5: startCamera
import com.sonyericsson.extras.liveware.aef.control.Control; //导入依赖的package包/类
/**
* Initiates camera operation on the SmartEyeglass device, providing a file specification
* for saving
* captured image data.
*
* @param filePath Path of a file to which to save captured image data.
*/
public void startCamera(String filePath) throws ControlCameraException {
if (Dbg.DEBUG) {
Dbg.v("startCameraCapture");
}
if (mRecodingMode != SmartEyeglassControl.Intents.CAMERA_MODE_MOVIE_HIGH_RATE &&
mRecodingMode != SmartEyeglassControl.Intents.CAMERA_MODE_MOVIE_LOW_RATE &&
mRecodingMode != SmartEyeglassControl.Intents.CAMERA_MODE_STILL_TO_FILE) {
openSocket();
}
Intent intent = new Intent(SmartEyeglassControl.Intents.CONTROL_CAMERA_START_INTENT);
intent.putExtra(SmartEyeglassControl.Intents.EXTRA_CAMERA_VIDEO_SOCKET_NAME,
mCameraSocketName[0]);
if (filePath != null) {
intent.putExtra(Control.Intents.EXTRA_DATA_URI, filePath);
}
sendToHostApp(intent);
}
示例6: moveLowerLayer
import com.sonyericsson.extras.liveware.aef.control.Control; //导入依赖的package包/类
/**
* Transitions the screen display to the given bitmap using a built-in animation effect
* that looks like moving down to a lower layer.
* Display can take some time for a large image.
* If an image larger than the screen size,it is not displayed on the screen.<br>
* For screen size refer to
* {@link com.sony.smarteyeglass.SmartEyeglassControl.Intents#EXTRA_IMAGE_HEIGHT},
* {@link com.sony.smarteyeglass.SmartEyeglassControl.Intents#EXTRA_IMAGE_WIDTH}
*
* @param bitmap The new bitmap to show.
*/
public void moveLowerLayer(final Bitmap bitmap) {
if (Dbg.DEBUG) {
Dbg.d("showBitmap w/ animation");
}
byte[] buffer = EightBitMonochromeImageEncoder.convert(bitmap, 0, bitmap.getHeight());
Intent intent = new Intent(Control.Intents.CONTROL_DISPLAY_DATA_INTENT);
intent.putExtra(Control.Intents.EXTRA_DATA, buffer);
// since raw format then other side do not know width or height
intent.putExtra(SmartEyeglassControl.Intents.EXTRA_IMAGE_HEIGHT, bitmap.getHeight());
// since raw format then other side do not know width or height
intent.putExtra(SmartEyeglassControl.Intents.EXTRA_IMAGE_WIDTH, bitmap.getWidth());
intent.putExtra(SmartEyeglassControl.Intents.EXTRA_DATA_IS_RAW_FORMAT,
1); // SmartEyeglass raw format
intent.putExtra(SmartEyeglassControl.Intents.EXTRA_LAYER_TRANSITION_EFFECT_TYPE,
SmartEyeglassControl.Intents.LAYER_TRANSITION_MOVE_LOWER_LAYER);
sendToHostApp(intent);
}
示例7: moveUpperLayer
import com.sonyericsson.extras.liveware.aef.control.Control; //导入依赖的package包/类
/**
* Transitions the screen display to the given bitmap using a built-in animation effect
* that looks like moving up to a higher layer.
* Display can take some time for a large image.
* If an image larger than the screen size,it is not displayed on the screen.<br>
* For screen size refer to
* {@link com.sony.smarteyeglass.SmartEyeglassControl.Intents#EXTRA_IMAGE_HEIGHT},
* {@link com.sony.smarteyeglass.SmartEyeglassControl.Intents#EXTRA_IMAGE_WIDTH}
*
* @param bitmap The new bitmap to show.
*/
public void moveUpperLayer(final Bitmap bitmap) {
if (Dbg.DEBUG) {
Dbg.d("showBitmap w/ animation");
}
byte[] buffer = EightBitMonochromeImageEncoder.convert(bitmap, 0, bitmap.getHeight());
Intent intent = new Intent(Control.Intents.CONTROL_DISPLAY_DATA_INTENT);
intent.putExtra(Control.Intents.EXTRA_DATA, buffer);
// since raw format then other side do not know width or height
intent.putExtra(SmartEyeglassControl.Intents.EXTRA_IMAGE_HEIGHT, bitmap.getHeight());
// since raw format then other side do not know width or height
intent.putExtra(SmartEyeglassControl.Intents.EXTRA_IMAGE_WIDTH, bitmap.getWidth());
intent.putExtra(SmartEyeglassControl.Intents.EXTRA_DATA_IS_RAW_FORMAT, 1); //
// SmartEyeglass raw format
intent.putExtra(SmartEyeglassControl.Intents.EXTRA_LAYER_TRANSITION_EFFECT_TYPE,
SmartEyeglassControl.Intents.LAYER_TRANSITION_MOVE_UPPER_LAYER);
sendToHostApp(intent);
}
示例8: showImage
import com.sonyericsson.extras.liveware.aef.control.Control; //导入依赖的package包/类
/**
* Show an image on the accessory.
*
* @param resourceId The image resource id.
*/
protected void showImage(final int resourceId) {
if (Dbg.DEBUG) {
Dbg.d("showImage: " + resourceId);
}
Intent intent = new Intent();
intent.setAction(Control.Intents.CONTROL_DISPLAY_DATA_INTENT);
Bitmap bitmap = BitmapFactory
.decodeResource(mContext.getResources(), resourceId, mBitmapOptions);
ByteArrayOutputStream os = new ByteArrayOutputStream(256);
bitmap.compress(CompressFormat.PNG, 100, os);
byte[] buffer = os.toByteArray();
intent.putExtra(Control.Intents.EXTRA_DATA, buffer);
sendToHostApp(intent);
}
示例9: sendListItem
import com.sonyericsson.extras.liveware.aef.control.Control; //导入依赖的package包/类
/**
* Update a list item.
*
* @param item List item.
*/
protected void sendListItem(ControlListItem item) {
Intent intent = new Intent(Control.Intents.CONTROL_LIST_ITEM_INTENT);
intent.putExtra(Control.Intents.EXTRA_LAYOUT_REFERENCE, item.layoutReference);
intent.putExtra(Control.Intents.EXTRA_DATA_XML_LAYOUT, item.dataXmlLayout);
if (item.listItemId != -1) {
intent.putExtra(Control.Intents.EXTRA_LIST_ITEM_ID, item.listItemId);
}
if (item.listItemPosition != -1) {
intent.putExtra(Control.Intents.EXTRA_LIST_ITEM_POSITION, item.listItemPosition);
}
if (item.layoutData != null && item.layoutData.length > 0) {
intent.putExtra(Control.Intents.EXTRA_LAYOUT_DATA, item.layoutData);
}
sendToHostApp(intent);
}
示例10: sendToHostApp
import com.sonyericsson.extras.liveware.aef.control.Control; //导入依赖的package包/类
/**
* Send intent to host application. Adds host application package name and
* our package name.
*
* @param context a context
* @param hostPkgName package name of the host app
* @param intent The intent to send.
*/
public static void sendToHostApp(Context context, String hostPkgName, Intent intent) {
boolean whiteListed = false;
try {
PackageInfo packageInfo = context.getPackageManager().getPackageInfo(hostPkgName,
PackageManager.GET_SIGNATURES);
Signature[] signatures = packageInfo.signatures;
whiteListed = WhiteList.exists(hostPkgName, signatures[0]);
} catch (NameNotFoundException e) {
Dbg.e("No package info for host app", e);
return;
}
intent.putExtra(Control.Intents.EXTRA_AEA_PACKAGE_NAME, context.getPackageName());
intent.setPackage(hostPkgName);
if (whiteListed) {
context.sendBroadcast(intent);
} else {
context.sendBroadcast(intent, Registration.HOSTAPP_PERMISSION);
}
}
示例11: startCamera
import com.sonyericsson.extras.liveware.aef.control.Control; //导入依赖的package包/类
/**
* Initiates camera operation on the SmartEyeglass device, providing a file specification for saving
* captured image data.
*
* @param filePath Path of a file to which to save captured image data.
*/
public void startCamera(String filePath) throws ControlCameraException {
if (Dbg.DEBUG) {
Dbg.v("startCameraCapture");
}
if (mRecodingMode == INVALID_CAMERA_MODE) {
throw new IllegalArgumentException("Camera mode has not been set. Please call method setCameraMode().");
}
if (mRecodingMode != SmartEyeglassControl.Intents.CAMERA_MODE_STILL_TO_FILE) {
openSocket();
}
Intent intent = new Intent(SmartEyeglassControl.Intents.CONTROL_CAMERA_START_INTENT);
intent.putExtra(SmartEyeglassControl.Intents.EXTRA_CAMERA_VIDEO_SOCKET_NAME, mCameraSocketName[0]);
if (filePath != null) {
intent.putExtra(Control.Intents.EXTRA_DATA_URI, filePath);
}
sendToHostApp(intent);
}
示例12: moveLowerLayer
import com.sonyericsson.extras.liveware.aef.control.Control; //导入依赖的package包/类
/**
* Transitions the screen display to the given bitmap using a built-in animation effect
* that looks like moving down to a lower layer.
* Display can take some time for a large image.
* If an image larger than the screen size,it is not displayed on the screen.<br>
* For screen size refer to
* {@link com.sony.smarteyeglass.SmartEyeglassControl.Intents#EXTRA_IMAGE_HEIGHT},
* {@link com.sony.smarteyeglass.SmartEyeglassControl.Intents#EXTRA_IMAGE_WIDTH}
*
* @param bitmap The new bitmap to show.
*/
public void moveLowerLayer(final Bitmap bitmap) {
if (Dbg.DEBUG) {
Dbg.d("showBitmap w/ animation");
}
byte[] buffer = EightBitMonochromeImageEncoder.convert(bitmap, 0, bitmap.getHeight());
Intent intent = new Intent(Control.Intents.CONTROL_DISPLAY_DATA_INTENT);
intent.putExtra(Control.Intents.EXTRA_DATA, buffer);
// since raw format then other side do not know width or height
intent.putExtra(SmartEyeglassControl.Intents.EXTRA_IMAGE_HEIGHT, bitmap.getHeight());
// since raw format then other side do not know width or height
intent.putExtra(SmartEyeglassControl.Intents.EXTRA_IMAGE_WIDTH, bitmap.getWidth());
intent.putExtra(SmartEyeglassControl.Intents.EXTRA_DATA_IS_RAW_FORMAT, 1); // SmartEyeglass raw format
intent.putExtra(SmartEyeglassControl.Intents.EXTRA_LAYER_TRANSITION_EFFECT_TYPE,
SmartEyeglassControl.Intents.LAYER_TRANSITION_MOVE_LOWER_LAYER);
sendToHostApp(intent);
}
示例13: moveUpperLayer
import com.sonyericsson.extras.liveware.aef.control.Control; //导入依赖的package包/类
/**
* Transitions the screen display to the given bitmap using a built-in animation effect
* that looks like moving up to a higher layer.
* Display can take some time for a large image.
* If an image larger than the screen size,it is not displayed on the screen.<br>
* For screen size refer to
* {@link com.sony.smarteyeglass.SmartEyeglassControl.Intents#EXTRA_IMAGE_HEIGHT},
* {@link com.sony.smarteyeglass.SmartEyeglassControl.Intents#EXTRA_IMAGE_WIDTH}
*
* @param bitmap The new bitmap to show.
*/
public void moveUpperLayer(final Bitmap bitmap) {
if (Dbg.DEBUG) {
Dbg.d("showBitmap w/ animation");
}
byte[] buffer = EightBitMonochromeImageEncoder.convert(bitmap, 0, bitmap.getHeight());
Intent intent = new Intent(Control.Intents.CONTROL_DISPLAY_DATA_INTENT);
intent.putExtra(Control.Intents.EXTRA_DATA, buffer);
// since raw format then other side do not know width or height
intent.putExtra(SmartEyeglassControl.Intents.EXTRA_IMAGE_HEIGHT, bitmap.getHeight());
// since raw format then other side do not know width or height
intent.putExtra(SmartEyeglassControl.Intents.EXTRA_IMAGE_WIDTH, bitmap.getWidth());
intent.putExtra(SmartEyeglassControl.Intents.EXTRA_DATA_IS_RAW_FORMAT, 1); // SmartEyeglass raw format
intent.putExtra(SmartEyeglassControl.Intents.EXTRA_LAYER_TRANSITION_EFFECT_TYPE,
SmartEyeglassControl.Intents.LAYER_TRANSITION_MOVE_UPPER_LAYER);
sendToHostApp(intent);
}
示例14: startRequest
import com.sonyericsson.extras.liveware.aef.control.Control; //导入依赖的package包/类
/**
* Send request to start to host application.
*/
protected void startRequest() {
if (Dbg.DEBUG) {
Dbg.d("Sending start request");
}
Intent intent = new Intent(Control.Intents.CONTROL_START_REQUEST_INTENT);
sendToHostApp(intent);
}
示例15: stopRequest
import com.sonyericsson.extras.liveware.aef.control.Control; //导入依赖的package包/类
/**
* Send request to stop to host application.
*/
protected void stopRequest() {
if (Dbg.DEBUG) {
Dbg.d("Sending stop request");
}
Intent intent = new Intent(Control.Intents.CONTROL_STOP_REQUEST_INTENT);
sendToHostApp(intent);
}