mirror of
https://codeberg.org/Freeyourgadget/Gadgetbridge
synced 2024-11-03 17:02:13 +01:00
Pebble: Preparations for taking screenshots
This commit also includes some cleanups and removal of unused code/strings
This commit is contained in:
parent
4b241ca9eb
commit
07d59322bd
@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="nodomain.freeyourgadget.gadgetbridge" >
|
||||
package="nodomain.freeyourgadget.gadgetbridge">
|
||||
|
||||
<uses-sdk
|
||||
android:minSdkVersion="19"
|
||||
@ -23,19 +23,15 @@
|
||||
android:name="android.hardware.bluetooth_le"
|
||||
android:required="false" />
|
||||
|
||||
<android:uses-permission
|
||||
android:name="android.permission.WRITE_EXTERNAL_STORAGE"
|
||||
android:maxSdkVersion="18" />
|
||||
|
||||
<application
|
||||
android:name=".GBApplication"
|
||||
android:allowBackup="true"
|
||||
android:icon="@drawable/ic_launcher"
|
||||
android:label="@string/app_name"
|
||||
android:theme="@style/GadgetbridgeTheme" >
|
||||
android:theme="@style/GadgetbridgeTheme">
|
||||
<activity
|
||||
android:name=".ControlCenter"
|
||||
android:label="@string/title_activity_controlcenter" >
|
||||
android:label="@string/title_activity_controlcenter">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN" />
|
||||
|
||||
@ -44,35 +40,35 @@
|
||||
</activity>
|
||||
<activity
|
||||
android:name=".SettingsActivity"
|
||||
android:label="@string/title_activity_settings" >
|
||||
android:label="@string/title_activity_settings">
|
||||
<meta-data
|
||||
android:name="android.support.PARENT_ACTIVITY"
|
||||
android:value=".ControlCenter" />
|
||||
</activity>
|
||||
<activity
|
||||
android:name=".miband.MiBandPreferencesActivity"
|
||||
android:label="@string/preferences_miband_settings" >
|
||||
android:label="@string/preferences_miband_settings">
|
||||
<meta-data
|
||||
android:name="android.support.PARENT_ACTIVITY"
|
||||
android:value=".SettingsActivity" />
|
||||
</activity>
|
||||
<activity
|
||||
android:name=".AppManagerActivity"
|
||||
android:label="@string/title_activity_appmanager" >
|
||||
android:label="@string/title_activity_appmanager">
|
||||
<meta-data
|
||||
android:name="android.support.PARENT_ACTIVITY"
|
||||
android:value=".ControlCenter" />
|
||||
</activity>
|
||||
<activity
|
||||
android:name=".activities.SleepChartActivity"
|
||||
android:label="@string/title_activity_sleepmonitor" >
|
||||
android:label="@string/title_activity_sleepmonitor">
|
||||
<meta-data
|
||||
android:name="android.support.PARENT_ACTIVITY"
|
||||
android:value=".ControlCenter" />
|
||||
</activity>
|
||||
<activity
|
||||
android:name=".pebble.PebbleAppInstallerActivity"
|
||||
android:label="@string/title_activity_appinstaller" >
|
||||
android:label="@string/title_activity_appinstaller">
|
||||
<meta-data
|
||||
android:name="android.support.PARENT_ACTIVITY"
|
||||
android:value=".AppManagerActivity" />
|
||||
@ -92,7 +88,7 @@
|
||||
<service
|
||||
android:name=".externalevents.NotificationListener"
|
||||
android:label="@string/app_name"
|
||||
android:permission="android.permission.BIND_NOTIFICATION_LISTENER_SERVICE" >
|
||||
android:permission="android.permission.BIND_NOTIFICATION_LISTENER_SERVICE">
|
||||
<intent-filter>
|
||||
<action android:name="android.service.notification.NotificationListenerService" />
|
||||
</intent-filter>
|
||||
@ -101,7 +97,7 @@
|
||||
|
||||
<receiver
|
||||
android:name=".externalevents.PhoneCallReceiver"
|
||||
android:enabled="false" >
|
||||
android:enabled="false">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.PHONE_STATE" />
|
||||
</intent-filter>
|
||||
@ -111,14 +107,14 @@
|
||||
</receiver>
|
||||
<receiver
|
||||
android:name=".externalevents.SMSReceiver"
|
||||
android:enabled="false" >
|
||||
android:enabled="false">
|
||||
<intent-filter>
|
||||
<action android:name="android.provider.Telephony.SMS_RECEIVED" />
|
||||
</intent-filter>
|
||||
</receiver>
|
||||
<receiver
|
||||
android:name=".externalevents.TimeChangeReceiver"
|
||||
android:enabled="false" >
|
||||
android:enabled="false">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.TIMEZONE_CHANGED" />
|
||||
<action android:name="android.intent.action.TIME_SET" />
|
||||
@ -126,7 +122,7 @@
|
||||
</receiver>
|
||||
<receiver
|
||||
android:name=".externalevents.K9Receiver"
|
||||
android:enabled="false" >
|
||||
android:enabled="false">
|
||||
<intent-filter>
|
||||
<data android:scheme="email" />
|
||||
|
||||
@ -135,14 +131,14 @@
|
||||
</receiver>
|
||||
<receiver
|
||||
android:name=".externalevents.PebbleReceiver"
|
||||
android:enabled="false" >
|
||||
android:enabled="false">
|
||||
<intent-filter>
|
||||
<action android:name="com.getpebble.action.SEND_NOTIFICATION" />
|
||||
</intent-filter>
|
||||
</receiver>
|
||||
<receiver
|
||||
android:name=".externalevents.MusicPlaybackReceiver"
|
||||
android:enabled="false" >
|
||||
android:enabled="false">
|
||||
<intent-filter>
|
||||
<action android:name="com.andrew.apollo.metachanged" />
|
||||
<action android:name="com.cyanogenmod.eleven.metachanged" />
|
||||
@ -150,21 +146,21 @@
|
||||
</receiver>
|
||||
<receiver
|
||||
android:name=".externalevents.BluetoothStateChangeReceiver"
|
||||
android:exported="false" >
|
||||
android:exported="false">
|
||||
<intent-filter>
|
||||
<action android:name="android.bluetooth.adapter.action.STATE_CHANGED" />
|
||||
</intent-filter>
|
||||
</receiver>
|
||||
<receiver
|
||||
android:name=".GBMusicControlReceiver"
|
||||
android:exported="false" >
|
||||
android:exported="false">
|
||||
<intent-filter>
|
||||
<action android:name="nodomain.freeyourgadget.gadgetbridge.musiccontrol" />
|
||||
</intent-filter>
|
||||
</receiver>
|
||||
<receiver
|
||||
android:name=".GBCallControlReceiver"
|
||||
android:exported="false" >
|
||||
android:exported="false">
|
||||
<intent-filter>
|
||||
<action android:name="nodomain.freeyourgadget.gadgetbridge.callcontrol" />
|
||||
</intent-filter>
|
||||
@ -172,30 +168,28 @@
|
||||
|
||||
<activity
|
||||
android:name=".DebugActivity"
|
||||
android:label="@string/title_activity_debug" >
|
||||
android:label="@string/title_activity_debug">
|
||||
<meta-data
|
||||
android:name="android.support.PARENT_ACTIVITY"
|
||||
android:value=".ControlCenter" />
|
||||
</activity>
|
||||
<activity
|
||||
android:name=".discovery.DiscoveryActivity"
|
||||
android:label="@string/title_activity_discovery" >
|
||||
android:label="@string/title_activity_discovery">
|
||||
<meta-data
|
||||
android:name="android.support.PARENT_ACTIVITY"
|
||||
android:value=".ControlCenter" />
|
||||
</activity>
|
||||
<activity
|
||||
android:name=".activities.AndroidPairingActivity"
|
||||
android:label="@string/title_activity_android_pairing" >
|
||||
</activity>
|
||||
android:label="@string/title_activity_android_pairing"></activity>
|
||||
<activity
|
||||
android:name=".miband.MiBandPairingActivity"
|
||||
android:label="@string/title_activity_mi_band_pairing" >
|
||||
</activity>
|
||||
android:label="@string/title_activity_mi_band_pairing"></activity>
|
||||
<activity
|
||||
android:name=".activities.ChartsActivity"
|
||||
android:label="@string/title_activity_charts"
|
||||
android:parentActivityName=".ControlCenter" >
|
||||
android:parentActivityName=".ControlCenter">
|
||||
<meta-data
|
||||
android:name="android.support.PARENT_ACTIVITY"
|
||||
android:value="nodomain.freeyourgadget.gadgetbridge.ControlCenter" />
|
||||
|
@ -167,4 +167,10 @@ public abstract class AbstractBTDeviceSupport extends AbstractDeviceSupport {
|
||||
byte[] bytes = gbDeviceProtocol.encodeFindDevice(start);
|
||||
sendToDevice(bytes);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onScreenshotReq() {
|
||||
byte[] bytes = gbDeviceProtocol.encodeScreenshotReq();
|
||||
sendToDevice(bytes);
|
||||
}
|
||||
}
|
||||
|
@ -30,8 +30,6 @@ import nodomain.freeyourgadget.gadgetbridge.pebble.PebbleSupport;
|
||||
public class BluetoothCommunicationService extends Service {
|
||||
public static final String ACTION_START
|
||||
= "nodomain.freeyourgadget.gadgetbride.bluetoothcommunicationservice.action.start";
|
||||
public static final String ACTION_PAIR
|
||||
= "nodomain.freeyourgadget.gadgetbride.bluetoothcommunicationservice.action.pair";
|
||||
public static final String ACTION_CONNECT
|
||||
= "nodomain.freeyourgadget.gadgetbride.bluetoothcommunicationservice.action.connect";
|
||||
public static final String ACTION_NOTIFICATION_GENERIC
|
||||
@ -50,6 +48,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_REQUEST_SCREENSHOT
|
||||
= "nodomain.freeyourgadget.gadgetbride.bluetoothcommunicationservice.action.request_screenshot";
|
||||
public static final String ACTION_STARTAPP
|
||||
= "nodomain.freeyourgadget.gadgetbride.bluetoothcommunicationservice.action.startapp";
|
||||
public static final String ACTION_DELETEAPP
|
||||
@ -243,6 +243,9 @@ public class BluetoothCommunicationService extends Service {
|
||||
case ACTION_REQUEST_APPINFO:
|
||||
mDeviceSupport.onAppInfoReq();
|
||||
break;
|
||||
case ACTION_REQUEST_SCREENSHOT:
|
||||
mDeviceSupport.onScreenshotReq();
|
||||
break;
|
||||
case ACTION_STARTAPP:
|
||||
UUID uuid = UUID.fromString(intent.getStringExtra("app_uuid"));
|
||||
mDeviceSupport.onAppStart(uuid);
|
||||
|
@ -176,6 +176,10 @@ public class ControlCenter extends Activity {
|
||||
menu.removeItem(R.id.controlcenter_fetch_activity_data);
|
||||
}
|
||||
|
||||
if (!selectedDevice.isConnected() || selectedDevice.getType() == DeviceType.MIBAND) {
|
||||
menu.removeItem(R.id.controlcenter_take_screenshot);
|
||||
}
|
||||
|
||||
if (!selectedDevice.isConnected()) {
|
||||
menu.removeItem(R.id.controlcenter_disconnect);
|
||||
menu.removeItem(R.id.controlcenter_find_device);
|
||||
@ -214,7 +218,7 @@ public class ControlCenter extends Activity {
|
||||
case R.id.controlcenter_find_device:
|
||||
if (selectedDevice != null) {
|
||||
findDevice(true);
|
||||
ProgressDialog dialog = ProgressDialog.show(
|
||||
ProgressDialog.show(
|
||||
this,
|
||||
getString(R.string.control_center_find_lost_device),
|
||||
getString(R.string.control_center_cancel_to_stop_vibration),
|
||||
@ -226,6 +230,14 @@ public class ControlCenter extends Activity {
|
||||
}
|
||||
});
|
||||
}
|
||||
return true;
|
||||
case R.id.controlcenter_take_screenshot:
|
||||
if (selectedDevice != null) {
|
||||
Intent startIntent = new Intent(this, BluetoothCommunicationService.class);
|
||||
startIntent.setAction(BluetoothCommunicationService.ACTION_REQUEST_SCREENSHOT);
|
||||
startService(startIntent);
|
||||
}
|
||||
return true;
|
||||
default:
|
||||
return super.onContextItemSelected(item);
|
||||
}
|
||||
|
@ -36,4 +36,6 @@ public interface EventHandler {
|
||||
void onReboot();
|
||||
|
||||
void onFindDevice(boolean start);
|
||||
|
||||
void onScreenshotReq();
|
||||
}
|
||||
|
@ -218,4 +218,12 @@ public class ServiceDeviceSupport implements DeviceSupport {
|
||||
}
|
||||
delegate.onFindDevice(start);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onScreenshotReq() {
|
||||
if (checkBusy("request screenshot")) {
|
||||
return;
|
||||
}
|
||||
delegate.onScreenshotReq();
|
||||
}
|
||||
}
|
||||
|
@ -490,6 +490,11 @@ public class MiBandSupport extends AbstractBTLEDeviceSupport {
|
||||
// not supported
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onScreenshotReq() {
|
||||
// not supported
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCharacteristicChanged(BluetoothGatt gatt,
|
||||
BluetoothGattCharacteristic characteristic) {
|
||||
|
@ -112,11 +112,13 @@ public class PebbleProtocol extends GBDeviceProtocol {
|
||||
static final byte PUTBYTES_TYPE_FILE = 6;
|
||||
public static final byte PUTBYTES_TYPE_WORKER = 7;
|
||||
|
||||
public static final byte RESET_REBOOT = 0;
|
||||
static final byte RESET_REBOOT = 0;
|
||||
|
||||
private final byte SYSTEMMESSAGE_FIRMWARESTART = 1;
|
||||
private final byte SYSTEMMESSAGE_FIRMWARECOMPLETE = 2;
|
||||
private final byte SYSTEMMESSAGE_FIRMWAREFAIL = 3;
|
||||
static final byte SCREENSHOT_TAKE = 0;
|
||||
|
||||
static final byte SYSTEMMESSAGE_FIRMWARESTART = 1;
|
||||
static final byte SYSTEMMESSAGE_FIRMWARECOMPLETE = 2;
|
||||
static final byte SYSTEMMESSAGE_FIRMWAREFAIL = 3;
|
||||
|
||||
static final byte PHONEVERSION_REQUEST = 0;
|
||||
static final byte PHONEVERSION_APPVERSION_MAGIC = 2; // increase this if pebble complains
|
||||
@ -529,6 +531,11 @@ public class PebbleProtocol extends GBDeviceProtocol {
|
||||
return encodeSimpleMessage(ENDPOINT_RESET, RESET_REBOOT);
|
||||
}
|
||||
|
||||
@Override
|
||||
public byte[] encodeScreenshotReq() {
|
||||
return encodeSimpleMessage( ENDPOINT_SCREENSHOT, SCREENSHOT_TAKE );
|
||||
}
|
||||
|
||||
/* pebble specific install methods */
|
||||
public byte[] encodeUploadStart(byte type, byte index, int size) {
|
||||
ByteBuffer buf = ByteBuffer.allocate(LENGTH_PREFIX + LENGTH_UPLOADSTART);
|
||||
|
@ -43,6 +43,10 @@ public abstract class GBDeviceProtocol {
|
||||
return null;
|
||||
}
|
||||
|
||||
public byte[] encodeScreenshotReq() {
|
||||
return null;
|
||||
}
|
||||
|
||||
public byte[] encodeAppDelete(UUID uuid) {
|
||||
return null;
|
||||
}
|
||||
|
@ -8,7 +8,10 @@
|
||||
android:title="@string/controlcenter_start_sleepmonitor"/>
|
||||
<item
|
||||
android:id="@+id/controlcenter_find_device"
|
||||
android:title="@string/control_center_find_device"/>
|
||||
android:title="@string/controlcenter_find_device"/>
|
||||
<item
|
||||
android:id="@+id/controlcenter_take_screenshot"
|
||||
android:title="@string/controlcenter_take_screenshot"/>
|
||||
<item
|
||||
android:id="@+id/controlcenter_disconnect"
|
||||
android:title="@string/controlcenter_disconnect"/>
|
||||
|
@ -6,7 +6,11 @@
|
||||
<string name="action_settings">Settings</string>
|
||||
<string name="action_debug">Debug</string>
|
||||
<string name="action_quit">Quit</string>
|
||||
<string name="controlcenter_fetch_activity_data">Fetch Activity Data</string>
|
||||
<string name="controlcenter_start_sleepmonitor">Sleep Monitor (ALPHA)</string>
|
||||
<string name="controlcenter_find_device">Find Device…</string>
|
||||
<string name="controlcenter_take_screenshot">Take Screenshot</string>
|
||||
<string name="controlcenter_disconnect">Disconnect</string>
|
||||
|
||||
<string name="title_activity_debug">Debug</string>
|
||||
|
||||
@ -113,8 +117,6 @@
|
||||
<string name="pref_write_logfiles">Write Log Files (needs restart)</string>
|
||||
<string name="initializing">initializing</string>
|
||||
<string name="busy_task_fetch_activity_data">Fetching Activity Data</string>
|
||||
<string name="controlcenter_fetch_activity_data">Fetch Activity Data</string>
|
||||
<string name="controlcenter_disconnect">Disconnect</string>
|
||||
<string name="sleep_activity_date_range">From %1$s to %2$s</string>
|
||||
<string name="miband_prefs_wearside">Wearing left or right?</string>
|
||||
<string name="pref_screen_vibration_profile">Vibration Profile</string>
|
||||
@ -133,15 +135,8 @@
|
||||
<string name="pref_screen_notification_profile_pebblemsg">Pebble Notification</string>
|
||||
<string name="pref_screen_notification_profile_k9mail">K9 Mail Notification</string>
|
||||
<string name="pref_screen_notification_profile_incoming_call">Incoming Call Notification</string>
|
||||
<string name="control_center_find_device">Find Device…</string>
|
||||
<string name="control_center_find_lost_device">Find lost Device</string>
|
||||
<string name="control_center_cancel_to_stop_vibration">Cancel to stop vibration.</string>
|
||||
<string name="title_activity_charts">ChartsActivity</string>
|
||||
|
||||
<string name="title_section1">Section 1</string>
|
||||
<string name="title_section2">Section 2</string>
|
||||
<string name="title_section3">Section 3</string>
|
||||
|
||||
<string name="hello_world">Hello world!</string>
|
||||
|
||||
</resources>
|
||||
|
Loading…
Reference in New Issue
Block a user