Skip to content

Commit 657937b

Browse files
author
Chris Bellew
committed
Added preliminary support for Android Wear (Chromecast not implemented yet).
Fixed bug that caused now playing screen from losing subscription temporarily when using buttons in notification. Added disconnect button to big notification. Changed rewind button in notification and added fast forward button.
1 parent 7715553 commit 657937b

File tree

97 files changed

+2506
-330
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

97 files changed

+2506
-330
lines changed

Voice Control For Plex/Voice Control For Plex.iml

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -81,22 +81,23 @@
8181
<excludeFolder url="file://$MODULE_DIR$/build/outputs" />
8282
<excludeFolder url="file://$MODULE_DIR$/build/tmp" />
8383
</content>
84-
<orderEntry type="jdk" jdkName="Android API 19 Platform" jdkType="Android SDK" />
84+
<orderEntry type="jdk" jdkName="Android API 21 Platform" jdkType="Android SDK" />
8585
<orderEntry type="sourceFolder" forTests="false" />
8686
<orderEntry type="library" exported="" name="android-async-http-1.4.4" level="project" />
8787
<orderEntry type="library" exported="" name="bugsense-3.6" level="project" />
88-
<orderEntry type="library" exported="" name="gson-2.2.4" level="project" />
88+
<orderEntry type="library" exported="" name="play-services-wearable-6.5.87" level="project" />
89+
<orderEntry type="library" exported="" name="support-v4-21.0.3" level="project" />
8990
<orderEntry type="library" exported="" name="mediarouter-v7-19.1.0" level="project" />
90-
<orderEntry type="library" exported="" name="support-v4-20.0.0" level="project" />
91+
<orderEntry type="library" exported="" name="play-services-base-6.5.87" level="project" />
92+
<orderEntry type="library" exported="" name="commons-io-2.4" level="project" />
9193
<orderEntry type="library" exported="" name="disklrucache-2.0.2" level="project" />
92-
<orderEntry type="library" exported="" name="library-1.0.21" level="project" />
93-
<orderEntry type="library" exported="" name="play-services-4.4.52" level="project" />
94+
<orderEntry type="library" exported="" name="gson-2.3.1" level="project" />
95+
<orderEntry type="library" exported="" name="library-1.0.25" level="project" />
96+
<orderEntry type="library" exported="" name="appcompat-v7-21.0.3" level="project" />
9497
<orderEntry type="library" exported="" name="stax-1.2.0" level="project" />
95-
<orderEntry type="library" exported="" name="appcompat-v7-20.0.0" level="project" />
98+
<orderEntry type="library" exported="" name="support-annotations-21.0.3" level="project" />
9699
<orderEntry type="library" exported="" name="simple-xml-2.7.1" level="project" />
97-
<orderEntry type="library" exported="" name="support-annotations-20.0.0" level="project" />
98-
<orderEntry type="library" exported="" name="commons-io-1.3.2" level="project" />
99-
<orderEntry type="library" exported="" name="1_commons-io-1.3.2" level="project" />
100+
<orderEntry type="module" module-name="shared" exported="" />
100101
<orderEntry type="module" module-name="CastCompanionLibrary-android" exported="" />
101102
</component>
102103
</module>

Voice Control For Plex/build.gradle

Lines changed: 26 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,15 @@
11
apply plugin: 'android'
22

