Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added support for Sony SmartWatch #50

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 30 additions & 0 deletions AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
<uses-permission android:name="android.permission.CHANGE_WIFI_STATE" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
<uses-permission android:name="com.sonyericsson.extras.liveware.aef.EXTENSION_PERMISSION" />

<uses-feature android:name="android.hardware.telephony" android:required="false" />
<uses-feature android:name="android.hardware.location.network" android:required="false" />
Expand Down Expand Up @@ -89,8 +90,37 @@
<action android:name="android.intent.action.BOOT_COMPLETED"/>
</intent-filter>
</receiver>
<receiver android:name="org.xbmc.android.smartextension.XbmcExtensionReceiver" >
<intent-filter>
<!-- Generic extension intents. -->
<action android:name="com.sonyericsson.extras.liveware.aef.registration.EXTENSION_REGISTER_REQUEST" />
<action android:name="com.sonyericsson.extras.liveware.aef.registration.ACCESSORY_CONNECTION" />
<action android:name="android.intent.action.LOCALE_CHANGED" />

<!-- Notification intents -->
<action android:name="com.sonyericsson.extras.liveware.aef.notification.VIEW_EVENT_DETAIL" />
<action android:name="com.sonyericsson.extras.liveware.aef.notification.REFRESH_REQUEST" />

<!-- Widget intents -->
<action android:name="com.sonyericsson.extras.aef.widget.START_REFRESH_IMAGE_REQUEST" />
<action android:name="com.sonyericsson.extras.aef.widget.STOP_REFRESH_IMAGE_REQUEST" />
<action android:name="com.sonyericsson.extras.aef.widget.ONTOUCH" />
<action android:name="com.sonyericsson.extras.liveware.extension.util.widget.scheduled.refresh" />

<!-- Control intents -->
<action android:name="com.sonyericsson.extras.aef.control.START" />
<action android:name="com.sonyericsson.extras.aef.control.STOP" />
<action android:name="com.sonyericsson.extras.aef.control.PAUSE" />
<action android:name="com.sonyericsson.extras.aef.control.RESUME" />
<action android:name="com.sonyericsson.extras.aef.control.ERROR" />
<action android:name="com.sonyericsson.extras.aef.control.KEY_EVENT" />
<action android:name="com.sonyericsson.extras.aef.control.TOUCH_EVENT" />
<action android:name="com.sonyericsson.extras.aef.control.SWIPE_EVENT" />
</intent-filter>
</receiver>
<provider android:name=".business.provider.HostProvider" android:authorities="org.xbmc.android.provider.remote" />
<service android:name="org.xbmc.android.jsonrpc.service.ConnectionService" />
<service android:name="org.xbmc.android.smartextension.XbmcExtensionService" />

</application>
</manifest>
1 change: 1 addition & 0 deletions project.properties
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,4 @@ split.density=false
# Project target.
target=android-16
android.library.reference.1=../xbmc-jsonrpclib-android
android.library.reference.2=../SmartExtensionUtils
Binary file added res/drawable/ext_icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added res/drawable/ext_icon_bw.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
38 changes: 38 additions & 0 deletions src/org/xbmc/android/smartextension/XbmcExtensionReceiver.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
/*
* Copyright (C) 2012 Cedric Priscal
*
* This Program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
*
* This Program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with XBMC Remote; see the file license. If not, write to
* the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
* http://www.gnu.org/copyleft/gpl.html
*
*/

package org.xbmc.android.smartextension;

import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.os.Build.VERSION;

