summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--AndroidManifest.xml25
-rw-r--r--res/layout/mirosearch.xml13
-rw-r--r--res/values/strings.xml1
-rw-r--r--res/xml/miro_searchable.xml5
-rw-r--r--src/de/danoeh/antennapod/activity/MiroGuideMainActivity.java33
-rw-r--r--src/de/danoeh/antennapod/activity/MiroSearchActivity.java81
6 files changed, 151 insertions, 7 deletions
diff --git a/AndroidManifest.xml b/AndroidManifest.xml
index 12ffda396..336b0cf01 100644
--- a/AndroidManifest.xml
+++ b/AndroidManifest.xml
@@ -61,7 +61,9 @@
android:name="android.app.default_searchable"
android:value=".activity.SearchActivity" />
</activity>
- <activity android:name="de.danoeh.antennapod.activity.ItemviewActivity" android:configChanges="keyboardHidden|orientation"/>
+ <activity
+ android:name="de.danoeh.antennapod.activity.ItemviewActivity"
+ android:configChanges="keyboardHidden|orientation" />
<activity
android:name="de.danoeh.antennapod.activity.DownloadActivity"
android:label="@string/downloads_label" />
@@ -98,7 +100,7 @@
</intent-filter>
</receiver>
- <activity android:name=".activity.FeedInfoActivity">
+ <activity android:name=".activity.FeedInfoActivity" >
</activity>
<service
@@ -175,7 +177,24 @@
android:name="android.app.default_searchable"
android:value=".activity.SearchActivity" />
</activity>
- <activity android:name=".activity.MiroGuideMainActivity" android:label="@string/miro_guide_label"></activity>
+ <activity
+ android:name=".activity.MiroGuideMainActivity"
+ android:label="@string/miro_guide_label" >
+ <meta-data
+ android:name="android.app.default_searchable"
+ android:value=".activity.MiroSearchActivity" />
+ </activity>
+ <activity android:name=".activity.MiroSearchActivity" android:launchMode="singleTop" android:configChanges="keyboardHidden|orientation">
+ <intent-filter>
+ <action android:name="android.intent.action.SEARCH" />
+ </intent-filter>
+ <meta-data
+ android:name="android.app.searchable"
+ android:resource="@xml/miro_searchable" />
+ <meta-data
+ android:name="android.app.default_searchable"
+ android:value=".activity.MiroSearchActivity" />
+ </activity>
</application>
</manifest> \ No newline at end of file
diff --git a/res/layout/mirosearch.xml b/res/layout/mirosearch.xml
new file mode 100644
index 000000000..9a7947f9b
--- /dev/null
+++ b/res/layout/mirosearch.xml
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="utf-8"?>
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:orientation="vertical" >
+
+ <FrameLayout
+ android:id="@+id/channellistFragment"
+ android:name=".fragment.MiroChannellistFragment"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent" />
+
+</LinearLayout> \ No newline at end of file
diff --git a/res/values/strings.xml b/res/values/strings.xml
index d894e3a42..cf55941af 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -163,6 +163,7 @@
<string name="txtv_browse_miroguide_label">Or browse the Miro Guide:</string>
<string name="miro_guide_label">Miro Guide</string>
<string name="loading_label">Loading...</string>
+ <string name="miro_search_hint">Search Miro Guide</string>
</resources> \ No newline at end of file
diff --git a/res/xml/miro_searchable.xml b/res/xml/miro_searchable.xml
new file mode 100644
index 000000000..6710981e5
--- /dev/null
+++ b/res/xml/miro_searchable.xml
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="utf-8"?>
+<searchable xmlns:android="http://schemas.android.com/apk/res/android" android:hint="@string/miro_search_hint" android:label="@string/app_name" android:icon="@drawable/ic_launcher">
+
+
+</searchable> \ No newline at end of file
diff --git a/src/de/danoeh/antennapod/activity/MiroGuideMainActivity.java b/src/de/danoeh/antennapod/activity/MiroGuideMainActivity.java
index 8284e3c5e..6b794dd46 100644
--- a/src/de/danoeh/antennapod/activity/MiroGuideMainActivity.java
+++ b/src/de/danoeh/antennapod/activity/MiroGuideMainActivity.java
@@ -8,6 +8,8 @@ import android.widget.ArrayAdapter;
import android.widget.TextView;
import com.actionbarsherlock.app.SherlockListActivity;
+import com.actionbarsherlock.view.Menu;
+import com.actionbarsherlock.view.MenuItem;
import de.danoeh.antennapod.AppConfig;
import de.danoeh.antennapod.R;
@@ -46,7 +48,7 @@ public class MiroGuideMainActivity extends SherlockListActivity {
loadCategories();
}
}
-
+
private void createAdapter() {
if (categories != null) {
listAdapter = new ArrayAdapter<String>(this,
@@ -62,11 +64,12 @@ public class MiroGuideMainActivity extends SherlockListActivity {
private String[] c;
private MiroException exception;
-
+
@Override
protected void onPostExecute(Void result) {
if (exception == null) {
- if (AppConfig.DEBUG) Log.d(TAG, "Successfully loaded categories");
+ if (AppConfig.DEBUG)
+ Log.d(TAG, "Successfully loaded categories");
categories = c;
createAdapter();
} else {
@@ -93,7 +96,7 @@ public class MiroGuideMainActivity extends SherlockListActivity {
}
};
-
+
if (android.os.Build.VERSION.SDK_INT > android.os.Build.VERSION_CODES.GINGERBREAD_MR1) {
listLoader.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
} else {
@@ -101,4 +104,26 @@ public class MiroGuideMainActivity extends SherlockListActivity {
}
}
+ @Override
+ public boolean onCreateOptionsMenu(Menu menu) {
+ menu.add(Menu.NONE, R.id.search_item, Menu.NONE, R.string.search_label)
+ .setIcon(R.drawable.action_search)
+ .setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM);
+ return true;
+ }
+
+ @Override
+ public boolean onOptionsItemSelected(MenuItem item) {
+ switch (item.getItemId()) {
+ case android.R.id.home:
+ finish();
+ return true;
+ case R.id.search_item:
+ onSearchRequested();
+ return true;
+ default:
+ return false;
+ }
+ }
+
}
diff --git a/src/de/danoeh/antennapod/activity/MiroSearchActivity.java b/src/de/danoeh/antennapod/activity/MiroSearchActivity.java
new file mode 100644
index 000000000..461ca1292
--- /dev/null
+++ b/src/de/danoeh/antennapod/activity/MiroSearchActivity.java
@@ -0,0 +1,81 @@
+package de.danoeh.antennapod.activity;
+
+import android.app.SearchManager;
+import android.content.Intent;
+import android.os.Bundle;
+import android.support.v4.app.FragmentTransaction;
+import android.util.Log;
+
+import com.actionbarsherlock.app.SherlockFragmentActivity;
+import com.actionbarsherlock.view.Menu;
+import com.actionbarsherlock.view.MenuItem;
+
+import de.danoeh.antennapod.AppConfig;
+import de.danoeh.antennapod.R;
+import de.danoeh.antennapod.fragment.MiroChannellistFragment;
+
+public class MiroSearchActivity extends SherlockFragmentActivity {
+ private static final String TAG = "MiroSearchActivity";
+
+ private MiroChannellistFragment listFragment;
+
+ @Override
+ protected void onCreate(Bundle arg0) {
+ super.onCreate(arg0);
+ getSupportActionBar().setDisplayHomeAsUpEnabled(true);
+ setContentView(R.layout.mirosearch);
+ }
+
+ @Override
+ protected void onResume() {
+ super.onResume();
+ Intent intent = getIntent();
+ if (Intent.ACTION_SEARCH.equals(intent.getAction())) {
+ String query = intent.getStringExtra(SearchManager.QUERY);
+ getSupportActionBar()
+ .setSubtitle(
+ getString(R.string.search_term_label) + "\""
+ + query + "\"");
+ handleSearchRequest(query);
+ }
+ }
+
+ private void handleSearchRequest(String query) {
+ if (AppConfig.DEBUG)
+ Log.d(TAG, "Performing search");
+ FragmentTransaction ft = getSupportFragmentManager().beginTransaction();
+ listFragment = MiroChannellistFragment.newInstance("name", query,
+ "name");
+ ft.replace(R.id.channellistFragment, listFragment);
+ ft.commit();
+ }
+
+ @Override
+ protected void onNewIntent(Intent intent) {
+ setIntent(intent);
+ }
+
+ @Override
+ public boolean onCreateOptionsMenu(Menu menu) {
+ menu.add(Menu.NONE, R.id.search_item, Menu.NONE, R.string.search_label)
+ .setIcon(R.drawable.action_search)
+ .setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM);
+
+ return true;
+ }
+
+ @Override
+ public boolean onOptionsItemSelected(MenuItem item) {
+ switch (item.getItemId()) {
+ case android.R.id.home:
+ finish();
+ return true;
+ case R.id.search_item:
+ onSearchRequested();
+ return true;
+ default:
+ return false;
+ }
+ }
+
+}