33
android {
4-
compileSdkVersion 19
5-
buildToolsVersion '20'
4+
compileSdkVersion 21
5+
buildToolsVersion '21.1.2'
66
defaultConfig {
7+
applicationId "com.atomjack.vcfp"
78
minSdkVersion 15
8-
targetSdkVersion 19
9+
targetSdkVersion 21
10+
}
11+
dexOptions {
12+
preDexLibraries = false
913
}
1014
packagingOptions {
1115
exclude 'META-INF/LICENSE.txt'
@@ -38,14 +42,18 @@ android {
3842
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
3943
buildConfigField "boolean", "USE_BUGSENSE", "true"
4044
buildConfigField "boolean", "CHROMECAST_REQUIRES_PURCHASE", "true"
45+
buildConfigField "boolean", "WEAR_REQUIRES_PURCHASE", "true"
4146
buildConfigField "String", "SKU_CHROMECAST", "\"chromecast\""
47+
buildConfigField "String", "SKU_WEAR", "\"wear\""
4248
buildConfigField "String", "CHROMECAST_APP_ID", "\"" + RELEASE_CHROMECAST_APP_ID + "\""
4349
}
4450
debug {
4551
debuggable true
4652
buildConfigField "boolean", "USE_BUGSENSE", "false"
4753
buildConfigField "boolean", "CHROMECAST_REQUIRES_PURCHASE", "false"
48-
buildConfigField "String", "SKU_CHROMECAST", "\"android.test.purchased\""
54+
buildConfigField "boolean", "WEAR_REQUIRES_PURCHASE", "false"
55+
buildConfigField "String", "SKU_CHROMECAST", "\"chromecast\""
56+
buildConfigField "String", "SKU_WEAR", "\"wear\""
4957
buildConfigField "String", "CHROMECAST_APP_ID", "\"" + DEBUG_CHROMECAST_APP_ID + "\""
5058
}
5159
chromecast {
@@ -56,6 +64,7 @@ android {
5664
buildConfigField "boolean", "USE_BUGSENSE", "false"
5765
buildConfigField "boolean", "CHROMECAST_REQUIRES_PURCHASE", "true"
5866
buildConfigField "String", "SKU_CHROMECAST", "\"chromecast\""
67+
buildConfigField "String", "SKU_WEAR", "\"wear\""
5968
buildConfigField "String", "CHROMECAST_APP_ID", "\"" + RELEASE_CHROMECAST_APP_ID + "\""
6069
}
6170
chromecastTest {
@@ -73,7 +82,9 @@ android {
7382
signingConfig signingConfigs.debug
7483
buildConfigField "boolean", "USE_BUGSENSE", "true"
7584
buildConfigField "boolean", "CHROMECAST_REQUIRES_PURCHASE", "false"
85+
buildConfigField "boolean", "WEAR_REQUIRES_PURCHASE", "false"
7686
buildConfigField "String", "SKU_CHROMECAST", "\"android.test.purchased\""
87+
buildConfigField "String", "SKU_WEAR", "\"android.test.purchased\""
7788
buildConfigField "String", "CHROMECAST_APP_ID", "\"" + RELEASE_CHROMECAST_APP_ID + "\""
7889
}
7990
}
@@ -84,6 +95,11 @@ android {
8495
}
8596
productFlavors {
8697
}
98+
gradle.projectsEvaluated {
99+
tasks.withType(JavaCompile) {
100+
options.compilerArgs << "-Xlint:unchecked" << "-Xlint:deprecation"
101+
}
102+
}
87103
}
88104

89105
dependencies {
@@ -93,13 +109,14 @@ dependencies {
93109
exclude group: 'stax', module: 'stax-api'
94110
exclude group: 'xpp3', module: 'xpp3'
95111
}
96-
compile 'com.google.code.gson:gson:2.2.+'
97-
compile 'com.android.support:support-v4:20+'
112+
compile 'com.google.code.gson:gson:2.3.+'
113+
compile 'com.android.support:support-v4:21.0+'
98114
compile 'com.github.codechimp-org.apprater:library:1.0.+'
99-
compile 'com.google.android.gms:play-services:4.4.52'
100-
compile 'com.android.support:appcompat-v7:20.0.+'
115+
compile 'com.google.android.gms:play-services-wearable:6.5.87'
116+
compile 'com.android.support:appcompat-v7:21.0.3'
101117
compile 'com.android.support:mediarouter-v7:19.1.+'
102118
compile project(':CastCompanionLibrary-android')
103119
compile 'com.jakewharton:disklrucache:2.0.2'
104-
compile 'org.apache.commons:commons-io:1.3.2'
120+
compile files('libs/commons-io-2.4.jar')
121+
compile project(':shared')
105122
}
181 KB
Binary file not shown.

Voice Control For Plex/src/main/AndroidManifest.xml

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
33
xmlns:tools="http://schemas.android.com/tools"
44
package="com.atomjack.vcfp"
5-
android:versionCode="31"
6-
android:versionName="1.9.4" >
5+
android:versionCode="32"
6+
android:versionName="2.0b1" >
77

88
<uses-permission android:name="com.mohammadag.googlesearchapi.permission.ACCESS_GGOGLE_SEARCH_API" />
99
<uses-permission android:name="android.permission.INTERNET" />
@@ -41,6 +41,12 @@
4141
<service android:name=".services.PlexSearchService"
4242
android:label="Plex Search">
4343
</service>
44+
<service android:name=".services.WearListenerService"
45+
android:label="Wear Listener">
46+
<intent-filter>
47+
<action android:name="com.google.android.gms.wearable.BIND_LISTENER" />
48+
</intent-filter>
49+
</service>
4450
<activity
4551
android:name=".activities.NowPlayingActivity"
4652
android:configChanges="orientation|screenSize"

Voice Control For Plex/src/main/java/com/atomjack/vcfp/CastPlayerManager.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@
33
import android.content.Context;
44
import android.support.v7.media.MediaRouter;
55

6+
import com.atomjack.shared.Logger;
7+
import com.atomjack.shared.PlayerState;
8+
import com.atomjack.shared.Preferences;
69
import com.atomjack.vcfp.model.PlexClient;
710
import com.atomjack.vcfp.model.PlexMedia;
811
import com.atomjack.vcfp.model.PlexTrack;

Voice Control For Plex/src/main/java/com/atomjack/vcfp/Feedback.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
import android.speech.tts.UtteranceProgressListener;
66
import android.widget.Toast;
77

8+
import com.atomjack.shared.Logger;
9+
import com.atomjack.shared.Preferences;
810
import com.atomjack.vcfp.activities.MainActivity;
911

1012
import java.util.HashMap;
@@ -90,11 +92,11 @@ public void t(int id) {
9092
feedback(context.getString(id), true, true);
9193
}
9294

93-
private void feedback(String text, boolean errors) {
95+
protected void feedback(String text, boolean errors) {
9496
feedback(text, errors, false);
9597
}
9698

97-
private void feedback(String text, boolean errors, boolean forceToast) {
99+
protected void feedback(String text, boolean errors, boolean forceToast) {
98100

99101
if(!forceToast && VoiceControlForPlexApplication.getInstance().prefs.get(errors ? Preferences.ERRORS : Preferences.FEEDBACK, MainActivity.FEEDBACK_TOAST) == MainActivity.FEEDBACK_VOICE) {
100102
TextToSpeech tts = errors ? errorsTts : feedbackTts;

Voice Control For Plex/src/main/java/com/atomjack/vcfp/GDMService.java

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@
77
import android.net.wifi.WifiManager;
88
import android.support.v4.content.LocalBroadcastManager;
99

10+
import com.atomjack.shared.Logger;
11+
1012
import java.io.IOException;
1113
import java.net.DatagramPacket;
1214
import java.net.DatagramSocket;
@@ -50,18 +52,18 @@ protected void onHandleIntent(Intent intent) {
5052
Intent packetBroadcast = new Intent(GDMService.MSG_RECEIVED);
5153
packetBroadcast.putExtra("data", packetData);
5254
packetBroadcast.putExtra("ipaddress", packet.getAddress().toString());
53-
packetBroadcast.putExtra(VoiceControlForPlexApplication.Intent.EXTRA_CLASS, intent.getSerializableExtra(VoiceControlForPlexApplication.Intent.EXTRA_CLASS));
55+
packetBroadcast.putExtra(com.atomjack.shared.Intent.EXTRA_CLASS, intent.getSerializableExtra(com.atomjack.shared.Intent.EXTRA_CLASS));
5456
LocalBroadcastManager.getInstance(this).sendBroadcast(packetBroadcast);
5557
}
5658
} catch (SocketTimeoutException e) {
5759
Logger.w("Socket Timeout");
5860
socket.close();
5961
listening = false;
6062
Intent socketBroadcast = new Intent(GDMService.SOCKET_CLOSED);
61-
socketBroadcast.putExtra(VoiceControlForPlexApplication.Intent.EXTRA_SILENT, intent.getBooleanExtra(VoiceControlForPlexApplication.Intent.EXTRA_SILENT, false));
62-
socketBroadcast.putExtra(VoiceControlForPlexApplication.Intent.EXTRA_CLASS, intent.getSerializableExtra(VoiceControlForPlexApplication.Intent.EXTRA_CLASS));
63-
socketBroadcast.putExtra(VoiceControlForPlexApplication.Intent.SCAN_TYPE, intent.getStringExtra(VoiceControlForPlexApplication.Intent.SCAN_TYPE));
64-
socketBroadcast.putExtra(VoiceControlForPlexApplication.Intent.EXTRA_CONNECT_TO_CLIENT, intent.getBooleanExtra(VoiceControlForPlexApplication.Intent.EXTRA_CONNECT_TO_CLIENT, false));
63+
socketBroadcast.putExtra(com.atomjack.shared.Intent.EXTRA_SILENT, intent.getBooleanExtra(com.atomjack.shared.Intent.EXTRA_SILENT, false));
64+
socketBroadcast.putExtra(com.atomjack.shared.Intent.EXTRA_CLASS, intent.getSerializableExtra(com.atomjack.shared.Intent.EXTRA_CLASS));
65+
socketBroadcast.putExtra(com.atomjack.shared.Intent.SCAN_TYPE, intent.getStringExtra(com.atomjack.shared.Intent.SCAN_TYPE));
66+
socketBroadcast.putExtra(com.atomjack.shared.Intent.EXTRA_CONNECT_TO_CLIENT, intent.getBooleanExtra(com.atomjack.shared.Intent.EXTRA_CONNECT_TO_CLIENT, false));
6567
LocalBroadcastManager.getInstance(this).sendBroadcast(socketBroadcast);
6668
}
6769
}

Voice Control For Plex/src/main/java/com/atomjack/vcfp/ListenerWidget.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
import android.speech.RecognizerIntent;
1111
import android.widget.RemoteViews;
1212

13+
import com.atomjack.shared.Logger;
1314
import com.atomjack.vcfp.services.PlexSearchService;
1415

1516
import java.math.BigInteger;

Voice Control For Plex/src/main/java/com/atomjack/vcfp/NetworkChangeReceiver.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66
import android.net.ConnectivityManager;
77
import android.net.NetworkInfo;
88

9+
import com.atomjack.shared.Logger;
10+
911
public class NetworkChangeReceiver extends BroadcastReceiver {
1012
private boolean wifiConnected;
1113

Voice Control For Plex/src/main/java/com/atomjack/vcfp/PlayReceiver.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
import android.content.Intent;
66
import android.os.Bundle;
77

8+
import com.atomjack.shared.Logger;
89
import com.atomjack.vcfp.services.PlexSearchService;
910

1011
public class PlayReceiver extends BroadcastReceiver
@@ -14,15 +15,15 @@ public void onReceive(final Context context, final Intent intent)
1415
{
1516
Logger.d("PLAYRECEIVER");
1617
Bundle bundle = intent.getExtras();
17-
String queryText = bundle.getString(VoiceControlForPlexApplication.Intent.ARGUMENTS);
18+
String queryText = bundle.getString(com.atomjack.shared.Intent.ARGUMENTS);
1819
if(queryText == null && intent.getStringExtra(GoogleSearchApi.KEY_QUERY_TEXT) != null)
1920
queryText = intent.getStringExtra(GoogleSearchApi.KEY_QUERY_TEXT);
2021

2122
if(queryText != null && queryText.matches(context.getResources().getString(R.string.pattern_recognition))) {
2223
queryText = queryText.toLowerCase();
2324
Intent sendIntent = new Intent(context, PlexSearchService.class);
24-
sendIntent.setAction("com.atomjack.vcfp.intent.ACTION_SEARCH");
25-
sendIntent.putExtra(VoiceControlForPlexApplication.Intent.EXTRA_QUERYTEXT, queryText);
25+
// sendIntent.setAction("com.atomjack.vcfp.intent.ACTION_SEARCH");
26+
sendIntent.putExtra(com.atomjack.shared.Intent.EXTRA_QUERYTEXT, queryText);
2627
sendIntent.addFlags(Intent.FLAG_FROM_BACKGROUND);
2728
sendIntent.addFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP);
2829
sendIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);

0 commit comments

Comments
 (0)