diff --git a/android/AndroidManifest.xml b/android/AndroidManifest.xml
index d53da66..1e07e69 100644
--- a/android/AndroidManifest.xml
+++ b/android/AndroidManifest.xml
@@ -23,31 +23,10 @@
android:screenOrientation="portrait" >
-
-
-
-
-
-
+
+
-
+
diff --git a/android/res/layout/fragment_search_page.xml b/android/res/layout/fragment_search_page.xml
new file mode 100644
index 0000000..263f855
--- /dev/null
+++ b/android/res/layout/fragment_search_page.xml
@@ -0,0 +1,18 @@
+
+
+
+
+
+
diff --git a/android/res/layout/fragment_settings_page.xml b/android/res/layout/fragment_settings_page.xml
new file mode 100644
index 0000000..a52c340
--- /dev/null
+++ b/android/res/layout/fragment_settings_page.xml
@@ -0,0 +1,65 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/android/res/layout/search_page_list_element.xml b/android/res/layout/search_page_list_element.xml
new file mode 100644
index 0000000..2a7e4e8
--- /dev/null
+++ b/android/res/layout/search_page_list_element.xml
@@ -0,0 +1,44 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/android/res/layout/search_page_list_header.xml b/android/res/layout/search_page_list_header.xml
new file mode 100644
index 0000000..4ac816d
--- /dev/null
+++ b/android/res/layout/search_page_list_header.xml
@@ -0,0 +1,22 @@
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/android/res/values-ru/strings.xml b/android/res/values-ru/strings.xml
index 9efc86e..76ac38f 100644
--- a/android/res/values-ru/strings.xml
+++ b/android/res/values-ru/strings.xml
@@ -10,8 +10,11 @@
Выберите язык:
+
Поиск
+ Введите запрос
+
Запись недоступна
Другие новости…
diff --git a/android/res/values-zh-rCN/strings.xml b/android/res/values-zh-rCN/strings.xml
index d210653..000f490 100644
--- a/android/res/values-zh-rCN/strings.xml
+++ b/android/res/values-zh-rCN/strings.xml
@@ -10,6 +10,8 @@
搜索标题
+ 输入问题
+
无法查看新闻记录
其他新闻…
diff --git a/android/res/values/strings.xml b/android/res/values/strings.xml
index 9f1bc9d..00b7dc5 100644
--- a/android/res/values/strings.xml
+++ b/android/res/values/strings.xml
@@ -16,7 +16,7 @@
Search
- Search hint
+ Enter search query
Record is not available
diff --git a/android/src/fishrungames/bashgid/MainActivity.java b/android/src/fishrungames/bashgid/MainActivity.java
index 378f8e0..e6641b6 100644
--- a/android/src/fishrungames/bashgid/MainActivity.java
+++ b/android/src/fishrungames/bashgid/MainActivity.java
@@ -6,10 +6,8 @@ import java.util.Locale;
import fishrungames.bashgid.core.NewsManager.NewsRecord;
import fishrungames.bashgid.core.db.NewsDataSource;
import android.support.v7.app.ActionBarActivity;
-import android.support.v7.widget.SearchView;
import android.support.v4.app.Fragment;
-import android.app.SearchManager;
-import android.content.Context;
+
import android.content.res.Configuration;
import android.os.Bundle;
@@ -25,7 +23,13 @@ public class MainActivity extends ActionBarActivity implements NavigationDrawerF
public static final String TAG_FROM_MAINFRAGMENT_TO_NEWSRECORDFRAGMENT = "TAG_FROM_MAINFRAGMENT_TO_NEWSRECORDFRAGMENT";
public static final String TAG_FROM_NEWSLISTFRAGMENT_TO_NEWSRECORDFRAGMENT = "TAG_FROM_NEWSLISTFRAGMENT_TO_NEWSRECORDFRAGMENT";
+ public static final String TAG_FROM_SEARCHFRAGMENT_TO_NEWSRECORDFRAGMENT = "TAG_FROM_SEARCHFRAGMENT_TO_NEWSRECORDFRAGMENT";
+ public static final String TAG_TO_SEARCHFRAGMENT = "SearchFragment";
+
+
+
+
static MainActivity instance = null;
private NavigationDrawerFragment mNavigationDrawerFragment = null;
@@ -49,7 +53,7 @@ public class MainActivity extends ActionBarActivity implements NavigationDrawerF
newsDataSource = new NewsDataSource(this);
newsDataSource.open();
-
+
}
public static MainActivity getInstance()
@@ -129,6 +133,20 @@ public class MainActivity extends ActionBarActivity implements NavigationDrawerF
mNavigationDrawerFragment.EnableDrawer();
}
+ public void OpenSearchScreen()
+ {
+ getSupportFragmentManager().beginTransaction().replace(R.id.fragment_container, new SearchFragment(), TAG_TO_SEARCHFRAGMENT).commit();
+
+ mNavigationDrawerFragment.EnableDrawer();
+ }
+
+ public void OpenSearchScreen(boolean restorePreviousSearch)
+ {
+ getSupportFragmentManager().beginTransaction().replace(R.id.fragment_container, new SearchFragment(restorePreviousSearch), TAG_TO_SEARCHFRAGMENT).commit();
+
+ mNavigationDrawerFragment.EnableDrawer();
+ }
+
public void OpenNewsRecordScreen(NewsRecord newsRecord, String tag)
{
// Xperimental -- addToBackStack provoke error "Class not found". Need
@@ -170,18 +188,7 @@ public class MainActivity extends ActionBarActivity implements NavigationDrawerF
{
MenuInflater inflater = getMenuInflater();
- inflater.inflate(R.menu.global, menu);
-
- /*
- SearchManager searchManager =
- (SearchManager) getSystemService(Context.SEARCH_SERVICE);
- SearchView searchView =
- (SearchView) menu.findItem(R.id.action_search).getActionView();
- searchView.setSearchableInfo(
- searchManager.getSearchableInfo(getComponentName()));
-*/
-
-
+ inflater.inflate(R.menu.global, menu);
return super.onCreateOptionsMenu(menu);
}
@@ -192,6 +199,16 @@ public class MainActivity extends ActionBarActivity implements NavigationDrawerF
// automatically handle clicks on the Home/Up button, so long
// as you specify a parent activity in AndroidManifest.xml.
int id = item.getItemId();
+
+ if (id == R.id.action_search)
+ {
+ if (getSupportFragmentManager().findFragmentByTag(TAG_TO_SEARCHFRAGMENT) == null)
+ {
+ OpenSearchScreen();
+ }
+ return true;
+ }
+
if (id == R.id.action_settings)
{
return true;
@@ -233,6 +250,20 @@ public class MainActivity extends ActionBarActivity implements NavigationDrawerF
return;
}
+
+ if (getSupportFragmentManager().findFragmentByTag(TAG_FROM_SEARCHFRAGMENT_TO_NEWSRECORDFRAGMENT) != null)
+ {
+ OpenSearchScreen(true);
+
+ return;
+ }
+
+ if (getSupportFragmentManager().findFragmentByTag(TAG_TO_SEARCHFRAGMENT) != null)
+ {
+ OpenMainScreen();
+
+ return;
+ }
super.onBackPressed();
diff --git a/android/src/fishrungames/bashgid/MainPageFragment.java b/android/src/fishrungames/bashgid/MainPageFragment.java
index bad6c35..163898f 100644
--- a/android/src/fishrungames/bashgid/MainPageFragment.java
+++ b/android/src/fishrungames/bashgid/MainPageFragment.java
@@ -5,7 +5,8 @@ import java.util.ArrayList;
import fishrungames.bashgid.core.ImageManager;
import fishrungames.bashgid.core.NewsManager;
import fishrungames.bashgid.core.NewsManager.NewsRecord;
-import fishrungames.bashgid.core.NewsManager.NewsUpdatedCallbackInterface;
+import fishrungames.bashgid.core.NewsUpdatedCallbackInterface;
+import fishrungames.bashgid.core.RemoveCallbackInterface;
import android.content.Context;
import android.os.Bundle;
import android.support.v4.app.Fragment;
@@ -47,7 +48,7 @@ public class MainPageFragment extends Fragment implements NewsUpdatedCallbackInt
ListView listView;
View header;
- NewsManager.RemoveCallbackInterface downloadNewsCanceller = null;
+ RemoveCallbackInterface downloadNewsCanceller = null;
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
diff --git a/android/src/fishrungames/bashgid/NavigationDrawerFragment.java b/android/src/fishrungames/bashgid/NavigationDrawerFragment.java
index ca38ef3..00353bd 100644
--- a/android/src/fishrungames/bashgid/NavigationDrawerFragment.java
+++ b/android/src/fishrungames/bashgid/NavigationDrawerFragment.java
@@ -259,8 +259,6 @@ public class NavigationDrawerFragment extends Fragment {
// If the drawer is open, show the global app actions in the action bar. See also
// showGlobalContextActionBar, which controls the top-left area of the action bar.
-
- //inflater.inflate(R.menu.global, menu);
showGlobalContextActionBar();
super.onCreateOptionsMenu(menu, inflater);
diff --git a/android/src/fishrungames/bashgid/NewsListFragment.java b/android/src/fishrungames/bashgid/NewsListFragment.java
index d6d6e26..7604665 100644
--- a/android/src/fishrungames/bashgid/NewsListFragment.java
+++ b/android/src/fishrungames/bashgid/NewsListFragment.java
@@ -6,7 +6,8 @@ import java.util.ArrayList;
import fishrungames.bashgid.core.ImageManager;
import fishrungames.bashgid.core.NewsManager;
import fishrungames.bashgid.core.NewsManager.NewsRecord;
-import fishrungames.bashgid.core.NewsManager.NewsUpdatedCallbackInterface;
+import fishrungames.bashgid.core.NewsUpdatedCallbackInterface;
+import fishrungames.bashgid.core.RemoveCallbackInterface;
import fishrungames.bashgid.core.db.NewsDataSource;
import android.content.Context;
import android.os.Bundle;
@@ -31,7 +32,7 @@ public class NewsListFragment extends Fragment implements NewsUpdatedCallbackInt
ArrayList newsRecordArr;
- NewsManager.RemoveCallbackInterface downloadNewsCanceller = null;
+ RemoveCallbackInterface downloadNewsCanceller = null;
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
diff --git a/android/src/fishrungames/bashgid/SearchFragment.java b/android/src/fishrungames/bashgid/SearchFragment.java
new file mode 100644
index 0000000..5600958
--- /dev/null
+++ b/android/src/fishrungames/bashgid/SearchFragment.java
@@ -0,0 +1,224 @@
+package fishrungames.bashgid;
+
+
+import java.util.ArrayList;
+
+import fishrungames.bashgid.core.NewsManager;
+import fishrungames.bashgid.core.NewsManager.NewsRecord;
+import fishrungames.bashgid.core.db.NewsDataSource;
+import fishrungames.bashgid.core.ImageManager;
+import fishrungames.bashgid.core.NewsSearchRunnable;
+import fishrungames.bashgid.core.NewsUpdatedCallbackInterface;
+import android.content.Context;
+import android.os.Bundle;
+import android.support.v4.app.Fragment;
+import android.text.Editable;
+import android.text.TextWatcher;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.View.OnClickListener;
+import android.view.ViewGroup;
+import android.widget.BaseAdapter;
+import android.widget.Button;
+import android.widget.EditText;
+import android.widget.ImageButton;
+import android.widget.ListView;
+import android.widget.TextView;
+
+public class SearchFragment extends Fragment implements NewsUpdatedCallbackInterface
+{
+
+ ListView listView;
+
+ ListAdapter listAdapter;
+
+ EditText searchEditText;
+
+ ArrayList searchResultArr = new ArrayList();
+
+ volatile boolean searchIsPerformingNow = false;
+
+ NewsSearchRunnable nextSearchRunnable = null;
+
+ boolean restorePreviousSearch = false;
+
+ public SearchFragment()
+ {
+ }
+
+ public SearchFragment(boolean restorePreviousSearch)
+ {
+ this.restorePreviousSearch = restorePreviousSearch;
+ }
+
+ @Override
+ public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
+
+ View rootView = inflater.inflate(R.layout.fragment_search_page, container, false);
+
+ listView = (ListView) rootView.findViewById(R.id.listView);
+
+ listAdapter = new ListAdapter(getActivity());
+
+ listView.setAdapter(listAdapter);
+
+ View header = inflater.inflate(R.layout.search_page_list_header, null);
+
+ searchEditText = (EditText) header.findViewById(R.id.editText);
+
+ if (restorePreviousSearch)
+ {
+ searchEditText.setText(NewsManager.GetInstance().getLastSearchQuery());
+ searchResultArr = NewsManager.GetInstance().getSearchResultNews();
+ }
+
+
+ searchEditText.addTextChangedListener(new TextWatcher(){
+
+ public void afterTextChanged(Editable s) {
+
+ String text = searchEditText.getText().toString();
+
+ CallUpdateNews(text);
+
+ }
+
+ public void beforeTextChanged(CharSequence s, int start, int count, int after){}
+ public void onTextChanged(CharSequence s, int start, int before, int count){}
+ });
+
+
+
+ listView.addHeaderView(header);
+
+ return rootView;
+ }
+
+
+ public class ListAdapter extends BaseAdapter {
+ private Context mContext;
+
+ public ListAdapter(Context c) {
+ mContext = c;
+ }
+
+ public int getCount() {
+ return searchResultArr.size();
+ }
+
+ public Object getItem(int position) {
+ return null;
+ }
+
+ public long getItemId(int position) {
+ return 0;
+ }
+
+ // create a new ImageView for each item referenced by the Adapter
+ public View getView(int position, View convertView, ViewGroup parent) {
+
+
+ View view;
+ if (convertView == null) { // if it's not recycled, initialize some attributes
+ LayoutInflater inflater = (LayoutInflater) mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
+ view = inflater.inflate(R.layout.search_page_list_element, null);
+
+ } else {
+ view = convertView;
+ }
+
+ ImageButton imageButton = (ImageButton) view.findViewById(R.id.imageButton);
+
+ Button button = (Button) view.findViewById(R.id.button);
+
+ TextView textView = (TextView) view.findViewById(R.id.textView);
+
+ ImageManager.getInstance().ApplyImageToImageView(imageButton, searchResultArr.get(position).imageId);
+
+ button.setText(searchResultArr.get(position).title);
+
+ textView.setText(NewsDataSource.iso8601Format.format(searchResultArr.get(position).pubDate));
+
+ button.setOnClickListener(new ButtonOnClickListener(searchResultArr.get(position)));
+
+ imageButton.setOnClickListener(new ButtonOnClickListener(searchResultArr.get(position)));
+
+ return view;
+ }
+
+ }
+
+
+ @Override
+ public void OnNewsUpdated()
+ {
+ getActivity().runOnUiThread(new RefreshSearchListRunnable());
+ }
+
+ public void CallUpdateNews(String text)
+ {
+ if (!searchIsPerformingNow)
+ {
+ searchIsPerformingNow = true;
+
+ NewsSearchRunnable runnable = new NewsSearchRunnable(this, text);
+
+ ImmediateSearchNews(runnable);
+ }
+ else
+ {
+ nextSearchRunnable = new NewsSearchRunnable(this, text);
+ }
+ }
+
+ private void ImmediateSearchNews(NewsSearchRunnable runnable)
+ {
+ Thread thread = new Thread(runnable);
+
+ thread.start();
+ }
+
+
+ private class RefreshSearchListRunnable implements Runnable
+ {
+
+ @Override
+ public void run()
+ {
+ searchResultArr = NewsManager.GetInstance().getSearchResultNews();
+
+ listAdapter.notifyDataSetChanged();
+
+ searchIsPerformingNow = false;
+
+ if (nextSearchRunnable != null)
+ {
+ ImmediateSearchNews(nextSearchRunnable);
+
+ nextSearchRunnable = null;
+ }
+ }
+
+ }
+
+
+ public static class ButtonOnClickListener implements OnClickListener
+ {
+
+ NewsRecord newsRecord;
+
+ public ButtonOnClickListener(NewsRecord newsRecord)
+ {
+ this.newsRecord = newsRecord;
+ }
+
+ @Override
+ public void onClick(View v)
+ {
+ MainActivity.getInstance().OpenNewsRecordScreen(newsRecord, MainActivity.TAG_FROM_SEARCHFRAGMENT_TO_NEWSRECORDFRAGMENT);
+ }
+
+ }
+
+
+}
diff --git a/android/src/fishrungames/bashgid/core/NewsManager.java b/android/src/fishrungames/bashgid/core/NewsManager.java
index 74d0b20..fd7083f 100644
--- a/android/src/fishrungames/bashgid/core/NewsManager.java
+++ b/android/src/fishrungames/bashgid/core/NewsManager.java
@@ -10,7 +10,7 @@ import android.util.Log;
import fishrungames.bashgid.MainActivity;
-import fishrungames.bashgid.core.db.BashgidSqliteHelper;
+
public class NewsManager {
@@ -30,6 +30,10 @@ public class NewsManager {
private ArrayList newsRecord = new ArrayList();
+ private volatile Semaphore newsSearchResultMutex = new Semaphore(1, true);
+ private ArrayList newsSearchResult = new ArrayList();
+ String LastSearchQuery = "";
+
public static boolean CanCallSynchronization()
{
@@ -220,18 +224,7 @@ public class NewsManager {
}
}
-
- public static interface NewsUpdatedCallbackInterface
- {
- public void OnNewsUpdated();
- }
-
- public static interface RemoveCallbackInterface
- {
- public void RemoveCallback();
- }
-
-
+
public NewsManager()
{
try
@@ -276,6 +269,62 @@ public class NewsManager {
return result;
}
+ public ArrayList getSearchResultNews()
+ {
+ ArrayList result = new ArrayList();
+
+ try
+ {
+ newsSearchResultMutex.acquire();
+ try
+ {
+ result.addAll(newsSearchResult);
+
+ } finally
+ {
+ newsSearchResultMutex.release();
+ }
+ } catch (InterruptedException ie)
+ {
+ Log.e("Error in getSearchResultNews", "Error in getSearchResultNews");
+ }
+
+ return result;
+ }
+
+
+ public String getLastSearchQuery()
+ {
+ //Should always be called from main thread
+
+ return LastSearchQuery;
+ }
+
+ public void searchNews(String searchText)
+ {
+ ArrayList result = new ArrayList();
+
+ result = MainActivity.getInstance().newsDataSource.searchNewsByString(searchText);
+
+ try
+ {
+ newsSearchResultMutex.acquire();
+ try
+ {
+
+ LastSearchQuery = searchText;
+ newsSearchResult = result;
+
+ } finally
+ {
+ newsSearchResultMutex.release();
+ }
+ } catch (InterruptedException ie)
+ {
+ Log.e("Error in getSearchResultNews", "Error in getSearchResultNews");
+ }
+ }
+
public static ArrayList ExtractEnclosureImageUrl(ArrayList rss2ItemArr)
{
diff --git a/android/src/fishrungames/bashgid/core/NewsSearchResultInterface.java b/android/src/fishrungames/bashgid/core/NewsSearchResultInterface.java
new file mode 100644
index 0000000..f7d69f3
--- /dev/null
+++ b/android/src/fishrungames/bashgid/core/NewsSearchResultInterface.java
@@ -0,0 +1,12 @@
+package fishrungames.bashgid.core;
+
+import java.util.ArrayList;
+
+import fishrungames.bashgid.core.NewsManager.NewsRecord;
+
+public interface NewsSearchResultInterface
+{
+
+ public void OnNewsUpdated(ArrayList newsRecordArr);
+
+}
diff --git a/android/src/fishrungames/bashgid/core/NewsSearchRunnable.java b/android/src/fishrungames/bashgid/core/NewsSearchRunnable.java
new file mode 100644
index 0000000..9b0dbfa
--- /dev/null
+++ b/android/src/fishrungames/bashgid/core/NewsSearchRunnable.java
@@ -0,0 +1,92 @@
+package fishrungames.bashgid.core;
+
+import java.util.concurrent.Semaphore;
+
+
+import android.util.Log;
+
+public class NewsSearchRunnable implements Runnable, RemoveCallbackInterface
+{
+
+ private volatile Semaphore callbackMutex = new Semaphore(1, true);
+
+ private NewsUpdatedCallbackInterface callback = null;
+
+ private String query;
+
+ public NewsSearchRunnable(NewsUpdatedCallbackInterface callback, String query)
+ {
+ this.query = query;
+
+ try
+ {
+ callbackMutex.acquire();
+ try
+ {
+
+ this.callback = callback;
+
+
+ } finally
+ {
+ callbackMutex.release();
+ }
+ } catch (InterruptedException ie)
+ {
+ Log.e("Error in NewsSearchRunnable", "Error in NewsSearchRunnable");
+ }
+ }
+
+ @Override
+ public void run()
+ {
+
+ NewsManager.GetInstance().searchNews(query);
+
+ //After all
+
+ try
+ {
+ callbackMutex.acquire();
+ try
+ {
+
+ if (callback != null)
+ {
+ callback.OnNewsUpdated();
+
+ callback = null;
+ }
+
+ } finally
+ {
+ callbackMutex.release();
+ }
+ } catch (InterruptedException ie)
+ {
+ Log.e("Error in DownloadNewsRunnable", "Error in DownloadNewsRunnable");
+ }
+ }
+
+ @Override
+ public void RemoveCallback()
+ {
+ try
+ {
+ callbackMutex.acquire();
+ try
+ {
+
+ callback = null;
+
+ } finally
+ {
+ callbackMutex.release();
+ }
+ } catch (InterruptedException ie)
+ {
+ Log.e("Error in NewsSearchRunnable", "Error in NewsSearchRunnable");
+ }
+ }
+
+}
diff --git a/android/src/fishrungames/bashgid/core/NewsUpdatedCallbackInterface.java b/android/src/fishrungames/bashgid/core/NewsUpdatedCallbackInterface.java
new file mode 100644
index 0000000..2b1a19b
--- /dev/null
+++ b/android/src/fishrungames/bashgid/core/NewsUpdatedCallbackInterface.java
@@ -0,0 +1,8 @@
+package fishrungames.bashgid.core;
+
+public interface NewsUpdatedCallbackInterface
+{
+ //Xperimental -- maybe allow it to return value? Array of news
+ public void OnNewsUpdated();
+}
+
diff --git a/android/src/fishrungames/bashgid/core/RemoveCallbackInterface.java b/android/src/fishrungames/bashgid/core/RemoveCallbackInterface.java
new file mode 100644
index 0000000..7638843
--- /dev/null
+++ b/android/src/fishrungames/bashgid/core/RemoveCallbackInterface.java
@@ -0,0 +1,8 @@
+package fishrungames.bashgid.core;
+
+
+public interface RemoveCallbackInterface
+{
+ public void RemoveCallback();
+}
+
\ No newline at end of file
diff --git a/android/src/fishrungames/bashgid/core/db/NewsDataSource.java b/android/src/fishrungames/bashgid/core/db/NewsDataSource.java
index 9be548e..7dc9de2 100644
--- a/android/src/fishrungames/bashgid/core/db/NewsDataSource.java
+++ b/android/src/fishrungames/bashgid/core/db/NewsDataSource.java
@@ -167,13 +167,13 @@ public class NewsDataSource
{
ArrayList newsRecordArr = new ArrayList();
-/*
+
try
{
mutex.acquire();
try
{
-*/
+
if (database != null)
{
Cursor cursor = database.query(BashgidSqliteHelper.TABLE_NEWS, allColumns, null, null, null, null, null);
@@ -190,16 +190,58 @@ public class NewsDataSource
cursor.close();
}
- /*
+
} finally
{
mutex.release();
}
} catch (InterruptedException ie)
{
- Log.e("Error when calling replaceNews", "Error when calling replaceNews");
+ Log.e("Error when calling getNews", "Error when calling getNews");
}
- */
+
+ return newsRecordArr;
+ }
+
+
+ public ArrayList searchNewsByString(String searchText)
+ {
+
+ ArrayList newsRecordArr = new ArrayList();
+
+ try
+ {
+ mutex.acquire();
+ try
+ {
+
+ if (database != null)
+ {
+
+ Cursor cursor = database.query(true, BashgidSqliteHelper.TABLE_NEWS, allColumns, BashgidSqliteHelper.COLUMN_TITLE + " LIKE '%"+searchText+"%'", null, null, null, null, null);
+
+ cursor.moveToFirst();
+
+ while (!cursor.isAfterLast())
+ {
+ NewsManager.NewsRecord newsRecord = cursorToNewsRecord(cursor);
+ newsRecordArr.add(newsRecord);
+ cursor.moveToNext();
+ }
+
+ cursor.close();
+ }
+
+
+ } finally
+ {
+ mutex.release();
+ }
+ } catch (InterruptedException ie)
+ {
+ Log.e("Error when calling searchNewsByString", "Error when calling searchNewsByString");
+ }
+
return newsRecordArr;
}