new system
This commit is contained in:
parent
e882bf6e05
commit
5fd5dd703b
@ -1,6 +1,8 @@
|
|||||||
package fishrungames.bashgid;
|
package fishrungames.bashgid;
|
||||||
|
|
||||||
|
import java.text.ParseException;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Date;
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
|
|
||||||
import fishrungames.bashgid.core.AlbumManager;
|
import fishrungames.bashgid.core.AlbumManager;
|
||||||
@ -11,6 +13,8 @@ import fishrungames.bashgid.core.ArticleManager;
|
|||||||
import fishrungames.bashgid.core.ArticleManager.ArticleRecordData;
|
import fishrungames.bashgid.core.ArticleManager.ArticleRecordData;
|
||||||
import fishrungames.bashgid.core.BookManager.BookRecord;
|
import fishrungames.bashgid.core.BookManager.BookRecord;
|
||||||
|
|
||||||
|
import fishrungames.bashgid.core.ArticleManager.ArticleFullData;
|
||||||
|
import fishrungames.bashgid.core.ArticleManager.ArticleShortData;
|
||||||
import fishrungames.bashgid.core.HtmlDownloadManager.TextFileRecord;
|
import fishrungames.bashgid.core.HtmlDownloadManager.TextFileRecord;
|
||||||
import fishrungames.bashgid.core.NewsDownloadTask;
|
import fishrungames.bashgid.core.NewsDownloadTask;
|
||||||
import fishrungames.bashgid.core.NewsManager.NewsRecord;
|
import fishrungames.bashgid.core.NewsManager.NewsRecord;
|
||||||
@ -37,6 +41,7 @@ import android.os.Handler;
|
|||||||
import android.os.Looper;
|
import android.os.Looper;
|
||||||
import android.os.Message;
|
import android.os.Message;
|
||||||
|
|
||||||
|
import android.util.Log;
|
||||||
import android.view.Menu;
|
import android.view.Menu;
|
||||||
import android.view.MenuInflater;
|
import android.view.MenuInflater;
|
||||||
import android.view.MenuItem;
|
import android.view.MenuItem;
|
||||||
@ -124,11 +129,11 @@ public class MainActivity extends ActionBarActivity implements NavigationDrawerF
|
|||||||
{
|
{
|
||||||
case ImageDownloadTask.IMAGE_DOWNLOADER_STATE_UPDATE:
|
case ImageDownloadTask.IMAGE_DOWNLOADER_STATE_UPDATE:
|
||||||
case ImageDownloadTask.IMAGE_DOWNLOADER_STATE_FINISHED:
|
case ImageDownloadTask.IMAGE_DOWNLOADER_STATE_FINISHED:
|
||||||
//UpdateOnImageDownloaded();
|
UpdateOnImageDownloaded();
|
||||||
break;
|
break;
|
||||||
case NEWS_DOWNLOADER_STATE_UPDATE:
|
case NEWS_DOWNLOADER_STATE_UPDATE:
|
||||||
case NEWS_DOWNLOADER_STATE_FINISHED:
|
case NEWS_DOWNLOADER_STATE_FINISHED:
|
||||||
//UpdateOnNewsDownloaded();
|
UpdateOnNewsDownloaded();
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
super.handleMessage(inputMessage);
|
super.handleMessage(inputMessage);
|
||||||
@ -160,14 +165,27 @@ public class MainActivity extends ActionBarActivity implements NavigationDrawerF
|
|||||||
*/
|
*/
|
||||||
albumDataSource.CreateNewAlbum(new AlbumRecordData("TEST", "Vk Photos", "Wow"));
|
albumDataSource.CreateNewAlbum(new AlbumRecordData("TEST", "Vk Photos", "Wow"));
|
||||||
|
|
||||||
|
|
||||||
|
Date articleTestDate = new Date();
|
||||||
|
Date articleTestDate2 = new Date();
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
articleTestDate = ArticleManager.iso8601Format.parse("2015-05-30 9:00:00");
|
||||||
|
articleTestDate2 = ArticleManager.iso8601Format.parse("2015-05-30 9:30:00");
|
||||||
|
} catch (ParseException e)
|
||||||
|
{
|
||||||
|
// TODO Auto-generated catch block
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
|
||||||
AlbumManager.DownloadAndAddPhotoToAlbum(new PhotoRecordData(
|
AlbumManager.DownloadAndAddPhotoToAlbum(new PhotoRecordData(
|
||||||
"Lilia",
|
"Lilia",
|
||||||
"Lilia photo",
|
"Lilia photo",
|
||||||
"http://pp.vk.me/c622725/v622725384/3290f/hfnoyPHe5y8.jpg",
|
"http://pp.vk.me/c622725/v622725384/3290f/hfnoyPHe5y8.jpg",
|
||||||
"",
|
"",
|
||||||
0,
|
0,
|
||||||
0
|
0), "TEST");
|
||||||
), "TEST");
|
|
||||||
|
|
||||||
AlbumManager.DownloadAndAddPhotoToAlbum(new PhotoRecordData(
|
AlbumManager.DownloadAndAddPhotoToAlbum(new PhotoRecordData(
|
||||||
"Vlad",
|
"Vlad",
|
||||||
@ -178,6 +196,13 @@ public class MainActivity extends ActionBarActivity implements NavigationDrawerF
|
|||||||
0
|
0
|
||||||
), "TEST");
|
), "TEST");
|
||||||
|
|
||||||
|
PhotoRecordData photo = photoDataSource.GetPhotoByImageUrl("http://pp.vk.me/c623226/v623226718/2af84/NeEYYIlnR-I.jpg");
|
||||||
|
|
||||||
|
if (photo != null)
|
||||||
|
{
|
||||||
|
Log.e("aaa", "xxx");
|
||||||
|
}
|
||||||
|
|
||||||
articleDataSource.CreateNewArticle(new ArticleRecordData(
|
articleDataSource.CreateNewArticle(new ArticleRecordData(
|
||||||
"TESTART",
|
"TESTART",
|
||||||
0,
|
0,
|
||||||
@ -185,9 +210,13 @@ public class MainActivity extends ActionBarActivity implements NavigationDrawerF
|
|||||||
"Wow 2 photos",
|
"Wow 2 photos",
|
||||||
0,
|
0,
|
||||||
0,
|
0,
|
||||||
""));
|
"",
|
||||||
|
articleTestDate
|
||||||
|
));
|
||||||
|
|
||||||
articleDataSource.AddAlbumToArticle("TEST", "TESTART");
|
//articleDataSource.AddAlbumToArticle("TEST", "TESTART");
|
||||||
|
|
||||||
|
AlbumManager.AddExistingArticleToJournal("TESTART", "news");
|
||||||
|
|
||||||
|
|
||||||
AlbumManager.AddNewVideoToChannel(new VideoRecordData(
|
AlbumManager.AddNewVideoToChannel(new VideoRecordData(
|
||||||
@ -196,8 +225,7 @@ public class MainActivity extends ActionBarActivity implements NavigationDrawerF
|
|||||||
"Rickroll",
|
"Rickroll",
|
||||||
"Mega Rickroll",
|
"Mega Rickroll",
|
||||||
"http://img.youtube.com/vi/dQw4w9WgXcQ/0.jpg",
|
"http://img.youtube.com/vi/dQw4w9WgXcQ/0.jpg",
|
||||||
""
|
""), "main");
|
||||||
), "main");
|
|
||||||
|
|
||||||
AlbumManager.AddNewArticleToJournal(new ArticleRecordData(
|
AlbumManager.AddNewArticleToJournal(new ArticleRecordData(
|
||||||
"testArticle2",
|
"testArticle2",
|
||||||
@ -206,11 +234,19 @@ public class MainActivity extends ActionBarActivity implements NavigationDrawerF
|
|||||||
"Wow content lol",
|
"Wow content lol",
|
||||||
0,
|
0,
|
||||||
0,
|
0,
|
||||||
"http://fishrungames.ru"
|
"http://fishrungames.ru",
|
||||||
), "main");
|
articleTestDate2
|
||||||
|
), "news");
|
||||||
|
|
||||||
articleDataSource.AddAlbumToArticle("TEST", "testArticle2");
|
//articleDataSource.AddAlbumToArticle("TEST", "testArticle2");
|
||||||
articleDataSource.AddChannelToArticle("main", "testArticle2");
|
//articleDataSource.AddChannelToArticle("main", "testArticle2");
|
||||||
|
|
||||||
|
ArrayList<ArticleShortData> fullData = journalDataSource.GetRecentArticles("news", 2);
|
||||||
|
|
||||||
|
for (ArticleShortData d : fullData)
|
||||||
|
{
|
||||||
|
Log.e("sss", d.title);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -371,7 +407,7 @@ public class MainActivity extends ActionBarActivity implements NavigationDrawerF
|
|||||||
|
|
||||||
mNavigationDrawerFragment.EnableDrawer();
|
mNavigationDrawerFragment.EnableDrawer();
|
||||||
|
|
||||||
//StartDownloadNewsTask();
|
StartDownloadNewsTask();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void OpenNewsScreen()
|
public void OpenNewsScreen()
|
||||||
@ -463,7 +499,7 @@ public class MainActivity extends ActionBarActivity implements NavigationDrawerF
|
|||||||
mNavigationDrawerFragment.EnableDrawer();
|
mNavigationDrawerFragment.EnableDrawer();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void OpenNewsRecordScreen(NewsRecord newsRecord, String tag)
|
public void OpenNewsRecordScreen(String articleName, String tag)
|
||||||
{
|
{
|
||||||
// Xperimental -- addToBackStack provoke error "Class not found". Need
|
// Xperimental -- addToBackStack provoke error "Class not found". Need
|
||||||
// to resolve somehow!
|
// to resolve somehow!
|
||||||
@ -474,7 +510,7 @@ public class MainActivity extends ActionBarActivity implements NavigationDrawerF
|
|||||||
|
|
||||||
ClearAllFragmentLinks();
|
ClearAllFragmentLinks();
|
||||||
|
|
||||||
NewsRecordFragment newsRecordFragment = new NewsRecordFragment(newsRecord);
|
NewsRecordFragment newsRecordFragment = new NewsRecordFragment(articleName);
|
||||||
|
|
||||||
getSupportFragmentManager().beginTransaction().replace(R.id.fragment_container, newsRecordFragment, tag).commit();
|
getSupportFragmentManager().beginTransaction().replace(R.id.fragment_container, newsRecordFragment, tag).commit();
|
||||||
|
|
||||||
|
@ -5,6 +5,8 @@ import java.util.ArrayList;
|
|||||||
import fishrungames.networkutils.ImageManager;
|
import fishrungames.networkutils.ImageManager;
|
||||||
|
|
||||||
|
|
||||||
|
import fishrungames.bashgid.core.ArticleManager.ArticleRecordData;
|
||||||
|
import fishrungames.bashgid.core.ArticleManager.ArticleShortData;
|
||||||
import fishrungames.bashgid.core.NewsManager;
|
import fishrungames.bashgid.core.NewsManager;
|
||||||
import fishrungames.bashgid.core.NewsManager.NewsRecord;
|
import fishrungames.bashgid.core.NewsManager.NewsRecord;
|
||||||
|
|
||||||
@ -83,15 +85,16 @@ public class MainPageFragment extends Fragment {
|
|||||||
Button news3Button = (Button)header.findViewById(R.id.news3Button);
|
Button news3Button = (Button)header.findViewById(R.id.news3Button);
|
||||||
|
|
||||||
|
|
||||||
ArrayList<NewsManager.NewsRecord> newsRecordArr = NewsManager.getInstance().getNews();
|
ArrayList<ArticleShortData> newsRecordArr = MainActivity.getInstance().journalDataSource.GetRecentArticles("news", 3);
|
||||||
|
|
||||||
|
|
||||||
if (newsRecordArr.size() > 0)
|
if (newsRecordArr.size() > 0)
|
||||||
{
|
{
|
||||||
ImageManager.getInstance().ApplyImageToImageView(news1ImageButton, newsRecordArr.get(0).imageId);
|
ImageManager.getInstance().ApplyImageToImageView(news1ImageButton, newsRecordArr.get(0).previewImageUrl);
|
||||||
news1Button.setText(newsRecordArr.get(0).title);
|
news1Button.setText(newsRecordArr.get(0).title);
|
||||||
|
|
||||||
news1ImageButton.setOnClickListener(new NewsButtonOnClickListener(newsRecordArr.get(0)));
|
news1ImageButton.setOnClickListener(new NewsButtonOnClickListener(newsRecordArr.get(0).name));
|
||||||
news1Button.setOnClickListener(new NewsButtonOnClickListener(newsRecordArr.get(0)));
|
news1Button.setOnClickListener(new NewsButtonOnClickListener(newsRecordArr.get(0).name));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -103,10 +106,10 @@ public class MainPageFragment extends Fragment {
|
|||||||
|
|
||||||
if (newsRecordArr.size() > 1)
|
if (newsRecordArr.size() > 1)
|
||||||
{
|
{
|
||||||
ImageManager.getInstance().ApplyImageToImageView(news2ImageButton, newsRecordArr.get(1).imageId);
|
ImageManager.getInstance().ApplyImageToImageView(news2ImageButton, newsRecordArr.get(1).previewImageUrl);
|
||||||
news2Button.setText(newsRecordArr.get(1).title);
|
news2Button.setText(newsRecordArr.get(1).title);
|
||||||
news2ImageButton.setOnClickListener(new NewsButtonOnClickListener(newsRecordArr.get(1)));
|
news2ImageButton.setOnClickListener(new NewsButtonOnClickListener(newsRecordArr.get(1).name));
|
||||||
news2Button.setOnClickListener(new NewsButtonOnClickListener(newsRecordArr.get(1)));
|
news2Button.setOnClickListener(new NewsButtonOnClickListener(newsRecordArr.get(1).name));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -118,10 +121,10 @@ public class MainPageFragment extends Fragment {
|
|||||||
|
|
||||||
if (newsRecordArr.size() > 2)
|
if (newsRecordArr.size() > 2)
|
||||||
{
|
{
|
||||||
ImageManager.getInstance().ApplyImageToImageView(news3ImageButton, newsRecordArr.get(2).imageId);
|
ImageManager.getInstance().ApplyImageToImageView(news3ImageButton, newsRecordArr.get(2).previewImageUrl);
|
||||||
news3Button.setText(newsRecordArr.get(2).title);
|
news3Button.setText(newsRecordArr.get(2).title);
|
||||||
news3ImageButton.setOnClickListener(new NewsButtonOnClickListener(newsRecordArr.get(2)));
|
news3ImageButton.setOnClickListener(new NewsButtonOnClickListener(newsRecordArr.get(2).name));
|
||||||
news3Button.setOnClickListener(new NewsButtonOnClickListener(newsRecordArr.get(2)));
|
news3Button.setOnClickListener(new NewsButtonOnClickListener(newsRecordArr.get(2).name));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -193,17 +196,17 @@ public class MainPageFragment extends Fragment {
|
|||||||
public static class NewsButtonOnClickListener implements OnClickListener
|
public static class NewsButtonOnClickListener implements OnClickListener
|
||||||
{
|
{
|
||||||
|
|
||||||
NewsRecord newsRecord;
|
String articleName;
|
||||||
|
|
||||||
public NewsButtonOnClickListener(NewsRecord newsRecord)
|
public NewsButtonOnClickListener(String articleName)
|
||||||
{
|
{
|
||||||
this.newsRecord = newsRecord;
|
this.articleName = articleName;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View v)
|
public void onClick(View v)
|
||||||
{
|
{
|
||||||
MainActivity.getInstance().OpenNewsRecordScreen(newsRecord, MainActivity.TAG_FROM_MAINFRAGMENT_TO_NEWSRECORDFRAGMENT);
|
MainActivity.getInstance().OpenNewsRecordScreen(articleName, MainActivity.TAG_FROM_MAINFRAGMENT_TO_NEWSRECORDFRAGMENT);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -126,7 +126,7 @@ public class NewsListFragment extends Fragment
|
|||||||
@Override
|
@Override
|
||||||
public void onClick(View v)
|
public void onClick(View v)
|
||||||
{
|
{
|
||||||
MainActivity.getInstance().OpenNewsRecordScreen(newsRecord, MainActivity.TAG_FROM_NEWSLISTFRAGMENT_TO_NEWSRECORDFRAGMENT);
|
//MainActivity.getInstance().OpenNewsRecordScreen(newsRecord, MainActivity.TAG_FROM_NEWSLISTFRAGMENT_TO_NEWSRECORDFRAGMENT);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -2,7 +2,7 @@ package fishrungames.bashgid;
|
|||||||
|
|
||||||
|
|
||||||
import fishrungames.networkutils.ImageManager;
|
import fishrungames.networkutils.ImageManager;
|
||||||
import fishrungames.bashgid.core.NewsManager.NewsRecord;
|
import fishrungames.bashgid.core.ArticleManager.ArticleFullData;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.support.v4.app.Fragment;
|
import android.support.v4.app.Fragment;
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
@ -16,34 +16,60 @@ import android.widget.TextView;
|
|||||||
public class NewsRecordFragment extends Fragment
|
public class NewsRecordFragment extends Fragment
|
||||||
{
|
{
|
||||||
|
|
||||||
NewsRecord newsRecord;
|
String articleName;
|
||||||
|
|
||||||
public NewsRecordFragment(NewsRecord newsRecord)
|
ArticleFullData articleData;
|
||||||
|
|
||||||
|
public NewsRecordFragment()
|
||||||
{
|
{
|
||||||
this.newsRecord = newsRecord;
|
this.articleName = "";
|
||||||
|
this.articleData = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public NewsRecordFragment(String articleName)
|
||||||
|
{
|
||||||
|
this.articleName = articleName;
|
||||||
|
RestoreArticle();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onSaveInstanceState(final Bundle outState) {
|
||||||
|
super.onSaveInstanceState(outState);
|
||||||
|
outState.putString("articleName", articleName);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
|
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
|
||||||
|
|
||||||
|
if (savedInstanceState != null) {
|
||||||
|
articleName = savedInstanceState.getString("articleName");
|
||||||
|
RestoreArticle();
|
||||||
|
}
|
||||||
|
|
||||||
View rootView = inflater.inflate(R.layout.fragment_news_record_page, container, false);
|
View rootView = inflater.inflate(R.layout.fragment_news_record_page, container, false);
|
||||||
|
|
||||||
TextView titleTextView = (TextView) rootView.findViewById(R.id.titleTextView);
|
TextView titleTextView = (TextView) rootView.findViewById(R.id.titleTextView);
|
||||||
titleTextView.setText(newsRecord.title);
|
titleTextView.setText(articleData.title);
|
||||||
|
|
||||||
ImageView imageView = (ImageView) rootView.findViewById(R.id.imageView);
|
|
||||||
ImageManager.getInstance().ApplyImageToImageView(imageView, newsRecord.imageId);
|
|
||||||
|
|
||||||
|
//ImageView imageView = (ImageView) rootView.findViewById(R.id.imageView);
|
||||||
|
//ImageManager.getInstance().ApplyImageToImageView(imageView, articleData.);
|
||||||
|
|
||||||
WebView webView = (WebView) rootView.findViewById(R.id.webView);
|
WebView webView = (WebView) rootView.findViewById(R.id.webView);
|
||||||
|
|
||||||
webView.getSettings().setJavaScriptEnabled(false);
|
webView.getSettings().setJavaScriptEnabled(false);
|
||||||
|
|
||||||
String htmlCode = "<html><body>" + newsRecord.description + "</body></html>";
|
String htmlCode = "<html><body>" + articleData.content + "</body></html>";
|
||||||
|
|
||||||
webView.loadDataWithBaseURL(null, htmlCode, "text/html", "UTF-8", null);
|
webView.loadDataWithBaseURL(null, htmlCode, "text/html", "UTF-8", null);
|
||||||
|
|
||||||
return rootView;
|
return rootView;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void RestoreArticle()
|
||||||
|
{
|
||||||
|
articleData = MainActivity.getInstance().articleDataSource.GetArticleFullData(articleName);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -223,7 +223,7 @@ public class SearchFragment extends Fragment implements UpdateAndFinishCallbackI
|
|||||||
@Override
|
@Override
|
||||||
public void onClick(View v)
|
public void onClick(View v)
|
||||||
{
|
{
|
||||||
MainActivity.getInstance().OpenNewsRecordScreen(newsRecord, MainActivity.TAG_FROM_SEARCHFRAGMENT_TO_NEWSRECORDFRAGMENT);
|
//MainActivity.getInstance().OpenNewsRecordScreen(newsRecord, MainActivity.TAG_FROM_SEARCHFRAGMENT_TO_NEWSRECORDFRAGMENT);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -36,8 +36,20 @@ public class VideoRecordFragment extends Fragment
|
|||||||
RestoreVideo();
|
RestoreVideo();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onSaveInstanceState(final Bundle outState) {
|
||||||
|
super.onSaveInstanceState(outState);
|
||||||
|
outState.putString("videoUrl", videoUrl);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
|
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);
|
View rootView = inflater.inflate(R.layout.fragment_video_record_page, container, false);
|
||||||
|
|
||||||
TextView nameTextView = (TextView) rootView.findViewById(R.id.nameTextView);
|
TextView nameTextView = (TextView) rootView.findViewById(R.id.nameTextView);
|
||||||
|
@ -1,6 +1,9 @@
|
|||||||
package fishrungames.bashgid.core;
|
package fishrungames.bashgid.core;
|
||||||
|
|
||||||
|
import java.text.SimpleDateFormat;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.Locale;
|
||||||
|
|
||||||
import fishrungames.bashgid.core.AlbumManager.AlbumFullData;
|
import fishrungames.bashgid.core.AlbumManager.AlbumFullData;
|
||||||
import fishrungames.bashgid.core.ChannelManager.ChannelFullData;
|
import fishrungames.bashgid.core.ChannelManager.ChannelFullData;
|
||||||
@ -8,7 +11,10 @@ import fishrungames.bashgid.core.ChannelManager.ChannelFullData;
|
|||||||
public class ArticleManager
|
public class ArticleManager
|
||||||
{
|
{
|
||||||
|
|
||||||
|
public static final SimpleDateFormat iso8601Format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss", Locale.US);
|
||||||
|
|
||||||
public static final int ARTICLE_TYPE_NORMAL = 0;
|
public static final int ARTICLE_TYPE_NORMAL = 0;
|
||||||
|
public static final int ARTICLE_TYPE_NEWS = 1;
|
||||||
|
|
||||||
public static class ArticleRecordData
|
public static class ArticleRecordData
|
||||||
{
|
{
|
||||||
@ -20,8 +26,9 @@ public class ArticleManager
|
|||||||
public double geoLat;
|
public double geoLat;
|
||||||
public double geoLon;
|
public double geoLon;
|
||||||
public String externalLink;
|
public String externalLink;
|
||||||
|
public Date dateTime;
|
||||||
|
|
||||||
public ArticleRecordData(String name, int type, String title, String content, double geoLat, double geoLon, String externalLink)
|
public ArticleRecordData(String name, int type, String title, String content, double geoLat, double geoLon, String externalLink, Date dateTime)
|
||||||
{
|
{
|
||||||
this.name = name;
|
this.name = name;
|
||||||
this.type = type;
|
this.type = type;
|
||||||
@ -30,6 +37,7 @@ public class ArticleManager
|
|||||||
this.geoLat = geoLat;
|
this.geoLat = geoLat;
|
||||||
this.geoLon = geoLon;
|
this.geoLon = geoLon;
|
||||||
this.externalLink = externalLink;
|
this.externalLink = externalLink;
|
||||||
|
this.dateTime = dateTime;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ArticleRecordData(ArticleRecordData copyFrom)
|
public ArticleRecordData(ArticleRecordData copyFrom)
|
||||||
@ -41,6 +49,7 @@ public class ArticleManager
|
|||||||
this.geoLat = copyFrom.geoLat;
|
this.geoLat = copyFrom.geoLat;
|
||||||
this.geoLon = copyFrom.geoLon;
|
this.geoLon = copyFrom.geoLon;
|
||||||
this.externalLink = copyFrom.externalLink;
|
this.externalLink = copyFrom.externalLink;
|
||||||
|
this.dateTime = copyFrom.dateTime;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -8,6 +8,7 @@ import android.os.Bundle;
|
|||||||
import android.os.Handler;
|
import android.os.Handler;
|
||||||
import android.os.Message;
|
import android.os.Message;
|
||||||
import fishrungames.bashgid.MainActivity;
|
import fishrungames.bashgid.MainActivity;
|
||||||
|
import fishrungames.bashgid.core.ArticleManager.ArticleRecordData;
|
||||||
import fishrungames.bashgid.core.NewsManager.NewsRecord;
|
import fishrungames.bashgid.core.NewsManager.NewsRecord;
|
||||||
import fishrungames.bashgid.core.NewsManager.NewsSortComparator;
|
import fishrungames.bashgid.core.NewsManager.NewsSortComparator;
|
||||||
import fishrungames.networkutils.ImageDownloadTask;
|
import fishrungames.networkutils.ImageDownloadTask;
|
||||||
@ -20,10 +21,9 @@ public class NewsDownloadTask extends AsyncTask<Bundle, Integer, Long>
|
|||||||
protected Long doInBackground(Bundle... queryArr)
|
protected Long doInBackground(Bundle... queryArr)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
/*
|
||||||
ArrayList<NewsRecord> localNewsRecordArr = MainActivity.getInstance().newsDataSource.getNews();
|
ArrayList<NewsRecord> localNewsRecordArr = MainActivity.getInstance().newsDataSource.getNews();
|
||||||
|
|
||||||
ArrayList<String> imageToDownloadList = new ArrayList<String>();
|
|
||||||
|
|
||||||
for (int i = 0; i < NewsManager.urlArr.length; i++)
|
for (int i = 0; i < NewsManager.urlArr.length; i++)
|
||||||
{
|
{
|
||||||
|
|
||||||
@ -35,6 +35,7 @@ public class NewsDownloadTask extends AsyncTask<Bundle, Integer, Long>
|
|||||||
|
|
||||||
NewsManager.getInstance().replaceNews(localNewsRecordArr);
|
NewsManager.getInstance().replaceNews(localNewsRecordArr);
|
||||||
|
|
||||||
|
|
||||||
Bundle innerQuery = new Bundle();
|
Bundle innerQuery = new Bundle();
|
||||||
|
|
||||||
innerQuery.putStringArray("imageUrlArr", imageToDownloadList.toArray(new String[imageToDownloadList.size()]));
|
innerQuery.putStringArray("imageUrlArr", imageToDownloadList.toArray(new String[imageToDownloadList.size()]));
|
||||||
@ -44,6 +45,12 @@ public class NewsDownloadTask extends AsyncTask<Bundle, Integer, Long>
|
|||||||
task.mHandler = this.mHandler;
|
task.mHandler = this.mHandler;
|
||||||
|
|
||||||
task.execute(innerQuery);
|
task.execute(innerQuery);
|
||||||
|
*/
|
||||||
|
|
||||||
|
for (int i = 0; i < NewsManager.urlArr.length; i++)
|
||||||
|
{
|
||||||
|
NewsManager.LoadNewsAndImagesFromRss2_new(NewsManager.urlArr[i]);
|
||||||
|
}
|
||||||
|
|
||||||
return (long) 0;
|
return (long) 0;
|
||||||
}
|
}
|
||||||
|
@ -14,6 +14,7 @@ import android.util.Log;
|
|||||||
|
|
||||||
|
|
||||||
import fishrungames.bashgid.MainActivity;
|
import fishrungames.bashgid.MainActivity;
|
||||||
|
import fishrungames.bashgid.core.ArticleManager.ArticleRecordData;
|
||||||
|
|
||||||
|
|
||||||
public class NewsManager {
|
public class NewsManager {
|
||||||
@ -322,6 +323,84 @@ public class NewsManager {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static void LoadNewsAndImagesFromRss2_new(String url)
|
||||||
|
{
|
||||||
|
//Xperimental -- need to optimize this code. slow block BEGINS
|
||||||
|
String xmlCode = DownloadFunctions.getXmlFromUrl(url);
|
||||||
|
|
||||||
|
if (xmlCode == null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
//Remove BOM character if present
|
||||||
|
if (xmlCode.startsWith("\uFEFF"))
|
||||||
|
{
|
||||||
|
xmlCode = xmlCode.substring(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
RssReader rssReader = new RssReader();
|
||||||
|
|
||||||
|
rssReader.ReadRss(xmlCode);
|
||||||
|
|
||||||
|
|
||||||
|
//Xperimental -- need to optimize this code. slow block ENDS
|
||||||
|
|
||||||
|
|
||||||
|
for (RssReader.Rss2Item rss2Item : rssReader.rss2ItemArr)
|
||||||
|
{
|
||||||
|
|
||||||
|
ArticleRecordData newsArticle = new ArticleRecordData(
|
||||||
|
rss2Item.title,
|
||||||
|
ArticleManager.ARTICLE_TYPE_NEWS,
|
||||||
|
rss2Item.title,
|
||||||
|
rss2Item.description,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
rss2Item.link,
|
||||||
|
rss2Item.pubDate
|
||||||
|
);
|
||||||
|
|
||||||
|
AlbumManager.AddNewArticleToJournal(newsArticle, "news");
|
||||||
|
//newsRecordArr.add(newsArticle);
|
||||||
|
|
||||||
|
}
|
||||||
|
/*imageUrlArr.addAll(ExtractEnclosureImageUrl(rssReader.rss2ItemArr));
|
||||||
|
|
||||||
|
|
||||||
|
ArrayList<String> relativeImageUrlList = ExtractDescriptionImageUrl(rssReader.rss2ItemArr);
|
||||||
|
|
||||||
|
ArrayList<String> absoluteImageUrlList = ConvertRelativeToAbsoluteImageUrlList(relativeImageUrlList, url);
|
||||||
|
|
||||||
|
imageUrlArr.addAll(absoluteImageUrlList);
|
||||||
|
|
||||||
|
//Xperimental -- this function is very slow, need to speed up
|
||||||
|
ReplaceRemoteUrlToLocalUrl(rssReader.rss2ItemArr, relativeImageUrlList, absoluteImageUrlList);
|
||||||
|
|
||||||
|
for (RssReader.Rss2Item rss2Item : rssReader.rss2ItemArr)
|
||||||
|
{
|
||||||
|
boolean exists = false;
|
||||||
|
|
||||||
|
for (NewsRecord newsRecord : newsRecordArr)
|
||||||
|
{
|
||||||
|
if (newsRecord.title.equals(rss2Item.title))
|
||||||
|
{
|
||||||
|
exists = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!exists)
|
||||||
|
{
|
||||||
|
newsRecordArr.add(new NewsRecord(rss2Item));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
public static class NewsSortComparator implements Comparator<NewsRecord> {
|
public static class NewsSortComparator implements Comparator<NewsRecord> {
|
||||||
public int compare(NewsRecord newsRecord1, NewsRecord newsRecord2) {
|
public int compare(NewsRecord newsRecord1, NewsRecord newsRecord2) {
|
||||||
return newsRecord2.pubDate.compareTo(newsRecord1.pubDate);
|
return newsRecord2.pubDate.compareTo(newsRecord1.pubDate);
|
||||||
|
@ -203,15 +203,6 @@ public class AlbumDataSource
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
/*
|
|
||||||
* 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);
|
|
||||||
*/
|
|
||||||
|
|
||||||
Cursor cursor = database.query(BashgidSqliteHelper.TABLE_ALBUM, new String[] { BashgidSqliteHelper.COLUMN_NAME,
|
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 }, null, null, null, null, null, null);
|
||||||
@ -238,6 +229,8 @@ public class AlbumDataSource
|
|||||||
} while (cursor.moveToNext());
|
} while (cursor.moveToNext());
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
cursor.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
} finally
|
} finally
|
||||||
@ -252,6 +245,8 @@ public class AlbumDataSource
|
|||||||
|
|
||||||
private boolean innerIsAlbumAlreadyExist(String name, SQLiteDatabase database)
|
private boolean innerIsAlbumAlreadyExist(String name, SQLiteDatabase database)
|
||||||
{
|
{
|
||||||
|
boolean result = false;
|
||||||
|
|
||||||
Cursor cursor = database.query(BashgidSqliteHelper.TABLE_ALBUM, new String[] { BashgidSqliteHelper.COLUMN_NAME }, BashgidSqliteHelper.COLUMN_NAME
|
Cursor cursor = database.query(BashgidSqliteHelper.TABLE_ALBUM, new String[] { BashgidSqliteHelper.COLUMN_NAME }, BashgidSqliteHelper.COLUMN_NAME
|
||||||
+ "=?", new String[] { name }, null, null, null, null);
|
+ "=?", new String[] { name }, null, null, null, null);
|
||||||
|
|
||||||
@ -259,16 +254,22 @@ public class AlbumDataSource
|
|||||||
{
|
{
|
||||||
if (cursor.getCount() > 0)
|
if (cursor.getCount() > 0)
|
||||||
{
|
{
|
||||||
return true;
|
result = true;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
cursor.close();
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean innerPhotoAlbumRelationAlreadyExist(String imageUrl, String name, SQLiteDatabase database)
|
private boolean innerPhotoAlbumRelationAlreadyExist(String imageUrl, String name, SQLiteDatabase database)
|
||||||
{
|
{
|
||||||
|
boolean result = false;
|
||||||
|
|
||||||
Cursor cursor = database.query(BashgidSqliteHelper.TABLE_PHOTO_ALBUM_RELATION, new String[] { BashgidSqliteHelper.COLUMN_IMAGE_URL,
|
Cursor cursor = database.query(BashgidSqliteHelper.TABLE_PHOTO_ALBUM_RELATION, new String[] { BashgidSqliteHelper.COLUMN_IMAGE_URL,
|
||||||
BashgidSqliteHelper.COLUMN_NAME }, BashgidSqliteHelper.COLUMN_IMAGE_URL + "=?" + " AND " + BashgidSqliteHelper.COLUMN_NAME + "=?",
|
BashgidSqliteHelper.COLUMN_NAME }, BashgidSqliteHelper.COLUMN_IMAGE_URL + "=?" + " AND " + BashgidSqliteHelper.COLUMN_NAME + "=?",
|
||||||
new String[] { imageUrl, name }, null, null, null, null);
|
new String[] { imageUrl, name }, null, null, null, null);
|
||||||
@ -277,11 +278,13 @@ public class AlbumDataSource
|
|||||||
{
|
{
|
||||||
if (cursor.getCount() > 0)
|
if (cursor.getCount() > 0)
|
||||||
{
|
{
|
||||||
return true;
|
result = true;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
cursor.close();
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -302,6 +305,8 @@ public class AlbumDataSource
|
|||||||
} while (cursor.moveToNext());
|
} while (cursor.moveToNext());
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
cursor.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
@ -311,20 +316,22 @@ public class AlbumDataSource
|
|||||||
public AlbumRecordData innerGetAlbumByName(String name, SQLiteDatabase database)
|
public AlbumRecordData innerGetAlbumByName(String name, SQLiteDatabase database)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
AlbumRecordData result = null;
|
||||||
|
|
||||||
Cursor cursor = database.query(BashgidSqliteHelper.TABLE_ALBUM, new String[] { BashgidSqliteHelper.COLUMN_NAME, BashgidSqliteHelper.COLUMN_TITLE,
|
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_NAME + "=?", new String[] { name }, null, null, null, null);
|
||||||
|
|
||||||
if (cursor != null)
|
if (cursor != null)
|
||||||
{
|
{
|
||||||
if (cursor.getCount() > 0)
|
if (cursor.moveToFirst())
|
||||||
{
|
{
|
||||||
cursor.moveToFirst();
|
result = new AlbumRecordData(cursor.getString(0), cursor.getString(1), cursor.getString(2));
|
||||||
|
|
||||||
return new AlbumRecordData(cursor.getString(0), cursor.getString(1), cursor.getString(2));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
cursor.close();
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,6 +1,11 @@
|
|||||||
package fishrungames.bashgid.core.db;
|
package fishrungames.bashgid.core.db;
|
||||||
|
|
||||||
|
|
||||||
|
import java.text.ParseException;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Comparator;
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
|
||||||
import fishrungames.bashgid.MainActivity;
|
import fishrungames.bashgid.MainActivity;
|
||||||
|
|
||||||
@ -9,8 +14,6 @@ import fishrungames.bashgid.core.ArticleManager.ArticleFullData;
|
|||||||
import fishrungames.bashgid.core.ArticleManager.ArticleRecordData;
|
import fishrungames.bashgid.core.ArticleManager.ArticleRecordData;
|
||||||
import fishrungames.bashgid.core.ArticleManager.ArticleShortData;
|
import fishrungames.bashgid.core.ArticleManager.ArticleShortData;
|
||||||
import fishrungames.bashgid.core.ChannelManager.ChannelFullData;
|
import fishrungames.bashgid.core.ChannelManager.ChannelFullData;
|
||||||
import fishrungames.bashgid.core.ChannelManager.ChannelRecordData;
|
|
||||||
import fishrungames.bashgid.core.VideoManager.VideoRecordData;
|
|
||||||
|
|
||||||
|
|
||||||
import android.content.ContentValues;
|
import android.content.ContentValues;
|
||||||
@ -21,11 +24,17 @@ import android.util.Log;
|
|||||||
|
|
||||||
public class ArticleDataSource
|
public class ArticleDataSource
|
||||||
{
|
{
|
||||||
// private SQLiteDatabase database = null;
|
|
||||||
|
|
||||||
private BashgidSqliteHelper dbHelper = null;
|
private BashgidSqliteHelper dbHelper = null;
|
||||||
|
|
||||||
// private final Semaphore mutex = new Semaphore(1, true);
|
|
||||||
|
|
||||||
|
public static class DateSortComparator implements Comparator<ArticleManager.ArticleRecordData> {
|
||||||
|
public int compare(ArticleManager.ArticleRecordData record1, ArticleManager.ArticleRecordData record2) {
|
||||||
|
return record2.dateTime.compareTo(record1.dateTime);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public ArticleDataSource(Context context, BashgidSqliteHelper dbHelper)
|
public ArticleDataSource(Context context, BashgidSqliteHelper dbHelper)
|
||||||
{
|
{
|
||||||
@ -50,6 +59,7 @@ public class ArticleDataSource
|
|||||||
values.put(BashgidSqliteHelper.COLUMN_GEOLAT, recordData.geoLat);
|
values.put(BashgidSqliteHelper.COLUMN_GEOLAT, recordData.geoLat);
|
||||||
values.put(BashgidSqliteHelper.COLUMN_GEOLON, recordData.geoLon);
|
values.put(BashgidSqliteHelper.COLUMN_GEOLON, recordData.geoLon);
|
||||||
values.put(BashgidSqliteHelper.COLUMN_EXTERNAL_LINK, recordData.externalLink);
|
values.put(BashgidSqliteHelper.COLUMN_EXTERNAL_LINK, recordData.externalLink);
|
||||||
|
values.put(BashgidSqliteHelper.COLUMN_DATE_TIME, ArticleManager.iso8601Format.format(recordData.dateTime));
|
||||||
|
|
||||||
if (!innerIsArticleAlreadyExist(recordData.name, database))
|
if (!innerIsArticleAlreadyExist(recordData.name, database))
|
||||||
{
|
{
|
||||||
@ -160,6 +170,23 @@ public class ArticleDataSource
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
|
||||||
|
result = InnerGetArticleFullData(name, database);
|
||||||
|
|
||||||
|
|
||||||
|
} finally
|
||||||
|
{
|
||||||
|
dbHelper.close();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ArticleFullData InnerGetArticleFullData(String name, SQLiteDatabase database)
|
||||||
|
{
|
||||||
|
ArticleFullData result = null;
|
||||||
|
|
||||||
|
|
||||||
ArticleRecordData recordData = innerGetArticleByName(name, database);
|
ArticleRecordData recordData = innerGetArticleByName(name, database);
|
||||||
|
|
||||||
if (recordData != null)
|
if (recordData != null)
|
||||||
@ -183,12 +210,6 @@ public class ArticleDataSource
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
} finally
|
|
||||||
{
|
|
||||||
dbHelper.close();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -204,6 +225,24 @@ public class ArticleDataSource
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
|
||||||
|
result = InnerGetArticleShortData(name, database);
|
||||||
|
|
||||||
|
|
||||||
|
} finally
|
||||||
|
{
|
||||||
|
dbHelper.close();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public ArticleShortData InnerGetArticleShortData(String name, SQLiteDatabase database)
|
||||||
|
{
|
||||||
|
ArticleShortData result = null;
|
||||||
|
|
||||||
|
|
||||||
ArticleRecordData recordData = innerGetArticleByName(name, database);
|
ArticleRecordData recordData = innerGetArticleByName(name, database);
|
||||||
|
|
||||||
if (recordData != null)
|
if (recordData != null)
|
||||||
@ -236,17 +275,13 @@ public class ArticleDataSource
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
} finally
|
|
||||||
{
|
|
||||||
dbHelper.close();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean innerIsArticleAlreadyExist(String name, SQLiteDatabase database)
|
private boolean innerIsArticleAlreadyExist(String name, SQLiteDatabase database)
|
||||||
{
|
{
|
||||||
|
boolean result = false;
|
||||||
|
|
||||||
Cursor cursor = database.query(BashgidSqliteHelper.TABLE_ARTICLE, new String[] { BashgidSqliteHelper.COLUMN_NAME },
|
Cursor cursor = database.query(BashgidSqliteHelper.TABLE_ARTICLE, new String[] { BashgidSqliteHelper.COLUMN_NAME },
|
||||||
BashgidSqliteHelper.COLUMN_NAME + "=?", new String[] { name }, null, null, null, null);
|
BashgidSqliteHelper.COLUMN_NAME + "=?", new String[] { name }, null, null, null, null);
|
||||||
|
|
||||||
@ -254,11 +289,13 @@ public class ArticleDataSource
|
|||||||
{
|
{
|
||||||
if (cursor.getCount() > 0)
|
if (cursor.getCount() > 0)
|
||||||
{
|
{
|
||||||
return true;
|
result = true;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
cursor.close();
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -266,6 +303,8 @@ public class ArticleDataSource
|
|||||||
|
|
||||||
private boolean innerAlbumArticleRelationAlreadyExist(String albumName, String articleName, SQLiteDatabase database)
|
private boolean innerAlbumArticleRelationAlreadyExist(String albumName, String articleName, SQLiteDatabase database)
|
||||||
{
|
{
|
||||||
|
boolean result = false;
|
||||||
|
|
||||||
Cursor cursor = database.query(BashgidSqliteHelper.TABLE_ALBUM_ARTICLE_RELATION, new String[] { BashgidSqliteHelper.COLUMN_ALBUM_NAME, BashgidSqliteHelper.COLUMN_ARTICLE_NAME },
|
Cursor cursor = database.query(BashgidSqliteHelper.TABLE_ALBUM_ARTICLE_RELATION, new String[] { BashgidSqliteHelper.COLUMN_ALBUM_NAME, BashgidSqliteHelper.COLUMN_ARTICLE_NAME },
|
||||||
BashgidSqliteHelper.COLUMN_ALBUM_NAME + "=?" + " AND " + BashgidSqliteHelper.COLUMN_ARTICLE_NAME + "=?", new String[] { albumName, articleName }, null, null, null, null);
|
BashgidSqliteHelper.COLUMN_ALBUM_NAME + "=?" + " AND " + BashgidSqliteHelper.COLUMN_ARTICLE_NAME + "=?", new String[] { albumName, articleName }, null, null, null, null);
|
||||||
|
|
||||||
@ -273,16 +312,20 @@ public class ArticleDataSource
|
|||||||
{
|
{
|
||||||
if (cursor.getCount() > 0)
|
if (cursor.getCount() > 0)
|
||||||
{
|
{
|
||||||
return true;
|
result = true;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
cursor.close();
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean innerChannelArticleRelationAlreadyExist(String channelName, String articleName, SQLiteDatabase database)
|
private boolean innerChannelArticleRelationAlreadyExist(String channelName, String articleName, SQLiteDatabase database)
|
||||||
{
|
{
|
||||||
|
boolean result = false;
|
||||||
|
|
||||||
Cursor cursor = database.query(BashgidSqliteHelper.TABLE_CHANNEL_ARTICLE_RELATION, new String[] { BashgidSqliteHelper.COLUMN_CHANNEL_NAME, BashgidSqliteHelper.COLUMN_ARTICLE_NAME },
|
Cursor cursor = database.query(BashgidSqliteHelper.TABLE_CHANNEL_ARTICLE_RELATION, new String[] { BashgidSqliteHelper.COLUMN_CHANNEL_NAME, BashgidSqliteHelper.COLUMN_ARTICLE_NAME },
|
||||||
BashgidSqliteHelper.COLUMN_CHANNEL_NAME + "=?" + " AND " + BashgidSqliteHelper.COLUMN_ARTICLE_NAME + "=?", new String[] { channelName, articleName }, null, null, null, null);
|
BashgidSqliteHelper.COLUMN_CHANNEL_NAME + "=?" + " AND " + BashgidSqliteHelper.COLUMN_ARTICLE_NAME + "=?", new String[] { channelName, articleName }, null, null, null, null);
|
||||||
|
|
||||||
@ -290,39 +333,57 @@ public class ArticleDataSource
|
|||||||
{
|
{
|
||||||
if (cursor.getCount() > 0)
|
if (cursor.getCount() > 0)
|
||||||
{
|
{
|
||||||
return true;
|
result = true;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
cursor.close();
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private ArticleRecordData innerGetArticleByName(String name, SQLiteDatabase database)
|
private ArticleRecordData innerGetArticleByName(String name, SQLiteDatabase database)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
ArticleRecordData result = null;
|
||||||
|
|
||||||
Cursor cursor = database.query(BashgidSqliteHelper.TABLE_ARTICLE, new String[] {
|
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_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 + "=?", new String[] { name }, null, null, null, null);
|
BashgidSqliteHelper.COLUMN_NAME + "=?", new String[] { name }, null, null, null, null);
|
||||||
|
|
||||||
if (cursor != null)
|
if (cursor != null)
|
||||||
{
|
{
|
||||||
if (cursor.getCount() > 0)
|
if (cursor.moveToFirst())
|
||||||
{
|
{
|
||||||
cursor.moveToFirst();
|
|
||||||
|
|
||||||
return new ArticleRecordData(
|
Date d = new Date();
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
d = ArticleManager.iso8601Format.parse(cursor.getString(7));
|
||||||
|
}
|
||||||
|
catch(ParseException e)
|
||||||
|
{
|
||||||
|
Log.e("aaa", "aaa!!!!!");
|
||||||
|
}
|
||||||
|
|
||||||
|
result = new ArticleRecordData(
|
||||||
cursor.getString(0),
|
cursor.getString(0),
|
||||||
cursor.getInt(1),
|
cursor.getInt(1),
|
||||||
cursor.getString(2),
|
cursor.getString(2),
|
||||||
cursor.getString(3),
|
cursor.getString(3),
|
||||||
cursor.getDouble(4),
|
cursor.getDouble(4),
|
||||||
cursor.getDouble(5),
|
cursor.getDouble(5),
|
||||||
cursor.getString(6)
|
cursor.getString(6),
|
||||||
|
d
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
cursor.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
return result;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -344,6 +405,8 @@ public class ArticleDataSource
|
|||||||
while (cursor.moveToNext());
|
while (cursor.moveToNext());
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
cursor.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
@ -368,10 +431,14 @@ public class ArticleDataSource
|
|||||||
while (cursor.moveToNext());
|
while (cursor.moveToNext());
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
cursor.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -56,6 +56,11 @@ public class BashgidSqliteHelper extends SQLiteOpenHelper
|
|||||||
public static final String COLUMN_PREVIEW_IMAGE_URL = "previewImageUrl";
|
public static final String COLUMN_PREVIEW_IMAGE_URL = "previewImageUrl";
|
||||||
public static final String COLUMN_PREVIEW_IMAGE_HASH = "previewImageHash";
|
public static final String COLUMN_PREVIEW_IMAGE_HASH = "previewImageHash";
|
||||||
|
|
||||||
|
public static final String COLUMN_DATE_TIME = "dateTime";
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
private static final String DATABASE_NAME = "bashgid.db";
|
private static final String DATABASE_NAME = "bashgid.db";
|
||||||
private static final int DATABASE_VERSION = 1;
|
private static final int DATABASE_VERSION = 1;
|
||||||
|
|
||||||
@ -83,7 +88,7 @@ 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"
|
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
|
+ ", " + 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" +");";
|
+ " real not null" + ", " + COLUMN_GEOLON + " real not null" + ", " + COLUMN_EXTERNAL_LINK + " text not null" + ", " + COLUMN_DATE_TIME + " text 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"
|
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" + ");";
|
+ ", " + COLUMN_ARTICLE_NAME + " text not null" + ");";
|
||||||
@ -186,8 +191,8 @@ public class BashgidSqliteHelper extends SQLiteOpenHelper
|
|||||||
@Override
|
@Override
|
||||||
public void close()
|
public void close()
|
||||||
{
|
{
|
||||||
mutex.release();
|
|
||||||
super.close();
|
super.close();
|
||||||
|
mutex.release();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,22 +1,17 @@
|
|||||||
package fishrungames.bashgid.core.db;
|
package fishrungames.bashgid.core.db;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.concurrent.Semaphore;
|
|
||||||
|
|
||||||
import fishrungames.bashgid.MainActivity;
|
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.ChannelManager;
|
import fishrungames.bashgid.core.ChannelManager;
|
||||||
import fishrungames.bashgid.core.ChannelManager.ChannelFullData;
|
import fishrungames.bashgid.core.ChannelManager.ChannelFullData;
|
||||||
import fishrungames.bashgid.core.ChannelManager.ChannelRecordData;
|
import fishrungames.bashgid.core.ChannelManager.ChannelRecordData;
|
||||||
import fishrungames.bashgid.core.PhotoManager;
|
|
||||||
|
|
||||||
import android.content.ContentValues;
|
import android.content.ContentValues;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.database.Cursor;
|
import android.database.Cursor;
|
||||||
import android.database.SQLException;
|
|
||||||
import android.database.sqlite.SQLiteDatabase;
|
import android.database.sqlite.SQLiteDatabase;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
|
|
||||||
@ -75,7 +70,6 @@ public class ChannelDataSource
|
|||||||
{
|
{
|
||||||
result = innerIsChannelAlreadyExist(name, database);
|
result = innerIsChannelAlreadyExist(name, database);
|
||||||
|
|
||||||
|
|
||||||
} finally
|
} finally
|
||||||
{
|
{
|
||||||
dbHelper.close();
|
dbHelper.close();
|
||||||
@ -156,83 +150,51 @@ public class ChannelDataSource
|
|||||||
result.videoRecordArr.add(MainActivity.getInstance().videoDataSource.InnerGetVideoByVideoUrl(videoUrl, database));
|
result.videoRecordArr.add(MainActivity.getInstance().videoDataSource.InnerGetVideoByVideoUrl(videoUrl, database));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
/*
|
|
||||||
public AlbumShortData GetAlbumShortData(String name)
|
|
||||||
{
|
|
||||||
AlbumShortData result = null;
|
|
||||||
|
|
||||||
SQLiteDatabase database = dbHelper.getWritableDatabase();
|
|
||||||
|
|
||||||
if (database != null)
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
|
|
||||||
AlbumRecordData recordData = innerGetAlbumByName(name, database);
|
|
||||||
|
|
||||||
if (recordData != null)
|
|
||||||
{
|
|
||||||
|
|
||||||
result = new AlbumShortData(recordData);
|
|
||||||
|
|
||||||
ArrayList<String> imageUrlArr = innerGetImageUrlArrInAlbum(name, database);
|
|
||||||
|
|
||||||
result.photoCount = imageUrlArr.size();
|
|
||||||
|
|
||||||
if (imageUrlArr.size() > 0)
|
|
||||||
{
|
|
||||||
result.firstImageUrl = imageUrlArr.get(0);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
} finally
|
|
||||||
{
|
|
||||||
dbHelper.close();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
*/
|
|
||||||
private boolean innerIsChannelAlreadyExist(String name, SQLiteDatabase database)
|
private boolean innerIsChannelAlreadyExist(String name, SQLiteDatabase database)
|
||||||
{
|
{
|
||||||
Cursor cursor = database.query(BashgidSqliteHelper.TABLE_CHANNEL, new String[] { BashgidSqliteHelper.COLUMN_NAME },
|
boolean result = false;
|
||||||
BashgidSqliteHelper.COLUMN_NAME + "=?", new String[] { name }, null, null, null, null);
|
|
||||||
|
Cursor cursor = database.query(BashgidSqliteHelper.TABLE_CHANNEL, new String[] { BashgidSqliteHelper.COLUMN_NAME }, BashgidSqliteHelper.COLUMN_NAME
|
||||||
|
+ "=?", new String[] { name }, null, null, null, null);
|
||||||
|
|
||||||
if (cursor != null)
|
if (cursor != null)
|
||||||
{
|
{
|
||||||
if (cursor.getCount() > 0)
|
if (cursor.getCount() > 0)
|
||||||
{
|
{
|
||||||
return true;
|
result = true;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
cursor.close();
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean innerVideoChannelRelationAlreadyExist(String videoUrl, String name, SQLiteDatabase database)
|
private boolean innerVideoChannelRelationAlreadyExist(String videoUrl, String name, SQLiteDatabase database)
|
||||||
{
|
{
|
||||||
Cursor cursor = database.query(BashgidSqliteHelper.TABLE_VIDEO_CHANNEL_RELATION, new String[] { BashgidSqliteHelper.COLUMN_VIDEO_URL, BashgidSqliteHelper.COLUMN_NAME },
|
boolean result = false;
|
||||||
BashgidSqliteHelper.COLUMN_VIDEO_URL + "=?" + " AND " + BashgidSqliteHelper.COLUMN_NAME + "=?", new String[] { videoUrl, name }, null, null, null, null);
|
|
||||||
|
Cursor cursor = database.query(BashgidSqliteHelper.TABLE_VIDEO_CHANNEL_RELATION, new String[] { BashgidSqliteHelper.COLUMN_VIDEO_URL,
|
||||||
|
BashgidSqliteHelper.COLUMN_NAME }, BashgidSqliteHelper.COLUMN_VIDEO_URL + "=?" + " AND " + BashgidSqliteHelper.COLUMN_NAME + "=?",
|
||||||
|
new String[] { videoUrl, name }, null, null, null, null);
|
||||||
|
|
||||||
if (cursor != null)
|
if (cursor != null)
|
||||||
{
|
{
|
||||||
if (cursor.getCount() > 0)
|
if (cursor.getCount() > 0)
|
||||||
{
|
{
|
||||||
return true;
|
result = true;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
cursor.close();
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -250,10 +212,10 @@ public class ChannelDataSource
|
|||||||
do
|
do
|
||||||
{
|
{
|
||||||
result.add(cursor.getString(0));
|
result.add(cursor.getString(0));
|
||||||
}
|
} while (cursor.moveToNext());
|
||||||
while (cursor.moveToNext());
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
cursor.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
@ -263,25 +225,23 @@ public class ChannelDataSource
|
|||||||
public ChannelRecordData InnerGetChannelByName(String name, SQLiteDatabase database)
|
public ChannelRecordData InnerGetChannelByName(String name, SQLiteDatabase database)
|
||||||
{
|
{
|
||||||
|
|
||||||
Cursor cursor = database.query(BashgidSqliteHelper.TABLE_CHANNEL,
|
ChannelRecordData result = null;
|
||||||
new String[] { BashgidSqliteHelper.COLUMN_NAME, BashgidSqliteHelper.COLUMN_TITLE, BashgidSqliteHelper.COLUMN_DESCRIPTION },
|
|
||||||
BashgidSqliteHelper.COLUMN_NAME + "=?", new String[] { name }, null, null, null, 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);
|
||||||
|
|
||||||
if (cursor != null)
|
if (cursor != null)
|
||||||
{
|
{
|
||||||
if (cursor.getCount() > 0)
|
if (cursor.moveToFirst())
|
||||||
{
|
{
|
||||||
cursor.moveToFirst();
|
|
||||||
|
|
||||||
return new ChannelRecordData(
|
result = new ChannelRecordData(cursor.getString(0), cursor.getString(1), cursor.getString(2));
|
||||||
cursor.getString(0),
|
|
||||||
cursor.getString(1),
|
|
||||||
cursor.getString(2)
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
cursor.close();
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,13 +1,13 @@
|
|||||||
package fishrungames.bashgid.core.db;
|
package fishrungames.bashgid.core.db;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Collections;
|
||||||
|
|
||||||
import fishrungames.bashgid.MainActivity;
|
import fishrungames.bashgid.MainActivity;
|
||||||
import fishrungames.bashgid.core.AlbumManager;
|
|
||||||
import fishrungames.bashgid.core.AlbumManager.AlbumFullData;
|
import fishrungames.bashgid.core.ArticleManager.ArticleShortData;
|
||||||
import fishrungames.bashgid.core.AlbumManager.AlbumRecordData;
|
|
||||||
import fishrungames.bashgid.core.AlbumManager.AlbumShortData;
|
|
||||||
import fishrungames.bashgid.core.JournalManager;
|
import fishrungames.bashgid.core.JournalManager;
|
||||||
|
import fishrungames.bashgid.core.JournalManager.JournalRecordData;
|
||||||
|
|
||||||
import android.content.ContentValues;
|
import android.content.ContentValues;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
@ -98,7 +98,7 @@ public class JournalDataSource
|
|||||||
if (!innerArticleJournalRelationAlreadyExist(articleName, journalName, database))
|
if (!innerArticleJournalRelationAlreadyExist(articleName, journalName, database))
|
||||||
{
|
{
|
||||||
Log.e("a", "aaa1");
|
Log.e("a", "aaa1");
|
||||||
database.insert(BashgidSqliteHelper.TABLE_PHOTO_ALBUM_RELATION, null, values);
|
database.insert(BashgidSqliteHelper.TABLE_ARTICLE_JOURNAL_RELATION, null, values);
|
||||||
Log.e("a", "aaa2");
|
Log.e("a", "aaa2");
|
||||||
}
|
}
|
||||||
Log.e("a", "aaa3");
|
Log.e("a", "aaa3");
|
||||||
@ -110,10 +110,10 @@ public class JournalDataSource
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
public AlbumFullData GetAlbumFullData(String name)
|
public ArrayList<ArticleShortData> GetRecentArticles(String journalName, int count)
|
||||||
{
|
{
|
||||||
AlbumFullData result = null;
|
ArrayList<ArticleShortData> result = new ArrayList<ArticleShortData>();
|
||||||
|
|
||||||
SQLiteDatabase database = dbHelper.getWritableDatabase();
|
SQLiteDatabase database = dbHelper.getWritableDatabase();
|
||||||
|
|
||||||
@ -122,115 +122,23 @@ public class JournalDataSource
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
|
||||||
result = InnerGetAlbumFullData(name, database);
|
JournalRecordData recordData = innerGetJournalByName(journalName, database);
|
||||||
|
|
||||||
} finally
|
|
||||||
{
|
|
||||||
dbHelper.close();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
public AlbumFullData InnerGetAlbumFullData(String name, SQLiteDatabase database)
|
|
||||||
{
|
|
||||||
|
|
||||||
AlbumFullData result = null;
|
|
||||||
|
|
||||||
AlbumRecordData recordData = innerGetAlbumByName(name, database);
|
|
||||||
|
|
||||||
if (recordData != null)
|
if (recordData != null)
|
||||||
{
|
{
|
||||||
|
|
||||||
result = new AlbumFullData(recordData);
|
ArrayList<String> articleNameArr = innerGetArticleArrInJournal(journalName, database);
|
||||||
|
|
||||||
ArrayList<String> imageUrlArr = innerGetImageUrlArrInAlbum(name, database);
|
for (String articleName : articleNameArr)
|
||||||
|
|
||||||
for (String imageUrl : imageUrlArr)
|
|
||||||
{
|
{
|
||||||
result.photoRecordArr.add(MainActivity.getInstance().photoDataSource.InnerGetPhotoByImageUrl(imageUrl, database));
|
result.add(MainActivity.getInstance().articleDataSource.InnerGetArticleShortData(articleName, database));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
Collections.sort(result, new ArticleDataSource.DateSortComparator());
|
||||||
|
|
||||||
return result;
|
if (result.size() > count)
|
||||||
}
|
|
||||||
|
|
||||||
public AlbumShortData GetAlbumShortData(String name)
|
|
||||||
{
|
{
|
||||||
AlbumShortData result = null;
|
result.subList(count, result.size() - count - 1).clear();
|
||||||
|
|
||||||
SQLiteDatabase database = dbHelper.getWritableDatabase();
|
|
||||||
|
|
||||||
if (database != null)
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
|
|
||||||
AlbumRecordData recordData = innerGetAlbumByName(name, database);
|
|
||||||
|
|
||||||
if (recordData != null)
|
|
||||||
{
|
|
||||||
|
|
||||||
result = new AlbumShortData(recordData);
|
|
||||||
|
|
||||||
ArrayList<String> imageUrlArr = innerGetImageUrlArrInAlbum(name, database);
|
|
||||||
|
|
||||||
result.photoCount = imageUrlArr.size();
|
|
||||||
|
|
||||||
if (imageUrlArr.size() > 0)
|
|
||||||
{
|
|
||||||
result.firstImageUrl = imageUrlArr.get(0);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
} finally
|
|
||||||
{
|
|
||||||
dbHelper.close();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
public ArrayList<AlbumShortData> GetAllAlbumShortData()
|
|
||||||
{
|
|
||||||
|
|
||||||
ArrayList<AlbumShortData> result = new ArrayList<AlbumShortData>();
|
|
||||||
|
|
||||||
SQLiteDatabase database = dbHelper.getWritableDatabase();
|
|
||||||
|
|
||||||
if (database != null)
|
|
||||||
{
|
|
||||||
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);
|
|
||||||
|
|
||||||
if (cursor != null)
|
|
||||||
{
|
|
||||||
if (cursor.moveToFirst())
|
|
||||||
{
|
|
||||||
do
|
|
||||||
{
|
|
||||||
|
|
||||||
AlbumShortData shortData = new AlbumShortData(new AlbumRecordData(cursor.getString(0), cursor.getString(1), cursor.getString(2)));
|
|
||||||
|
|
||||||
ArrayList<String> imageUrlArr = innerGetImageUrlArrInAlbum(shortData.name, database);
|
|
||||||
|
|
||||||
shortData.photoCount = imageUrlArr.size();
|
|
||||||
|
|
||||||
if (imageUrlArr.size() > 0)
|
|
||||||
{
|
|
||||||
shortData.firstImageUrl = imageUrlArr.get(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
result.add(shortData);
|
|
||||||
} while (cursor.moveToNext());
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -243,10 +151,11 @@ public class JournalDataSource
|
|||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
*/
|
|
||||||
|
|
||||||
private boolean innerIsJournalAlreadyExist(String name, SQLiteDatabase database)
|
private boolean innerIsJournalAlreadyExist(String name, SQLiteDatabase database)
|
||||||
{
|
{
|
||||||
|
boolean result = false;
|
||||||
|
|
||||||
Cursor cursor = database.query(BashgidSqliteHelper.TABLE_JOURNAL, new String[] { BashgidSqliteHelper.COLUMN_NAME }, BashgidSqliteHelper.COLUMN_NAME
|
Cursor cursor = database.query(BashgidSqliteHelper.TABLE_JOURNAL, new String[] { BashgidSqliteHelper.COLUMN_NAME }, BashgidSqliteHelper.COLUMN_NAME
|
||||||
+ "=?", new String[] { name }, null, null, null, null);
|
+ "=?", new String[] { name }, null, null, null, null);
|
||||||
|
|
||||||
@ -254,16 +163,20 @@ public class JournalDataSource
|
|||||||
{
|
{
|
||||||
if (cursor.getCount() > 0)
|
if (cursor.getCount() > 0)
|
||||||
{
|
{
|
||||||
return true;
|
result = true;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
cursor.close();
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean innerArticleJournalRelationAlreadyExist(String articleName, String journalName, SQLiteDatabase database)
|
private boolean innerArticleJournalRelationAlreadyExist(String articleName, String journalName, SQLiteDatabase database)
|
||||||
{
|
{
|
||||||
|
boolean result = false;
|
||||||
|
|
||||||
Cursor cursor = database.query(BashgidSqliteHelper.TABLE_ARTICLE_JOURNAL_RELATION, new String[] { BashgidSqliteHelper.COLUMN_ARTICLE_NAME,
|
Cursor cursor = database.query(BashgidSqliteHelper.TABLE_ARTICLE_JOURNAL_RELATION, new String[] { BashgidSqliteHelper.COLUMN_ARTICLE_NAME,
|
||||||
BashgidSqliteHelper.COLUMN_JOURNAL_NAME }, BashgidSqliteHelper.COLUMN_ARTICLE_NAME + "=?" + " AND " + BashgidSqliteHelper.COLUMN_JOURNAL_NAME + "=?",
|
BashgidSqliteHelper.COLUMN_JOURNAL_NAME }, BashgidSqliteHelper.COLUMN_ARTICLE_NAME + "=?" + " AND " + BashgidSqliteHelper.COLUMN_JOURNAL_NAME + "=?",
|
||||||
new String[] { articleName, journalName }, null, null, null, null);
|
new String[] { articleName, journalName }, null, null, null, null);
|
||||||
@ -272,21 +185,23 @@ public class JournalDataSource
|
|||||||
{
|
{
|
||||||
if (cursor.getCount() > 0)
|
if (cursor.getCount() > 0)
|
||||||
{
|
{
|
||||||
return true;
|
result = true;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
cursor.close();
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
private ArrayList<String> innerGetImageUrlArrInAlbum(String name, SQLiteDatabase database)
|
private ArrayList<String> innerGetArticleArrInJournal(String name, SQLiteDatabase database)
|
||||||
{
|
{
|
||||||
ArrayList<String> result = new ArrayList<String>();
|
ArrayList<String> result = new ArrayList<String>();
|
||||||
|
|
||||||
Cursor cursor = database.query(BashgidSqliteHelper.TABLE_PHOTO_ALBUM_RELATION, new String[] { BashgidSqliteHelper.COLUMN_IMAGE_URL },
|
Cursor cursor = database.query(BashgidSqliteHelper.TABLE_ARTICLE_JOURNAL_RELATION, new String[] { BashgidSqliteHelper.COLUMN_ARTICLE_NAME },
|
||||||
BashgidSqliteHelper.COLUMN_NAME + "=?", new String[] { name }, null, null, null, null);
|
BashgidSqliteHelper.COLUMN_JOURNAL_NAME + "=?", new String[] { name }, null, null, null, null);
|
||||||
|
|
||||||
if (cursor != null)
|
if (cursor != null)
|
||||||
{
|
{
|
||||||
@ -298,16 +213,20 @@ public class JournalDataSource
|
|||||||
} while (cursor.moveToNext());
|
} while (cursor.moveToNext());
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
cursor.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public AlbumRecordData innerGetAlbumByName(String name, SQLiteDatabase database)
|
public JournalRecordData innerGetJournalByName(String name, SQLiteDatabase database)
|
||||||
{
|
{
|
||||||
|
|
||||||
Cursor cursor = database.query(BashgidSqliteHelper.TABLE_ALBUM, new String[] { BashgidSqliteHelper.COLUMN_NAME, BashgidSqliteHelper.COLUMN_TITLE,
|
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_NAME + "=?", new String[] { name }, null, null, null, null);
|
||||||
|
|
||||||
if (cursor != null)
|
if (cursor != null)
|
||||||
@ -316,12 +235,13 @@ public class JournalDataSource
|
|||||||
{
|
{
|
||||||
cursor.moveToFirst();
|
cursor.moveToFirst();
|
||||||
|
|
||||||
return new AlbumRecordData(cursor.getString(0), cursor.getString(1), cursor.getString(2));
|
result = new JournalRecordData(cursor.getString(0), cursor.getString(1), cursor.getString(2));
|
||||||
}
|
}
|
||||||
|
cursor.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
return result;
|
||||||
|
|
||||||
}
|
}
|
||||||
*/
|
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
package fishrungames.bashgid.core.db;
|
package fishrungames.bashgid.core.db;
|
||||||
|
|
||||||
|
import fishrungames.bashgid.core.PhotoManager.PhotoRecordData;
|
||||||
import fishrungames.bashgid.core.PhotoManager;
|
|
||||||
|
|
||||||
import android.content.ContentValues;
|
import android.content.ContentValues;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
@ -12,15 +11,9 @@ import android.util.Log;
|
|||||||
|
|
||||||
public class PhotoDataSource
|
public class PhotoDataSource
|
||||||
{
|
{
|
||||||
// private SQLiteDatabase database = null;
|
|
||||||
|
|
||||||
private BashgidSqliteHelper dbHelper = null;
|
private BashgidSqliteHelper dbHelper = null;
|
||||||
|
|
||||||
// private String[] allColumns = { BashgidSqliteHelper.COLUMN_ID,
|
|
||||||
// BashgidSqliteHelper.COLUMN_TITLE, BashgidSqliteHelper.COLUMN_DESCRIPTION,
|
|
||||||
// BashgidSqliteHelper.COLUMN_IMAGE_URL, BashgidSqliteHelper.COLUMN_GEOLAT,
|
|
||||||
// BashgidSqliteHelper.COLUMN_GEOLON };
|
|
||||||
|
|
||||||
public PhotoDataSource(Context context, BashgidSqliteHelper dbHelper)
|
public PhotoDataSource(Context context, BashgidSqliteHelper dbHelper)
|
||||||
{
|
{
|
||||||
|
|
||||||
@ -28,7 +21,7 @@ public class PhotoDataSource
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void AddOrReplacePhoto(PhotoManager.PhotoRecordData recordData)
|
public void AddOrReplacePhoto(PhotoRecordData recordData)
|
||||||
{
|
{
|
||||||
SQLiteDatabase database = dbHelper.getWritableDatabase();
|
SQLiteDatabase database = dbHelper.getWritableDatabase();
|
||||||
|
|
||||||
@ -67,9 +60,9 @@ public class PhotoDataSource
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public PhotoManager.PhotoRecordData GetPhotoByImageUrl(String imageUrl)
|
public PhotoRecordData GetPhotoByImageUrl(String imageUrl)
|
||||||
{
|
{
|
||||||
PhotoManager.PhotoRecordData result = null;
|
PhotoRecordData result = null;
|
||||||
|
|
||||||
SQLiteDatabase database = dbHelper.getWritableDatabase();
|
SQLiteDatabase database = dbHelper.getWritableDatabase();
|
||||||
|
|
||||||
@ -88,36 +81,37 @@ public class PhotoDataSource
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
public PhotoManager.PhotoRecordData InnerGetPhotoByImageUrl(String imageUrl, SQLiteDatabase database)
|
public PhotoRecordData InnerGetPhotoByImageUrl(String imageUrl, SQLiteDatabase database)
|
||||||
{
|
{
|
||||||
|
|
||||||
Cursor cursor = database.query(BashgidSqliteHelper.TABLE_PHOTO,
|
PhotoRecordData result = null;
|
||||||
new String[] { BashgidSqliteHelper.COLUMN_TITLE, BashgidSqliteHelper.COLUMN_DESCRIPTION, BashgidSqliteHelper.COLUMN_IMAGE_URL, BashgidSqliteHelper.COLUMN_IMAGE_HASH, BashgidSqliteHelper.COLUMN_GEOLAT, BashgidSqliteHelper.COLUMN_GEOLON },
|
|
||||||
BashgidSqliteHelper.COLUMN_IMAGE_URL + "=?", new String[] { imageUrl }, null, null, null, null);
|
Cursor cursor = database.query(BashgidSqliteHelper.TABLE_PHOTO, new String[] { BashgidSqliteHelper.COLUMN_TITLE,
|
||||||
|
BashgidSqliteHelper.COLUMN_DESCRIPTION, BashgidSqliteHelper.COLUMN_IMAGE_URL, BashgidSqliteHelper.COLUMN_IMAGE_HASH,
|
||||||
|
BashgidSqliteHelper.COLUMN_GEOLAT, BashgidSqliteHelper.COLUMN_GEOLON }, BashgidSqliteHelper.COLUMN_IMAGE_URL + "=?", new String[] { imageUrl },
|
||||||
|
null, null, null, null);
|
||||||
|
|
||||||
if (cursor != null)
|
if (cursor != null)
|
||||||
{
|
{
|
||||||
if (cursor.getCount() > 0)
|
if (cursor.moveToFirst())
|
||||||
{
|
{
|
||||||
cursor.moveToFirst();
|
|
||||||
|
|
||||||
return new PhotoManager.PhotoRecordData(
|
|
||||||
cursor.getString(0),
|
result = new PhotoRecordData(cursor.getString(0), cursor.getString(1), cursor.getString(2), cursor.getString(3),
|
||||||
cursor.getString(1),
|
cursor.getDouble(4), cursor.getDouble(5));
|
||||||
cursor.getString(2),
|
|
||||||
cursor.getString(3),
|
|
||||||
cursor.getDouble(4),
|
|
||||||
cursor.getDouble(5)
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
cursor.close();
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean isPhotoAlreadyExist(String imageUrl, SQLiteDatabase database)
|
private boolean isPhotoAlreadyExist(String imageUrl, SQLiteDatabase database)
|
||||||
{
|
{
|
||||||
|
boolean result = false;
|
||||||
|
|
||||||
Cursor cursor = database.query(BashgidSqliteHelper.TABLE_PHOTO, new String[] { BashgidSqliteHelper.COLUMN_IMAGE_URL },
|
Cursor cursor = database.query(BashgidSqliteHelper.TABLE_PHOTO, new String[] { BashgidSqliteHelper.COLUMN_IMAGE_URL },
|
||||||
BashgidSqliteHelper.COLUMN_IMAGE_URL + "=?", new String[] { imageUrl }, null, null, null, null);
|
BashgidSqliteHelper.COLUMN_IMAGE_URL + "=?", new String[] { imageUrl }, null, null, null, null);
|
||||||
|
|
||||||
@ -125,12 +119,13 @@ public class PhotoDataSource
|
|||||||
{
|
{
|
||||||
if (cursor.getCount() > 0)
|
if (cursor.getCount() > 0)
|
||||||
{
|
{
|
||||||
return true;
|
result = true;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
cursor.close();
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
package fishrungames.bashgid.core.db;
|
package fishrungames.bashgid.core.db;
|
||||||
|
|
||||||
|
|
||||||
import fishrungames.bashgid.core.VideoManager;
|
import fishrungames.bashgid.core.VideoManager.VideoRecordData;
|
||||||
|
|
||||||
import android.content.ContentValues;
|
import android.content.ContentValues;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
@ -21,7 +21,7 @@ public class VideoDataSource
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void AddOrReplaceVideo(VideoManager.VideoRecordData recordData)
|
public void AddOrReplaceVideo(VideoRecordData recordData)
|
||||||
{
|
{
|
||||||
SQLiteDatabase database = dbHelper.getWritableDatabase();
|
SQLiteDatabase database = dbHelper.getWritableDatabase();
|
||||||
|
|
||||||
@ -59,9 +59,9 @@ public class VideoDataSource
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public VideoManager.VideoRecordData GetVideoByVideoUrl(String videoUrl)
|
public VideoRecordData GetVideoByVideoUrl(String videoUrl)
|
||||||
{
|
{
|
||||||
VideoManager.VideoRecordData result = null;
|
VideoRecordData result = null;
|
||||||
|
|
||||||
SQLiteDatabase database = dbHelper.getWritableDatabase();
|
SQLiteDatabase database = dbHelper.getWritableDatabase();
|
||||||
|
|
||||||
@ -80,10 +80,10 @@ public class VideoDataSource
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
public VideoManager.VideoRecordData InnerGetVideoByVideoUrl(String videoUrl, SQLiteDatabase database)
|
public VideoRecordData InnerGetVideoByVideoUrl(String videoUrl, SQLiteDatabase database)
|
||||||
{
|
{
|
||||||
|
|
||||||
VideoManager.VideoRecordData result = null;
|
VideoRecordData result = null;
|
||||||
|
|
||||||
Cursor cursor = database.query(BashgidSqliteHelper.TABLE_VIDEO,
|
Cursor cursor = database.query(BashgidSqliteHelper.TABLE_VIDEO,
|
||||||
new String[] { BashgidSqliteHelper.COLUMN_TYPE, BashgidSqliteHelper.COLUMN_VIDEO_URL, BashgidSqliteHelper.COLUMN_TITLE, BashgidSqliteHelper.COLUMN_DESCRIPTION, BashgidSqliteHelper.COLUMN_PREVIEW_IMAGE_URL, BashgidSqliteHelper.COLUMN_PREVIEW_IMAGE_HASH },
|
new String[] { BashgidSqliteHelper.COLUMN_TYPE, BashgidSqliteHelper.COLUMN_VIDEO_URL, BashgidSqliteHelper.COLUMN_TITLE, BashgidSqliteHelper.COLUMN_DESCRIPTION, BashgidSqliteHelper.COLUMN_PREVIEW_IMAGE_URL, BashgidSqliteHelper.COLUMN_PREVIEW_IMAGE_HASH },
|
||||||
@ -91,11 +91,11 @@ public class VideoDataSource
|
|||||||
|
|
||||||
if (cursor != null)
|
if (cursor != null)
|
||||||
{
|
{
|
||||||
if (cursor.getCount() > 0)
|
if (cursor.moveToFirst())
|
||||||
{
|
{
|
||||||
cursor.moveToFirst();
|
|
||||||
|
|
||||||
result = new VideoManager.VideoRecordData(
|
|
||||||
|
result = new VideoRecordData(
|
||||||
cursor.getInt(0),
|
cursor.getInt(0),
|
||||||
cursor.getString(1),
|
cursor.getString(1),
|
||||||
cursor.getString(2),
|
cursor.getString(2),
|
||||||
@ -104,6 +104,8 @@ public class VideoDataSource
|
|||||||
cursor.getString(5)
|
cursor.getString(5)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
cursor.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
@ -112,6 +114,8 @@ public class VideoDataSource
|
|||||||
|
|
||||||
private boolean isVideoAlreadyExist(String videoUrl, SQLiteDatabase database)
|
private boolean isVideoAlreadyExist(String videoUrl, SQLiteDatabase database)
|
||||||
{
|
{
|
||||||
|
boolean result = false;
|
||||||
|
|
||||||
Cursor cursor = database.query(BashgidSqliteHelper.TABLE_VIDEO, new String[] { BashgidSqliteHelper.COLUMN_VIDEO_URL },
|
Cursor cursor = database.query(BashgidSqliteHelper.TABLE_VIDEO, new String[] { BashgidSqliteHelper.COLUMN_VIDEO_URL },
|
||||||
BashgidSqliteHelper.COLUMN_VIDEO_URL + "=?", new String[] { videoUrl }, null, null, null, null);
|
BashgidSqliteHelper.COLUMN_VIDEO_URL + "=?", new String[] { videoUrl }, null, null, null, null);
|
||||||
|
|
||||||
@ -119,11 +123,13 @@ public class VideoDataSource
|
|||||||
{
|
{
|
||||||
if (cursor.getCount() > 0)
|
if (cursor.getCount() > 0)
|
||||||
{
|
{
|
||||||
return true;
|
result = true;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
cursor.close();
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user