public class XbmcExtensionReceiver extends BroadcastReceiver {

@Override
public void onReceive(Context context, Intent intent) {
if (VERSION.SDK_INT >= 7) {
intent.setClass(context, XbmcExtensionService.class);
context.startService(intent);
}
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,120 @@
/*
* Copyright (C) 2012 Cedric Priscal
*
* This Program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
*
* This Program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with XBMC Remote; see the file license. If not, write to
* the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
* http://www.gnu.org/copyleft/gpl.html
*
*/

package org.xbmc.android.smartextension;

import android.content.ContentValues;
import android.content.Context;

import com.sonyericsson.extras.liveware.aef.registration.Registration;
import com.sonyericsson.extras.liveware.extension.util.ExtensionUtils;
import com.sonyericsson.extras.liveware.extension.util.registration.RegistrationInformation;
import com.sonyericsson.extras.liveware.sdk.R;

public class XbmcExtensionRegistrationInformation extends
RegistrationInformation {

final Context mContext;

protected XbmcExtensionRegistrationInformation(Context context) {
if (context == null) {
throw new IllegalArgumentException("context == null");
}
mContext = context;
}

/*
* (non-Javadoc)
*
* @see com.sonyericsson.extras.liveware.extension.util.registration.
* RegistrationInformation#getRequiredNotificationApiVersion()
*/
@Override
public int getRequiredNotificationApiVersion() {
return API_NOT_REQUIRED;
}

/*
* (non-Javadoc)
*
* @see com.sonyericsson.extras.liveware.extension.util.registration.
* RegistrationInformation#getExtensionRegistrationConfiguration()
*/
@Override
public ContentValues getExtensionRegistrationConfiguration() {
ContentValues values = new ContentValues();

values.put(Registration.ExtensionColumns.NAME,
mContext.getString(R.string.app_name));
values.put(Registration.ExtensionColumns.EXTENSION_KEY,
XbmcExtensionService.EXTENSION_KEY);
values.put(Registration.ExtensionColumns.HOST_APP_ICON_URI,
ExtensionUtils.getUriString(mContext, org.xbmc.android.remote.R.drawable.icon));
values.put(Registration.ExtensionColumns.EXTENSION_ICON_URI,
ExtensionUtils.getUriString(mContext, org.xbmc.android.remote.R.drawable.ext_icon));
values.put(
Registration.ExtensionColumns.EXTENSION_ICON_URI_BLACK_WHITE,
ExtensionUtils.getUriString(mContext, org.xbmc.android.remote.R.drawable.ext_icon_bw));
values.put(Registration.ExtensionColumns.NOTIFICATION_API_VERSION,
getRequiredNotificationApiVersion());
values.put(Registration.ExtensionColumns.PACKAGE_NAME,
mContext.getPackageName());

return values;
}

/*
* (non-Javadoc)
*
* @see com.sonyericsson.extras.liveware.extension.util.registration.
* RegistrationInformation#getRequiredWidgetApiVersion()
*/
@Override
public int getRequiredWidgetApiVersion() {
return API_NOT_REQUIRED;
}

/*
* (non-Javadoc)
*
* @see com.sonyericsson.extras.liveware.extension.util.registration.
* RegistrationInformation#getRequiredControlApiVersion()
*/
@Override
public int getRequiredControlApiVersion() {
return 1;
}

/*
* (non-Javadoc)
*
* @see com.sonyericsson.extras.liveware.extension.util.registration.
* RegistrationInformation#getRequiredSensorApiVersion()
*/
@Override
public int getRequiredSensorApiVersion() {
return API_NOT_REQUIRED;
}

@Override
public boolean isDisplaySizeSupported(int width, int height) {
return true;
}
}
63 changes: 63 additions & 0 deletions src/org/xbmc/android/smartextension/XbmcExtensionService.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
/*
* Copyright (C) 2012 Cedric Priscal
*
* This Program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
*
* This Program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with XBMC Remote; see the file license. If not, write to
* the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
* http://www.gnu.org/copyleft/gpl.html
*
*/

package org.xbmc.android.smartextension;

import android.util.Log;

import com.sonyericsson.extras.liveware.extension.util.ExtensionService;
import com.sonyericsson.extras.liveware.extension.util.control.ControlExtension;
import com.sonyericsson.extras.liveware.extension.util.registration.RegistrationInformation;

public class XbmcExtensionService extends ExtensionService {

public static final String EXTENSION_KEY = "org.xbmc.android.smartextension";
private static final String LOG_TAG = "XbmcExtensionService";

public XbmcExtensionService() {
super(EXTENSION_KEY);
Log.d(LOG_TAG, "Starting XbmcExtensionService");
}

/* (non-Javadoc)
* @see com.sonyericsson.extras.liveware.extension.util.ExtensionService#getRegistrationInformation()
*/
@Override
protected RegistrationInformation getRegistrationInformation() {
return new XbmcExtensionRegistrationInformation(this);
}

/* (non-Javadoc)
* @see com.sonyericsson.extras.liveware.extension.util.ExtensionService#keepRunningWhenConnected()
*/
@Override
protected boolean keepRunningWhenConnected() {
return false;
}

/* (non-Javadoc)
* @see com.sonyericsson.extras.liveware.extension.util.ExtensionService#createControlExtension()
*/
@Override
public ControlExtension createControlExtension(String hostAppPackageName) {
return new XbmcSmartWatchControlExtension(this, hostAppPackageName);
}

}
Loading