diff --git a/android/res/drawable/drawer_book.png b/android/res/drawable/drawer_bookmark.png
similarity index 100%
rename from android/res/drawable/drawer_book.png
rename to android/res/drawable/drawer_bookmark.png
diff --git a/android/res/drawable/drawer_books.png b/android/res/drawable/drawer_books.png
new file mode 100644
index 0000000..eeeb783
Binary files /dev/null and b/android/res/drawable/drawer_books.png differ
diff --git a/android/res/drawable/no_picture.png b/android/res/drawable/no_picture.png
new file mode 100644
index 0000000..974cfaa
Binary files /dev/null and b/android/res/drawable/no_picture.png differ
diff --git a/android/res/layout/books_page_list_element.xml b/android/res/layout/books_page_list_element.xml
new file mode 100644
index 0000000..a1b45df
--- /dev/null
+++ b/android/res/layout/books_page_list_element.xml
@@ -0,0 +1,38 @@
+
+
+
+
+
+
+
+
+
+
diff --git a/android/res/layout/fragment_book_record_page.xml b/android/res/layout/fragment_book_record_page.xml
new file mode 100644
index 0000000..58b07d4
--- /dev/null
+++ b/android/res/layout/fragment_book_record_page.xml
@@ -0,0 +1,62 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/android/res/layout/fragment_books_page.xml b/android/res/layout/fragment_books_page.xml
new file mode 100644
index 0000000..f1f7f0d
--- /dev/null
+++ b/android/res/layout/fragment_books_page.xml
@@ -0,0 +1,17 @@
+
+
+
+
+
+
+
+
diff --git a/android/res/layout/fragment_video_page.xml b/android/res/layout/fragment_video_page.xml
new file mode 100644
index 0000000..2a098d2
--- /dev/null
+++ b/android/res/layout/fragment_video_page.xml
@@ -0,0 +1,14 @@
+
+
+
+
+
+
+
diff --git a/android/res/layout/fragment_video_record_page.xml b/android/res/layout/fragment_video_record_page.xml
new file mode 100644
index 0000000..32535fc
--- /dev/null
+++ b/android/res/layout/fragment_video_record_page.xml
@@ -0,0 +1,27 @@
+
+
+
+
+
+
+
+
+
+
diff --git a/android/res/layout/video_page_list_element.xml b/android/res/layout/video_page_list_element.xml
new file mode 100644
index 0000000..c6906c3
--- /dev/null
+++ b/android/res/layout/video_page_list_element.xml
@@ -0,0 +1,31 @@
+
+
+
+
+
+
+
+
diff --git a/android/res/values-ru/strings.xml b/android/res/values-ru/strings.xml
index 5e920db..40d076d 100644
--- a/android/res/values-ru/strings.xml
+++ b/android/res/values-ru/strings.xml
@@ -40,10 +40,16 @@
Карта
Видео
Фотогалерея
+ Книги
Инвестору
Настройки
Перейти на сайт
+
+ Купить...
+ Читать
+ Стоимость:
+ Руб.
diff --git a/android/res/values-zh-rCN/strings.xml b/android/res/values-zh-rCN/strings.xml
index dba37cb..d5fc94b 100644
--- a/android/res/values-zh-rCN/strings.xml
+++ b/android/res/values-zh-rCN/strings.xml
@@ -35,6 +35,7 @@
地图
视频
图片库
+ 书籍
投资者信息
设置
diff --git a/android/res/values/strings.xml b/android/res/values/strings.xml
index d75191f..ff15f30 100644
--- a/android/res/values/strings.xml
+++ b/android/res/values/strings.xml
@@ -41,11 +41,17 @@
Map
Video
Photo gallery
+ Books
For investor
Settings
Go to website
+
+ Buy
+ Read
+ Price:
+ RUB
diff --git a/android/src/fishrungames/bashgid/BookRecordFragment.java b/android/src/fishrungames/bashgid/BookRecordFragment.java
new file mode 100644
index 0000000..e9c22f6
--- /dev/null
+++ b/android/src/fishrungames/bashgid/BookRecordFragment.java
@@ -0,0 +1,62 @@
+package fishrungames.bashgid;
+
+
+import fishrungames.networkutils.ImageManager;
+import fishrungames.bashgid.core.BookManager.BookRecord;
+import android.os.Bundle;
+import android.support.v4.app.Fragment;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.ViewGroup;
+import android.widget.Button;
+import android.widget.ImageView;
+import android.widget.TextView;
+
+
+public class BookRecordFragment extends Fragment
+{
+
+ BookRecord bookRecord;
+
+ public BookRecordFragment(BookRecord bookRecord)
+ {
+ this.bookRecord = bookRecord;
+ }
+
+ @Override
+ public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
+ View rootView = inflater.inflate(R.layout.fragment_book_record_page, container, false);
+
+ TextView nameTextView = (TextView) rootView.findViewById(R.id.nameTextView);
+ nameTextView.setText(bookRecord.name);
+
+ TextView authorTextView = (TextView) rootView.findViewById(R.id.authorTextView);
+ authorTextView.setText(bookRecord.author);
+
+ TextView descriptionTextView = (TextView) rootView.findViewById(R.id.descriptionTextView);
+ descriptionTextView.setText(bookRecord.description);
+
+ TextView priceTextView = (TextView) rootView.findViewById(R.id.priceTextView);
+ priceTextView.setText(getResources().getString(R.string.price) + Integer.toString(bookRecord.price) + " " + getResources().getString(R.string.rub));
+
+ ImageView imageView = (ImageView) rootView.findViewById(R.id.imageView);
+
+ if (bookRecord.imageUrl.length() == 0)
+ {
+ imageView.setImageResource(R.drawable.no_picture);
+ }
+ else
+ {
+ ImageManager.getInstance().ApplyImageToImageView(imageView, bookRecord.imageUrl);
+ }
+
+ //ImageManager.getInstance().ApplyImageToImageView(imageView, realImageUrl);
+
+ //Button buyButton = (Button) rootView.findViewById(R.id.buyButton);
+ //Button readButton = (Button) rootView.findViewById(R.id.readButton);
+
+ return rootView;
+ }
+
+
+}
diff --git a/android/src/fishrungames/bashgid/BooksFragment.java b/android/src/fishrungames/bashgid/BooksFragment.java
new file mode 100644
index 0000000..6d5441a
--- /dev/null
+++ b/android/src/fishrungames/bashgid/BooksFragment.java
@@ -0,0 +1,175 @@
+package fishrungames.bashgid;
+
+
+import java.util.ArrayList;
+
+import fishrungames.bashgid.core.BookManager;
+import fishrungames.networkutils.ImageManager;
+import fishrungames.networkutils.UniversalActionWithCallback;
+import fishrungames.networkutils.interfaces.RemoveCallbackInterface;
+import fishrungames.networkutils.interfaces.UpdateAndFinishCallbackInterface;
+
+import android.annotation.SuppressLint;
+import android.content.Context;
+import android.os.Bundle;
+import android.support.v4.app.Fragment;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.ViewGroup;
+import android.widget.AdapterView;
+import android.widget.AdapterView.OnItemClickListener;
+import android.widget.BaseAdapter;
+import android.widget.GridView;
+import android.widget.ImageView;
+
+import android.widget.TextView;
+
+
+public class BooksFragment extends Fragment implements UpdateAndFinishCallbackInterface
+{
+
+ ListAdapter listAdapter;
+
+ GridView gridView;
+
+ ArrayList bookRecordArr;
+
+ RemoveCallbackInterface removeCallback = null;
+ Object removeCallbackSynchronizer = new Object();
+
+
+
+ @Override
+ public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
+
+
+ bookRecordArr = BookManager.getInstance().getBooks();
+
+ removeCallback = UniversalActionWithCallback.PerformActionIfNotPerforming(BookManager.getInstance(), null, this, "BookManager");
+
+
+ View rootView = inflater.inflate(R.layout.fragment_books_page, container, false);
+
+ gridView = (GridView) rootView.findViewById(R.id.gridView);
+
+ listAdapter = new ListAdapter(getActivity());
+
+ gridView.setAdapter(listAdapter);
+
+ gridView.setOnItemClickListener(new OnItemClickListener()
+ {
+
+ @Override
+ public void onItemClick(AdapterView> parent, View view, int position, long id)
+ {
+ MainActivity.getInstance().OpenBookRecordScreen(bookRecordArr.get(position), MainActivity.TAG_FROM_BOOKSFRAGMENT_TO_BOOKRECORDFRAGMENT);
+ }
+
+ });
+
+ RefreshBookList();
+
+ return rootView;
+ }
+
+ @Override
+ public void onDestroyView()
+ {
+ synchronized (removeCallbackSynchronizer)
+ {
+ if (removeCallback != null)
+ {
+ removeCallback.RemoveCallback();
+ removeCallback = null;
+ }
+ }
+ super.onDestroyView();
+ }
+
+ public void RefreshBookList()
+ {
+ bookRecordArr = BookManager.getInstance().getBooks();
+
+ listAdapter.notifyDataSetChanged();
+ }
+
+ @Override
+ public void OnFinished()
+ {
+ synchronized (removeCallbackSynchronizer)
+ {
+ removeCallback = null;
+ }
+
+ }
+
+ @Override
+ public void OnUpdated(Bundle result)
+ {
+ getActivity().runOnUiThread(new Runnable() {
+
+ @Override
+ public void run()
+ {
+ RefreshBookList();
+ }
+
+ });
+ }
+
+ public class ListAdapter extends BaseAdapter {
+ private Context mContext;
+
+ public ListAdapter(Context c) {
+ mContext = c;
+ }
+
+ public int getCount() {
+ return bookRecordArr.size();
+ }
+
+ public Object getItem(int position) {
+ return null;
+ }
+
+ public long getItemId(int position) {
+ return 0;
+ }
+
+ // create a new ImageView for each item referenced by the Adapter
+ @SuppressLint("InflateParams")
+ public View getView(int position, View convertView, ViewGroup parent) {
+
+
+ View view;
+ if (convertView == null) { // if it's not recycled, initialize some attributes
+ LayoutInflater inflater = (LayoutInflater) mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
+ view = inflater.inflate(R.layout.books_page_list_element, null);
+
+
+ } else {
+ view = convertView;
+ }
+
+ ImageView imageView = (ImageView)view.findViewById(R.id.imageView);
+ TextView nameTextView = (TextView) view.findViewById(R.id.nameTextView);
+ TextView authorTextView = (TextView) view.findViewById(R.id.authorTextView);
+
+ if (bookRecordArr.get(position).imageUrl.length() == 0)
+ {
+ imageView.setImageResource(R.drawable.no_picture);
+ }
+ else
+ {
+ ImageManager.getInstance().ApplyImageToImageView(imageView, bookRecordArr.get(position).imageUrl);
+ }
+
+ nameTextView.setText(bookRecordArr.get(position).name);
+
+ authorTextView.setText(bookRecordArr.get(position).author);
+
+ return view;
+ }
+
+ }
+}
diff --git a/android/src/fishrungames/bashgid/MainActivity.java b/android/src/fishrungames/bashgid/MainActivity.java
index 3297fe1..9fadeac 100644
--- a/android/src/fishrungames/bashgid/MainActivity.java
+++ b/android/src/fishrungames/bashgid/MainActivity.java
@@ -4,8 +4,10 @@ package fishrungames.bashgid;
import java.util.Locale;
import fishrungames.bashgid.core.AlbumManager;
+import fishrungames.bashgid.core.BookManager.BookRecord;
import fishrungames.bashgid.core.HtmlDownloadManager.TextFileRecord;
import fishrungames.bashgid.core.NewsManager.NewsRecord;
+import fishrungames.bashgid.core.VideoManager.VideoRecord;
import fishrungames.bashgid.core.db.NewsDataSource;
import fishrungames.networkutils.ContextHolder;
import fishrungames.networkutils.ImageManager;
@@ -28,6 +30,11 @@ public class MainActivity extends ActionBarActivity implements NavigationDrawerF
public static final String TAG_FROM_MAINFRAGMENT_TO_NEWSRECORDFRAGMENT = "TAG_FROM_MAINFRAGMENT_TO_NEWSRECORDFRAGMENT";
public static final String TAG_FROM_NEWSLISTFRAGMENT_TO_NEWSRECORDFRAGMENT = "TAG_FROM_NEWSLISTFRAGMENT_TO_NEWSRECORDFRAGMENT";
public static final String TAG_FROM_SEARCHFRAGMENT_TO_NEWSRECORDFRAGMENT = "TAG_FROM_SEARCHFRAGMENT_TO_NEWSRECORDFRAGMENT";
+ public static final String TAG_FROM_BOOKSFRAGMENT_TO_BOOKRECORDFRAGMENT = "TAG_FROM_BOOKSFRAGMENT_TO_BOOKRECORDFRAGMENT";
+ public static final String TAG_FROM_VIDEOLISTFRAGMENT_TO_VIDEORECORDFRAGMENT = "TAG_FROM_VIDEOLISTFRAGMENT_TO_VIDEORECORDFRAGMENT";
+
+
+
public static final String TAG_TO_WELCOMEFRAGMENT = "WelcomeFragment";
public static final String TAG_TO_SEARCHFRAGMENT = "SearchFragment";
public static final String TAG_TO_MAINFRAGMENT = "MainFragment";
@@ -217,6 +224,57 @@ public class MainActivity extends ActionBarActivity implements NavigationDrawerF
mNavigationDrawerFragment.EnableDrawer();
}
+
+ public void OpenBooksScreen()
+ {
+ getSupportFragmentManager().beginTransaction().replace(R.id.fragment_container, new BooksFragment(), TAG_TO_MAINFRAGMENT).commit();
+
+ mNavigationDrawerFragment.EnableDrawer();
+
+ }
+
+
+ public void OpenBookRecordScreen(BookRecord bookRecord, String tag)
+ {
+ // Xperimental -- addToBackStack provoke error "Class not found". Need
+ // to resolve somehow!
+ // getSupportFragmentManager().beginTransaction().replace(R.id.fragment_container,
+ // new NewsRecordFragment(newsRecord)).addToBackStack(null).commit();
+
+ // I added workaround:
+
+ BookRecordFragment bookRecordFragment = new BookRecordFragment(bookRecord);
+
+ getSupportFragmentManager().beginTransaction().replace(R.id.fragment_container, bookRecordFragment, tag).commit();
+
+ mNavigationDrawerFragment.EnableDrawer();
+ }
+
+ //TAG_FROM_VIDEOLISTFRAGMENT_TO_VIDEORECORDFRAGMENT
+
+ public void OpenVideoListScreen()
+ {
+ getSupportFragmentManager().beginTransaction().replace(R.id.fragment_container, new VideoListFragment(), TAG_TO_MAINFRAGMENT).commit();
+
+ mNavigationDrawerFragment.EnableDrawer();
+
+ }
+
+ public void OpenVideoRecordScreen(VideoRecord videoRecord, String tag)
+ {
+ // Xperimental -- addToBackStack provoke error "Class not found". Need
+ // to resolve somehow!
+ // getSupportFragmentManager().beginTransaction().replace(R.id.fragment_container,
+ // new NewsRecordFragment(newsRecord)).addToBackStack(null).commit();
+
+ // I added workaround:
+
+ VideoRecordFragment videoRecordFragment = new VideoRecordFragment(videoRecord);
+
+ getSupportFragmentManager().beginTransaction().replace(R.id.fragment_container, videoRecordFragment, tag).commit();
+
+ mNavigationDrawerFragment.EnableDrawer();
+ }
@Override
public void onAttachFragment(Fragment fragment)
@@ -283,16 +341,23 @@ public class MainActivity extends ActionBarActivity implements NavigationDrawerF
{
OpenNewsScreen();
}
+ else if (position == 4)
+ {
+ OpenMapScreen();
+ }
+ else if (position == 5)
+ {
+ OpenVideoListScreen();
+ }
else if (position == 6)
{
OpenPhotoAlbumListScreen();
}
- else if (position == 4)
+ else if (position == 7)
{
- OpenMapScreen();
- //OpenStreetViewScreen();
+ OpenBooksScreen();
}
- else if (position == 8)
+ else if (position == 9)
{
OpenSettingsScreen();
}
@@ -316,6 +381,22 @@ public class MainActivity extends ActionBarActivity implements NavigationDrawerF
return;
}
+ if (getSupportFragmentManager().findFragmentByTag(TAG_FROM_BOOKSFRAGMENT_TO_BOOKRECORDFRAGMENT) != null)
+ {
+ OpenBooksScreen();
+
+ return;
+ }
+
+ if (getSupportFragmentManager().findFragmentByTag(TAG_FROM_VIDEOLISTFRAGMENT_TO_VIDEORECORDFRAGMENT) != null)
+ {
+ OpenVideoListScreen();
+
+ return;
+ }
+
+
+
if (getSupportFragmentManager().findFragmentByTag(TAG_FROM_SEARCHFRAGMENT_TO_NEWSRECORDFRAGMENT) != null)
{
OpenSearchScreen(true);
@@ -344,9 +425,9 @@ public class MainActivity extends ActionBarActivity implements NavigationDrawerF
return;
}
-
-
+
+
super.onBackPressed();
/*
diff --git a/android/src/fishrungames/bashgid/NavigationDrawerFragment.java b/android/src/fishrungames/bashgid/NavigationDrawerFragment.java
index c92ab09..832971e 100644
--- a/android/src/fishrungames/bashgid/NavigationDrawerFragment.java
+++ b/android/src/fishrungames/bashgid/NavigationDrawerFragment.java
@@ -324,6 +324,7 @@ public class NavigationDrawerFragment extends Fragment {
R.string.drawer_map,
R.string.drawer_video,
R.string.drawer_photo_gallery,
+ R.string.drawer_books,
R.string.drawer_for_investor,
R.string.drawer_settings
};
@@ -332,10 +333,11 @@ public class NavigationDrawerFragment extends Fragment {
R.drawable.drawer_bashgid_logo,
R.drawable.drawer_agenda,
R.drawable.drawer_news,
- R.drawable.drawer_book,
+ R.drawable.drawer_bookmark,
R.drawable.drawer_pushpin,
R.drawable.drawer_tv,
R.drawable.drawer_photography,
+ R.drawable.drawer_books,
R.drawable.drawer_id,
R.drawable.drawer_gear
};
diff --git a/android/src/fishrungames/bashgid/VideoListFragment.java b/android/src/fishrungames/bashgid/VideoListFragment.java
new file mode 100644
index 0000000..558705e
--- /dev/null
+++ b/android/src/fishrungames/bashgid/VideoListFragment.java
@@ -0,0 +1,165 @@
+package fishrungames.bashgid;
+
+
+import java.util.ArrayList;
+
+import fishrungames.bashgid.core.VideoManager;
+import fishrungames.bashgid.core.VideoManager.VideoRecord;
+import fishrungames.networkutils.ImageManager;
+import fishrungames.networkutils.UniversalActionWithCallback;
+import fishrungames.networkutils.interfaces.RemoveCallbackInterface;
+import fishrungames.networkutils.interfaces.UpdateAndFinishCallbackInterface;
+
+import android.annotation.SuppressLint;
+import android.content.Context;
+import android.os.Bundle;
+import android.support.v4.app.Fragment;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.ViewGroup;
+import android.widget.AdapterView;
+import android.widget.AdapterView.OnItemClickListener;
+import android.widget.BaseAdapter;
+import android.widget.GridView;
+import android.widget.ImageView;
+
+import android.widget.TextView;
+
+
+public class VideoListFragment extends Fragment implements UpdateAndFinishCallbackInterface
+{
+
+ ListAdapter listAdapter;
+
+ GridView gridView;
+
+ ArrayList videoRecordArr;
+
+ RemoveCallbackInterface removeCallback = null;
+ Object removeCallbackSynchronizer = new Object();
+
+
+
+ @Override
+ public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
+
+
+ videoRecordArr = VideoManager.getInstance().getVideoList();
+
+ removeCallback = UniversalActionWithCallback.PerformActionIfNotPerforming(VideoManager.getInstance(), null, this, "VideoManager");
+
+ View rootView = inflater.inflate(R.layout.fragment_video_page, container, false);
+
+ gridView = (GridView) rootView.findViewById(R.id.gridView);
+
+ listAdapter = new ListAdapter(getActivity());
+
+ gridView.setAdapter(listAdapter);
+
+ gridView.setOnItemClickListener(new OnItemClickListener()
+ {
+
+ @Override
+ public void onItemClick(AdapterView> parent, View view, int position, long id)
+ {
+ MainActivity.getInstance().OpenVideoRecordScreen(videoRecordArr.get(position), MainActivity.TAG_FROM_VIDEOLISTFRAGMENT_TO_VIDEORECORDFRAGMENT);
+ }
+
+ });
+
+ RefreshVideoList();
+
+ return rootView;
+ }
+
+ @Override
+ public void onDestroyView()
+ {
+ synchronized (removeCallbackSynchronizer)
+ {
+ if (removeCallback != null)
+ {
+ removeCallback.RemoveCallback();
+ removeCallback = null;
+ }
+ }
+ super.onDestroyView();
+ }
+
+ public void RefreshVideoList()
+ {
+ videoRecordArr = VideoManager.getInstance().getVideoList();
+
+ listAdapter.notifyDataSetChanged();
+ }
+
+ @Override
+ public void OnFinished()
+ {
+ synchronized (removeCallbackSynchronizer)
+ {
+ removeCallback = null;
+ }
+
+ }
+
+ @Override
+ public void OnUpdated(Bundle result)
+ {
+ getActivity().runOnUiThread(new Runnable() {
+
+ @Override
+ public void run()
+ {
+ RefreshVideoList();
+ }
+
+ });
+ }
+
+ public class ListAdapter extends BaseAdapter {
+ private Context mContext;
+
+ public ListAdapter(Context c) {
+ mContext = c;
+ }
+
+ public int getCount() {
+ return videoRecordArr.size();
+ }
+
+ public Object getItem(int position) {
+ return null;
+ }
+
+ public long getItemId(int position) {
+ return 0;
+ }
+
+ // create a new ImageView for each item referenced by the Adapter
+ @SuppressLint("InflateParams")
+ public View getView(int position, View convertView, ViewGroup parent) {
+
+
+ View view;
+ if (convertView == null) { // if it's not recycled, initialize some attributes
+ LayoutInflater inflater = (LayoutInflater) mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
+ view = inflater.inflate(R.layout.video_page_list_element, null);
+
+
+ } else {
+ view = convertView;
+ }
+
+ ImageView imageView = (ImageView)view.findViewById(R.id.imageView);
+ TextView nameTextView = (TextView) view.findViewById(R.id.nameTextView);
+
+ ImageManager.getInstance().ApplyImageToImageView(imageView, videoRecordArr.get(position).imageUrl);
+
+ nameTextView.setText(videoRecordArr.get(position).name);
+
+ return view;
+ }
+
+ }
+}
diff --git a/android/src/fishrungames/bashgid/VideoRecordFragment.java b/android/src/fishrungames/bashgid/VideoRecordFragment.java
new file mode 100644
index 0000000..0464fba
--- /dev/null
+++ b/android/src/fishrungames/bashgid/VideoRecordFragment.java
@@ -0,0 +1,59 @@
+package fishrungames.bashgid;
+
+
+import fishrungames.networkutils.ImageManager;
+import fishrungames.bashgid.core.VideoManager.VideoRecord;
+import android.content.Intent;
+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.ViewGroup;
+import android.widget.ImageView;
+import android.widget.TextView;
+
+
+public class VideoRecordFragment extends Fragment
+{
+
+ VideoRecord videoRecord;
+
+ public VideoRecordFragment(VideoRecord videoRecord)
+ {
+ this.videoRecord = videoRecord;
+ }
+
+ @Override
+ public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
+ View rootView = inflater.inflate(R.layout.fragment_video_record_page, container, false);
+
+ TextView nameTextView = (TextView) rootView.findViewById(R.id.nameTextView);
+ nameTextView.setText(videoRecord.name);
+
+ TextView descriptionTextView = (TextView) rootView.findViewById(R.id.descriptionTextView);
+ descriptionTextView.setText(videoRecord.description);
+
+ ImageView imageView = (ImageView) rootView.findViewById(R.id.imageView);
+ ImageManager.getInstance().ApplyImageToImageView(imageView, videoRecord.imageUrl);
+
+ imageView.setOnClickListener(new OnClickListener()
+ {
+
+ @Override
+ public void onClick(View v)
+ {
+ if (videoRecord.videoType.equals("youtube"))
+ {
+ MainActivity.getInstance().startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(videoRecord.videoUrl)));
+ }
+ }
+
+ });
+
+ return rootView;
+ }
+
+
+}
diff --git a/android/src/fishrungames/bashgid/core/BookManager.java b/android/src/fishrungames/bashgid/core/BookManager.java
new file mode 100644
index 0000000..ef89fe7
--- /dev/null
+++ b/android/src/fishrungames/bashgid/core/BookManager.java
@@ -0,0 +1,92 @@
+package fishrungames.bashgid.core;
+
+import java.util.ArrayList;
+
+import android.os.Bundle;
+
+import fishrungames.networkutils.ImageManager;
+import fishrungames.networkutils.UpdateCallbackHolder;
+import fishrungames.networkutils.interfaces.NetworkActionInterface;
+
+
+public class BookManager implements NetworkActionInterface
+{
+
+ public static class BookRecord
+ {
+ public String name;
+ public String author;
+ public String imageUrl;
+ public Integer price;
+ public String description;
+
+ public BookRecord(String name, String author, String imageUrl, Integer price, String description)
+ {
+ this.name = name;
+ this.author = author;
+ this.imageUrl = imageUrl;
+ this.price = price;
+ this.description = description;
+ }
+ }
+
+ private ArrayList BookArr = new ArrayList();
+
+ public static BookManager instance = null;
+
+ public static BookManager getInstance()
+ {
+ if (instance == null)
+ {
+ instance = new BookManager();
+ }
+
+ return instance;
+ }
+
+ public BookManager()
+ {
+ initBooks();
+ }
+
+
+ public ArrayList getBooks()
+ {
+ ArrayList books = new ArrayList();
+
+ synchronized(BookArr)
+ {
+ books.addAll(BookArr);
+ }
+
+ return books;
+ }
+
+ private void initBooks()
+ {
+ BookArr.add(new BookRecord("Репка", "", "http://www.kitap-ufa.ru/upload/iblock/079/575.jpg", 40, "Русская народная сказка..."));
+ BookArr.add(new BookRecord("Уроки поэзии", "Рахматуллин С.И.", "http://www.kitap-ufa.ru/upload/iblock/6e7/012.jpg", 85, "В книгу вошли стихотворные произведения..."));
+ BookArr.add(new BookRecord("Новые валенки", "Калимуллина Г.К.", "http://www.kitap-ufa.ru/upload/iblock/edd/010.jpg", 75, "Детство - самая прекрасная, веселая и интересная пора в жизни человека..."));
+ BookArr.add(new BookRecord("В стране Урала", "Рафиков Б.З.", "", 90, "Эта книга настоящего мастера пера не оставит..."));
+ }
+
+ @Override
+ public void InThreadAction(Bundle query, UpdateCallbackHolder callbackHolder)
+ {
+
+ ArrayList imageToDownloadList = new ArrayList();
+
+ for (int i = 0; i < BookArr.size(); i++)
+ {
+ imageToDownloadList.add(BookArr.get(i).imageUrl);
+ }
+
+ Bundle innerQuery = new Bundle();
+
+ innerQuery.putStringArray("imageUrlArr", imageToDownloadList.toArray(new String[imageToDownloadList.size()]));
+
+ ImageManager.getInstance().InThreadAction(innerQuery, callbackHolder);
+
+ callbackHolder.OnUpdated(null);
+ }
+}
diff --git a/android/src/fishrungames/bashgid/core/VideoManager.java b/android/src/fishrungames/bashgid/core/VideoManager.java
new file mode 100644
index 0000000..ae27936
--- /dev/null
+++ b/android/src/fishrungames/bashgid/core/VideoManager.java
@@ -0,0 +1,95 @@
+package fishrungames.bashgid.core;
+
+import java.util.ArrayList;
+
+import android.os.Bundle;
+
+import fishrungames.networkutils.ImageManager;
+import fishrungames.networkutils.UpdateCallbackHolder;
+import fishrungames.networkutils.interfaces.NetworkActionInterface;
+
+
+public class VideoManager implements NetworkActionInterface
+{
+
+ public static class VideoRecord
+ {
+ public String name;
+ public String videoUrl;
+ public String imageUrl;
+ public String videoType;
+ public String description;
+
+ public VideoRecord(String name, String videoUrl, String imageUrl, String videoType, String description)
+ {
+ this.name = name;
+ this.videoUrl = videoUrl;
+ this.imageUrl = imageUrl;
+ this.videoType = videoType;
+ this.description = description;
+ }
+ }
+
+ private ArrayList VideoArr = new ArrayList();
+
+ public static VideoManager instance = null;
+
+ public static VideoManager getInstance()
+ {
+ if (instance == null)
+ {
+ instance = new VideoManager();
+ }
+
+ return instance;
+ }
+
+ public VideoManager()
+ {
+ initVideos();
+ }
+
+
+ public ArrayList getVideoList()
+ {
+ ArrayList videos = new ArrayList();
+
+ synchronized(VideoArr)
+ {
+ videos.addAll(VideoArr);
+ }
+
+ return videos;
+ }
+
+ private void initVideos()
+ {
+ VideoArr.add(new VideoRecord("Rickroll", "http://www.youtube.com/watch?v=dQw4w9WgXcQ", "http://img.youtube.com/vi/dQw4w9WgXcQ/0.jpg", "youtube", "Rickroll"));
+ /*
+ BookArr.add(new BookRecord("Репка", "", "http://www.kitap-ufa.ru/upload/iblock/079/575.jpg", 40, "Русская народная сказка..."));
+ BookArr.add(new BookRecord("Уроки поэзии", "Рахматуллин С.И.", "http://www.kitap-ufa.ru/upload/iblock/6e7/012.jpg", 85, "В книгу вошли стихотворные произведения..."));
+ BookArr.add(new BookRecord("Новые валенки", "Калимуллина Г.К.", "http://www.kitap-ufa.ru/upload/iblock/edd/010.jpg", 75, "Детство - самая прекрасная, веселая и интересная пора в жизни человека..."));
+ BookArr.add(new BookRecord("В стране Урала", "Рафиков Б.З.", "", 90, "Эта книга настоящего мастера пера не оставит..."));
+ */
+ }
+
+ @Override
+ public void InThreadAction(Bundle query, UpdateCallbackHolder callbackHolder)
+ {
+
+ ArrayList imageToDownloadList = new ArrayList();
+
+ for (int i = 0; i < VideoArr.size(); i++)
+ {
+ imageToDownloadList.add(VideoArr.get(i).imageUrl);
+ }
+
+ Bundle innerQuery = new Bundle();
+
+ innerQuery.putStringArray("imageUrlArr", imageToDownloadList.toArray(new String[imageToDownloadList.size()]));
+
+ ImageManager.getInstance().InThreadAction(innerQuery, callbackHolder);
+
+ callbackHolder.OnUpdated(null);
+ }
+}