Start App on Pebble when tapping it AppManager
This commit is contained in:
parent
c37cacf43d
commit
c4f7fc1531
|
@ -107,6 +107,12 @@ public abstract class AbstractBTDeviceSupport extends AbstractDeviceSupport {
|
|||
sendToDevice(bytes);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAppStart(UUID uuid) {
|
||||
byte[] bytes = gbDeviceProtocol.encodeAppStart(uuid);
|
||||
sendToDevice(bytes);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAppDelete(UUID uuid) {
|
||||
byte[] bytes = gbDeviceProtocol.encodeAppDelete(uuid);
|
||||
|
|
|
@ -63,6 +63,17 @@ public class AppManagerActivity extends Activity {
|
|||
ListView appListView = (ListView) findViewById(R.id.appListView);
|
||||
mGBDeviceAppAdapter = new GBDeviceAppAdapter(this, appList);
|
||||
appListView.setAdapter(this.mGBDeviceAppAdapter);
|
||||
|
||||
appListView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
|
||||
@Override
|
||||
public void onItemClick(AdapterView parent, View v, int position, long id) {
|
||||
Intent startIntent = new Intent(AppManagerActivity.this, BluetoothCommunicationService.class);
|
||||
startIntent.setAction(BluetoothCommunicationService.ACTION_STARTAPP);
|
||||
startIntent.putExtra("app_uuid", appList.get(position).getUUID().toString());
|
||||
startService(startIntent);
|
||||
}
|
||||
});
|
||||
|
||||
registerForContextMenu(appListView);
|
||||
|
||||
IntentFilter filter = new IntentFilter();
|
||||
|
|
|
@ -51,6 +51,8 @@ public class BluetoothCommunicationService extends Service {
|
|||
= "nodomain.freeyourgadget.gadgetbride.bluetoothcommunicationservice.action.request_versioninfo";
|
||||
public static final String ACTION_REQUEST_APPINFO
|
||||
= "nodomain.freeyourgadget.gadgetbride.bluetoothcommunicationservice.action.request_appinfo";
|
||||
public static final String ACTION_STARTAPP
|
||||
= "nodomain.freeyourgadget.gadgetbride.bluetoothcommunicationservice.action.startapp";
|
||||
public static final String ACTION_DELETEAPP
|
||||
= "nodomain.freeyourgadget.gadgetbride.bluetoothcommunicationservice.action.deleteapp";
|
||||
public static final String ACTION_INSTALL_PEBBLEAPP
|
||||
|
@ -227,8 +229,12 @@ public class BluetoothCommunicationService extends Service {
|
|||
case ACTION_REQUEST_APPINFO:
|
||||
mDeviceSupport.onAppInfoReq();
|
||||
break;
|
||||
case ACTION_DELETEAPP:
|
||||
case ACTION_STARTAPP:
|
||||
UUID uuid = UUID.fromString(intent.getStringExtra("app_uuid"));
|
||||
mDeviceSupport.onAppStart(uuid);
|
||||
break;
|
||||
case ACTION_DELETEAPP:
|
||||
uuid = UUID.fromString(intent.getStringExtra("app_uuid"));
|
||||
mDeviceSupport.onAppDelete(uuid);
|
||||
break;
|
||||
case ACTION_INSTALL_PEBBLEAPP:
|
||||
|
|
|
@ -21,9 +21,12 @@ public interface EventHandler {
|
|||
|
||||
void onAppInfoReq();
|
||||
|
||||
void onAppStart(UUID uuid);
|
||||
|
||||
void onAppDelete(UUID uuid);
|
||||
|
||||
void onPhoneVersion(byte os);
|
||||
|
||||
void onReboot();
|
||||
|
||||
}
|
||||
|
|
|
@ -321,6 +321,11 @@ public class MiBandSupport extends AbstractBTLEDeviceSupport {
|
|||
// not supported
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAppStart(UUID uuid) {
|
||||
// not supported
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAppDelete(UUID uuid) {
|
||||
// not supported
|
||||
|
|
|
@ -46,6 +46,10 @@ public abstract class GBDeviceProtocol {
|
|||
return null;
|
||||
}
|
||||
|
||||
public byte[] encodeAppStart(UUID uuid) {
|
||||
return null;
|
||||
}
|
||||
|
||||
public byte[] encodePhoneVersion(byte os) {
|
||||
return null;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue