6
6
import android .content .DialogInterface ;
7
7
import android .content .Intent ;
8
8
import android .content .IntentFilter ;
9
+ import android .net .Uri ;
9
10
import android .os .Bundle ;
10
11
import android .support .v4 .content .LocalBroadcastManager ;
11
12
15
16
import com .atomjack .vcfp .Preferences ;
16
17
import com .atomjack .vcfp .R ;
17
18
import com .atomjack .vcfp .ScanHandler ;
19
+ import com .atomjack .vcfp .UriSerializer ;
18
20
import com .atomjack .vcfp .VoiceControlForPlexApplication ;
19
21
import com .atomjack .vcfp .model .PlexClient ;
20
22
import com .atomjack .vcfp .model .PlexDevice ;
21
23
import com .atomjack .vcfp .model .PlexServer ;
22
24
import com .google .gson .Gson ;
25
+ import com .google .gson .GsonBuilder ;
23
26
import com .google .gson .reflect .TypeToken ;
24
27
25
28
import java .lang .reflect .Type ;
@@ -32,6 +35,9 @@ public class ShortcutProviderActivity extends Activity {
32
35
private LocalScan localScan ;
33
36
34
37
private Gson gson = new Gson ();
38
+ private Gson gsonWrite = new GsonBuilder ()
39
+ .registerTypeAdapter (Uri .class , new UriSerializer ())
40
+ .create ();
35
41
36
42
private BroadcastReceiver gdmReceiver = new GDMReceiver ();
37
43
@@ -107,9 +113,9 @@ private void createShortcut(boolean use_current) {
107
113
108
114
Intent launchIntent = new Intent (this , ShortcutActivity .class );
109
115
if (!use_current ) {
110
- Logger .d ("setting mClient to %s" , client .name );
111
- launchIntent .putExtra (VoiceControlForPlexApplication .Intent .EXTRA_SERVER , gson .toJson (server ));
112
- launchIntent .putExtra (VoiceControlForPlexApplication .Intent .EXTRA_CLIENT , gson .toJson (client ));
116
+ Logger .d ("setting client to %s" , client .name );
117
+ launchIntent .putExtra (VoiceControlForPlexApplication .Intent .EXTRA_SERVER , gsonWrite .toJson (server ));
118
+ launchIntent .putExtra (VoiceControlForPlexApplication .Intent .EXTRA_CLIENT , gsonWrite .toJson (client ));
113
119
launchIntent .putExtra (VoiceControlForPlexApplication .Intent .EXTRA_RESUME , resume );
114
120
String label = server .name .equals (client .name ) ? server .name : (server .owned ? server .name : server .sourceTitle ) + "/" + client .name ;
115
121
sendIntent .putExtra (Intent .EXTRA_SHORTCUT_NAME , label );
0 commit comments