diff --git a/android/res/drawable-hdpi/ic_action_call.png b/android/res/drawable-hdpi/ic_action_call.png
new file mode 100644
index 0000000..4960e96
Binary files /dev/null and b/android/res/drawable-hdpi/ic_action_call.png differ
diff --git a/android/res/drawable-hdpi/ic_action_search.png b/android/res/drawable-hdpi/ic_action_search.png
new file mode 100644
index 0000000..f594b4e
Binary files /dev/null and b/android/res/drawable-hdpi/ic_action_search.png differ
diff --git a/android/res/drawable-hdpi/ic_action_web_site.png b/android/res/drawable-hdpi/ic_action_web_site.png
new file mode 100644
index 0000000..64c48a0
Binary files /dev/null and b/android/res/drawable-hdpi/ic_action_web_site.png differ
diff --git a/android/res/drawable-mdpi/ic_action_call.png b/android/res/drawable-mdpi/ic_action_call.png
new file mode 100644
index 0000000..f9441cd
Binary files /dev/null and b/android/res/drawable-mdpi/ic_action_call.png differ
diff --git a/android/res/drawable-mdpi/ic_action_search.png b/android/res/drawable-mdpi/ic_action_search.png
new file mode 100644
index 0000000..2e446ec
Binary files /dev/null and b/android/res/drawable-mdpi/ic_action_search.png differ
diff --git a/android/res/drawable-mdpi/ic_action_web_site.png b/android/res/drawable-mdpi/ic_action_web_site.png
new file mode 100644
index 0000000..5e7d69f
Binary files /dev/null and b/android/res/drawable-mdpi/ic_action_web_site.png differ
diff --git a/android/res/drawable-xhdpi/ic_action_call.png b/android/res/drawable-xhdpi/ic_action_call.png
new file mode 100644
index 0000000..2790e4f
Binary files /dev/null and b/android/res/drawable-xhdpi/ic_action_call.png differ
diff --git a/android/res/drawable-xhdpi/ic_action_search.png b/android/res/drawable-xhdpi/ic_action_search.png
new file mode 100644
index 0000000..aad535e
Binary files /dev/null and b/android/res/drawable-xhdpi/ic_action_search.png differ
diff --git a/android/res/drawable-xhdpi/ic_action_web_site.png b/android/res/drawable-xhdpi/ic_action_web_site.png
new file mode 100644
index 0000000..f800630
Binary files /dev/null and b/android/res/drawable-xhdpi/ic_action_web_site.png differ
diff --git a/android/res/drawable-xxhdpi/ic_action_call.png b/android/res/drawable-xxhdpi/ic_action_call.png
new file mode 100644
index 0000000..3162ed2
Binary files /dev/null and b/android/res/drawable-xxhdpi/ic_action_call.png differ
diff --git a/android/res/drawable-xxhdpi/ic_action_search.png b/android/res/drawable-xxhdpi/ic_action_search.png
new file mode 100644
index 0000000..9c0ea3c
Binary files /dev/null and b/android/res/drawable-xxhdpi/ic_action_search.png differ
diff --git a/android/res/drawable-xxhdpi/ic_action_web_site.png b/android/res/drawable-xxhdpi/ic_action_web_site.png
new file mode 100644
index 0000000..dc210c4
Binary files /dev/null and b/android/res/drawable-xxhdpi/ic_action_web_site.png differ
diff --git a/android/res/drawable/ic_action_call.png b/android/res/drawable/ic_action_call.png
new file mode 100644
index 0000000..3162ed2
Binary files /dev/null and b/android/res/drawable/ic_action_call.png differ
diff --git a/android/res/drawable/ic_action_search.png b/android/res/drawable/ic_action_search.png
new file mode 100644
index 0000000..9c0ea3c
Binary files /dev/null and b/android/res/drawable/ic_action_search.png differ
diff --git a/android/res/drawable/ic_action_web_site.png b/android/res/drawable/ic_action_web_site.png
new file mode 100644
index 0000000..dc210c4
Binary files /dev/null and b/android/res/drawable/ic_action_web_site.png differ
diff --git a/android/res/drawable/see_more_small.png b/android/res/drawable/see_more_small.png
new file mode 100644
index 0000000..8785a9d
Binary files /dev/null and b/android/res/drawable/see_more_small.png differ
diff --git a/android/res/layout/article_button_element.xml b/android/res/layout/article_button_element.xml
index b4c36f5..3633a0f 100644
--- a/android/res/layout/article_button_element.xml
+++ b/android/res/layout/article_button_element.xml
@@ -10,8 +10,13 @@
+ android:layout_margin="8dp"
+ android:background="@color/bkg2"
+ android:drawableLeft="@drawable/ic_action_web_site"
+ android:text="@string/go_to_website"
+ android:textSize="30sp" />
diff --git a/android/res/layout/article_geotag_element.xml b/android/res/layout/article_geotag_element.xml
index 1cc053c..5ca9b1a 100644
--- a/android/res/layout/article_geotag_element.xml
+++ b/android/res/layout/article_geotag_element.xml
@@ -8,6 +8,25 @@
android:orientation="vertical"
android:showDividers="middle" >
+
+
+
+
+
+
+
+
+
diff --git a/android/res/layout/fragment_osm_map_page.xml b/android/res/layout/fragment_osm_map_page.xml
index c995b62..52c21f6 100644
--- a/android/res/layout/fragment_osm_map_page.xml
+++ b/android/res/layout/fragment_osm_map_page.xml
@@ -11,7 +11,7 @@
tools:context="fishrungames.bashgid.MapHolderFragment" >
+
+
+ android:layout_height="wrap_content"
+ android:layout_gravity="bottom"
+ android:gravity="bottom" >
+ android:textSize="20sp" />
+
+
@@ -40,7 +50,9 @@
android:id="@+id/descriptionTextView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
- android:text="TextView" />
+ android:layout_margin="14dp"
+ android:text=""
+ android:textSize="18sp" />
diff --git a/android/res/layout/main_page_search.xml b/android/res/layout/main_page_search.xml
index abf740e..5b4082c 100644
--- a/android/res/layout/main_page_search.xml
+++ b/android/res/layout/main_page_search.xml
@@ -26,7 +26,7 @@
android:textSize="20sp" />
diff --git a/android/res/layout/osm_dialog.xml b/android/res/layout/osm_dialog.xml
new file mode 100644
index 0000000..f682be7
--- /dev/null
+++ b/android/res/layout/osm_dialog.xml
@@ -0,0 +1,51 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/android/res/layout/search_page_list_header.xml b/android/res/layout/search_page_list_header.xml
index edf3957..a56c9d7 100644
--- a/android/res/layout/search_page_list_header.xml
+++ b/android/res/layout/search_page_list_header.xml
@@ -9,7 +9,7 @@
tools:context="fishrungames.bashgid.SearchFragment" >
+
+
\ No newline at end of file
diff --git a/android/res/layout/simple_hview_list_element.xml b/android/res/layout/simple_hview_list_element.xml
index ee2bb30..02b9232 100644
--- a/android/res/layout/simple_hview_list_element.xml
+++ b/android/res/layout/simple_hview_list_element.xml
@@ -24,7 +24,7 @@
android:layout_gravity="center_horizontal"
android:padding="2dp"
android:text="TextView"
- android:textSize="16sp"
+ android:textSize="24sp"
android:textStyle="bold" />
+ android:text="TextView"
+ android:textSize="18sp" />
diff --git a/android/res/menu/global.xml b/android/res/menu/global.xml
index 307306f..3ad6f3b 100644
--- a/android/res/menu/global.xml
+++ b/android/res/menu/global.xml
@@ -4,7 +4,7 @@
diff --git a/android/res/values-ru/strings.xml b/android/res/values-ru/strings.xml
index 3abdb76..da4ce1c 100644
--- a/android/res/values-ru/strings.xml
+++ b/android/res/values-ru/strings.xml
@@ -63,5 +63,16 @@
Открыть
Отмена
-
+ Искать везде
+ Искать в: %%
+
+Адрес:
+Скопированный текст
+Адрес скопирован в буфер обмена.
+
+Найдено результатов поиска: %%
+Идет поиск, пожалуйста, подождите...
+Чтобы начать поиск, введите как минимум 3 символа
+
+
diff --git a/android/res/values-zh-rCN/strings.xml b/android/res/values-zh-rCN/strings.xml
index acf0ba1..9e028da 100644
--- a/android/res/values-zh-rCN/strings.xml
+++ b/android/res/values-zh-rCN/strings.xml
@@ -20,7 +20,7 @@
头条新闻
- Load more
+ 加载更多
新闻内容描述
@@ -47,13 +47,25 @@
Price:
RUB
- Show on map
- Map is loading...
- Map is loaded
- News are loading...
- Open
- Cancel
+ 在地图上显示
+ 地图正在加载...
+ 地图加载完毕
+ 新闻正在加载
+ 打开
+ 取消
+
+全面搜索
+在%%搜索:
+
+地址:
+复制文本
+地址已被复制到剪贴板
+
+搜索结果: %% 文章被找到
+正在搜索,请稍等…
+输入关键字符,开始搜索
+
diff --git a/android/res/values/strings.xml b/android/res/values/strings.xml
index 4887391..ed61d2d 100644
--- a/android/res/values/strings.xml
+++ b/android/res/values/strings.xml
@@ -63,6 +63,18 @@
Open
Cancel
+
+ Search everywhere
+Search in: %%
+Address:
+Copied text
+Address is copied to clipboard.
+
+
+Search result: %% articles found
+Search is performing, please wait...
+To start search, enter at least 3 symbols
+
+
-
diff --git a/android/src/fishrungames/bashgid/AlbumListFragment.java b/android/src/fishrungames/bashgid/AlbumListFragment.java
index 16d92a4..2f0236b 100644
--- a/android/src/fishrungames/bashgid/AlbumListFragment.java
+++ b/android/src/fishrungames/bashgid/AlbumListFragment.java
@@ -110,7 +110,7 @@ public class AlbumListFragment extends Fragment
protected Long doInBackground(String... queryArr)
{
- albumArr = MainActivity.getInstance().albumDataSource.GetAllAlbumShortData();
+ albumArr = MainActivity.getInstance().albumDataSource.GetAllAlbumShortDataExceptHidden();
return (long) 0;
}
diff --git a/android/src/fishrungames/bashgid/ArticleFragment.java b/android/src/fishrungames/bashgid/ArticleFragment.java
index 04d1c10..72654aa 100644
--- a/android/src/fishrungames/bashgid/ArticleFragment.java
+++ b/android/src/fishrungames/bashgid/ArticleFragment.java
@@ -38,15 +38,18 @@ import android.view.LayoutInflater;
import android.view.MotionEvent;
import android.view.View;
import android.view.View.OnClickListener;
+import android.view.View.OnLongClickListener;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.AdapterView;
import android.widget.Button;
+import android.widget.EditText;
import android.widget.ImageView;
import android.widget.ListView;
import android.widget.ProgressBar;
import android.widget.TextView;
+import android.widget.Toast;
@@ -55,7 +58,7 @@ public class ArticleFragment extends Fragment
public static class ArticleLayoutElement
{
- public int type; //0 title; 1 text; 2 photo; 3 geotag; 4 photo_album; 5 button
+ public int type; //0 title; 1 text; 2 photo; 3 geotag; 4 photo_album; 5 button 6 phone
public String value;
@@ -194,6 +197,12 @@ public class ArticleFragment extends Fragment
articleLayout.add(new ArticleLayoutElement(1, article.content));
+ if (article.phone.length() > 0)
+ {
+ articleLayout.add(new ArticleLayoutElement(6, article.phone));
+
+ }
+
if (article.geoLat != 0 && article.geoLon != 0)
{
articleLayout.add(new ArticleLayoutElement(article.geoLat, article.geoLon));
@@ -271,7 +280,7 @@ public class ArticleFragment extends Fragment
@Override
public int getViewTypeCount()
{
- return 6;
+ return 7;
}
@Override
@@ -309,15 +318,20 @@ public class ArticleFragment extends Fragment
LayoutInflater inflater = (LayoutInflater) mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
view = inflater.inflate(R.layout.article_album_element, null);
}
- else //if (getItemViewType(position) == 5)
+ else if (getItemViewType(position) == 5)
{
LayoutInflater inflater = (LayoutInflater) mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
view = inflater.inflate(R.layout.article_button_element, null);
}
+ else //if (getItemViewType(position) == 6)
+ {
+ LayoutInflater inflater = (LayoutInflater) mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
+ view = inflater.inflate(R.layout.article_phone_element, null);
+ }
} else {
view = convertView;
}
-
+
if (getItemViewType(position) == 0)
{
@@ -325,7 +339,7 @@ public class ArticleFragment extends Fragment
textView.setText(articleLayout.get(position).value);
- textView.setTextSize(24);
+ textView.setTextSize(64);
textView.setTypeface(null, Typeface.BOLD);
textView.setGravity(Gravity.CENTER_HORIZONTAL);
@@ -336,7 +350,7 @@ public class ArticleFragment extends Fragment
textView.setText(articleLayout.get(position).value);
- textView.setTextSize(12);
+ textView.setTextSize(24);
textView.setTypeface(null, Typeface.NORMAL);
textView.setGravity(Gravity.LEFT);
@@ -357,7 +371,49 @@ public class ArticleFragment extends Fragment
double geoLat = articleLayout.get(position).geoLat;
double geoLon = articleLayout.get(position).geoLon;
+ TextView addressTextView = (TextView) view.findViewById(R.id.addressTextView);
+
+ if (article.address.length() > 0)
+ {
+ addressTextView.setText(article.address);
+ addressTextView.setVisibility(View.VISIBLE);
+
+ final String copied_text = getResources().getString(R.string.copied_text);
+
+ addressTextView.setOnLongClickListener(new OnLongClickListener(){
+
+ @Override
+ public boolean onLongClick(View v)
+ {
+
+
+ if(android.os.Build.VERSION.SDK_INT < android.os.Build.VERSION_CODES.HONEYCOMB) {
+ android.text.ClipboardManager clipboard = (android.text.ClipboardManager) MainActivity.getInstance().getSystemService(Context.CLIPBOARD_SERVICE);
+ clipboard.setText(article.address);
+ } else {
+ android.content.ClipboardManager clipboard = (android.content.ClipboardManager) MainActivity.getInstance().getSystemService(Context.CLIPBOARD_SERVICE);
+ android.content.ClipData clip = android.content.ClipData.newPlainText(copied_text, article.address);
+ clipboard.setPrimaryClip(clip);
+ }
+
+ CharSequence text = getResources().getString(R.string.text_is_copied);
+ Toast toast = Toast.makeText(MainActivity.getInstance(), text, Toast.LENGTH_SHORT);
+ toast.show();
+
+ return true;
+ }
+
+ });
+ //editText.setKeyListener(null);
+
+ }
+ else
+ {
+ addressTextView.setVisibility(View.GONE);
+ }
+
MapView mapView = (MapView) view.findViewById(R.id.mapview);
+
mapView.setMaxZoomLevel(20);
mapView.setMinZoomLevel(4);
@@ -422,6 +478,15 @@ public class ArticleFragment extends Fragment
else if (getItemViewType(position) == 5)
{
Button button = (Button) view.findViewById(R.id.button);
+
+ if (article.externalLinkText.length() > 0)
+ {
+ button.setText(article.externalLinkText);
+ }
+ else
+ {
+ button.setText(R.string.go_to_website);
+ }
button.setOnClickListener(new OnClickListener()
{
@@ -434,6 +499,27 @@ public class ArticleFragment extends Fragment
}
});
}
+ else if (getItemViewType(position) == 6)
+ {
+ Button button = (Button) view.findViewById(R.id.button);
+
+ final String phone = article.phone;
+
+ button.setText(phone);
+
+
+ button.setOnClickListener(new OnClickListener()
+ {
+ @Override
+ public void onClick(View v)
+ {
+ String uri = "tel:" + phone;
+ Intent intent = new Intent(Intent.ACTION_DIAL);
+ intent.setData(Uri.parse(uri));
+ MainActivity.getInstance().startActivity(intent);
+ }
+ });
+ }
diff --git a/android/src/fishrungames/bashgid/CatalogFragment.java b/android/src/fishrungames/bashgid/CatalogFragment.java
index 138d433..3b01c38 100644
--- a/android/src/fishrungames/bashgid/CatalogFragment.java
+++ b/android/src/fishrungames/bashgid/CatalogFragment.java
@@ -3,9 +3,6 @@ package fishrungames.bashgid;
import java.util.ArrayList;
import it.sephiroth.android.library.widget.HListView;
-import fishrungames.bashgid.AlbumListFragment.DatabaseGetAlbumListTask;
-import fishrungames.bashgid.MainPageFragment.ListAdapter;
-import fishrungames.bashgid.core.AlbumManager.AlbumShortData;
import fishrungames.bashgid.core.DatabaseGetJournalListTask;
import fishrungames.bashgid.core.JournalManager.JournalSemiFullData;
import android.annotation.SuppressLint;
@@ -21,6 +18,7 @@ import android.view.View.OnClickListener;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.Button;
+import android.widget.ImageButton;
import android.widget.ListView;
import android.widget.ProgressBar;
import android.widget.TextView;
@@ -142,6 +140,7 @@ public class CatalogFragment extends Fragment
TextView descriptionTextView = (TextView) view.findViewById(R.id.descriptionTextView);
Button button = (Button) view.findViewById(R.id.button);
+ ImageButton imageButton = (ImageButton) view.findViewById(R.id.imageButton);
HListView hListView = (HListView) view.findViewById(R.id.hListView);
@@ -164,6 +163,15 @@ public class CatalogFragment extends Fragment
});
+ imageButton.setOnClickListener(new OnClickListener()
+ {
+ @Override
+ public void onClick(View v)
+ {
+ MainActivity.getInstance().OpenJournalScreen(journalList.get(position).name, MainActivity.TAG_FROM_CATALOGFRAGMENT_TO_JOURNALFRAGMENT);
+ }
+
+ });
return view;
}
diff --git a/android/src/fishrungames/bashgid/MainActivity.java b/android/src/fishrungames/bashgid/MainActivity.java
index 2e0d6bb..8190cd0 100644
--- a/android/src/fishrungames/bashgid/MainActivity.java
+++ b/android/src/fishrungames/bashgid/MainActivity.java
@@ -20,6 +20,7 @@ import fishrungames.bashgid.core.ArticleManager.ArticleShortData;
import fishrungames.bashgid.core.ChannelManager.ChannelFullData;
import fishrungames.bashgid.core.DatabaseDownloadTask;
import fishrungames.bashgid.core.HtmlDownloadManager.TextFileRecord;
+import fishrungames.bashgid.core.JournalManager.JournalRecordData;
import fishrungames.bashgid.core.JournalManager.JournalSemiFullData;
import fishrungames.bashgid.core.NewsDownloadTask;
import fishrungames.bashgid.core.TranslationManager.TranslationRecordData;
@@ -43,6 +44,7 @@ import fishrungames.networkutils.ImageManager;
import android.support.v7.app.ActionBarActivity;
import android.support.v4.app.Fragment;
+import android.content.Context;
import android.content.SharedPreferences;
import android.content.res.Configuration;
import android.os.Bundle;
@@ -54,6 +56,7 @@ import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.view.View;
+import android.view.inputmethod.InputMethodManager;
import android.support.v4.widget.DrawerLayout;
@@ -114,6 +117,10 @@ public class MainActivity extends ActionBarActivity implements NavigationDrawerF
public static final int DATABASE_SEARCH_ARTICLE_STATE_UPDATE = 28;
public static final int DATABASE_SEARCH_ARTICLE_STATE_FINISHED = 29;
+ public static final int DATABASE_GET_GEO_JOURNAL_LIST_STATE_UPDATE = 30;
+ public static final int DATABASE_GET_GEO_JOURNAL_LIST_STATE_FINISHED = 31;
+
+
@@ -253,7 +260,10 @@ public class MainActivity extends ActionBarActivity implements NavigationDrawerF
UpdateOnArticleSearchPerformed((ArrayList) inputMessage.obj);
break;
-
+ case DATABASE_GET_GEO_JOURNAL_LIST_STATE_UPDATE:
+ case DATABASE_GET_GEO_JOURNAL_LIST_STATE_FINISHED:
+ UpdateOnGeoJournalListLoaded((ArrayList) inputMessage.obj);
+ break;
default:
super.handleMessage(inputMessage);
@@ -421,6 +431,9 @@ public class MainActivity extends ActionBarActivity implements NavigationDrawerF
searchFragment = null;
catalogFragment = null;
+
+ InputMethodManager imm = (InputMethodManager)this.getSystemService(Context.INPUT_METHOD_SERVICE);
+ imm.hideSoftInputFromWindow(getWindow().getDecorView().getWindowToken(), 0);
}
public void StartDownloadImagesTask(ArrayList imageUrlArr, ArrayList imageHashArr)
@@ -578,6 +591,17 @@ public class MainActivity extends ActionBarActivity implements NavigationDrawerF
}
+ public void UpdateOnGeoJournalListLoaded(ArrayList journalList)
+ {
+
+ if (mapHolderFragment != null)
+ {
+ mapHolderFragment.SetGeoJournals(journalList);
+ }
+
+ }
+
+
public void UpdateOnArticleSearchPerformed(ArrayList articleArr)
{
@@ -736,6 +760,17 @@ public class MainActivity extends ActionBarActivity implements NavigationDrawerF
mNavigationDrawerFragment.EnableDrawer();
}
+ public void OpenSearchScreen(String query)
+ {
+ ClearAllFragmentLinks();
+
+ searchFragment = new SearchFragment(query);
+
+ getSupportFragmentManager().beginTransaction().replace(R.id.fragment_container, searchFragment, TAG_TO_MAINFRAGMENT).commit();
+
+ mNavigationDrawerFragment.EnableDrawer();
+ }
+
public void OpenSearchScreen(String journalName, String journalTitle)
{
ClearAllFragmentLinks();
@@ -1038,7 +1073,8 @@ public class MainActivity extends ActionBarActivity implements NavigationDrawerF
}
else if (position == 7)
{
- OpenBooksScreen();
+ //OpenBooksScreen();
+ OpenJournalScreen("books", MainActivity.TAG_TO_MAINFRAGMENT);
}
else if (position == 8)
{
diff --git a/android/src/fishrungames/bashgid/MainPageFragment.java b/android/src/fishrungames/bashgid/MainPageFragment.java
index f744795..1f6d549 100644
--- a/android/src/fishrungames/bashgid/MainPageFragment.java
+++ b/android/src/fishrungames/bashgid/MainPageFragment.java
@@ -22,6 +22,7 @@ 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.ProgressBar;
@@ -37,6 +38,7 @@ public class MainPageFragment extends Fragment {
ListAdapter listAdapter;
View header;
ProgressBar progressBar;
+ EditText searchEditText;
JournalSemiFullData newsJournal;
@@ -87,6 +89,8 @@ public class MainPageFragment extends Fragment {
}
);
+ searchEditText = (EditText) header.findViewById(R.id.searchEditText);
+
Button searchButton = (Button) header.findViewById(R.id.searchButton);
searchButton.setOnClickListener(new OnClickListener()
@@ -95,7 +99,8 @@ public class MainPageFragment extends Fragment {
@Override
public void onClick(View v)
{
- MainActivity.getInstance().OpenSearchScreen();
+ String query = searchEditText.getText().toString();
+ MainActivity.getInstance().OpenSearchScreen(query);
}
}
);
@@ -294,6 +299,9 @@ public class MainPageFragment extends Fragment {
Button button = (Button) view.findViewById(R.id.button);
+ ImageButton imageButton = (ImageButton) view.findViewById(R.id.imageButton);
+
+
HListView hListView = (HListView) view.findViewById(R.id.hListView);
hListView.setAdapter(new MainPageHListViewAdapters.JournalElementAdapter(getActivity(), journalList.get(position)));
@@ -317,6 +325,21 @@ public class MainPageFragment extends Fragment {
MainActivity.getInstance().OpenJournalScreen(journalList.get(position).name, MainActivity.TAG_TO_MAINFRAGMENT);
}
});
+
+ imageButton.setOnClickListener(new OnClickListener()
+ {
+ @Override
+ public void onClick(View v)
+ {
+ if (databaseGetJournalTask != null)
+ {
+ databaseGetJournalTask.cancel(false);
+ }
+ MainActivity.getInstance().OpenJournalScreen(journalList.get(position).name, MainActivity.TAG_TO_MAINFRAGMENT);
+ }
+ });
+
+
return view;
}
@@ -336,7 +359,11 @@ public class MainPageFragment extends Fragment {
@Override
public void onClick(View v)
{
- databaseGetJournalTask.cancel(false);
+ if (databaseGetJournalTask != null)
+ {
+ databaseGetJournalTask.cancel(false);
+ databaseGetJournalTask = null;
+ }
MainActivity.getInstance().OpenNewsRecordScreen(articleName, MainActivity.TAG_FROM_MAINFRAGMENT_TO_NEWSRECORDFRAGMENT);
}
diff --git a/android/src/fishrungames/bashgid/OsmMapHolderFragment.java b/android/src/fishrungames/bashgid/OsmMapHolderFragment.java
index f03f1ae..5c63e23 100644
--- a/android/src/fishrungames/bashgid/OsmMapHolderFragment.java
+++ b/android/src/fishrungames/bashgid/OsmMapHolderFragment.java
@@ -1,25 +1,34 @@
package fishrungames.bashgid;
-
-
import java.util.ArrayList;
import android.app.AlertDialog;
+import android.content.Context;
import android.content.DialogInterface;
+import android.content.Intent;
import android.graphics.Point;
import android.graphics.drawable.Drawable;
+import android.net.Uri;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
+import android.view.View.OnClickListener;
+import android.view.View.OnLongClickListener;
import android.view.ViewGroup;
+import android.widget.AdapterView;
+import android.widget.AdapterView.OnItemSelectedListener;
+import android.widget.ArrayAdapter;
+import android.widget.Button;
import android.widget.ImageView;
+import android.widget.Spinner;
import android.widget.TextView;
-
+import android.widget.Toast;
import org.osmdroid.DefaultResourceProxyImpl;
import org.osmdroid.ResourceProxy;
+import org.osmdroid.api.IGeoPoint;
import org.osmdroid.api.IMapController;
import org.osmdroid.api.IMapView;
import org.osmdroid.util.GeoPoint;
@@ -33,7 +42,9 @@ import org.osmdroid.views.overlay.OverlayItem.HotspotPlace;
import fishrungames.bashgid.core.ArticleManager.ArticleFullData;
import fishrungames.bashgid.core.ArticleManager.ArticleRecordData;
import fishrungames.bashgid.core.DatabaseGetArticleTask;
+import fishrungames.bashgid.core.DatabaseGetGeoJournalListTask;
import fishrungames.bashgid.core.DatabaseGetJournalTask;
+import fishrungames.bashgid.core.JournalManager.JournalRecordData;
import fishrungames.bashgid.core.LocationHolder;
import fishrungames.bashgid.core.JournalManager.JournalSemiFullData;
import fishrungames.networkutils.ImageManager;
@@ -41,31 +52,55 @@ import fishrungames.networkutils.ImageManager;
public class OsmMapHolderFragment extends Fragment
{
- public static class CustomItemizedOverlay extends ItemizedOverlay{
+ public static class DetailsOverlayItem extends OverlayItem
+ {
- private ArrayList mOverlayItems = new ArrayList();
+ public String address;
+ public String phone;
+
+ public DetailsOverlayItem(String aTitle, String aSnippet, IGeoPoint aGeoPoint, String address, String phone)
+ {
+ super(aTitle, aSnippet, aGeoPoint);
+ this.address = address;
+ this.phone = phone;
+ }
+
+ }
+
+ public static class CustomItemizedOverlay extends ItemizedOverlay
+ {
+
+ private ArrayList mOverlayItems = new ArrayList();
private ArrayList mArticles = new ArrayList();
String journalName;
+ Context context;
- public CustomItemizedOverlay(Drawable pDefaultMarker, ResourceProxy pResourceProxy, String journalName) {
+ public CustomItemizedOverlay(Drawable pDefaultMarker, ResourceProxy pResourceProxy, String journalName, Context context)
+ {
super(pDefaultMarker, pResourceProxy);
this.journalName = journalName;
+ this.context = context;
}
@Override
- protected OverlayItem createItem(int pos) {
+ protected OverlayItem createItem(int pos)
+ {
return mOverlayItems.get(pos);
}
@Override
- public int size() {
- if(mOverlayItems!=null) return mOverlayItems.size();
- else return 0;
+ public int size()
+ {
+ if (mOverlayItems != null)
+ return mOverlayItems.size();
+ else
+ return 0;
}
- public void addOverlayItem(GeoPoint geoPoint, String articleName, String title, String imageUrl){
+ public void addOverlayItem(GeoPoint geoPoint, String articleName, String title, String imageUrl, String address, String phone)
+ {
- OverlayItem item = new OverlayItem(title, imageUrl, geoPoint);
+ DetailsOverlayItem item = new DetailsOverlayItem(title, imageUrl, geoPoint, address, phone);
item.setMarker(MainActivity.getInstance().getResources().getDrawable(R.drawable.marker_default));
item.setMarkerHotspot(HotspotPlace.CENTER);
@@ -75,7 +110,8 @@ public class OsmMapHolderFragment extends Fragment
populateNow();
}
- public void populateNow(){
+ public void populateNow()
+ {
populate();
}
@@ -87,64 +123,141 @@ public class OsmMapHolderFragment extends Fragment
}
@Override
- protected boolean onTap(final int index) {
- OverlayItem item = mOverlayItems.get(index);
+ protected boolean onTap(final int index)
+ {
+ DetailsOverlayItem item = mOverlayItems.get(index);
AlertDialog.Builder dialog = new AlertDialog.Builder(MainActivity.getInstance());
dialog.setTitle(item.getTitle());
- //dialog.setMessage(item.getSnippet());
+ // dialog.setMessage(item.getSnippet());
+
+ LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
+
+ View dialogInnerView = inflater.inflate(R.layout.osm_dialog, null, false);
+
+ ImageView image = (ImageView) dialogInnerView.findViewById(R.id.imageView);
+ TextView textView = (TextView) dialogInnerView.findViewById(R.id.addressTextView);
+ Button button = (Button) dialogInnerView.findViewById(R.id.button);
- ImageView image = new ImageView(MainActivity.getInstance());
ImageManager.getInstance().ApplyImageToImageView(image, item.getSnippet());
- //image.setImageResource(R.drawable.YOUR_IMAGE_ID);
- dialog.setView(image);
+ if (item.address.length() > 0)
+ {
+ final String address = item.address;
-
-
+ textView.setText(address);
+ textView.setVisibility(View.VISIBLE);
- dialog.setPositiveButton(R.string.dialog_open, new DialogInterface.OnClickListener() {
- public void onClick(DialogInterface dialog, int id) {
+ final String copied_text = MainActivity.getInstance().getResources().getString(R.string.copied_text);
+
+ textView.setOnLongClickListener(new OnLongClickListener()
+ {
+
+ @Override
+ public boolean onLongClick(View v)
+ {
+
+ if (android.os.Build.VERSION.SDK_INT < android.os.Build.VERSION_CODES.HONEYCOMB)
+ {
+ android.text.ClipboardManager clipboard = (android.text.ClipboardManager) MainActivity.getInstance().getSystemService(
+ Context.CLIPBOARD_SERVICE);
+ clipboard.setText(address);
+ } else
+ {
+ android.content.ClipboardManager clipboard = (android.content.ClipboardManager) MainActivity.getInstance().getSystemService(
+ Context.CLIPBOARD_SERVICE);
+ android.content.ClipData clip = android.content.ClipData.newPlainText(copied_text, address);
+ clipboard.setPrimaryClip(clip);
+ }
+
+ CharSequence text = MainActivity.getInstance().getResources().getString(R.string.text_is_copied);
+ Toast toast = Toast.makeText(MainActivity.getInstance(), text, Toast.LENGTH_SHORT);
+ toast.show();
+
+ return true;
+ }
+
+ });
+ } else
+ {
+ textView.setVisibility(View.GONE);
+ }
+
+ if (item.phone.length() > 0)
+ {
+ final String phone = item.phone;
+ button.setText(phone);
+ button.setVisibility(View.VISIBLE);
+
+ button.setOnClickListener(new OnClickListener()
+ {
+
+ @Override
+ public void onClick(View v)
+ {
+ String uri = "tel:" + phone;
+ Intent intent = new Intent(Intent.ACTION_DIAL);
+ intent.setData(Uri.parse(uri));
+ MainActivity.getInstance().startActivity(intent);
+ }
+
+ });
+
+ } else
+ {
+ button.setVisibility(View.GONE);
+ }
+
+ dialog.setView(dialogInnerView);
+
+ dialog.setPositiveButton(R.string.dialog_open, new DialogInterface.OnClickListener()
+ {
+ public void onClick(DialogInterface dialog, int id)
+ {
MainActivity.getInstance().SetLastMapFilterName(journalName);
MainActivity.getInstance().OpenArticleScreen(mArticles.get(index), MainActivity.TAG_FROM_MAPFRAGMENT_TO_ARTICLEFRAGMENT);
}
});
- dialog.setNegativeButton(R.string.dialog_cancel, new DialogInterface.OnClickListener() {
- public void onClick(DialogInterface dialog, int id) {
+ dialog.setNegativeButton(R.string.dialog_cancel, new DialogInterface.OnClickListener()
+ {
+ public void onClick(DialogInterface dialog, int id)
+ {
dialog.cancel();
}
});
-
-
-
dialog.show();
-
return true;
}
}
-
- public static class NoInteractionOverlay extends ItemizedOverlay{
+ public static class NoInteractionOverlay extends ItemizedOverlay
+ {
private ArrayList mOverlayItems = new ArrayList();
- public NoInteractionOverlay(Drawable pDefaultMarker, ResourceProxy pResourceProxy) {
+ public NoInteractionOverlay(Drawable pDefaultMarker, ResourceProxy pResourceProxy)
+ {
super(pDefaultMarker, pResourceProxy);
}
@Override
- protected OverlayItem createItem(int pos) {
+ protected OverlayItem createItem(int pos)
+ {
return mOverlayItems.get(pos);
}
@Override
- public int size() {
- if(mOverlayItems!=null) return mOverlayItems.size();
- else return 0;
+ public int size()
+ {
+ if (mOverlayItems != null)
+ return mOverlayItems.size();
+ else
+ return 0;
}
- public void addOverlayItem(GeoPoint geoPoint){
+ public void addOverlayItem(GeoPoint geoPoint)
+ {
OverlayItem item = new OverlayItem("", "", geoPoint);
item.setMarker(MainActivity.getInstance().getResources().getDrawable(R.drawable.marker_default));
@@ -155,7 +268,8 @@ public class OsmMapHolderFragment extends Fragment
populateNow();
}
- public void populateNow(){
+ public void populateNow()
+ {
populate();
}
@@ -171,11 +285,17 @@ public class OsmMapHolderFragment extends Fragment
String filter;
+ ArrayList availableGeoJournals;
+ ArrayList availableGeoJournalNames;
+
+ ArrayAdapter spinnerAdapter;
+
JournalSemiFullData journal;
ArticleFullData article;
-
+
int filterType;
+ Spinner spinner;
public OsmMapHolderFragment()
{
@@ -183,8 +303,10 @@ public class OsmMapHolderFragment extends Fragment
article = null;
filter = "";
filterType = 0;
- }
+ availableGeoJournals = new ArrayList();
+ availableGeoJournalNames = new ArrayList();
+ }
public OsmMapHolderFragment(int filterType, String filter)
{
@@ -192,54 +314,51 @@ public class OsmMapHolderFragment extends Fragment
this.article = null;
this.filter = filter;
this.filterType = filterType;
-
- RestoreJournalOrArticle();
-
+
+ availableGeoJournals = new ArrayList();
+ availableGeoJournalNames = new ArrayList();
+
}
-
+
public OsmMapHolderFragment(ArticleFullData article)
{
this.filter = article.name;
this.filterType = 1;
-
+
this.article = article;
this.journal = null;
-
+
+ availableGeoJournals = new ArrayList();
+ availableGeoJournalNames = new ArrayList();
+
}
@Override
- public void onSaveInstanceState(final Bundle outState) {
+ public void onSaveInstanceState(final Bundle outState)
+ {
super.onSaveInstanceState(outState);
outState.putString("filter", filter);
outState.putInt("filterType", filterType);
}
-
MapView mapView;
TextView textView;
@Override
- public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
+ public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
+ {
- if (savedInstanceState != null) {
+ if (savedInstanceState != null)
+ {
filter = savedInstanceState.getString("filter");
filterType = savedInstanceState.getInt("filterType");
-
- RestoreJournalOrArticle();
}
View rootView = inflater.inflate(R.layout.fragment_osm_map_page, container, false);
- textView = (TextView) rootView.findViewById(R.id.textView);
+ textView = (TextView) rootView.findViewById(R.id.addressTextView);
- if ((filterType == 0 && journal == null) || (filterType == 1 && article == null))
- {
- textView.setText(R.string.map_is_loading);
- }
- else
- {
- textView.setText(R.string.map_is_loaded);
- }
+
mapView = (MapView) rootView.findViewById(R.id.mapview);
@@ -249,37 +368,82 @@ public class OsmMapHolderFragment extends Fragment
mapView.setBuiltInZoomControls(true);
mapView.setMultiTouchControls(true);
-
- IMapController mapController = mapView.getController();
+ IMapController mapController = mapView.getController();
GeoPoint center = new GeoPoint(LocationHolder.CONST_UFA_LATITUDE, LocationHolder.CONST_UFA_LONGITUDE);
mapController.setZoom(10);
mapController.animateTo(center);
-
RefreshView();
+ spinnerAdapter = new ArrayAdapter(getActivity(), android.R.layout.simple_spinner_item, availableGeoJournalNames);
+
+ spinnerAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
+
+ spinner = (Spinner) rootView.findViewById(R.id.spinner);
+
+ spinner.setAdapter(spinnerAdapter);
+
+ spinner.setOnItemSelectedListener(new OnItemSelectedListener()
+ {
+
+ @Override
+ public void onItemSelected(AdapterView> parent, View view, int position, long id)
+ {
+
+ if (position < availableGeoJournals.size())
+ {
+ if (!(filterType == 0 && filter.equals(availableGeoJournals.get(position).name)))
+ {
+
+ filterType = 0;
+ filter = availableGeoJournals.get(position).name;
+ textView.setText(R.string.map_is_loading);
+ RestoreJournalOrArticle();
+ }
+ }
+
+ }
+
+ @Override
+ public void onNothingSelected(AdapterView> parent)
+ {
+ }
+
+
+ });
+
+
+ if ((filterType == 0 && journal == null) || (filterType == 1 && article == null))
+ {
+ textView.setText(R.string.map_is_loading);
+
+ RestoreJournalOrArticle();
+
+ } else
+ {
+ textView.setText(R.string.map_is_loaded);
+ RestoreGeoJournals();
+ }
+
return rootView;
}
-
-
+
void RestoreJournalOrArticle()
{
if (filterType == 0)
{
RestoreJournal();
- }
- else
+ } else
{
RestoreArticle();
}
}
-
void RestoreJournal()
{
- //journal = JournalManager.CreateEmptyJournal();
+ // journal = JournalManager.CreateEmptyJournal();
DatabaseGetJournalTask task = new DatabaseGetJournalTask();
@@ -291,8 +455,12 @@ public class OsmMapHolderFragment extends Fragment
task.execute(bundle);
+ availableGeoJournals.clear();
+ availableGeoJournalNames.clear();
+ spinnerAdapter.notifyDataSetChanged();
+
}
-
+
void RestoreArticle()
{
@@ -302,71 +470,123 @@ public class OsmMapHolderFragment extends Fragment
task.execute(filter);
+ availableGeoJournals.clear();
+ availableGeoJournalNames.clear();
+ spinnerAdapter.notifyDataSetChanged();
+
+ }
+
+ void RestoreGeoJournals()
+ {
+
+ DatabaseGetGeoJournalListTask task = new DatabaseGetGeoJournalListTask();
+
+ task.mHandler = MainActivity.getInstance().mHandler;
+
+ task.execute();
+
}
public void SetJournal(JournalSemiFullData journal)
{
filterType = 0;
-
+
textView.setText(R.string.map_is_loaded);
this.journal = journal;
RefreshView();
+ RestoreGeoJournals();
+
}
-
+
public void SetArticle(ArticleFullData article)
{
filterType = 1;
-
+
textView.setText(R.string.map_is_loaded);
this.article = article;
RefreshView();
+ RestoreGeoJournals();
+
+ }
+
+ public void SetGeoJournals(ArrayList availableGeoJournals)
+ {
+
+ this.availableGeoJournals = availableGeoJournals;
+ availableGeoJournalNames.clear();
+
+ int selection = -1;
+
+ for (JournalRecordData journal : availableGeoJournals)
+ {
+ if (filterType == 0 && filter.equals(journal.name))
+ {
+ selection = availableGeoJournalNames.size();
+ }
+
+ availableGeoJournalNames.add(journal.title);
+
+ }
+
+ if (filterType == 1)
+ {
+ selection = availableGeoJournalNames.size();
+ availableGeoJournalNames.add(article.title);
+ }
+
+ spinnerAdapter.notifyDataSetChanged();
+
+ if (selection != -1)
+ {
+ spinner.setSelection(selection);
+ }
+
}
public void RefreshView()
{
-
- ResourceProxy resourceProxy = new DefaultResourceProxyImpl(getActivity());
-
- itemizedOverlay = new CustomItemizedOverlay(getResources().getDrawable(R.drawable.russia_icon), resourceProxy, filter);
- if (filterType == 0)
- {
- if (journal != null)
- {
-
- for (int i = 0; i < journal.articleArr.size(); i++)
- {
- ArticleRecordData article = journal.articleArr.get(i);
+ ResourceProxy resourceProxy = new DefaultResourceProxyImpl(getActivity());
- if (article.geoLat != 0 || article.geoLon != 0)
+ itemizedOverlay = new CustomItemizedOverlay(getResources().getDrawable(R.drawable.russia_icon), resourceProxy, filter, getActivity());
+
+ if (filterType == 0)
+ {
+ if (journal != null)
+ {
+
+ for (int i = 0; i < journal.articleArr.size(); i++)
{
- GeoPoint markerPoint = new GeoPoint(article.geoLat, article.geoLon);
+ ArticleRecordData article = journal.articleArr.get(i);
- itemizedOverlay.addOverlayItem(markerPoint, article.name, article.title, journal.articleArr.get(i).previewImageUrl);
+ if (article.geoLat != 0 || article.geoLon != 0)
+ {
+ GeoPoint markerPoint = new GeoPoint(article.geoLat, article.geoLon);
+ itemizedOverlay.addOverlayItem(markerPoint, article.name, article.title, journal.articleArr.get(i).previewImageUrl, article.address,
+ article.phone);
+
+ }
}
}
- }
-
- }
- else
+
+ } else
+ {
+ if (article != null)
{
- if (article != null)
- {
-
-
+
if (article.geoLat != 0 || article.geoLon != 0)
{
GeoPoint markerPoint = new GeoPoint(article.geoLat, article.geoLon);
String imageUrl = "R.drawable.no_picture";
-
+
if (article.albumArr.size() > 0)
{
if (article.albumArr.get(0).photoRecordArr.size() > 0)
@@ -374,20 +594,19 @@ public class OsmMapHolderFragment extends Fragment
imageUrl = article.albumArr.get(0).photoRecordArr.get(0).imageUrl;
}
}
-
- itemizedOverlay.addOverlayItem(markerPoint, article.name, article.title, imageUrl);
+
+ itemizedOverlay.addOverlayItem(markerPoint, article.name, article.title, imageUrl, article.address, article.phone);
}
-
- }
+
}
-
- mapView.getOverlays().clear();
- mapView.getOverlays().add(itemizedOverlay);
-
- mapView.invalidate();
-
}
-
+
+ mapView.getOverlays().clear();
+ mapView.getOverlays().add(itemizedOverlay);
+
+ mapView.invalidate();
+
+ }
}
diff --git a/android/src/fishrungames/bashgid/SearchFragment.java b/android/src/fishrungames/bashgid/SearchFragment.java
index f30abab..6fc04d0 100644
--- a/android/src/fishrungames/bashgid/SearchFragment.java
+++ b/android/src/fishrungames/bashgid/SearchFragment.java
@@ -2,6 +2,7 @@ package fishrungames.bashgid;
import java.util.ArrayList;
+import java.util.Locale;
import fishrungames.bashgid.core.ArticleManager;
import fishrungames.bashgid.core.ArticleManager.ArticleShortData;
@@ -39,12 +40,15 @@ public class SearchFragment extends Fragment
ListAdapter listAdapter;
+ TextView hintTextView;
+
EditText searchEditText;
ArrayList searchResultArr = new ArrayList();
String journalName;
String journalTitle;
+ String query;
DatabaseSearchArticleTask databaseSearchArticleTask = null;
@@ -52,12 +56,22 @@ public class SearchFragment extends Fragment
{
this.journalName = "";
this.journalTitle = "";
+ this.query = "";
+ }
+
+ public SearchFragment(String query)
+ {
+ this.journalName = "";
+ this.journalTitle = "";
+ this.journalTitle = "";
+ this.query = query;
}
public SearchFragment(String journalName, String journalTitle)
{
this.journalName = journalName;
this.journalTitle = journalTitle;
+ this.query = "";
}
@Override
@@ -65,6 +79,7 @@ public class SearchFragment extends Fragment
super.onSaveInstanceState(outState);
outState.putString("journalName", journalName);
outState.putString("journalTitle", journalTitle);
+ outState.putString("query", query);
}
@SuppressLint("InflateParams") @Override
@@ -73,6 +88,7 @@ public class SearchFragment extends Fragment
if (savedInstanceState != null) {
journalName = savedInstanceState.getString("journalName");
journalTitle = savedInstanceState.getString("journalTitle");
+ query = savedInstanceState.getString("query");
}
@@ -82,26 +98,36 @@ public class SearchFragment extends Fragment
View header = inflater.inflate(R.layout.search_page_list_header, null);
- TextView textView = (TextView) header.findViewById(R.id.textView);
+ TextView addressTextView = (TextView) header.findViewById(R.id.addressTextView);
+
if (journalTitle == null || journalTitle.length() == 0)
{
- textView.setText("Search everywhere");
+ addressTextView.setText(R.string.search_everywhere);
}
else
{
- textView.setText("Search in: " + journalTitle);
+ String search_in = this.getResources().getString(R.string.search_in);
+
+ search_in = search_in.replace("%%", journalTitle);
+
+ addressTextView.setText(search_in);
}
+ hintTextView = (TextView) header.findViewById(R.id.hintTextView);
+
+
searchEditText = (EditText) header.findViewById(R.id.editText);
+
+ searchEditText.setText(query);
searchEditText.addTextChangedListener(new TextWatcher(){
public void afterTextChanged(Editable s) {
- String text = searchEditText.getText().toString();
+ query = searchEditText.getText().toString();
- CallUpdateNews(text);
+ CallUpdateNews();
}
@@ -115,6 +141,7 @@ public class SearchFragment extends Fragment
listView.setAdapter(listAdapter);
+ CallUpdateNews();
return rootView;
}
@@ -124,6 +151,12 @@ public class SearchFragment extends Fragment
{
searchResultArr = articleArr;
listAdapter.notifyDataSetChanged();
+
+ String searchResultCount = getResources().getString(R.string.search_result_count);
+
+ searchResultCount = searchResultCount.replace("%%", Integer.toString(articleArr.size()));
+
+ hintTextView.setText(searchResultCount);
}
@@ -165,13 +198,13 @@ public class SearchFragment extends Fragment
Button button = (Button) view.findViewById(R.id.button);
- TextView textView = (TextView) view.findViewById(R.id.dateTextView);
+ TextView dateTextView = (TextView) view.findViewById(R.id.dateTextView);
ImageManager.getInstance().ApplyImageToImageView(imageButton, searchResultArr.get(position).previewImageUrl);
button.setText(searchResultArr.get(position).title);
- textView.setText(NewsDataSource.iso8601Format.format(searchResultArr.get(position).dateTime));
+ dateTextView.setText(NewsDataSource.iso8601Format.format(searchResultArr.get(position).dateTime));
@@ -185,9 +218,11 @@ public class SearchFragment extends Fragment
}
- public void CallUpdateNews(String text)
+ public void CallUpdateNews()
{
- if (text.length() >= 3)
+
+
+ if (query.length() >= 3 || Locale.getDefault() == Locale.CHINA)
{
if (databaseSearchArticleTask != null)
{
@@ -198,17 +233,21 @@ public class SearchFragment extends Fragment
databaseSearchArticleTask.mHandler = MainActivity.getInstance().mHandler;
- Bundle bundle = new Bundle();
-
- bundle.putString("journalName", journalName);
- bundle.putString("query", text);
-
- databaseSearchArticleTask.execute(bundle);
+ Bundle bundle = new Bundle();
+
+ bundle.putString("journalName", journalName);
+ bundle.putString("query", query);
+
+ databaseSearchArticleTask.execute(bundle);
+
+ hintTextView.setText(R.string.search_is_performing);
}
else
{
searchResultArr.clear();
listAdapter.notifyDataSetChanged();
+
+ hintTextView.setText(R.string.search_at_least_3_symbols);
}
}
diff --git a/android/src/fishrungames/bashgid/VideoRecordFragment.java b/android/src/fishrungames/bashgid/VideoRecordFragment.java
index e13ec8d..fd0c28d 100644
--- a/android/src/fishrungames/bashgid/VideoRecordFragment.java
+++ b/android/src/fishrungames/bashgid/VideoRecordFragment.java
@@ -1,6 +1,5 @@
package fishrungames.bashgid;
-
import fishrungames.bashgid.core.AlbumManager;
import fishrungames.bashgid.core.DatabaseGetAlbumTask;
import fishrungames.bashgid.core.VideoManager;
@@ -23,107 +22,107 @@ import android.widget.ImageView;
import android.widget.ProgressBar;
import android.widget.TextView;
-
public class VideoRecordFragment extends Fragment
{
-
+
String videoUrl;
-
+
VideoRecordData recordData;
-
+
TextView nameTextView;
TextView descriptionTextView;
ImageView imageView;
ProgressBar progressBar;
-
+
public VideoRecordFragment()
{
this.videoUrl = "";
this.recordData = null;
}
-
+
public VideoRecordFragment(String videoUrl)
{
this.recordData = null;
this.videoUrl = videoUrl;
RestoreVideo();
}
-
+
public VideoRecordFragment(VideoRecordData recordData)
{
this.videoUrl = recordData.videoUrl;
this.recordData = recordData;
}
-
+
@Override
- public void onSaveInstanceState(final Bundle outState) {
- super.onSaveInstanceState(outState);
- outState.putString("videoUrl", videoUrl);
- }
-
+ public void onSaveInstanceState(final Bundle outState)
+ {
+ super.onSaveInstanceState(outState);
+ outState.putString("videoUrl", videoUrl);
+ }
+
@Override
- public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
-
- if (savedInstanceState != null) {
+ public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
+ {
+
+ if (savedInstanceState != null)
+ {
videoUrl = savedInstanceState.getString("videoUrl");
RestoreVideo();
- }
-
- View rootView = inflater.inflate(R.layout.fragment_video_record_page, container, false);
-
-progressBar = (ProgressBar)rootView.findViewById(R.id.progressBar);
-
-if (recordData == null)
-{
- progressBar.setVisibility(View.VISIBLE);
+ }
+
+ View rootView = inflater.inflate(R.layout.fragment_video_record_page, container, false);
+
+ progressBar = (ProgressBar) rootView.findViewById(R.id.progressBar);
+
+ if (recordData == null)
+ {
+ progressBar.setVisibility(View.VISIBLE);
+
+ } else
+ {
+ progressBar.setVisibility(View.GONE);
+ }
-}
-else
-{
- progressBar.setVisibility(View.GONE);
-}
-
nameTextView = (TextView) rootView.findViewById(R.id.nameTextView);
descriptionTextView = (TextView) rootView.findViewById(R.id.descriptionTextView);
imageView = (ImageView) rootView.findViewById(R.id.imageView);
-
-
+
RefreshView();
-
+
return rootView;
}
-
-
+
void RestoreVideo()
{
- //recordData = MainActivity.getInstance().videoDataSource.GetVideoByVideoUrl(videoUrl);
+ // recordData =
+ // MainActivity.getInstance().videoDataSource.GetVideoByVideoUrl(videoUrl);
recordData = VideoManager.CreateEmptyVideo();
-
+
DatabaseGetVideoTask task = new DatabaseGetVideoTask();
task.mHandler = MainActivity.getInstance().mHandler;
task.execute(videoUrl);
}
-
+
void SetVideo(VideoRecordData recordData)
{
progressBar.setVisibility(View.GONE);
this.recordData = recordData;
RefreshView();
}
-
+
void RefreshView()
{
nameTextView.setText(recordData.title);
-
+
descriptionTextView.setText(recordData.description);
-
+
ImageManager.getInstance().ApplyImageToImageView(imageView, recordData.previewImageUrl);
-
+
imageView.setOnClickListener(new OnClickListener()
{
-
+
@Override
public void onClick(View v)
{
@@ -132,24 +131,23 @@ else
MainActivity.getInstance().startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(videoUrl)));
}
}
-
+
});
}
-
-
+
public static class DatabaseGetVideoTask extends AsyncTask
{
VideoRecordData recordData = null;
-
+
public Handler mHandler;
protected Long doInBackground(String... queryArr)
{
String videoUrl = queryArr[0];
-
+
recordData = MainActivity.getInstance().videoDataSource.GetVideoByVideoUrl(videoUrl);
-
+
return (long) 0;
}
@@ -168,6 +166,5 @@ else
completeMessage.sendToTarget();
}
}
-
-
+
}
diff --git a/android/src/fishrungames/bashgid/core/AlbumManager.java b/android/src/fishrungames/bashgid/core/AlbumManager.java
index 78351a1..de8f8ab 100644
--- a/android/src/fishrungames/bashgid/core/AlbumManager.java
+++ b/android/src/fishrungames/bashgid/core/AlbumManager.java
@@ -19,13 +19,15 @@ public class AlbumManager
public String name;
public String title;
public String description;
+ public int hidden;
- public AlbumRecordData(String name, String title, String description)
+ public AlbumRecordData(String name, String title, String description, int hidden)
{
this.name = name;
this.title = title;
this.description = description;
+ this.hidden = hidden;
}
public AlbumRecordData(AlbumRecordData copyFrom)
@@ -33,6 +35,7 @@ public class AlbumManager
this.name = copyFrom.name;
this.title = copyFrom.title;
this.description = copyFrom.description;
+ this.hidden = copyFrom.hidden;
}
}
@@ -65,16 +68,16 @@ public class AlbumManager
{
public int id;
- public AlbumRecord(int id, String name, String title, String description)
+ public AlbumRecord(int id, String name, String title, String description, int hidden)
{
- super(name, title, description);
+ super(name, title, description, hidden);
this.id = id;
}
}
public static AlbumFullData CreateEmptyAlbum()
{
- AlbumFullData result = new AlbumFullData(new AlbumRecordData("", "", ""));
+ AlbumFullData result = new AlbumFullData(new AlbumRecordData("", "", "", 0));
return result;
}
@@ -91,7 +94,7 @@ public class AlbumManager
{
if (!MainActivity.getInstance().albumDataSource.IsAlbumAlreadyExist(albumName))
{
- MainActivity.getInstance().albumDataSource.CreateNewAlbum(new AlbumRecordData(albumName, albumName, ""));
+ MainActivity.getInstance().albumDataSource.CreateNewAlbum(new AlbumRecordData(albumName, albumName, "", 0));
}
MainActivity.getInstance().albumDataSource.AddPhotoToAlbum(imageUrl, albumName);
@@ -118,7 +121,7 @@ public class AlbumManager
{
if (!MainActivity.getInstance().channelDataSource.IsChannelAlreadyExist(channelName))
{
- MainActivity.getInstance().channelDataSource.CreateNewChannel(new ChannelRecordData(channelName, channelName, ""));
+ MainActivity.getInstance().channelDataSource.CreateNewChannel(new ChannelRecordData(channelName, channelName, "", 0));
}
MainActivity.getInstance().channelDataSource.AddVideoToChannel(videoUrl, channelName);
@@ -143,7 +146,7 @@ public class AlbumManager
{
if (!MainActivity.getInstance().journalDataSource.IsJournalAlreadyExist(journalName))
{
- MainActivity.getInstance().journalDataSource.CreateNewJournal(new JournalRecordData(journalName, journalName, ""));
+ MainActivity.getInstance().journalDataSource.CreateNewJournal(new JournalRecordData(journalName, journalName, "", 0, 0, 0));
}
MainActivity.getInstance().journalDataSource.AddArticleToJournal(articleName, journalName);
diff --git a/android/src/fishrungames/bashgid/core/ArticleManager.java b/android/src/fishrungames/bashgid/core/ArticleManager.java
index 2b08968..27b89ef 100644
--- a/android/src/fishrungames/bashgid/core/ArticleManager.java
+++ b/android/src/fishrungames/bashgid/core/ArticleManager.java
@@ -27,10 +27,14 @@ public class ArticleManager
public String content;
public double geoLat;
public double geoLon;
+ public String address;
+ public String phone;
public String externalLink;
+ public String externalLinkText;
public Date dateTime;
+ public int hidden;
- public ArticleRecordData(String name, int type, String title, String content, double geoLat, double geoLon, String externalLink, Date dateTime)
+ public ArticleRecordData(String name, int type, String title, String content, double geoLat, double geoLon, String address, String phone, String externalLink, String externalLinkText, Date dateTime, int hidden)
{
this.name = name;
this.type = type;
@@ -38,8 +42,12 @@ public class ArticleManager
this.content = content;
this.geoLat = geoLat;
this.geoLon = geoLon;
+ this.address = address;
+ this.phone = phone;
this.externalLink = externalLink;
+ this.externalLinkText = externalLinkText;
this.dateTime = dateTime;
+ this.hidden = hidden;
}
public ArticleRecordData(ArticleRecordData copyFrom)
@@ -50,8 +58,12 @@ public class ArticleManager
this.content = copyFrom.content;
this.geoLat = copyFrom.geoLat;
this.geoLon = copyFrom.geoLon;
+ this.address = copyFrom.address;
+ this.phone = copyFrom.phone;
this.externalLink = copyFrom.externalLink;
+ this.externalLinkText = copyFrom.externalLinkText;
this.dateTime = copyFrom.dateTime;
+ this.hidden = copyFrom.hidden;
}
}
diff --git a/android/src/fishrungames/bashgid/core/ChannelManager.java b/android/src/fishrungames/bashgid/core/ChannelManager.java
index e7957e3..9134496 100644
--- a/android/src/fishrungames/bashgid/core/ChannelManager.java
+++ b/android/src/fishrungames/bashgid/core/ChannelManager.java
@@ -17,13 +17,15 @@ public class ChannelManager
public String name;
public String title;
public String description;
+ public int hidden;
- public ChannelRecordData(String name, String title, String description)
+ public ChannelRecordData(String name, String title, String description, int hidden)
{
this.name = name;
this.title = title;
this.description = description;
+ this.hidden = hidden;
}
public ChannelRecordData(ChannelRecordData copyFrom)
@@ -31,6 +33,7 @@ public class ChannelManager
this.name = copyFrom.name;
this.title = copyFrom.title;
this.description = copyFrom.description;
+ this.hidden = copyFrom.hidden;
}
}
@@ -50,16 +53,16 @@ public class ChannelManager
{
public int id;
- public ChannelRecord(int id, String name, String title, String description)
+ public ChannelRecord(int id, String name, String title, String description, int hidden)
{
- super(name, title, description);
+ super(name, title, description, hidden);
this.id = id;
}
}
public static ChannelFullData CreateEmptyChannel()
{
- ChannelFullData result = new ChannelFullData(new ChannelRecordData("", "", ""));
+ ChannelFullData result = new ChannelFullData(new ChannelRecordData("", "", "", 0));
return result;
}
diff --git a/android/src/fishrungames/bashgid/core/DatabaseDownloadTask.java b/android/src/fishrungames/bashgid/core/DatabaseDownloadTask.java
index 47d9a4d..289ae32 100644
--- a/android/src/fishrungames/bashgid/core/DatabaseDownloadTask.java
+++ b/android/src/fishrungames/bashgid/core/DatabaseDownloadTask.java
@@ -200,11 +200,13 @@ public class DatabaseDownloadTask extends AsyncTask
String name = jObject.getString("name");
String title = jObject.getString("title");
String description = jObject.getString("description");
+ int hidden = jObject.getInt("hidden");
MainActivity.getInstance().albumDataSource.CreateNewAlbum(new AlbumRecordData(
name,
title,
- description));
+ description,
+ hidden));
} // End Loop
@@ -285,11 +287,13 @@ public class DatabaseDownloadTask extends AsyncTask
String name = jObject.getString("name");
String title = jObject.getString("title");
String description = jObject.getString("description");
+ int hidden = jObject.getInt("hidden");
MainActivity.getInstance().channelDataSource.CreateNewChannel(new ChannelRecordData(
name,
title,
- description));
+ description,
+ hidden));
} // End Loop
@@ -339,9 +343,13 @@ public class DatabaseDownloadTask extends AsyncTask
String content = jObject.getString("content");
double geoLat = jObject.getDouble("geoLat");
double geoLon = jObject.getDouble("geoLon");
+ String address = jObject.getString("address");
+ String phone = jObject.getString("phone");
String externalLink = jObject.getString("externalLink");
+ String externalLinkText = jObject.getString("externalLinkText");
Date dateTime = ArticleManager.iso8601Format.parse(jObject.getString("dateTime"));
-
+ int hidden = jObject.getInt("hidden");
+
MainActivity.getInstance().articleDataSource.CreateNewArticle(new ArticleRecordData(
name,
type,
@@ -349,9 +357,12 @@ public class DatabaseDownloadTask extends AsyncTask
content,
geoLat,
geoLon,
+ address,
+ phone,
externalLink,
- dateTime
- ));
+ externalLinkText,
+ dateTime,
+ hidden));
} catch (ParseException e)
@@ -379,11 +390,17 @@ public class DatabaseDownloadTask extends AsyncTask
String name = jObject.getString("name");
String title = jObject.getString("title");
String description = jObject.getString("description");
+ int hidden = jObject.getInt("hidden");
+ int geoCategory = jObject.getInt("geoCategory");
+ int main = jObject.getInt("main");
MainActivity.getInstance().journalDataSource.CreateNewJournal(new JournalRecordData(
name,
title,
- description));
+ description,
+ hidden,
+ geoCategory,
+ main));
} // End Loop
@@ -473,8 +490,11 @@ public class DatabaseDownloadTask extends AsyncTask
String textEn = jObject.getString("textEn");
String textRu = jObject.getString("textRu");
String textZh = jObject.getString("textZh");
+ String textEnUp = jObject.getString("textEnUp");
+ String textRuUp = jObject.getString("textRuUp");
+ String textZhUp = jObject.getString("textZhUp");
- MainActivity.getInstance().translationDataSource.CreateNewTranslation(new TranslationRecordData(name, textEn, textRu, textZh));
+ MainActivity.getInstance().translationDataSource.CreateNewTranslation(new TranslationRecordData(name, textEn, textRu, textZh, textEnUp, textRuUp, textZhUp));
} // End Loop
diff --git a/android/src/fishrungames/bashgid/core/DatabaseGetGeoJournalListTask.java b/android/src/fishrungames/bashgid/core/DatabaseGetGeoJournalListTask.java
new file mode 100644
index 0000000..fcbbcad
--- /dev/null
+++ b/android/src/fishrungames/bashgid/core/DatabaseGetGeoJournalListTask.java
@@ -0,0 +1,46 @@
+package fishrungames.bashgid.core;
+
+import java.util.ArrayList;
+
+import android.os.AsyncTask;
+import android.os.Handler;
+import android.os.Message;
+import fishrungames.bashgid.MainActivity;
+import fishrungames.bashgid.core.JournalManager.JournalRecordData;
+import fishrungames.bashgid.core.JournalManager.JournalSemiFullData;
+
+public class DatabaseGetGeoJournalListTask extends AsyncTask
+{
+
+
+ArrayList geoJournalList;
+
+ public Handler mHandler;
+
+ protected Long doInBackground(String... queryArr)
+ {
+
+
+ geoJournalList = MainActivity.getInstance().journalDataSource.GetGeoJournalList();
+
+
+
+ return (long) 0;
+ }
+
+ protected void onProgressUpdate(Integer... progress)
+ {
+ Message completeMessage = mHandler.obtainMessage(MainActivity.DATABASE_GET_GEO_JOURNAL_LIST_STATE_UPDATE, geoJournalList);
+
+ completeMessage.sendToTarget();
+
+ }
+
+ protected void onPostExecute(Long result)
+ {
+ Message completeMessage = mHandler.obtainMessage(MainActivity.DATABASE_GET_GEO_JOURNAL_LIST_STATE_FINISHED, geoJournalList);
+
+ completeMessage.sendToTarget();
+ }
+}
+
diff --git a/android/src/fishrungames/bashgid/core/DatabaseGetJournalListTask.java b/android/src/fishrungames/bashgid/core/DatabaseGetJournalListTask.java
index ad73493..ce2238f 100644
--- a/android/src/fishrungames/bashgid/core/DatabaseGetJournalListTask.java
+++ b/android/src/fishrungames/bashgid/core/DatabaseGetJournalListTask.java
@@ -11,23 +11,22 @@ import fishrungames.bashgid.core.JournalManager.JournalSemiFullData;
public class DatabaseGetJournalListTask extends AsyncTask
{
- ArrayList journalList;
+ArrayList journalList;
public Handler mHandler;
protected Long doInBackground(String... queryArr)
{
- String superJournal = "";
+ //String superJournal = "";
if (queryArr.length > 0)
{
- superJournal = queryArr[0];
- journalList = MainActivity.getInstance().journalDataSource.GetJournalList(superJournal, 3); //Xperimental -- need to pass exactly how many articles
+ journalList = MainActivity.getInstance().journalDataSource.GetJournalListMain(3); //Xperimental -- need to pass exactly how many articles
}
else
{
- journalList = MainActivity.getInstance().journalDataSource.GetAllJournalList(3); //Xperimental -- need to pass exactly how many articles
+ journalList = MainActivity.getInstance().journalDataSource.GetAllJournalListExceptHidden(3); //Xperimental -- need to pass exactly how many articles
}
@@ -48,4 +47,5 @@ public class DatabaseGetJournalListTask extends AsyncTask
completeMessage.sendToTarget();
}
+
}
diff --git a/android/src/fishrungames/bashgid/core/DatabaseSearchArticleTask.java b/android/src/fishrungames/bashgid/core/DatabaseSearchArticleTask.java
index 2f8b301..65a5301 100644
--- a/android/src/fishrungames/bashgid/core/DatabaseSearchArticleTask.java
+++ b/android/src/fishrungames/bashgid/core/DatabaseSearchArticleTask.java
@@ -2,6 +2,10 @@ package fishrungames.bashgid.core;
import java.util.ArrayList;
+import java.util.Comparator;
+import java.util.Locale;
+import java.util.Set;
+import java.util.TreeSet;
import android.os.AsyncTask;
import android.os.Bundle;
@@ -18,6 +22,8 @@ public class DatabaseSearchArticleTask extends AsyncTask
public Handler mHandler;
ArrayList articleArr = new ArrayList();
+
+ ArrayList translationNamesArr = new ArrayList();
protected Long doInBackground(Bundle... queryArr)
{
@@ -25,19 +31,54 @@ public class DatabaseSearchArticleTask extends AsyncTask
String journalName = queryArr[0].getString("journalName");
-
- if (journalName != null && journalName.length() > 0)
+ query = query.toUpperCase(Locale.getDefault());
+
+ if (Locale.getDefault().equals(new Locale("ru")))
{
- articleArr = MainActivity.getInstance().articleDataSource.SearchArticleByQueryAndJournal(query, journalName);
+
+ translationNamesArr = MainActivity.getInstance().translationDataSource.SearchRussian(query);
+ }
+ else if (Locale.getDefault() == Locale.CHINA)
+ {
+ translationNamesArr = MainActivity.getInstance().translationDataSource.SearchChinese(query);
}
else
{
- articleArr = MainActivity.getInstance().articleDataSource.SearchArticleByQuery(query);
-
+ translationNamesArr = MainActivity.getInstance().translationDataSource.SearchEnglish(query);
}
- //articleArr.addAll(journal.articleArr);
+ if (journalName != null && journalName.length() > 0)
+ {
+ for (String translationName : translationNamesArr)
+ {
+ articleArr.addAll(MainActivity.getInstance().articleDataSource.SearchArticleByTitleOrTextInJournal(translationName, journalName));
+ }
+ }
+ else
+ {
+ for (String translationName : translationNamesArr)
+ {
+ articleArr.addAll(MainActivity.getInstance().articleDataSource.SearchArticleByTitleOrText(translationName));
+ }
+ }
+ //Remove duplicates
+
+ Set articleSet = new TreeSet(new Comparator() {
+
+ @Override
+ public int compare(ArticleShortData lhs, ArticleShortData rhs)
+ {
+ return lhs.name.compareTo(rhs.name);
+ }
+ });
+
+ articleSet.addAll(articleArr);
+
+ articleArr.clear();
+
+ articleArr.addAll(articleSet);
+
return (long) 0;
}
diff --git a/android/src/fishrungames/bashgid/core/JournalManager.java b/android/src/fishrungames/bashgid/core/JournalManager.java
index bc64639..01129a3 100644
--- a/android/src/fishrungames/bashgid/core/JournalManager.java
+++ b/android/src/fishrungames/bashgid/core/JournalManager.java
@@ -19,13 +19,19 @@ public class JournalManager
public String name;
public String title;
public String description;
+ public int hidden;
+ public int geoCategory;
+ public int main;
- public JournalRecordData(String name, String title, String description)
+ public JournalRecordData(String name, String title, String description, int hidden, int geoCategory, int main)
{
this.name = name;
this.title = title;
this.description = description;
+ this.hidden = hidden;
+ this.geoCategory = geoCategory;
+ this.main = main;
}
public JournalRecordData(JournalRecordData copyFrom)
@@ -33,6 +39,9 @@ public class JournalManager
this.name = copyFrom.name;
this.title = copyFrom.title;
this.description = copyFrom.description;
+ this.hidden = copyFrom.hidden;
+ this.geoCategory = copyFrom.geoCategory;
+ this.main = copyFrom.main;
}
}
@@ -56,9 +65,9 @@ public class JournalManager
{
public int id;
- public JournalRecord(int id, String name, String title, String description)
+ public JournalRecord(int id, String name, String title, String description, int hidden, int geoCategory, int main)
{
- super(name, title, description);
+ super(name, title, description, hidden, geoCategory, main);
this.id = id;
}
}
@@ -66,7 +75,7 @@ public class JournalManager
public static JournalSemiFullData CreateEmptyJournal()
{
- JournalSemiFullData result = new JournalSemiFullData(new JournalRecordData("", "", ""));
+ JournalSemiFullData result = new JournalSemiFullData(new JournalRecordData("", "", "", 0, 0, 0));
return result;
}
diff --git a/android/src/fishrungames/bashgid/core/NewsManager.java b/android/src/fishrungames/bashgid/core/NewsManager.java
index e2bcea4..5c557fb 100644
--- a/android/src/fishrungames/bashgid/core/NewsManager.java
+++ b/android/src/fishrungames/bashgid/core/NewsManager.java
@@ -14,6 +14,7 @@ import android.util.Log;
import fishrungames.bashgid.MainActivity;
+import fishrungames.bashgid.R;
import fishrungames.bashgid.core.ArticleManager.ArticleRecordData;
@@ -360,9 +361,12 @@ public class NewsManager {
rss2Item.description.replace("'", "''").replace("\"", "\"\""),
0,
0,
+ "",
+ "",
rss2Item.link,
- rss2Item.pubDate
- );
+ MainActivity.getInstance().getResources().getString(R.string.dialog_open),
+ rss2Item.pubDate,
+ 0);
AlbumManager.AddNewArticleToJournal(newsArticle, "news");
//newsRecordArr.add(newsArticle);
diff --git a/android/src/fishrungames/bashgid/core/RssReader.java b/android/src/fishrungames/bashgid/core/RssReader.java
index 56c0090..ae0156d 100644
--- a/android/src/fishrungames/bashgid/core/RssReader.java
+++ b/android/src/fishrungames/bashgid/core/RssReader.java
@@ -15,14 +15,13 @@ import android.util.Log;
public class RssReader {
-
-
public static class Rss2Item
{
String title;
String link;
String description;
+
public static class Rss2Enclosure
{
String url;
diff --git a/android/src/fishrungames/bashgid/core/TranslationManager.java b/android/src/fishrungames/bashgid/core/TranslationManager.java
index 8c649d2..4fb5da5 100644
--- a/android/src/fishrungames/bashgid/core/TranslationManager.java
+++ b/android/src/fishrungames/bashgid/core/TranslationManager.java
@@ -10,14 +10,21 @@ public class TranslationManager
public String textEn;
public String textRu;
public String textZh;
+ public String textEnUp;
+ public String textRuUp;
+ public String textZhUp;
- public TranslationRecordData(String name, String textEn, String textRu, String textZh)
+ public TranslationRecordData(String name, String textEn, String textRu, String textZh, String textEnUp, String textRuUp, String textZhUp)
{
this.name = name;
this.textEn = textEn;
this.textRu = textRu;
this.textZh = textZh;
+
+ this.textEnUp = textEnUp;
+ this.textRuUp = textRuUp;
+ this.textZhUp = textZhUp;
}
public TranslationRecordData(TranslationRecordData copyFrom)
@@ -26,6 +33,9 @@ public class TranslationManager
this.textEn = copyFrom.textEn;
this.textRu = copyFrom.textRu;
this.textZh = copyFrom.textZh;
+ this.textEnUp = copyFrom.textEnUp;
+ this.textRuUp = copyFrom.textRuUp;
+ this.textZhUp = copyFrom.textZhUp;
}
}
diff --git a/android/src/fishrungames/bashgid/core/db/AlbumDataSource.java b/android/src/fishrungames/bashgid/core/db/AlbumDataSource.java
index 1f80d8c..e0015b7 100644
--- a/android/src/fishrungames/bashgid/core/db/AlbumDataSource.java
+++ b/android/src/fishrungames/bashgid/core/db/AlbumDataSource.java
@@ -40,6 +40,7 @@ public class AlbumDataSource
values.put(BashgidSqliteHelper.COLUMN_NAME, recordData.name);
values.put(BashgidSqliteHelper.COLUMN_TITLE, recordData.title);
values.put(BashgidSqliteHelper.COLUMN_DESCRIPTION, recordData.description);
+ values.put(BashgidSqliteHelper.COLUMN_HIDDEN, recordData.hidden);
if (!innerIsAlbumAlreadyExist(recordData.name, database))
{
@@ -196,7 +197,7 @@ public class AlbumDataSource
return result;
}
- public ArrayList GetAllAlbumShortData()
+ public ArrayList GetAllAlbumShortDataExceptHidden()
{
ArrayList result = new ArrayList();
@@ -208,7 +209,7 @@ public class AlbumDataSource
try
{
Cursor cursor = database.query(BashgidSqliteHelper.TABLE_ALBUM, new String[] { BashgidSqliteHelper.COLUMN_NAME,
- BashgidSqliteHelper.COLUMN_TITLE, BashgidSqliteHelper.COLUMN_DESCRIPTION }, null, null, null, null, null, null);
+ BashgidSqliteHelper.COLUMN_TITLE, BashgidSqliteHelper.COLUMN_DESCRIPTION, BashgidSqliteHelper.COLUMN_HIDDEN }, BashgidSqliteHelper.COLUMN_HIDDEN + "=0", null, null, null, null, null);
if (cursor != null)
{
@@ -217,7 +218,7 @@ public class AlbumDataSource
do
{
- AlbumShortData shortData = new AlbumShortData(new AlbumRecordData(cursor.getString(0), cursor.getString(1), cursor.getString(2)));
+ AlbumShortData shortData = new AlbumShortData(new AlbumRecordData(cursor.getString(0), cursor.getString(1), cursor.getString(2), cursor.getInt(3)));
ArrayList imageUrlArr = innerGetImageUrlArrInAlbum(shortData.name, database);
@@ -326,13 +327,13 @@ public class AlbumDataSource
AlbumRecordData result = null;
Cursor cursor = database.query(BashgidSqliteHelper.TABLE_ALBUM, new String[] { BashgidSqliteHelper.COLUMN_NAME, BashgidSqliteHelper.COLUMN_TITLE,
- BashgidSqliteHelper.COLUMN_DESCRIPTION }, BashgidSqliteHelper.COLUMN_NAME + "=?", new String[] { name }, null, null, null, null);
+ BashgidSqliteHelper.COLUMN_DESCRIPTION, BashgidSqliteHelper.COLUMN_HIDDEN }, BashgidSqliteHelper.COLUMN_NAME + "=?", new String[] { name }, null, null, null, null);
if (cursor != null)
{
if (cursor.moveToFirst())
{
- result = new AlbumRecordData(cursor.getString(0), cursor.getString(1), cursor.getString(2));
+ result = new AlbumRecordData(cursor.getString(0), cursor.getString(1), cursor.getString(2), cursor.getInt(3));
}
cursor.close();
diff --git a/android/src/fishrungames/bashgid/core/db/ArticleDataSource.java b/android/src/fishrungames/bashgid/core/db/ArticleDataSource.java
index 563713e..7060596 100644
--- a/android/src/fishrungames/bashgid/core/db/ArticleDataSource.java
+++ b/android/src/fishrungames/bashgid/core/db/ArticleDataSource.java
@@ -59,8 +59,12 @@ public class ArticleDataSource
values.put(BashgidSqliteHelper.COLUMN_CONTENT, recordData.content);
values.put(BashgidSqliteHelper.COLUMN_GEOLAT, recordData.geoLat);
values.put(BashgidSqliteHelper.COLUMN_GEOLON, recordData.geoLon);
+ values.put(BashgidSqliteHelper.COLUMN_ADDRESS, recordData.address);
+ values.put(BashgidSqliteHelper.COLUMN_PHONE, recordData.phone);
values.put(BashgidSqliteHelper.COLUMN_EXTERNAL_LINK, recordData.externalLink);
+ values.put(BashgidSqliteHelper.COLUMN_EXTERNAL_LINK_TEXT, recordData.externalLinkText);
values.put(BashgidSqliteHelper.COLUMN_DATE_TIME, ArticleManager.iso8601Format.format(recordData.dateTime));
+ values.put(BashgidSqliteHelper.COLUMN_HIDDEN, recordData.hidden);
if (!innerIsArticleAlreadyExist(recordData.name, database))
{
@@ -211,8 +215,12 @@ public class ArticleDataSource
result.title = MainActivity.getInstance().translationDataSource.TryTranslateText(result.title, database);
result.content = MainActivity.getInstance().translationDataSource.TryTranslateText(result.content, database);
+ result.address = MainActivity.getInstance().translationDataSource.TryTranslateText(result.address, database);
result.externalLink = MainActivity.getInstance().translationDataSource.TryTranslateText(result.externalLink, database);
-
+ result.externalLinkText = MainActivity.getInstance().translationDataSource.TryTranslateText(result.externalLinkText, database);
+
+
+
}
@@ -242,6 +250,61 @@ public class ArticleDataSource
return result;
}
+
+ public ArrayList SearchArticleByTitleOrText(String query)
+ {
+ ArrayList result = new ArrayList();
+
+ SQLiteDatabase database = dbHelper.getWritableDatabase();
+
+ if (database != null)
+ {
+ try
+ {
+ ArrayList articleNameArr = InnerSearchArticleByTitleOrText(query, database);
+
+ for (String articleName : articleNameArr)
+ {
+ result.add(InnerGetArticleShortData(articleName, database));
+ }
+
+ } finally
+ {
+ dbHelper.close();
+ }
+ }
+
+ return result;
+ }
+
+ public ArrayList SearchArticleByTitleOrTextInJournal(String query, String journalName)
+ {
+ ArrayList result = new ArrayList();
+
+ SQLiteDatabase database = dbHelper.getWritableDatabase();
+
+ if (database != null)
+ {
+ try
+ {
+ ArrayList articleNameArr = InnerSearchArticleByTitleOrText(query, database);
+
+ for (String articleName : articleNameArr)
+ {
+ if (MainActivity.getInstance().journalDataSource.InnerArticleJournalRelationAlreadyExist(articleName, journalName, database))
+ {
+ result.add(InnerGetArticleShortData(articleName, database));
+ }
+ }
+
+ } finally
+ {
+ dbHelper.close();
+ }
+ }
+
+ return result;
+ }
public ArrayList SearchArticleByQuery(String query)
{
@@ -317,6 +380,29 @@ public class ArticleDataSource
}
+ public boolean InnerArticleIsHidden(String name, SQLiteDatabase database)
+ {
+ boolean result = false;
+
+ Cursor cursor = database.query(BashgidSqliteHelper.TABLE_ARTICLE, new String[] { BashgidSqliteHelper.COLUMN_NAME },
+ BashgidSqliteHelper.COLUMN_NAME + "=? AND " +BashgidSqliteHelper.COLUMN_HIDDEN + "=1", new String[] { name }, null, null, null, null);
+
+ if (cursor != null)
+ {
+ if (cursor.getCount() > 0)
+ {
+ result = true;
+ }
+
+ cursor.close();
+ cursor = null;
+ }
+
+ return result;
+ }
+
+
+
public ArticleShortData InnerGetArticleShortData(String name, SQLiteDatabase database)
{
ArticleShortData result = null;
@@ -450,7 +536,19 @@ public class ArticleDataSource
ArticleRecordData result = null;
Cursor cursor = database.query(BashgidSqliteHelper.TABLE_ARTICLE, new String[] {
- BashgidSqliteHelper.COLUMN_NAME, BashgidSqliteHelper.COLUMN_TYPE, BashgidSqliteHelper.COLUMN_TITLE, BashgidSqliteHelper.COLUMN_CONTENT, BashgidSqliteHelper.COLUMN_GEOLAT, BashgidSqliteHelper.COLUMN_GEOLON, BashgidSqliteHelper.COLUMN_EXTERNAL_LINK,BashgidSqliteHelper.COLUMN_DATE_TIME },
+ BashgidSqliteHelper.COLUMN_NAME,
+ BashgidSqliteHelper.COLUMN_TYPE,
+ BashgidSqliteHelper.COLUMN_TITLE,
+ BashgidSqliteHelper.COLUMN_CONTENT,
+ BashgidSqliteHelper.COLUMN_GEOLAT,
+ BashgidSqliteHelper.COLUMN_GEOLON,
+ BashgidSqliteHelper.COLUMN_ADDRESS,
+ BashgidSqliteHelper.COLUMN_PHONE,
+ BashgidSqliteHelper.COLUMN_EXTERNAL_LINK,
+ BashgidSqliteHelper.COLUMN_EXTERNAL_LINK_TEXT,
+ BashgidSqliteHelper.COLUMN_DATE_TIME,
+ BashgidSqliteHelper.COLUMN_HIDDEN
+ },
BashgidSqliteHelper.COLUMN_NAME + "=?", new String[] { name }, null, null, null, null);
if (cursor != null)
@@ -462,7 +560,7 @@ public class ArticleDataSource
try
{
- d = ArticleManager.iso8601Format.parse(cursor.getString(7));
+ d = ArticleManager.iso8601Format.parse(cursor.getString(10));
}
catch(ParseException e)
{
@@ -477,7 +575,11 @@ public class ArticleDataSource
cursor.getDouble(4),
cursor.getDouble(5),
cursor.getString(6),
- d
+ cursor.getString(7),
+ cursor.getString(8),
+ cursor.getString(9),
+ d,
+ cursor.getInt(11)
);
}
@@ -495,7 +597,19 @@ public class ArticleDataSource
ArrayList result = new ArrayList();
Cursor cursor = database.query(BashgidSqliteHelper.TABLE_ARTICLE, new String[] {
- BashgidSqliteHelper.COLUMN_NAME, BashgidSqliteHelper.COLUMN_TYPE, BashgidSqliteHelper.COLUMN_TITLE, BashgidSqliteHelper.COLUMN_CONTENT, BashgidSqliteHelper.COLUMN_GEOLAT, BashgidSqliteHelper.COLUMN_GEOLON, BashgidSqliteHelper.COLUMN_EXTERNAL_LINK,BashgidSqliteHelper.COLUMN_DATE_TIME },
+ BashgidSqliteHelper.COLUMN_NAME,
+ BashgidSqliteHelper.COLUMN_TYPE,
+ BashgidSqliteHelper.COLUMN_TITLE,
+ BashgidSqliteHelper.COLUMN_CONTENT,
+ BashgidSqliteHelper.COLUMN_GEOLAT,
+ BashgidSqliteHelper.COLUMN_GEOLON,
+ BashgidSqliteHelper.COLUMN_ADDRESS,
+ BashgidSqliteHelper.COLUMN_PHONE,
+ BashgidSqliteHelper.COLUMN_EXTERNAL_LINK,
+ BashgidSqliteHelper.COLUMN_EXTERNAL_LINK_TEXT,
+ BashgidSqliteHelper.COLUMN_DATE_TIME,
+ BashgidSqliteHelper.COLUMN_HIDDEN
+ },
BashgidSqliteHelper.COLUMN_TITLE + " LIKE ?", new String[] { "%" + query + "%" }, null, null, null, null);
if (cursor != null)
@@ -510,7 +624,7 @@ public class ArticleDataSource
try
{
- d = ArticleManager.iso8601Format.parse(cursor.getString(7));
+ d = ArticleManager.iso8601Format.parse(cursor.getString(10));
}
catch(ParseException e)
{
@@ -525,7 +639,11 @@ public class ArticleDataSource
cursor.getDouble(4),
cursor.getDouble(5),
cursor.getString(6),
- d
+ cursor.getString(7),
+ cursor.getString(8),
+ cursor.getString(9),
+ d,
+ cursor.getInt(11)
));
}
@@ -540,6 +658,39 @@ public class ArticleDataSource
}
+
+ private ArrayList InnerSearchArticleByTitleOrText(String query, SQLiteDatabase database)
+ {
+
+ ArrayList result = new ArrayList();
+
+ Cursor cursor = database.query(BashgidSqliteHelper.TABLE_ARTICLE, new String[] {
+ BashgidSqliteHelper.COLUMN_NAME
+ },
+ BashgidSqliteHelper.COLUMN_TITLE + " = ? OR " + BashgidSqliteHelper.COLUMN_CONTENT + " = ?", new String[] { query, query }, null, null, null, null);
+
+ if (cursor != null)
+ {
+ if (cursor.moveToFirst())
+ {
+
+ do
+ {
+
+ result.add(cursor.getString(0));
+
+ }
+ while (cursor.moveToNext());
+ }
+
+ cursor.close();
+ cursor = null;
+ }
+
+ return result;
+
+ }
+
public ArrayList innerGetAlbumNameArrInArticle(String name, SQLiteDatabase database)
{
ArrayList result = new ArrayList();
diff --git a/android/src/fishrungames/bashgid/core/db/BashgidSqliteHelper.java b/android/src/fishrungames/bashgid/core/db/BashgidSqliteHelper.java
index 89f914f..5378636 100644
--- a/android/src/fishrungames/bashgid/core/db/BashgidSqliteHelper.java
+++ b/android/src/fishrungames/bashgid/core/db/BashgidSqliteHelper.java
@@ -43,11 +43,14 @@ public class BashgidSqliteHelper extends SQLiteOpenHelper
public static final String COLUMN_IMAGE_HASH = "imageHash";
public static final String COLUMN_GEOLAT = "geoLat";
public static final String COLUMN_GEOLON = "geoLon";
+ public static final String COLUMN_ADDRESS = "address";
+ public static final String COLUMN_PHONE = "phone";
public static final String COLUMN_PUBDATE = "pubDate";
public static final String COLUMN_TYPE = "type";
public static final String COLUMN_CONTENT = "content";
public static final String COLUMN_EXTERNAL_LINK = "externalLink";
+ public static final String COLUMN_EXTERNAL_LINK_TEXT = "externalLinkText";
public static final String COLUMN_ALBUM_NAME = "albumName";
public static final String COLUMN_CHANNEL_NAME = "channelName";
@@ -58,12 +61,21 @@ public class BashgidSqliteHelper extends SQLiteOpenHelper
public static final String COLUMN_PREVIEW_IMAGE_URL = "previewImageUrl";
public static final String COLUMN_PREVIEW_IMAGE_HASH = "previewImageHash";
+ public static final String COLUMN_HIDDEN = "hidden";
+ public static final String COLUMN_GEOCATEGORY = "geoCategory";
+ public static final String COLUMN_MAIN = "main";
+
+
public static final String COLUMN_DATE_TIME = "dateTime";
public static final String COLUMN_TEXT_EN = "textEn";
public static final String COLUMN_TEXT_RU = "textRu";
public static final String COLUMN_TEXT_ZH = "textZh";
+ public static final String COLUMN_TEXT_EN_UP = "textEnUp";
+ public static final String COLUMN_TEXT_RU_UP = "textRuUp";
+ public static final String COLUMN_TEXT_ZH_UP = "textZhUp";
+
private static final String DATABASE_NAME = "bashgid.db";
private static final int DATABASE_VERSION = 1;
@@ -79,7 +91,7 @@ public class BashgidSqliteHelper extends SQLiteOpenHelper
+ " real not null" + ", " + COLUMN_GEOLON + " real not null" + ");";
private static final String TABLE_ALBUM_CREATE = "create table " + TABLE_ALBUM + "(" + COLUMN_ID + " integer primary key autoincrement" + ", " + COLUMN_NAME + " text not null"
- + ", " + COLUMN_TITLE + " text not null" + ", " + COLUMN_DESCRIPTION + " text not null" + ");";
+ + ", " + COLUMN_TITLE + " text not null" + ", " + COLUMN_DESCRIPTION + " text not null" + ", " + COLUMN_HIDDEN + " integer not null" + ");";
private static final String TABLE_PHOTO_ALBUM_RELATION_CREATE = "create table " + TABLE_PHOTO_ALBUM_RELATION + "(" + COLUMN_ID + " integer primary key autoincrement" + ", " + COLUMN_IMAGE_URL + " text not null"
+ ", " + COLUMN_NAME + " text not null" + ");";
@@ -87,7 +99,11 @@ public class BashgidSqliteHelper extends SQLiteOpenHelper
private static final String TABLE_ARTICLE_CREATE = "create table " + TABLE_ARTICLE + "(" + COLUMN_ID + " integer primary key autoincrement" + ", " + COLUMN_NAME + " text not null"
+ ", " + COLUMN_TYPE + " integer not null" + ", " + COLUMN_TITLE + " text not null" + ", " + COLUMN_CONTENT + " text not null" + ", " + COLUMN_GEOLAT
- + " real not null" + ", " + COLUMN_GEOLON + " real not null" + ", " + COLUMN_EXTERNAL_LINK + " text not null" + ", " + COLUMN_DATE_TIME + " text not null" +");";
+ + " real not null" + ", " + COLUMN_GEOLON + " real not null" + ", "
+ + COLUMN_ADDRESS + " text not null" + ", "
+ + COLUMN_PHONE + " text not null" + ", "
+ + COLUMN_EXTERNAL_LINK + " text not null" + ", "
+ + COLUMN_EXTERNAL_LINK_TEXT + " text not null" + ", "+ COLUMN_DATE_TIME + " text not null" + ", " + COLUMN_HIDDEN + " integer not null" +");";
private static final String TABLE_ALBUM_ARTICLE_RELATION_CREATE = "create table " + TABLE_ALBUM_ARTICLE_RELATION + "(" + COLUMN_ID + " integer primary key autoincrement" + ", " + COLUMN_ALBUM_NAME + " text not null"
+ ", " + COLUMN_ARTICLE_NAME + " text not null" + ");";
@@ -101,19 +117,20 @@ public class BashgidSqliteHelper extends SQLiteOpenHelper
+ ", " + COLUMN_PREVIEW_IMAGE_HASH + " text not null"+ ");";
private static final String TABLE_CHANNEL_CREATE = "create table " + TABLE_CHANNEL + "(" + COLUMN_ID + " integer primary key autoincrement" + ", " + COLUMN_NAME + " text not null"
- + ", " + COLUMN_TITLE + " text not null" + ", " + COLUMN_DESCRIPTION + " text not null" + ");";
+ + ", " + COLUMN_TITLE + " text not null" + ", " + COLUMN_DESCRIPTION + " text not null" + ", " + COLUMN_HIDDEN + " integer not null" + ");";
private static final String TABLE_VIDEO_CHANNEL_RELATION_CREATE = "create table " + TABLE_VIDEO_CHANNEL_RELATION + "(" + COLUMN_ID + " integer primary key autoincrement" + ", " + COLUMN_VIDEO_URL + " text not null"
+ ", " + COLUMN_NAME + " text not null" + ");";
private static final String TABLE_JOURNAL_CREATE = "create table " + TABLE_JOURNAL + "(" + COLUMN_ID + " integer primary key autoincrement" + ", " + COLUMN_NAME + " text not null"
- + ", " + COLUMN_TITLE + " text not null" + ", " + COLUMN_DESCRIPTION + " text not null" + ");";
+ + ", " + COLUMN_TITLE + " text not null" + ", " + COLUMN_DESCRIPTION + " text not null" + ", " + COLUMN_HIDDEN + " integer not null" + ", " + COLUMN_GEOCATEGORY + " integer not null" + ", " + COLUMN_MAIN + " integer not null" + ");";
private static final String TABLE_ARTICLE_JOURNAL_RELATION_CREATE = "create table " + TABLE_ARTICLE_JOURNAL_RELATION + "(" + COLUMN_ID + " integer primary key autoincrement" + ", " + COLUMN_ARTICLE_NAME + " text not null"
+ ", " + COLUMN_JOURNAL_NAME + " text not null" + ");";
private static final String TABLE_TRANSLATION_CREATE = "create table " + TABLE_TRANSLATION + "(" + COLUMN_ID + " integer primary key autoincrement" + ", " + COLUMN_NAME + " text not null"
- + ", " + COLUMN_TEXT_EN + " text not null"+ ", " + COLUMN_TEXT_RU + " text not null" + ", " + COLUMN_TEXT_ZH + " text not null" + ");";
+ + ", " + COLUMN_TEXT_EN + " text not null"+ ", " + COLUMN_TEXT_RU + " text not null" + ", " + COLUMN_TEXT_ZH + " text not null"
+ + ", " + COLUMN_TEXT_EN_UP + " text not null"+ ", " + COLUMN_TEXT_RU_UP + " text not null" + ", " + COLUMN_TEXT_ZH_UP + " text not null" + ");";
public final Semaphore mutex = new Semaphore(1, true);
diff --git a/android/src/fishrungames/bashgid/core/db/ChannelDataSource.java b/android/src/fishrungames/bashgid/core/db/ChannelDataSource.java
index 2ddd965..e0d5d1e 100644
--- a/android/src/fishrungames/bashgid/core/db/ChannelDataSource.java
+++ b/android/src/fishrungames/bashgid/core/db/ChannelDataSource.java
@@ -40,6 +40,7 @@ public class ChannelDataSource
values.put(BashgidSqliteHelper.COLUMN_NAME, recordData.name);
values.put(BashgidSqliteHelper.COLUMN_TITLE, recordData.title);
values.put(BashgidSqliteHelper.COLUMN_DESCRIPTION, recordData.description);
+ values.put(BashgidSqliteHelper.COLUMN_HIDDEN, recordData.hidden);
if (!innerIsChannelAlreadyExist(recordData.name, database))
{
@@ -231,14 +232,15 @@ public class ChannelDataSource
ChannelRecordData result = null;
Cursor cursor = database.query(BashgidSqliteHelper.TABLE_CHANNEL, new String[] { BashgidSqliteHelper.COLUMN_NAME, BashgidSqliteHelper.COLUMN_TITLE,
- BashgidSqliteHelper.COLUMN_DESCRIPTION }, BashgidSqliteHelper.COLUMN_NAME + "=?", new String[] { name }, null, null, null, null);
+ BashgidSqliteHelper.COLUMN_DESCRIPTION, BashgidSqliteHelper.COLUMN_HIDDEN }, BashgidSqliteHelper.COLUMN_NAME + "=?", new String[] { name }, null, null, null, null);
if (cursor != null)
{
if (cursor.moveToFirst())
{
- result = new ChannelRecordData(cursor.getString(0), cursor.getString(1), cursor.getString(2));
+ result = new ChannelRecordData(cursor.getString(0), cursor.getString(1), cursor.getString(2), cursor.getInt(3));
+
}
cursor.close();
diff --git a/android/src/fishrungames/bashgid/core/db/JournalDataSource.java b/android/src/fishrungames/bashgid/core/db/JournalDataSource.java
index f643b95..0d01df1 100644
--- a/android/src/fishrungames/bashgid/core/db/JournalDataSource.java
+++ b/android/src/fishrungames/bashgid/core/db/JournalDataSource.java
@@ -46,6 +46,9 @@ public class JournalDataSource
values.put(BashgidSqliteHelper.COLUMN_NAME, recordData.name);
values.put(BashgidSqliteHelper.COLUMN_TITLE, recordData.title);
values.put(BashgidSqliteHelper.COLUMN_DESCRIPTION, recordData.description);
+ values.put(BashgidSqliteHelper.COLUMN_HIDDEN, recordData.hidden);
+ values.put(BashgidSqliteHelper.COLUMN_GEOCATEGORY, recordData.geoCategory);
+ values.put(BashgidSqliteHelper.COLUMN_MAIN, recordData.main);
if (!innerIsJournalAlreadyExist(recordData.name, database))
{
@@ -116,8 +119,8 @@ public class JournalDataSource
}
}
-
- public ArrayList GetRecentArticles(String journalName, int count)
+/*
+ public ArrayList GetRecentArticlesExceptHidden(String journalName, int count)
{
ArrayList result = new ArrayList();
@@ -137,8 +140,11 @@ public class JournalDataSource
for (String articleName : articleNameArr)
{
+ if (!MainActivity.getInstance().articleDataSource.InnerArticleIsHidden(articleName, database))
+ {
result.add(MainActivity.getInstance().articleDataSource.InnerGetArticleShortData(articleName, database));
}
+ }
Collections.sort(result, new ArticleDataSource.DateSortComparator());
@@ -156,7 +162,7 @@ public class JournalDataSource
}
return result;
- }
+ }*/
public JournalSemiFullData GetJournalSemiFullData(String name)
{
@@ -190,7 +196,7 @@ public class JournalDataSource
return result;
}
- public ArrayList GetAllJournalList(int count)
+ public ArrayList GetAllJournalListExceptHidden(int count)
{
ArrayList result = new ArrayList();
SQLiteDatabase database = dbHelper.getWritableDatabase();
@@ -201,7 +207,7 @@ public class JournalDataSource
{
Cursor cursor = database.query(BashgidSqliteHelper.TABLE_JOURNAL, new String[] { BashgidSqliteHelper.COLUMN_NAME,
- BashgidSqliteHelper.COLUMN_TITLE, BashgidSqliteHelper.COLUMN_DESCRIPTION }, null, null, null, null, null, null);
+ BashgidSqliteHelper.COLUMN_TITLE, BashgidSqliteHelper.COLUMN_DESCRIPTION, BashgidSqliteHelper.COLUMN_HIDDEN, BashgidSqliteHelper.COLUMN_GEOCATEGORY, BashgidSqliteHelper.COLUMN_MAIN }, BashgidSqliteHelper.COLUMN_HIDDEN + "=0", null, null, null, null, null);
if (cursor != null)
{
@@ -212,11 +218,11 @@ public class JournalDataSource
{
- String name = cursor.getString(0);
- if (!name.equals("news") && !name.equals("map"))
- {
+ //String name = cursor.getString(0);
+ //if (!name.equals("news") && !name.equals("map"))
+ //{
- JournalSemiFullData journal = new JournalSemiFullData(new JournalRecordData(cursor.getString(0), cursor.getString(1), cursor.getString(2)));
+ JournalSemiFullData journal = new JournalSemiFullData(new JournalRecordData(cursor.getString(0), cursor.getString(1), cursor.getString(2), cursor.getInt(3), cursor.getInt(4), cursor.getInt(5)));
ArrayList articleArr;
@@ -230,8 +236,10 @@ public class JournalDataSource
}
for (String article : articleArr)
{
+ if (!MainActivity.getInstance().articleDataSource.InnerArticleIsHidden(article, database))
+ {
journal.articleArr.add(MainActivity.getInstance().articleDataSource.InnerGetArticleShortData(article, database));
-
+ }
}
journal.title = MainActivity.getInstance().translationDataSource.TryTranslateText(journal.title, database);
@@ -239,7 +247,7 @@ public class JournalDataSource
result.add(journal);
- }
+ //}
} while (cursor.moveToNext());
@@ -262,7 +270,7 @@ public class JournalDataSource
}
- public ArrayList GetJournalList(String superJournalName, int count)
+ public ArrayList GetJournalListMain(int count)
{
//Xperimental - need to create a real superjournal
@@ -276,7 +284,8 @@ public class JournalDataSource
{
Cursor cursor = database.query(BashgidSqliteHelper.TABLE_JOURNAL, new String[] { BashgidSqliteHelper.COLUMN_NAME,
- BashgidSqliteHelper.COLUMN_TITLE, BashgidSqliteHelper.COLUMN_DESCRIPTION }, null, null, null, null, null, null);
+ BashgidSqliteHelper.COLUMN_TITLE, BashgidSqliteHelper.COLUMN_DESCRIPTION,
+ BashgidSqliteHelper.COLUMN_HIDDEN, BashgidSqliteHelper.COLUMN_GEOCATEGORY, BashgidSqliteHelper.COLUMN_MAIN}, BashgidSqliteHelper.COLUMN_MAIN + "=1", null, null, null, null, null);
if (cursor != null)
{
@@ -287,11 +296,11 @@ public class JournalDataSource
{
- String name = cursor.getString(0);
- if (name.equals("Universities") || name.equals("hotels")) //Xperimental
- {
+ //String name = cursor.getString(0);
+ //if (name.equals("Universities") || name.equals("hotels")) //Xperimental
+ //{
- JournalSemiFullData journal = new JournalSemiFullData(new JournalRecordData(cursor.getString(0), cursor.getString(1), cursor.getString(2)));
+ JournalSemiFullData journal = new JournalSemiFullData(new JournalRecordData(cursor.getString(0), cursor.getString(1), cursor.getString(2), cursor.getInt(3), cursor.getInt(4), cursor.getInt(5)));
ArrayList articleArr;
@@ -307,8 +316,10 @@ public class JournalDataSource
for (String article : articleArr)
{
+ if (!MainActivity.getInstance().articleDataSource.InnerArticleIsHidden(article, database))
+ {
journal.articleArr.add(MainActivity.getInstance().articleDataSource.InnerGetArticleShortData(article, database));
-
+ }
}
journal.title = MainActivity.getInstance().translationDataSource.TryTranslateText(journal.title, database);
@@ -316,7 +327,7 @@ public class JournalDataSource
result.add(journal);
- }
+ //}
} while (cursor.moveToNext());
@@ -334,6 +345,54 @@ public class JournalDataSource
}
+ return result;
+ }
+
+ public ArrayList GetGeoJournalList()
+ {
+ ArrayList result = new ArrayList();
+ SQLiteDatabase database = dbHelper.getWritableDatabase();
+
+ if (database != null)
+ {
+ try
+ {
+
+ Cursor cursor = database.query(BashgidSqliteHelper.TABLE_JOURNAL, new String[] { BashgidSqliteHelper.COLUMN_NAME,
+ BashgidSqliteHelper.COLUMN_TITLE, BashgidSqliteHelper.COLUMN_DESCRIPTION,
+ BashgidSqliteHelper.COLUMN_HIDDEN, BashgidSqliteHelper.COLUMN_GEOCATEGORY, BashgidSqliteHelper.COLUMN_MAIN}, BashgidSqliteHelper.COLUMN_GEOCATEGORY + "=1", null, null, null, null, null);
+
+ if (cursor != null)
+ {
+ if (cursor.moveToFirst())
+ {
+
+ do
+
+ {
+ JournalRecordData journal = new JournalRecordData(cursor.getString(0), cursor.getString(1), cursor.getString(2), cursor.getInt(3), cursor.getInt(4), cursor.getInt(5));
+
+ journal.title = MainActivity.getInstance().translationDataSource.TryTranslateText(journal.title, database);
+
+ //journal.description = MainActivity.getInstance().translationDataSource.TryTranslateText(journal.description, database);
+
+ result.add(journal);
+
+ } while (cursor.moveToNext());
+
+ }
+
+ cursor.close();
+ cursor = null;
+ }
+ }
+ finally
+ {
+ dbHelper.close();
+ }
+ }
+
+
return result;
}
@@ -355,9 +414,11 @@ public class JournalDataSource
for (String article : articleArr)
{
-
+ //if (!MainActivity.getInstance().articleDataSource.InnerArticleIsHidden(article, database))
+ //{
intermediateArticleArr.add(MainActivity.getInstance().articleDataSource.InnerGetArticleShortData(article, database));
+ //
}
Collections.sort(intermediateArticleArr, new ArticleManager.ArticleShortDataTimeSortComparator());
@@ -505,7 +566,7 @@ public class JournalDataSource
JournalRecordData result = null;
Cursor cursor = database.query(BashgidSqliteHelper.TABLE_JOURNAL, new String[] { BashgidSqliteHelper.COLUMN_NAME, BashgidSqliteHelper.COLUMN_TITLE,
- BashgidSqliteHelper.COLUMN_DESCRIPTION }, BashgidSqliteHelper.COLUMN_NAME + "=?", new String[] { name }, null, null, null, null);
+ BashgidSqliteHelper.COLUMN_DESCRIPTION, BashgidSqliteHelper.COLUMN_HIDDEN, BashgidSqliteHelper.COLUMN_GEOCATEGORY, BashgidSqliteHelper.COLUMN_MAIN }, BashgidSqliteHelper.COLUMN_NAME + "=?", new String[] { name }, null, null, null, null);
if (cursor != null)
{
@@ -513,7 +574,7 @@ public class JournalDataSource
{
cursor.moveToFirst();
- result = new JournalRecordData(cursor.getString(0), cursor.getString(1), cursor.getString(2));
+ result = new JournalRecordData(cursor.getString(0), cursor.getString(1), cursor.getString(2), cursor.getInt(3), cursor.getInt(4), cursor.getInt(5));
}
cursor.close();
cursor = null;
diff --git a/android/src/fishrungames/bashgid/core/db/PhotoDataSource.java b/android/src/fishrungames/bashgid/core/db/PhotoDataSource.java
index d7d5571..abb2fae 100644
--- a/android/src/fishrungames/bashgid/core/db/PhotoDataSource.java
+++ b/android/src/fishrungames/bashgid/core/db/PhotoDataSource.java
@@ -49,7 +49,7 @@ public class PhotoDataSource
database.update(BashgidSqliteHelper.TABLE_PHOTO, values, BashgidSqliteHelper.COLUMN_IMAGE_URL + " = " +"\"" + recordData.imageUrl +"\"", null);
}
- Log.e("a", "aaa4");
+ //Log.e("a", "aaa4");
} finally
{
dbHelper.close();
diff --git a/android/src/fishrungames/bashgid/core/db/TranslationDataSource.java b/android/src/fishrungames/bashgid/core/db/TranslationDataSource.java
index 15c0755..3bc0f32 100644
--- a/android/src/fishrungames/bashgid/core/db/TranslationDataSource.java
+++ b/android/src/fishrungames/bashgid/core/db/TranslationDataSource.java
@@ -3,11 +3,7 @@ package fishrungames.bashgid.core.db;
import java.util.ArrayList;
import java.util.Locale;
-import fishrungames.bashgid.MainActivity;
-import fishrungames.bashgid.core.AlbumManager;
-import fishrungames.bashgid.core.AlbumManager.AlbumFullData;
-import fishrungames.bashgid.core.AlbumManager.AlbumRecordData;
-import fishrungames.bashgid.core.AlbumManager.AlbumShortData;
+
import fishrungames.bashgid.core.TranslationManager.TranslationRecordData;
import android.content.ContentValues;
@@ -15,7 +11,7 @@ import android.content.Context;
import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;
-import android.util.Log;
+
public class TranslationDataSource
{
@@ -43,6 +39,10 @@ public class TranslationDataSource
values.put(BashgidSqliteHelper.COLUMN_TEXT_EN, recordData.textEn);
values.put(BashgidSqliteHelper.COLUMN_TEXT_RU, recordData.textRu);
values.put(BashgidSqliteHelper.COLUMN_TEXT_ZH, recordData.textZh);
+ values.put(BashgidSqliteHelper.COLUMN_TEXT_EN_UP, recordData.textEnUp);
+ values.put(BashgidSqliteHelper.COLUMN_TEXT_RU_UP, recordData.textRuUp);
+ values.put(BashgidSqliteHelper.COLUMN_TEXT_ZH_UP, recordData.textZhUp);
+
if (!innerIsTranslationAlreadyExist(recordData.name, database))
{
@@ -82,6 +82,72 @@ public class TranslationDataSource
return name;
}
}
+
+ public ArrayList SearchRussian(String partString)
+ {
+ ArrayList result = new ArrayList();
+
+ SQLiteDatabase database = dbHelper.getWritableDatabase();
+
+ if (database != null)
+ {
+
+ try
+ {
+ result = innerGetTranslationNameByPartString_Russian(partString, database);
+
+ } finally
+ {
+ dbHelper.close();
+ }
+ }
+
+ return result;
+ }
+
+ public ArrayList SearchEnglish(String partString)
+ {
+ ArrayList result = new ArrayList();
+
+ SQLiteDatabase database = dbHelper.getWritableDatabase();
+
+ if (database != null)
+ {
+
+ try
+ {
+ result = innerGetTranslationNameByPartString_English(partString, database);
+
+ } finally
+ {
+ dbHelper.close();
+ }
+ }
+
+ return result;
+ }
+
+ public ArrayList SearchChinese(String partString)
+ {
+ ArrayList result = new ArrayList();
+
+ SQLiteDatabase database = dbHelper.getWritableDatabase();
+
+ if (database != null)
+ {
+
+ try
+ {
+ result = innerGetTranslationNameByPartString_Chinese(partString, database);
+
+ } finally
+ {
+ dbHelper.close();
+ }
+ }
+
+ return result;
+ }
/*
public boolean IsTranslationAlreadyExist(String name)
{
@@ -371,14 +437,97 @@ public class TranslationDataSource
TranslationRecordData result = null;
- Cursor cursor = database.query(BashgidSqliteHelper.TABLE_TRANSLATION, new String[] { BashgidSqliteHelper.COLUMN_NAME, BashgidSqliteHelper.COLUMN_TEXT_EN,
- BashgidSqliteHelper.COLUMN_TEXT_RU, BashgidSqliteHelper.COLUMN_TEXT_ZH }, BashgidSqliteHelper.COLUMN_NAME + "=?", new String[] { name }, null, null, null, null);
+ Cursor cursor = database.query(BashgidSqliteHelper.TABLE_TRANSLATION, new String[] { BashgidSqliteHelper.COLUMN_NAME,
+ BashgidSqliteHelper.COLUMN_TEXT_EN, BashgidSqliteHelper.COLUMN_TEXT_RU, BashgidSqliteHelper.COLUMN_TEXT_ZH,
+ BashgidSqliteHelper.COLUMN_TEXT_EN_UP, BashgidSqliteHelper.COLUMN_TEXT_RU_UP, BashgidSqliteHelper.COLUMN_TEXT_ZH_UP}, BashgidSqliteHelper.COLUMN_NAME + "=?", new String[] { name }, null, null, null, null);
if (cursor != null)
{
if (cursor.moveToFirst())
{
- result = new TranslationRecordData(cursor.getString(0), cursor.getString(1), cursor.getString(2), cursor.getString(3));
+ result = new TranslationRecordData(
+ cursor.getString(0),
+ cursor.getString(1),
+ cursor.getString(2),
+ cursor.getString(3),
+ cursor.getString(4),
+ cursor.getString(5),
+ cursor.getString(6));
+ }
+
+ cursor.close();
+ cursor = null;
+ }
+
+ return result;
+
+ }
+
+ public ArrayList innerGetTranslationNameByPartString_Russian(String partString, SQLiteDatabase database)
+ {
+
+ ArrayList result = new ArrayList();
+
+ Cursor cursor = database.query(BashgidSqliteHelper.TABLE_TRANSLATION, new String[] { BashgidSqliteHelper.COLUMN_NAME}, BashgidSqliteHelper.COLUMN_TEXT_RU_UP + " LIKE ?", new String[] { "%" + partString + "%" }, null, null, null, null);
+
+ if (cursor != null)
+ {
+ if (cursor.moveToFirst())
+ {
+ do
+ {
+ result.add(cursor.getString(0));
+ } while (cursor.moveToNext());
+ }
+
+ cursor.close();
+ cursor = null;
+ }
+
+ return result;
+
+ }
+
+ public ArrayList innerGetTranslationNameByPartString_English(String partString, SQLiteDatabase database)
+ {
+
+ ArrayList result = new ArrayList();
+
+ Cursor cursor = database.query(BashgidSqliteHelper.TABLE_TRANSLATION, new String[] { BashgidSqliteHelper.COLUMN_NAME}, BashgidSqliteHelper.COLUMN_TEXT_EN_UP + " LIKE ?", new String[] { "%" + partString + "%" }, null, null, null, null);
+
+ if (cursor != null)
+ {
+ if (cursor.moveToFirst())
+ {
+ do
+ {
+ result.add(cursor.getString(0));
+ } while (cursor.moveToNext());
+ }
+
+ cursor.close();
+ cursor = null;
+ }
+
+ return result;
+
+ }
+
+ public ArrayList innerGetTranslationNameByPartString_Chinese(String partString, SQLiteDatabase database)
+ {
+
+ ArrayList result = new ArrayList();
+
+ Cursor cursor = database.query(BashgidSqliteHelper.TABLE_TRANSLATION, new String[] { BashgidSqliteHelper.COLUMN_NAME}, BashgidSqliteHelper.COLUMN_TEXT_ZH_UP + " LIKE ?", new String[] { "%" + partString + "%" }, null, null, null, null);
+
+ if (cursor != null)
+ {
+ if (cursor.moveToFirst())
+ {
+ do
+ {
+ result.add(cursor.getString(0));
+ } while (cursor.moveToNext());
}
cursor.close();