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);
|
sendToDevice(bytes);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onAppStart(UUID uuid) {
|
||||||
|
byte[] bytes = gbDeviceProtocol.encodeAppStart(uuid);
|
||||||
|
sendToDevice(bytes);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onAppDelete(UUID uuid) {
|
public void onAppDelete(UUID uuid) {
|
||||||
byte[] bytes = gbDeviceProtocol.encodeAppDelete(uuid);
|
byte[] bytes = gbDeviceProtocol.encodeAppDelete(uuid);
|
||||||
|
|
|
@ -63,6 +63,17 @@ public class AppManagerActivity extends Activity {
|
||||||
ListView appListView = (ListView) findViewById(R.id.appListView);
|
ListView appListView = (ListView) findViewById(R.id.appListView);
|
||||||
mGBDeviceAppAdapter = new GBDeviceAppAdapter(this, appList);
|
mGBDeviceAppAdapter = new GBDeviceAppAdapter(this, appList);
|
||||||
appListView.setAdapter(this.mGBDeviceAppAdapter);
|
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);
|
registerForContextMenu(appListView);
|
||||||
|
|
||||||
IntentFilter filter = new IntentFilter();
|
IntentFilter filter = new IntentFilter();
|
||||||
|
|
|
@ -51,6 +51,8 @@ public class BluetoothCommunicationService extends Service {
|
||||||
= "nodomain.freeyourgadget.gadgetbride.bluetoothcommunicationservice.action.request_versioninfo";
|
= "nodomain.freeyourgadget.gadgetbride.bluetoothcommunicationservice.action.request_versioninfo";
|
||||||
public static final String ACTION_REQUEST_APPINFO
|
public static final String ACTION_REQUEST_APPINFO
|
||||||
= "nodomain.freeyourgadget.gadgetbride.bluetoothcommunicationservice.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
|
public static final String ACTION_DELETEAPP
|
||||||
= "nodomain.freeyourgadget.gadgetbride.bluetoothcommunicationservice.action.deleteapp";
|
= "nodomain.freeyourgadget.gadgetbride.bluetoothcommunicationservice.action.deleteapp";
|
||||||
public static final String ACTION_INSTALL_PEBBLEAPP
|
public static final String ACTION_INSTALL_PEBBLEAPP
|
||||||
|
@ -227,8 +229,12 @@ public class BluetoothCommunicationService extends Service {
|
||||||
case ACTION_REQUEST_APPINFO:
|
case ACTION_REQUEST_APPINFO:
|
||||||
mDeviceSupport.onAppInfoReq();
|
mDeviceSupport.onAppInfoReq();
|
||||||
break;
|
break;
|
||||||
case ACTION_DELETEAPP:
|
case ACTION_STARTAPP:
|
||||||
UUID uuid = UUID.fromString(intent.getStringExtra("app_uuid"));
|
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);
|
mDeviceSupport.onAppDelete(uuid);
|
||||||
break;
|
break;
|
||||||
case ACTION_INSTALL_PEBBLEAPP:
|
case ACTION_INSTALL_PEBBLEAPP:
|
||||||
|
|
|
@ -21,9 +21,12 @@ public interface EventHandler {
|
||||||
|
|
||||||
void onAppInfoReq();
|
void onAppInfoReq();
|
||||||
|
|
||||||
|
void onAppStart(UUID uuid);
|
||||||
|
|
||||||
void onAppDelete(UUID uuid);
|
void onAppDelete(UUID uuid);
|
||||||
|
|
||||||
void onPhoneVersion(byte os);
|
void onPhoneVersion(byte os);
|
||||||
|
|
||||||
void onReboot();
|
void onReboot();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -321,6 +321,11 @@ public class MiBandSupport extends AbstractBTLEDeviceSupport {
|
||||||
// not supported
|
// not supported
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onAppStart(UUID uuid) {
|
||||||
|
// not supported
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onAppDelete(UUID uuid) {
|
public void onAppDelete(UUID uuid) {
|
||||||
// not supported
|
// not supported
|
||||||
|
|
|
@ -46,6 +46,10 @@ public abstract class GBDeviceProtocol {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public byte[] encodeAppStart(UUID uuid) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
public byte[] encodePhoneVersion(byte os) {
|
public byte[] encodePhoneVersion(byte os) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue