406.1.40
by sindre_mehus
Android: New search interface. |
1 |
/*
|
2 |
This file is part of Subsonic.
|
|
3 |
||
4 |
Subsonic is free software: you can redistribute it and/or modify
|
|
5 |
it under the terms of the GNU General Public License as published by
|
|
6 |
the Free Software Foundation, either version 3 of the License, or
|
|
7 |
(at your option) any later version.
|
|
8 |
||
9 |
Subsonic is distributed in the hope that it will be useful,
|
|
10 |
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
11 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
12 |
GNU General Public License for more details.
|
|
13 |
||
14 |
You should have received a copy of the GNU General Public License
|
|
15 |
along with Subsonic. If not, see <http://www.gnu.org/licenses/>.
|
|
16 |
||
17 |
Copyright 2009 (C) Sindre Mehus
|
|
18 |
*/
|
|
19 |
||
20 |
package net.sourceforge.subsonic.androidapp.activity; |
|
21 |
||
22 |
import android.app.Activity; |
|
23 |
import android.app.SearchManager; |
|
24 |
import android.content.Intent; |
|
25 |
import android.os.Bundle; |
|
26 |
import android.provider.SearchRecentSuggestions; |
|
27 |
import net.sourceforge.subsonic.androidapp.util.Constants; |
|
28 |
import net.sourceforge.subsonic.androidapp.util.Util; |
|
477.1.1
by Chad Miller
Move the search and widget providers to a new namespace, so we can coexist with upstream. |
29 |
import net.sourceforge.subsonic.u1m.androidapp.provider.SearchSuggestionProvider; |
406.1.40
by sindre_mehus
Android: New search interface. |
30 |
|
519
by Chad Miller
Start adding analytics to Music app. I don't know how some of these traits will graph, so I'll revisit these later. |
31 |
import net.sourceforge.subsonic.u1m.androidapp.Analytics; |
32 |
import com.google.android.apps.analytics.GoogleAnalyticsTracker; |
|
33 |
||
406.1.40
by sindre_mehus
Android: New search interface. |
34 |
/**
|
406.1.69
by sindre_mehus
Android: Voice search. |
35 |
* Receives voice search queries and forwards to the SearchActivity.
|
406.1.40
by sindre_mehus
Android: New search interface. |
36 |
*
|
37 |
* http://android-developers.blogspot.com/2010/09/supporting-new-music-voice-action.html
|
|
38 |
*
|
|
39 |
* @author Sindre Mehus
|
|
40 |
*/
|
|
41 |
public class VoiceQueryReceiverActivity extends Activity { |
|
519
by Chad Miller
Start adding analytics to Music app. I don't know how some of these traits will graph, so I'll revisit these later. |
42 |
private static final String TAG = VoiceQueryReceiverActivity.class.getSimpleName(); |
43 |
private GoogleAnalyticsTracker tracker; |
|
406.1.40
by sindre_mehus
Android: New search interface. |
44 |
|
45 |
@Override
|
|
46 |
public void onCreate(Bundle savedInstanceState) { |
|
47 |
super.onCreate(savedInstanceState); |
|
48 |
||
519
by Chad Miller
Start adding analytics to Music app. I don't know how some of these traits will graph, so I'll revisit these later. |
49 |
this.tracker = GoogleAnalyticsTracker.getInstance(); |
50 |
this.tracker.trackPageView(TAG); |
|
51 |
||
406.1.40
by sindre_mehus
Android: New search interface. |
52 |
String query = getIntent().getStringExtra(SearchManager.QUERY); |
53 |
||
54 |
if (query != null) { |
|
519
by Chad Miller
Start adding analytics to Music app. I don't know how some of these traits will graph, so I'll revisit these later. |
55 |
this.tracker.trackPageView(TAG); |
56 |
||
406.1.40
by sindre_mehus
Android: New search interface. |
57 |
SearchRecentSuggestions suggestions = new SearchRecentSuggestions(this, SearchSuggestionProvider.AUTHORITY, |
58 |
SearchSuggestionProvider.MODE); |
|
59 |
suggestions.saveRecentQuery(query, null); |
|
60 |
||
519
by Chad Miller
Start adding analytics to Music app. I don't know how some of these traits will graph, so I'll revisit these later. |
61 |
|
406.1.69
by sindre_mehus
Android: Voice search. |
62 |
Intent intent = new Intent(VoiceQueryReceiverActivity.this, SearchActivity.class); |
406.1.40
by sindre_mehus
Android: New search interface. |
63 |
intent.putExtra(Constants.INTENT_EXTRA_NAME_QUERY, query); |
406.1.65
by sindre_mehus
Android: Navigate from search result to artist. |
64 |
intent.putExtra(Constants.INTENT_EXTRA_NAME_AUTOPLAY, true); |
406.1.40
by sindre_mehus
Android: New search interface. |
65 |
Util.startActivityWithoutTransition(VoiceQueryReceiverActivity.this, intent); |
66 |
}
|
|
67 |
finish(); |
|
68 |
Util.disablePendingTransition(this); |
|
69 |
}
|
|
477.1.1
by Chad Miller
Move the search and widget providers to a new namespace, so we can coexist with upstream. |
70 |
}
|