Merge branch 'master' into appmanager-fragments

This commit is contained in:
Andreas Shimokawa 2016-06-19 12:33:05 +02:00
commit 4b5969ef96
8 changed files with 39 additions and 8 deletions

View File

@ -1,4 +1,12 @@
###Changelog ###Changelog
####Version 0.10.2
* Pebble: allow to manually paste configuration data for legacy configuration pages
* Pebble: various improvements to the configuration page
* Pebble: Suppport FW 4.0-dp1 and Pebble2 emulator (needs recompilation of Gadgetbridge)
* Pebble: Fix a problem with key events when using the Pebble music player
####Version 0.10.1 ####Version 0.10.1
* Pebble: set extended music info by dissecting notifications on Android 5.0+ * Pebble: set extended music info by dissecting notifications on Android 5.0+
* Pebble: various other improvemnts to music playback * Pebble: various other improvemnts to music playback

View File

@ -18,8 +18,8 @@ android {
targetSdkVersion 23 targetSdkVersion 23
// note: always bump BOTH versionCode and versionName! // note: always bump BOTH versionCode and versionName!
versionName "0.10.1" versionName "0.10.2"
versionCode 54 versionCode 55
} }
buildTypes { buildTypes {
release { release {

View File

@ -261,7 +261,9 @@
</receiver> </receiver>
<activity <activity
android:launchMode="singleInstance" android:launchMode="singleTask"
android:allowTaskReparenting="true"
android:clearTaskOnLaunch="true"
android:name=".activities.ExternalPebbleJSActivity" android:name=".activities.ExternalPebbleJSActivity"
android:label="@string/app_configure" android:label="@string/app_configure"
android:parentActivityName=".activities.appmanager.AppManagerActivity"> android:parentActivityName=".activities.appmanager.AppManagerActivity">

View File

@ -62,7 +62,7 @@
</button> </button>
</div> </div>
<div id="step1compat" class="step"> <div id="step1compat" class="step">
<p>In case of "network error" after saving settings in the wathchapp, copy the "network error" <p>In case of "network error" after saving settings in the watchhapp, copy the "network error"
URL and paste it here:</p> URL and paste it here:</p>
<textarea id="pastereturn"></textarea><br/> <textarea id="pastereturn"></textarea><br/>
<button class="btn" name="parse" onclick="Pebble.parseReturnedPebbleJS()">Parse legacy app <button class="btn" name="parse" onclick="Pebble.parseReturnedPebbleJS()">Parse legacy app

View File

@ -139,6 +139,11 @@ function gbPebble() {
this.ready = function() { this.ready = function() {
} }
this.showConfiguration = function() {
console.error("This watchapp doesn't support configuration");
GBjs.closeActivity();
}
this.parseReturnedPebbleJS = function() { this.parseReturnedPebbleJS = function() {
var str = document.getElementById('pastereturn').value; var str = document.getElementById('pastereturn').value;
var needle = "pebblejs://close#"; var needle = "pebblejs://close#";

View File

@ -1,5 +1,6 @@
package nodomain.freeyourgadget.gadgetbridge.activities; package nodomain.freeyourgadget.gadgetbridge.activities;
import android.content.Context;
import android.content.Intent; import android.content.Intent;
import android.net.Uri; import android.net.Uri;
import android.os.Bundle; import android.os.Bundle;
@ -66,7 +67,7 @@ public class ExternalPebbleJSActivity extends GBActivity {
//needed to access the DOM //needed to access the DOM
webSettings.setDomStorageEnabled(true); webSettings.setDomStorageEnabled(true);
JSInterface gbJSInterface = new JSInterface(); JSInterface gbJSInterface = new JSInterface(this);
myWebView.addJavascriptInterface(gbJSInterface, "GBjs"); myWebView.addJavascriptInterface(gbJSInterface, "GBjs");
myWebView.loadUrl("file:///android_asset/app_config/configure.html"); myWebView.loadUrl("file:///android_asset/app_config/configure.html");
@ -75,6 +76,7 @@ public class ExternalPebbleJSActivity extends GBActivity {
@Override @Override
protected void onNewIntent(Intent incoming) { protected void onNewIntent(Intent incoming) {
incoming.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK);
super.onNewIntent(incoming); super.onNewIntent(incoming);
confUri = incoming.getData(); confUri = incoming.getData();
} }
@ -129,6 +131,7 @@ public class ExternalPebbleJSActivity extends GBActivity {
public boolean shouldOverrideUrlLoading(WebView view, String url) { public boolean shouldOverrideUrlLoading(WebView view, String url) {
if (url.startsWith("http://") || url.startsWith("https://")) { if (url.startsWith("http://") || url.startsWith("https://")) {
Intent i = new Intent(Intent.ACTION_VIEW, Uri.parse(url)); Intent i = new Intent(Intent.ACTION_VIEW, Uri.parse(url));
i.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK | Intent.FLAG_ACTIVITY_NEW_TASK);
startActivity(i); startActivity(i);
} else { } else {
url = url.replaceFirst("^pebblejs://close#", "file:///android_asset/app_config/configure.html?config=true&json="); url = url.replaceFirst("^pebblejs://close#", "file:///android_asset/app_config/configure.html?config=true&json=");
@ -142,7 +145,10 @@ public class ExternalPebbleJSActivity extends GBActivity {
private class JSInterface { private class JSInterface {
public JSInterface() { Context mContext;
public JSInterface(Context c) {
mContext = c;
} }
@JavascriptInterface @JavascriptInterface
@ -240,7 +246,7 @@ public class ExternalPebbleJSActivity extends GBActivity {
@JavascriptInterface @JavascriptInterface
public void closeActivity() { public void closeActivity() {
finish(); NavUtils.navigateUpFromSameTask((ExternalPebbleJSActivity) mContext);
} }
} }

View File

@ -1108,6 +1108,10 @@ public class PebbleProtocol extends GBDeviceProtocol {
} }
public byte[] encodeSetMusicState(byte state, int position, int playRate, byte shuffle, byte repeat) { public byte[] encodeSetMusicState(byte state, int position, int playRate, byte shuffle, byte repeat) {
if (mFwMajor < 3) {
return null;
}
byte playState; byte playState;
switch (state) { switch (state) {
@ -1143,7 +1147,7 @@ public class PebbleProtocol extends GBDeviceProtocol {
@Override @Override
public byte[] encodeSetMusicInfo(String artist, String album, String track, int duration, int trackCount, int trackNr) { public byte[] encodeSetMusicInfo(String artist, String album, String track, int duration, int trackCount, int trackNr) {
String[] parts = {artist, album, track}; String[] parts = {artist, album, track};
if (duration == 0) { if (duration == 0 || mFwMajor < 3) {
return encodeMessage(ENDPOINT_MUSICCONTROL, MUSICCONTROL_SETMUSICINFO, 0, parts); return encodeMessage(ENDPOINT_MUSICCONTROL, MUSICCONTROL_SETMUSICINFO, 0, parts);
} else { } else {
// Calculate length first // Calculate length first

View File

@ -1,5 +1,11 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<changelog> <changelog>
<release version="0.10.2" versioncode="55">
<change>Pebble: allow to manually paste configuration data for legacy configuration pages</change>
<change>Pebble: various improvements to the configuration page</change>
<change>Pebble: Suppport FW 4.0-dp1 and Pebble2 emulator (needs recompilation of Gadgetbridge)</change>
<change>Pebble: Fix a problem with key events when using the Pebble music player</change>
</release>
<release version="0.10.1" versioncode="54"> <release version="0.10.1" versioncode="54">
<change>Pebble: set extended music info by dissecting notifications on Android 5.0+</change> <change>Pebble: set extended music info by dissecting notifications on Android 5.0+</change>
<change>Pebble: various other improvemnts to music playback</change> <change>Pebble: various other improvemnts to music playback</change>