Fixing context bugs

This commit is contained in:
Vladislav Khorev 2015-07-06 00:44:07 +00:00
parent b0021bbbf6
commit c0c8ba61c6
44 changed files with 938 additions and 957 deletions

View File

@ -1,8 +1,8 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" <manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="fishrungames.bashgid" package="fishrungames.bashgid"
android:versionCode="2" android:versionCode="4"
android:versionName="1.01" > android:versionName="1.03" >
<uses-feature <uses-feature
android:glEsVersion="0x00020000" android:glEsVersion="0x00020000"
@ -21,11 +21,13 @@
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /> <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<application <application
android:name="BashgidApplication"
android:allowBackup="true" android:allowBackup="true"
android:icon="@drawable/ic_launcher" android:icon="@drawable/ic_launcher"
android:label="@string/app_name" android:label="@string/app_name"
android:theme="@style/AppTheme" android:theme="@style/AppTheme"
android:configChanges="orientation|keyboardHidden"
android:hardwareAccelerated="true" > android:hardwareAccelerated="true" >
<activity <activity
android:name=".MainActivity" android:name=".MainActivity"
@ -35,12 +37,7 @@
<action android:name="android.intent.action.MAIN" /> <action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" /> <category android:name="android.intent.category.LAUNCHER" />
</intent-filter> </intent-filter>
</activity> </activity>
<meta-data android:name="com.google.android.gms.version"
android:value="@integer/google_play_services_version" />
</application> </application>
</manifest> </manifest>

View File

@ -13,5 +13,4 @@
# Project target. # Project target.
target=android-21 target=android-21
android.library.reference.1=..\\HorizontalListViewLibrary android.library.reference.1=..\\HorizontalListViewLibrary
android.library.reference.2=..\\google-play-services_lib android.library.reference.2=..\\networkutils
android.library.reference.3=../networkutils

View File

@ -6,12 +6,15 @@
tools:context="fishrungames.bashgid.MainActivity" > tools:context="fishrungames.bashgid.MainActivity" >
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" <FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/fragment_container" android:id="@+id/fragment_container"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" > android:layout_height="match_parent" >
</FrameLayout> </FrameLayout>
<fragment <fragment
android:id="@+id/navigation_drawer" android:id="@+id/navigation_drawer"
android:name="fishrungames.bashgid.NavigationDrawerFragment" android:name="fishrungames.bashgid.NavigationDrawerFragment"
@ -20,5 +23,4 @@
android:layout_gravity="start" android:layout_gravity="start"
tools:layout="@layout/fragment_navigation_drawer" /> tools:layout="@layout/fragment_navigation_drawer" />
</android.support.v4.widget.DrawerLayout> </android.support.v4.widget.DrawerLayout>

View File

@ -2,6 +2,7 @@
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:background="@color/bkg2"
android:orientation="vertical" > android:orientation="vertical" >
<ProgressBar <ProgressBar
android:id="@+id/progressBar" android:id="@+id/progressBar"
@ -11,7 +12,7 @@
android:layout_gravity="center_horizontal" android:layout_gravity="center_horizontal"
android:indeterminate="true" /> android:indeterminate="true" />
<fishrungames.bashgid.StaticGridView <GridView
android:id="@+id/gridView" android:id="@+id/gridView"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
@ -20,6 +21,7 @@
android:numColumns="@integer/grid_columns" android:numColumns="@integer/grid_columns"
android:verticalSpacing="@dimen/grid_view_vertical_spacing" android:verticalSpacing="@dimen/grid_view_vertical_spacing"
android:isScrollContainer="false" android:isScrollContainer="false"
android:background="@color/bkg2"
android:stretchMode="columnWidth" /> android:stretchMode="columnWidth" />

View File

@ -1,10 +1,11 @@
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android" <ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools" xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="match_parent"
android:paddingBottom="@dimen/large_margin" android:paddingBottom="@dimen/large_margin"
android:paddingLeft="@dimen/large_margin" android:paddingLeft="@dimen/large_margin"
android:paddingRight="@dimen/large_margin" android:paddingRight="@dimen/large_margin"
android:background="@color/bkg2"
tools:context="fishrungames.bashgid.SettingsFragment" > tools:context="fishrungames.bashgid.SettingsFragment" >

View File

@ -9,7 +9,7 @@
android:orientation="vertical" android:orientation="vertical"
android:showDividers="middle" > android:showDividers="middle" >
<fishrungames.bashgid.SquareImageView <ImageView
android:id="@+id/imageView" android:id="@+id/imageView"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"

View File

@ -27,21 +27,21 @@
<dimen name="small_margin">4dp</dimen> <dimen name="small_margin">4dp</dimen>
<dimen name="xxlarge_text_size">60dp</dimen> <dimen name="xxlarge_text_size">40sp</dimen>
<dimen name="xlarge_text_size">30dp</dimen> <dimen name="xlarge_text_size">30sp</dimen>
<dimen name="large_text_size">24dp</dimen> <dimen name="large_text_size">24sp</dimen>
<dimen name="medium_text_size">20dp</dimen> <dimen name="medium_text_size">20sp</dimen>
<dimen name="small_text_size">18dp</dimen> <dimen name="small_text_size">18sp</dimen>
<dimen name="xsmall_text_size">14dp</dimen> <dimen name="xsmall_text_size">14sp</dimen>
<dimen name="language_text_size">30dp</dimen> <dimen name="language_text_size">30sp</dimen>
<dimen name="article_content_text_size">24dp</dimen> <dimen name="article_content_text_size">20sp</dimen>

View File

@ -27,20 +27,20 @@
<dimen name="small_margin">4dp</dimen> <dimen name="small_margin">4dp</dimen>
<dimen name="xxlarge_text_size">30dp</dimen> <dimen name="xxlarge_text_size">30sp</dimen>
<dimen name="xlarge_text_size">24dp</dimen> <dimen name="xlarge_text_size">24sp</dimen>
<dimen name="large_text_size">24dp</dimen> <dimen name="large_text_size">24sp</dimen>
<dimen name="medium_text_size">20dp</dimen> <dimen name="medium_text_size">20sp</dimen>
<dimen name="small_text_size">18dp</dimen> <dimen name="small_text_size">18sp</dimen>
<dimen name="xsmall_text_size">14dp</dimen> <dimen name="xsmall_text_size">14sp</dimen>
<dimen name="language_text_size">20dp</dimen> <dimen name="language_text_size">20sp</dimen>
<dimen name="article_content_text_size">14dp</dimen> <dimen name="article_content_text_size">14sp</dimen>

View File

@ -27,20 +27,20 @@
<dimen name="small_margin">4dp</dimen> <dimen name="small_margin">4dp</dimen>
<dimen name="xxlarge_text_size">30dp</dimen> <dimen name="xxlarge_text_size">30sp</dimen>
<dimen name="xlarge_text_size">24dp</dimen> <dimen name="xlarge_text_size">24sp</dimen>
<dimen name="large_text_size">24dp</dimen> <dimen name="large_text_size">24sp</dimen>
<dimen name="medium_text_size">20dp</dimen> <dimen name="medium_text_size">20sp</dimen>
<dimen name="small_text_size">18dp</dimen> <dimen name="small_text_size">18sp</dimen>
<dimen name="xsmall_text_size">14dp</dimen> <dimen name="xsmall_text_size">14sp</dimen>
<dimen name="language_text_size">20dp</dimen> <dimen name="language_text_size">20sp</dimen>
<dimen name="article_content_text_size">14dp</dimen> <dimen name="article_content_text_size">14sp</dimen>
<dimen name="grid_view_horizontal_spacing">12dp</dimen> <dimen name="grid_view_horizontal_spacing">12dp</dimen>

View File

@ -27,21 +27,21 @@
<dimen name="small_margin">4dp</dimen> <dimen name="small_margin">4dp</dimen>
<dimen name="xxlarge_text_size">60dp</dimen> <dimen name="xxlarge_text_size">40sp</dimen>
<dimen name="xlarge_text_size">30dp</dimen> <dimen name="xlarge_text_size">30sp</dimen>
<dimen name="large_text_size">24dp</dimen> <dimen name="large_text_size">24sp</dimen>
<dimen name="medium_text_size">20dp</dimen> <dimen name="medium_text_size">20sp</dimen>
<dimen name="small_text_size">18dp</dimen> <dimen name="small_text_size">18sp</dimen>
<dimen name="xsmall_text_size">14dp</dimen> <dimen name="xsmall_text_size">14sp</dimen>
<dimen name="language_text_size">30dp</dimen> <dimen name="language_text_size">30sp</dimen>
<dimen name="article_content_text_size">24dp</dimen> <dimen name="article_content_text_size">20sp</dimen>

View File

@ -27,21 +27,21 @@
<dimen name="small_margin">4dp</dimen> <dimen name="small_margin">4dp</dimen>
<dimen name="xxlarge_text_size">60dp</dimen> <dimen name="xxlarge_text_size">40sp</dimen>
<dimen name="xlarge_text_size">30dp</dimen> <dimen name="xlarge_text_size">30sp</dimen>
<dimen name="large_text_size">24dp</dimen> <dimen name="large_text_size">24sp</dimen>
<dimen name="medium_text_size">20dp</dimen> <dimen name="medium_text_size">20sp</dimen>
<dimen name="small_text_size">18dp</dimen> <dimen name="small_text_size">18sp</dimen>
<dimen name="xsmall_text_size">14dp</dimen> <dimen name="xsmall_text_size">14sp</dimen>
<dimen name="language_text_size">30dp</dimen> <dimen name="language_text_size">30sp</dimen>
<dimen name="article_content_text_size">24dp</dimen> <dimen name="article_content_text_size">20sp</dimen>

View File

@ -166,7 +166,7 @@ public class AlbumListFragment extends Fragment
protected Long doInBackground(String... queryArr) protected Long doInBackground(String... queryArr)
{ {
albumArr = MainActivity.getInstance().albumDataSource.GetAllAlbumShortDataExceptHidden(); albumArr = BashgidApplication.albumDataSource.GetAllAlbumShortDataExceptHidden();
return (long) 0; return (long) 0;
} }
@ -181,7 +181,7 @@ public class AlbumListFragment extends Fragment
protected void onPostExecute(Long result) protected void onPostExecute(Long result)
{ {
Message completeMessage = MainActivity.getInstance().mainHandler.obtainMessage(MainActivity.DATABASE_GET_ALBUM_LIST_STATE_FINISHED, albumArr); Message completeMessage = BashgidApplication.mainHandler.obtainMessage(BashgidApplication.DATABASE_GET_ALBUM_LIST_STATE_FINISHED, albumArr);
completeMessage.sendToTarget(); completeMessage.sendToTarget();
} }

View File

@ -106,7 +106,7 @@ public class ArticleFragment extends Fragment
@Override @Override
public boolean onTouchEvent(final MotionEvent event, final MapView mapView) public boolean onTouchEvent(final MotionEvent event, final MapView mapView)
{ {
MainActivity.getInstance().SetLastArticleName(articleName); BashgidApplication.SetLastArticleName(articleName);
if (event.getAction() == MotionEvent.ACTION_UP) if (event.getAction() == MotionEvent.ACTION_UP)
{ {
@ -160,8 +160,6 @@ public class ArticleFragment extends Fragment
databaseGetArticleTask = new DatabaseGetArticleTask(); databaseGetArticleTask = new DatabaseGetArticleTask();
databaseGetArticleTask.mHandler = MainActivity.getInstance().mainHandler;
databaseGetArticleTask.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, articleName); databaseGetArticleTask.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, articleName);
} }
@ -394,7 +392,7 @@ public class ArticleFragment extends Fragment
TextView textView = (TextView) view.findViewById(R.id.dateTextView); TextView textView = (TextView) view.findViewById(R.id.dateTextView);
ImageView imageView = (ImageView) view.findViewById(R.id.imageView); ImageView imageView = (ImageView) view.findViewById(R.id.imageView);
PhotoRecordData photo = MainActivity.getInstance().photoDataSource.GetPhotoByImageUrl(articleLayout.get(position).value); PhotoRecordData photo = BashgidApplication.photoDataSource.GetPhotoByImageUrl(articleLayout.get(position).value);
//ImageManager.getInstance().ApplyImageToImageView(imageView, photo.imageUrl); //ImageManager.getInstance().ApplyImageToImageView(imageView, photo.imageUrl);
ImageManager.getInstance().ApplySmallImageToImageView(imageView, photo.imageUrl); ImageManager.getInstance().ApplySmallImageToImageView(imageView, photo.imageUrl);
@ -405,7 +403,7 @@ public class ArticleFragment extends Fragment
@Override @Override
public void onClick(View v) public void onClick(View v)
{ {
MainActivity.getInstance().SetLastArticleName(articleName); BashgidApplication.SetLastArticleName(articleName);
String albumName = article.albumArr.get(0).name; String albumName = article.albumArr.get(0).name;
@ -517,7 +515,7 @@ public class ArticleFragment extends Fragment
@Override @Override
public void onItemClick(it.sephiroth.android.library.widget.AdapterView<?> parent, View view, int innerPosition, long id) public void onItemClick(it.sephiroth.android.library.widget.AdapterView<?> parent, View view, int innerPosition, long id)
{ {
MainActivity.getInstance().SetLastArticleName(articleName); BashgidApplication.SetLastArticleName(articleName);
String albumName = article.albumArr.get(articleLayout.get(position).albumPos).name; String albumName = article.albumArr.get(articleLayout.get(position).albumPos).name;

View File

@ -0,0 +1,529 @@
package fishrungames.bashgid;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.Locale;
import fishrungames.bashgid.core.DatabaseDownloadTask;
import fishrungames.bashgid.core.NewsDownloadTask;
import fishrungames.bashgid.core.AlbumManager.AlbumFullData;
import fishrungames.bashgid.core.AlbumManager.AlbumShortData;
import fishrungames.bashgid.core.ArticleManager.ArticleFullData;
import fishrungames.bashgid.core.ArticleManager.ArticleShortData;
import fishrungames.bashgid.core.ChannelManager.ChannelFullData;
import fishrungames.bashgid.core.JournalManager.JournalRecordData;
import fishrungames.bashgid.core.JournalManager.JournalSemiFullData;
import fishrungames.bashgid.core.VideoManager.VideoRecordData;
import fishrungames.bashgid.core.db.AlbumDataSource;
import fishrungames.bashgid.core.db.ArticleDataSource;
import fishrungames.bashgid.core.db.BashgidSqliteHelper;
import fishrungames.bashgid.core.db.ChannelDataSource;
import fishrungames.bashgid.core.db.JournalDataSource;
import fishrungames.bashgid.core.db.PhotoDataSource;
import fishrungames.bashgid.core.db.TranslationDataSource;
import fishrungames.bashgid.core.db.VideoDataSource;
import fishrungames.networkutils.ContextHolder;
import fishrungames.networkutils.ImageDownloadTask;
import fishrungames.networkutils.ImageManager;
import android.content.Context;
import android.content.SharedPreferences;
import android.graphics.drawable.BitmapDrawable;
import android.os.AsyncTask;
import android.os.Bundle;
import android.os.Handler;
import android.os.Looper;
import android.os.Message;
import android.text.format.DateUtils;
public class BashgidApplication extends android.app.Application {
public static final String PREFS_MAIN = "PREFS_MAIN";
public static final int NEWS_DOWNLOADER_STATE_UPDATE = 10;
public static final int NEWS_DOWNLOADER_STATE_FINISHED = 11;
public static final int DATABASE_DOWNLOADER_STATE_UPDATE = 12;
public static final int DATABASE_DOWNLOADER_STATE_FINISHED = 13;
public static final int DATABASE_GET_ALBUM_STATE_UPDATE = 14;
public static final int DATABASE_GET_ALBUM_STATE_FINISHED = 15;
public static final int DATABASE_GET_ALBUM_LIST_STATE_UPDATE = 16;
public static final int DATABASE_GET_ALBUM_LIST_STATE_FINISHED = 17;
public static final int DATABASE_GET_ARTICLE_STATE_UPDATE = 18;
public static final int DATABASE_GET_ARTICLE_STATE_FINISHED = 19;
public static final int DATABASE_GET_JOURNAL_STATE_UPDATE = 20;
public static final int DATABASE_GET_JOURNAL_STATE_FINISHED = 21;
public static final int DATABASE_GET_CHANNEL_STATE_UPDATE = 22;
public static final int DATABASE_GET_CHANNEL_STATE_FINISHED = 23;
public static final int DATABASE_GET_VIDEO_STATE_UPDATE = 24;
public static final int DATABASE_GET_VIDEO_STATE_FINISHED = 25;
public static final int DATABASE_GET_JOURNAL_LIST_STATE_UPDATE = 26;
public static final int DATABASE_GET_JOURNAL_LIST_STATE_FINISHED = 27;
public static final int DATABASE_SEARCH_ARTICLE_STATE_UPDATE = 28;
public static final int DATABASE_SEARCH_ARTICLE_STATE_FINISHED = 29;
public static final int DATABASE_GET_GEO_JOURNAL_LIST_STATE_UPDATE = 30;
public static final int DATABASE_GET_GEO_JOURNAL_LIST_STATE_FINISHED = 31;
private static BashgidApplication instance = null;
public static final SimpleDateFormat iso8601Format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss", Locale.US);
private static ImageDownloadTask imageDownloadTask = null;
private static ArrayList<String> queuedImgUrlArr = new ArrayList<String>();
private static ArrayList<String> queuedImgHashArr = new ArrayList<String>();
public static Handler mainHandler;
public BashgidSqliteHelper dbHelper = null;
public static PhotoDataSource photoDataSource = null;
public static AlbumDataSource albumDataSource = null;
public static ArticleDataSource articleDataSource = null;
public static VideoDataSource videoDataSource = null;
public static ChannelDataSource channelDataSource = null;
public static JournalDataSource journalDataSource = null;
public static TranslationDataSource translationDataSource = null;
public static NewsDownloadTask newsDownloadTask = null;
public static DatabaseDownloadTask databaseDownloadTask = null;
public BashgidApplication() {
instance = this;
ImageManager.getInstance().PredefinedImageId.put("R.drawable.no_picture", R.drawable.no_picture);
ImageManager.PreferredEmptyPicture = "R.drawable.no_picture";
ImageManager.getInstance().alwaysUpdateImagesWithoutHash = false;
ContextHolder.setContext(instance);
dbHelper = new BashgidSqliteHelper(this);
photoDataSource = new PhotoDataSource(this, dbHelper);
albumDataSource = new AlbumDataSource(this, dbHelper);
articleDataSource = new ArticleDataSource(this, dbHelper);
videoDataSource = new VideoDataSource(this, dbHelper);
channelDataSource = new ChannelDataSource(this, dbHelper);
journalDataSource = new JournalDataSource(this, dbHelper);
translationDataSource = new TranslationDataSource(this, dbHelper);
mainHandler = new Handler(Looper.getMainLooper())
{
@Override
public void handleMessage(Message inputMessage)
{
switch (inputMessage.what)
{
case ImageDownloadTask.IMAGE_DOWNLOADER_STATE_UPDATE:
MainActivity.getInstance().UpdateOnImageDownloaded();
break;
case ImageDownloadTask.IMAGE_DOWNLOADER_STATE_FINISHED:
MainActivity.getInstance().UpdateOnImageDownloaded();
OnImageDownloaderStateFinished();
break;
case NEWS_DOWNLOADER_STATE_UPDATE:
SetNewsDownloadProgress((Integer)inputMessage.obj);
MainActivity.getInstance().UpdateOnNewsDownloaded((Integer)inputMessage.obj);
break;
case NEWS_DOWNLOADER_STATE_FINISHED:
MainActivity.getInstance().UpdateOnNewsDownloaded((Integer)inputMessage.obj);
newsDownloadTask = null;
break;
case DATABASE_DOWNLOADER_STATE_UPDATE:
MainActivity.getInstance().UpdateOnDatabaseDownloaded((Integer)inputMessage.obj);
break;
case DATABASE_DOWNLOADER_STATE_FINISHED:
MainActivity.getInstance().UpdateOnDatabaseDownloaded((Integer)inputMessage.obj);
databaseDownloadTask = null;
break;
case DATABASE_GET_JOURNAL_STATE_UPDATE:
case DATABASE_GET_JOURNAL_STATE_FINISHED:
final JournalSemiFullData journal = (JournalSemiFullData) inputMessage.obj;
MainActivity.getInstance().UpdateOnJournalLoaded(journal);
break;
case DATABASE_GET_JOURNAL_LIST_STATE_UPDATE:
case DATABASE_GET_JOURNAL_LIST_STATE_FINISHED:
MainActivity.getInstance().UpdateOnJournalListLoaded((ArrayList<JournalSemiFullData>) inputMessage.obj);
break;
case DATABASE_GET_ALBUM_STATE_UPDATE:
case DATABASE_GET_ALBUM_STATE_FINISHED:
MainActivity.getInstance().UpdateOnAlbumLoaded((AlbumFullData) inputMessage.obj);
break;
case DATABASE_GET_ALBUM_LIST_STATE_UPDATE:
case DATABASE_GET_ALBUM_LIST_STATE_FINISHED:
ArrayList<AlbumShortData> albumShortList = (ArrayList<AlbumShortData>) inputMessage.obj;
MainActivity.getInstance().UpdateOnAlbumListLoaded(albumShortList);
break;
case DATABASE_GET_ARTICLE_STATE_UPDATE:
case DATABASE_GET_ARTICLE_STATE_FINISHED:
MainActivity.getInstance().UpdateOnArticleLoaded((ArticleFullData) inputMessage.obj);
break;
case DATABASE_GET_CHANNEL_STATE_UPDATE:
case DATABASE_GET_CHANNEL_STATE_FINISHED:
MainActivity.getInstance().UpdateOnChannelLoaded((ChannelFullData) inputMessage.obj);
break;
case DATABASE_GET_VIDEO_STATE_UPDATE:
case DATABASE_GET_VIDEO_STATE_FINISHED:
MainActivity.getInstance().UpdateOnVideoLoaded((VideoRecordData) inputMessage.obj);
break;
case DATABASE_SEARCH_ARTICLE_STATE_UPDATE:
case DATABASE_SEARCH_ARTICLE_STATE_FINISHED:
MainActivity.getInstance().UpdateOnArticleSearchPerformed((ArrayList<ArticleShortData>) inputMessage.obj);
break;
case DATABASE_GET_GEO_JOURNAL_LIST_STATE_UPDATE:
case DATABASE_GET_GEO_JOURNAL_LIST_STATE_FINISHED:
MainActivity.getInstance().UpdateOnGeoJournalListLoaded((ArrayList<JournalRecordData>) inputMessage.obj);
break;
default:
super.handleMessage(inputMessage);
}
}
};
}
public static Context getContext() {
return instance;
}
public static void OnImageDownloaderStateFinished()
{
imageDownloadTask = null;
DownloadRestImageArr();
}
public static void DownloadImageArr(String[] imageUrlArr, String[] imageHashArr)
{
synchronized(queuedImgUrlArr)
{
for (int i = 0; i < imageUrlArr.length; i++)
{
queuedImgUrlArr.add(imageUrlArr[i]);
if (imageHashArr[i] == null)
{
queuedImgHashArr.add("");
}
else
{
queuedImgHashArr.add(imageHashArr[i]);
}
}
}
if (imageDownloadTask == null)
{
DownloadRestImageArr();
}
}
public static void DownloadRestImageArr()
{
synchronized(queuedImgUrlArr)
{
if (queuedImgUrlArr.size() > 0)
{
imageDownloadTask = new ImageDownloadTask();
imageDownloadTask.mHandler = mainHandler;
Bundle innerQuery = new Bundle();
String[] imageUrlArr = queuedImgUrlArr.toArray(new String[queuedImgUrlArr.size()]);
String[] imageHashArr = queuedImgHashArr.toArray(new String[queuedImgHashArr.size()]);
innerQuery.putStringArray("imageUrlArr", imageUrlArr);
innerQuery.putStringArray("imageHashArr", imageHashArr);
queuedImgUrlArr.clear();
queuedImgHashArr.clear();
imageDownloadTask.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, innerQuery);
}
}
}
public static void DownloadImage(String imageUrl, String imageHash)
{
DownloadImageArr(new String[] { imageUrl }, new String[] { imageHash });
}
public static void CancelDownloadDatabaseTask()
{
if (databaseDownloadTask != null)
{
databaseDownloadTask.cancel(false);
databaseDownloadTask = null;
}
MainActivity.getInstance().UpdateOnDatabaseDownloaded(0);
}
public static void DownloadDatabase()
{
if (databaseDownloadTask != null)
{
return;
}
databaseDownloadTask = new DatabaseDownloadTask();
databaseDownloadTask.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
}
public static void CancelDownloadNewsTask()
{
if (newsDownloadTask != null)
{
newsDownloadTask.cancel(false);
newsDownloadTask = null;
}
MainActivity.getInstance().UpdateOnNewsDownloaded(0);
}
public static void StartDownloadNewsTask()
{
if (newsDownloadTask != null)
{
return;
}
newsDownloadTask = new NewsDownloadTask();
newsDownloadTask.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
}
public static void SetLastAlbumName(String lastAlbumName)
{
SharedPreferences settings = instance.getSharedPreferences(PREFS_MAIN, 0);
SharedPreferences.Editor editor = settings.edit();
editor.putString("lastAlbumName", lastAlbumName);
editor.commit();
}
public static String GetLastAlbumName()
{
SharedPreferences settings = instance.getSharedPreferences(PREFS_MAIN, 0);
return settings.getString("lastAlbumName", "");
}
public static void SetLastChannelName(String lastChannelName)
{
SharedPreferences settings = instance.getSharedPreferences(PREFS_MAIN, 0);
SharedPreferences.Editor editor = settings.edit();
editor.putString("lastChannelName", lastChannelName);
editor.commit();
}
public static String GetLastChannelName()
{
SharedPreferences settings = instance.getSharedPreferences(PREFS_MAIN, 0);
return settings.getString("lastChannelName", "");
}
public static void SetLastArticleName(String lastArticleName)
{
SharedPreferences settings = instance.getSharedPreferences(PREFS_MAIN, 0);
SharedPreferences.Editor editor = settings.edit();
editor.putString("lastArticleName", lastArticleName);
editor.commit();
}
public static String GetLastArticleName()
{
SharedPreferences settings = instance.getSharedPreferences(PREFS_MAIN, 0);
return settings.getString("lastArticleName", "");
}
public static void SetLastJournalName(String lastJournalName)
{
SharedPreferences settings = instance.getSharedPreferences(PREFS_MAIN, 0);
SharedPreferences.Editor editor = settings.edit();
editor.putString("lastJournalName", lastJournalName);
editor.commit();
}
public static String GetLastJournalName()
{
SharedPreferences settings = instance.getSharedPreferences(PREFS_MAIN, 0);
return settings.getString("lastJournalName", "");
}
public static void SetLastJournalTitle(String lastJournalTitle)
{
SharedPreferences settings = instance.getSharedPreferences(PREFS_MAIN, 0);
SharedPreferences.Editor editor = settings.edit();
editor.putString("lastJournalTitle", lastJournalTitle);
editor.commit();
}
public static String GetLastJournalTitle()
{
SharedPreferences settings = instance.getSharedPreferences(PREFS_MAIN, 0);
return settings.getString("lastJournalTitle", "");
}
public static void SetLastSearchQuery(String searchQuery)
{
SharedPreferences settings = instance.getSharedPreferences(PREFS_MAIN, 0);
SharedPreferences.Editor editor = settings.edit();
editor.putString("searchQuery", searchQuery);
editor.commit();
}
public static String GetLastSearchQuery()
{
SharedPreferences settings = instance.getSharedPreferences(PREFS_MAIN, 0);
return settings.getString("searchQuery", "");
}
public static void SetLastMapFilterName(String lastMapFilterName)
{
SharedPreferences settings = instance.getSharedPreferences(PREFS_MAIN, 0);
SharedPreferences.Editor editor = settings.edit();
editor.putString("lastMapFilterName", lastMapFilterName);
editor.commit();
}
public static String GetLastMapFilterName()
{
SharedPreferences settings = instance.getSharedPreferences(PREFS_MAIN, 0);
return settings.getString("lastMapFilterName", "");
}
public static void SetNewsDownloadProgress(int newsDownloadProgress)
{
SharedPreferences settings = instance.getSharedPreferences(PREFS_MAIN, 0);
SharedPreferences.Editor editor = settings.edit();
editor.putInt("newsDownloadProgress", newsDownloadProgress);
editor.commit();
}
public static int GetNewsDownloadProgress()
{
SharedPreferences settings = instance.getSharedPreferences(PREFS_MAIN, 0);
return settings.getInt("newsDownloadProgress", 0);
}
public static void SetDatabaseDownloadProgress(int databaseDownloadProgress)
{
SharedPreferences settings = instance.getSharedPreferences(PREFS_MAIN, 0);
SharedPreferences.Editor editor = settings.edit();
editor.putInt("databaseDownloadProgress", databaseDownloadProgress);
editor.commit();
}
public static int GetDatabaseDownloadProgress()
{
SharedPreferences settings = instance.getSharedPreferences(PREFS_MAIN, 0);
return settings.getInt("databaseDownloadProgress", 0);
}
public static void SetLastLanguage(int lastLanguage) //0 russian, 1 english, 2 chinese
{
SharedPreferences settings = instance.getSharedPreferences(PREFS_MAIN, 0);
SharedPreferences.Editor editor = settings.edit();
editor.putInt("lastLanguage", lastLanguage);
editor.commit();
}
public static int GetLastLanguage()
{
SharedPreferences settings = instance.getSharedPreferences(PREFS_MAIN, 0);
return settings.getInt("lastLanguage", 0);
}
public static String DateFormattedForLocale(Date date)
{
return DateUtils.formatDateTime(instance, date.getTime(), DateUtils.FORMAT_ABBREV_ALL | DateUtils.FORMAT_SHOW_DATE | DateUtils.FORMAT_SHOW_TIME | DateUtils.FORMAT_SHOW_YEAR);
}
}

View File

@ -210,7 +210,7 @@ public class CatalogFragment extends Fragment
@Override @Override
public void onClick(View v) public void onClick(View v)
{ {
MainActivity.getInstance().OpenJournalScreen(journalList.get(position).name, MainActivity.TAG_BACK_TO_CATALOGFRAGMENT); MainActivity.getInstance().OpenJournalScreen(false, journalList.get(position).name, MainActivity.TAG_BACK_TO_CATALOGFRAGMENT);
} }
}); });
@ -220,7 +220,7 @@ public class CatalogFragment extends Fragment
@Override @Override
public void onClick(View v) public void onClick(View v)
{ {
MainActivity.getInstance().OpenJournalScreen(journalList.get(position).name, MainActivity.TAG_BACK_TO_CATALOGFRAGMENT); MainActivity.getInstance().OpenJournalScreen(false, journalList.get(position).name, MainActivity.TAG_BACK_TO_CATALOGFRAGMENT);
} }
}); });

View File

@ -89,13 +89,13 @@ public class JournalFragment extends Fragment
@Override @Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) public void onItemClick(AdapterView<?> parent, View view, int position, long id)
{ {
MainActivity.getInstance().SetLastJournalName(journalName); BashgidApplication.SetLastJournalName(journalName);
if (position == 0) if (position == 0)
{ {
if (journal.geoCategory == 1) if (journal.geoCategory == 1)
{ {
MainActivity.getInstance().OpenMapScreen(journalName, MainActivity.TAG_BACK_TO_JOURNALFRAGMENT); MainActivity.getInstance().OpenMapScreen(false, journalName, MainActivity.TAG_BACK_TO_JOURNALFRAGMENT);
} }
} }
else else
@ -225,8 +225,11 @@ public class JournalFragment extends Fragment
TextView dateTextView = (TextView)view.findViewById(R.id.dateTextView); TextView dateTextView = (TextView)view.findViewById(R.id.dateTextView);
dateTextView.setText(journal.articleArr.get(position).dateTime.toString()); //datiiiiieTextView.setText(journal.articleArr.get(position).dateTime.toString());
dateTextView.setText(BashgidApplication.DateFormattedForLocale(journal.articleArr.get(position).dateTime));
ImageView imageView = (ImageView) view.findViewById(R.id.imageView); ImageView imageView = (ImageView) view.findViewById(R.id.imageView);
if (journal.articleArr.get(position).previewImageUrl != null) if (journal.articleArr.get(position).previewImageUrl != null)

File diff suppressed because it is too large Load Diff

View File

@ -73,13 +73,13 @@ public class MainPageFragment extends Fragment
newsDownloadProgressBar.setVisibility(View.VISIBLE); newsDownloadProgressBar.setVisibility(View.VISIBLE);
newsDownloadProgressBar.setProgress(MainActivity.getInstance().GetNewsDownloadProgress()); newsDownloadProgressBar.setProgress(BashgidApplication.GetNewsDownloadProgress());
databaseDownloadProgressBar = (ProgressBar) header.findViewById(R.id.databaseDownloadProgressBar); databaseDownloadProgressBar = (ProgressBar) header.findViewById(R.id.databaseDownloadProgressBar);
databaseDownloadProgressBar.setVisibility(View.VISIBLE); databaseDownloadProgressBar.setVisibility(View.VISIBLE);
databaseDownloadProgressBar.setProgress(MainActivity.getInstance().GetDatabaseDownloadProgress()); databaseDownloadProgressBar.setProgress(BashgidApplication.GetDatabaseDownloadProgress());
Button moreNewsButton = (Button) header.findViewById(R.id.moreNewsButton); Button moreNewsButton = (Button) header.findViewById(R.id.moreNewsButton);
@ -89,7 +89,7 @@ public class MainPageFragment extends Fragment
@Override @Override
public void onClick(View v) public void onClick(View v)
{ {
MainActivity.getInstance().OpenNewsScreen(); MainActivity.getInstance().OpenNewsScreen(false);
} }
}); });
@ -131,8 +131,8 @@ public class MainPageFragment extends Fragment
@Override @Override
public void onClick(View v) public void onClick(View v)
{ {
MainActivity.getInstance().CancelDownloadDatabaseTask(); BashgidApplication.CancelDownloadDatabaseTask();
MainActivity.getInstance().DownloadDatabase(); BashgidApplication.DownloadDatabase();
} }
}); });
@ -144,16 +144,16 @@ public class MainPageFragment extends Fragment
@Override @Override
public void onClick(View v) public void onClick(View v)
{ {
MainActivity.getInstance().CancelDownloadNewsTask(); BashgidApplication.CancelDownloadNewsTask();
MainActivity.getInstance().StartDownloadNewsTask(); BashgidApplication.StartDownloadNewsTask();
} }
}); });
RestoreJournalListFromDatabase(); RestoreJournalListFromDatabase();
RestoreNewsFromDatabase(); RestoreNewsFromDatabase();
MainActivity.getInstance().StartDownloadNewsTask(); BashgidApplication.StartDownloadNewsTask();
MainActivity.getInstance().DownloadDatabase(); BashgidApplication.DownloadDatabase();
return rootView; return rootView;
} }
@ -409,7 +409,7 @@ public class MainPageFragment extends Fragment
{ {
databaseGetJournalTask.cancel(false); databaseGetJournalTask.cancel(false);
} }
MainActivity.getInstance().OpenJournalScreen(journalList.get(position).name, MainActivity.TAG_BACK_TO_MAINFRAGMENT); MainActivity.getInstance().OpenJournalScreen(false, journalList.get(position).name, MainActivity.TAG_BACK_TO_MAINFRAGMENT);
} }
}); });
@ -422,7 +422,7 @@ public class MainPageFragment extends Fragment
{ {
databaseGetJournalTask.cancel(false); databaseGetJournalTask.cancel(false);
} }
MainActivity.getInstance().OpenJournalScreen(journalList.get(position).name, MainActivity.TAG_BACK_TO_MAINFRAGMENT); MainActivity.getInstance().OpenJournalScreen(false, journalList.get(position).name, MainActivity.TAG_BACK_TO_MAINFRAGMENT);
} }
}); });

View File

@ -129,7 +129,7 @@ public class MainPageHListViewAdapters
textView.setText(journal.articleArr.get(position).title); textView.setText(journal.articleArr.get(position).title);
subTextView.setText(MainActivity.getInstance().DateFormattedForLocale(journal.articleArr.get(position).dateTime)); subTextView.setText(BashgidApplication.DateFormattedForLocale(journal.articleArr.get(position).dateTime));
String imageUrl = journal.articleArr.get(position).previewImageUrl; String imageUrl = journal.articleArr.get(position).previewImageUrl;

View File

@ -94,7 +94,8 @@ public class NavigationDrawerFragment extends Fragment
} }
// Select either the default item (0) or the last selected item. // Select either the default item (0) or the last selected item.
selectItem(mCurrentSelectedPosition); selectItemFromStart(mCurrentSelectedPosition);
} }
@ -252,7 +253,24 @@ public class NavigationDrawerFragment extends Fragment
} }
if (mCallbacks != null) if (mCallbacks != null)
{ {
mCallbacks.onNavigationDrawerItemSelected(position); mCallbacks.onNavigationDrawerItemSelected(position, false);
}
}
private void selectItemFromStart(int position)
{
mCurrentSelectedPosition = position;
if (mDrawerListView != null)
{
mDrawerListView.setItemChecked(position, true);
}
if (mDrawerLayout != null)
{
mDrawerLayout.closeDrawer(mFragmentContainerView);
}
if (mCallbacks != null)
{
mCallbacks.onNavigationDrawerItemSelected(position, true);
} }
} }
@ -351,7 +369,7 @@ public class NavigationDrawerFragment extends Fragment
/** /**
* Called when an item in the navigation drawer is selected. * Called when an item in the navigation drawer is selected.
*/ */
void onNavigationDrawerItemSelected(int position); void onNavigationDrawerItemSelected(int position, boolean fromSavedInstanceState);
} }
public class DrawerAdapter extends BaseAdapter public class DrawerAdapter extends BaseAdapter

View File

@ -64,7 +64,7 @@ public class NewsListFragment extends Fragment
newsDownloadProgressBar.setVisibility(View.VISIBLE); newsDownloadProgressBar.setVisibility(View.VISIBLE);
newsDownloadProgressBar.setProgress(MainActivity.getInstance().GetNewsDownloadProgress()); newsDownloadProgressBar.setProgress(BashgidApplication.GetNewsDownloadProgress());
View footer = inflater.inflate(R.layout.news_page_list_footer, null); View footer = inflater.inflate(R.layout.news_page_list_footer, null);
@ -107,13 +107,13 @@ public class NewsListFragment extends Fragment
@Override @Override
public void onClick(View v) public void onClick(View v)
{ {
MainActivity.getInstance().CancelDownloadNewsTask(); BashgidApplication.CancelDownloadNewsTask();
MainActivity.getInstance().StartDownloadNewsTask(); BashgidApplication.StartDownloadNewsTask();
} }
}); });
RestoreNewsFromDatabase(); RestoreNewsFromDatabase();
MainActivity.getInstance().StartDownloadNewsTask(); BashgidApplication.StartDownloadNewsTask();
return rootView; return rootView;
} }

View File

@ -222,7 +222,7 @@ public class OsmMapHolderFragment extends Fragment
{ {
if (journalName != null && journalName.length() > 0) if (journalName != null && journalName.length() > 0)
{ {
MainActivity.getInstance().SetLastMapFilterName(journalName); BashgidApplication.SetLastMapFilterName(journalName);
MainActivity.getInstance().OpenArticleScreen(mArticles.get(index), MainActivity.TAG_BACK_TO_MAPFRAGMENT); MainActivity.getInstance().OpenArticleScreen(mArticles.get(index), MainActivity.TAG_BACK_TO_MAPFRAGMENT);
} else } else
{ {
@ -468,7 +468,7 @@ public class OsmMapHolderFragment extends Fragment
databaseGetArticleTask = new DatabaseGetArticleTask(); databaseGetArticleTask = new DatabaseGetArticleTask();
databaseGetArticleTask.mHandler = MainActivity.getInstance().mainHandler; //databaseGetArticleTask.mHandler = MainActivity.getInstance().mainHandler;
databaseGetArticleTask.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, filter); databaseGetArticleTask.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, filter);
@ -484,7 +484,7 @@ public class OsmMapHolderFragment extends Fragment
databaseGetGeoJournalListTask = new DatabaseGetGeoJournalListTask(); databaseGetGeoJournalListTask = new DatabaseGetGeoJournalListTask();
databaseGetGeoJournalListTask.mHandler = MainActivity.getInstance().mainHandler; //databaseGetGeoJournalListTask.mHandler = MainActivity.getInstance().mainHandler;
databaseGetGeoJournalListTask.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR); databaseGetGeoJournalListTask.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);

View File

@ -79,7 +79,7 @@ public class PhotoAlbumFragment extends Fragment
@Override @Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) public void onItemClick(AdapterView<?> parent, View view, int position, long id)
{ {
MainActivity.getInstance().SetLastAlbumName(albumName); BashgidApplication.SetLastAlbumName(albumName);
MainActivity.getInstance().OpenPhotoScreen(album, position, MainActivity.TAG_BACK_TO_ALBUMFRAGMENT); MainActivity.getInstance().OpenPhotoScreen(album, position, MainActivity.TAG_BACK_TO_ALBUMFRAGMENT);
} }
@ -134,7 +134,7 @@ public class PhotoAlbumFragment extends Fragment
{ {
databaseGetAlbumTask = new DatabaseGetAlbumTask(); databaseGetAlbumTask = new DatabaseGetAlbumTask();
databaseGetAlbumTask.mHandler = MainActivity.getInstance().mainHandler; //databaseGetAlbumTask.mHandler = MainActivity.getInstance().mainHandler;
databaseGetAlbumTask.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, albumName); databaseGetAlbumTask.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, albumName);
} }

View File

@ -104,7 +104,7 @@ public class PhotoFragment extends Fragment
{ {
databaseGetAlbumTask = new DatabaseGetAlbumTask(); databaseGetAlbumTask = new DatabaseGetAlbumTask();
databaseGetAlbumTask.mHandler = MainActivity.getInstance().mainHandler; //databaseGetAlbumTask.mHandler = MainActivity.getInstance().mainHandler;
databaseGetAlbumTask.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, albumName); databaseGetAlbumTask.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, albumName);
} }

View File

@ -170,10 +170,10 @@ public class SearchFragment extends Fragment
public void onItemClick(AdapterView<?> parent, View view, int position, long id) public void onItemClick(AdapterView<?> parent, View view, int position, long id)
{ {
MainActivity.getInstance().SetLastJournalName(journalName); BashgidApplication.SetLastJournalName(journalName);
MainActivity.getInstance().SetLastJournalTitle(journalTitle); BashgidApplication.SetLastJournalTitle(journalTitle);
MainActivity.getInstance().SetLastSearchQuery(query); BashgidApplication.SetLastSearchQuery(query);
MainActivity.getInstance().OpenArticleScreen(searchResultArr.get(position - 1).name, MainActivity.TAG_BACK_TO_SEARCHFRAGMENT); MainActivity.getInstance().OpenArticleScreen(searchResultArr.get(position - 1).name, MainActivity.TAG_BACK_TO_SEARCHFRAGMENT);
} }
}); });
@ -208,7 +208,7 @@ public class SearchFragment extends Fragment
databaseSearchArticleTask = new DatabaseSearchArticleTask(); databaseSearchArticleTask = new DatabaseSearchArticleTask();
databaseSearchArticleTask.mHandler = MainActivity.getInstance().mainHandler; //databaseSearchArticleTask.mHandler = MainActivity.getInstance().mainHandler;
Bundle bundle = new Bundle(); Bundle bundle = new Bundle();
@ -305,7 +305,10 @@ public class SearchFragment extends Fragment
TextView dateTextView = (TextView) view.findViewById(R.id.dateTextView); TextView dateTextView = (TextView) view.findViewById(R.id.dateTextView);
dateTextView.setText(MainActivity.iso8601Format.format(searchResultArr.get(position).dateTime)); //dateTextView.setText(MainActivity.iso8601Format.format(searchResultArr.get(position).dateTime));
//dateTextView.setText(MainActivity.iso8601Format.format(searchResultArr.get(position).dateTime));
dateTextView.setText(BashgidApplication.DateFormattedForLocale(searchResultArr.get(position).dateTime));
ImageView imageView = (ImageView) view.findViewById(R.id.imageView); ImageView imageView = (ImageView) view.findViewById(R.id.imageView);

View File

@ -34,4 +34,5 @@ protected void onMeasure(int width, int height) {
}*/ }*/
} }
} }

View File

@ -42,6 +42,7 @@ public class VideoListFragment extends Fragment
public VideoListFragment() public VideoListFragment()
{ {
this.channelName = "";
} }
public VideoListFragment(String channelName) public VideoListFragment(String channelName)
@ -85,7 +86,7 @@ public class VideoListFragment extends Fragment
public void onItemClick(AdapterView<?> parent, View view, int position, long id) public void onItemClick(AdapterView<?> parent, View view, int position, long id)
{ {
MainActivity.getInstance().SetLastChannelName(channelName); BashgidApplication.SetLastChannelName(channelName);
MainActivity.getInstance().OpenVideoRecordScreen(channelFullData.videoRecordArr.get(position)); MainActivity.getInstance().OpenVideoRecordScreen(channelFullData.videoRecordArr.get(position));
} }
@ -141,7 +142,7 @@ public class VideoListFragment extends Fragment
databaseGetChannelTask = new DatabaseGetChannelTask(); databaseGetChannelTask = new DatabaseGetChannelTask();
databaseGetChannelTask.mHandler = MainActivity.getInstance().mainHandler; //databaseGetChannelTask.mHandler = MainActivity.getInstance().mainHandler;
databaseGetChannelTask.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, channelName); databaseGetChannelTask.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, channelName);
} }
@ -180,20 +181,20 @@ public class VideoListFragment extends Fragment
ChannelFullData channel = null; ChannelFullData channel = null;
public Handler mHandler; //public Handler mHandler;
protected Long doInBackground(String... queryArr) protected Long doInBackground(String... queryArr)
{ {
String channelName = queryArr[0]; String channelName = queryArr[0];
channel = MainActivity.getInstance().channelDataSource.GetChannelFullData(channelName); channel = BashgidApplication.channelDataSource.GetChannelFullData(channelName);
return (long) 0; return (long) 0;
} }
protected void onProgressUpdate(Integer... progress) protected void onProgressUpdate(Integer... progress)
{ {
Message completeMessage = mHandler.obtainMessage(MainActivity.DATABASE_GET_CHANNEL_STATE_UPDATE, channel); Message completeMessage = BashgidApplication.mainHandler.obtainMessage(BashgidApplication.DATABASE_GET_CHANNEL_STATE_UPDATE, channel);
completeMessage.sendToTarget(); completeMessage.sendToTarget();
@ -201,7 +202,7 @@ public class VideoListFragment extends Fragment
protected void onPostExecute(Long result) protected void onPostExecute(Long result)
{ {
Message completeMessage = mHandler.obtainMessage(MainActivity.DATABASE_GET_CHANNEL_STATE_FINISHED, channel); Message completeMessage = BashgidApplication.mainHandler.obtainMessage(BashgidApplication.DATABASE_GET_CHANNEL_STATE_FINISHED, channel);
completeMessage.sendToTarget(); completeMessage.sendToTarget();
} }

View File

@ -108,7 +108,7 @@ public class VideoRecordFragment extends Fragment
databaseGetVideoTask = new DatabaseGetVideoTask(); databaseGetVideoTask = new DatabaseGetVideoTask();
databaseGetVideoTask.mHandler = MainActivity.getInstance().mainHandler; //databaseGetVideoTask.mHandler = BashgidApplication.mainHandler;
databaseGetVideoTask.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, videoUrl); databaseGetVideoTask.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, videoUrl);
} }
@ -159,20 +159,20 @@ public class VideoRecordFragment extends Fragment
VideoRecordData recordData = null; VideoRecordData recordData = null;
public Handler mHandler; //public Handler mHandler;
protected Long doInBackground(String... queryArr) protected Long doInBackground(String... queryArr)
{ {
String videoUrl = queryArr[0]; String videoUrl = queryArr[0];
recordData = MainActivity.getInstance().videoDataSource.GetVideoByVideoUrl(videoUrl); recordData = BashgidApplication.videoDataSource.GetVideoByVideoUrl(videoUrl);
return (long) 0; return (long) 0;
} }
protected void onProgressUpdate(Integer... progress) protected void onProgressUpdate(Integer... progress)
{ {
Message completeMessage = mHandler.obtainMessage(MainActivity.DATABASE_GET_VIDEO_STATE_UPDATE, recordData); Message completeMessage = BashgidApplication.mainHandler.obtainMessage(BashgidApplication.DATABASE_GET_VIDEO_STATE_UPDATE, recordData);
completeMessage.sendToTarget(); completeMessage.sendToTarget();
@ -180,7 +180,7 @@ public class VideoRecordFragment extends Fragment
protected void onPostExecute(Long result) protected void onPostExecute(Long result)
{ {
Message completeMessage = mHandler.obtainMessage(MainActivity.DATABASE_GET_VIDEO_STATE_FINISHED, recordData); Message completeMessage = BashgidApplication.mainHandler.obtainMessage(BashgidApplication.DATABASE_GET_VIDEO_STATE_FINISHED, recordData);
completeMessage.sendToTarget(); completeMessage.sendToTarget();
} }

View File

@ -3,6 +3,7 @@ package fishrungames.bashgid.core;
import java.util.ArrayList; import java.util.ArrayList;
import fishrungames.bashgid.BashgidApplication;
import fishrungames.bashgid.MainActivity; import fishrungames.bashgid.MainActivity;
import fishrungames.bashgid.core.ArticleManager.ArticleRecordData; import fishrungames.bashgid.core.ArticleManager.ArticleRecordData;
import fishrungames.bashgid.core.ChannelManager.ChannelRecordData; import fishrungames.bashgid.core.ChannelManager.ChannelRecordData;
@ -73,19 +74,19 @@ public class AlbumManager
public static void DownloadAndAddPhoto(PhotoRecordData recordData) public static void DownloadAndAddPhoto(PhotoRecordData recordData)
{ {
MainActivity.getInstance().DownloadImage(recordData.imageUrl, recordData.imageHash); BashgidApplication.DownloadImage(recordData.imageUrl, recordData.imageHash);
MainActivity.getInstance().photoDataSource.AddOrReplacePhoto(recordData); BashgidApplication.photoDataSource.AddOrReplacePhoto(recordData);
} }
public static void AddExistingPhotoToAlbum(String imageUrl, String albumName) public static void AddExistingPhotoToAlbum(String imageUrl, String albumName)
{ {
if (!MainActivity.getInstance().albumDataSource.IsAlbumAlreadyExist(albumName)) if (!BashgidApplication.albumDataSource.IsAlbumAlreadyExist(albumName))
{ {
MainActivity.getInstance().albumDataSource.CreateNewAlbum(new AlbumRecordData(albumName, albumName, "", 1)); BashgidApplication.albumDataSource.CreateNewAlbum(new AlbumRecordData(albumName, albumName, "", 1));
} }
MainActivity.getInstance().albumDataSource.AddPhotoToAlbum(imageUrl, albumName); BashgidApplication.albumDataSource.AddPhotoToAlbum(imageUrl, albumName);
} }
@ -99,20 +100,20 @@ public class AlbumManager
public static void AddNewVideo(VideoRecordData recordData) public static void AddNewVideo(VideoRecordData recordData)
{ {
MainActivity.getInstance().DownloadImage(recordData.previewImageUrl, recordData.previewImageHash); BashgidApplication.DownloadImage(recordData.previewImageUrl, recordData.previewImageHash);
MainActivity.getInstance().videoDataSource.AddOrReplaceVideo(recordData); BashgidApplication.videoDataSource.AddOrReplaceVideo(recordData);
} }
public static void AddExistingVideoToChannel(String videoUrl, String channelName) public static void AddExistingVideoToChannel(String videoUrl, String channelName)
{ {
if (!MainActivity.getInstance().channelDataSource.IsChannelAlreadyExist(channelName)) if (!BashgidApplication.channelDataSource.IsChannelAlreadyExist(channelName))
{ {
MainActivity.getInstance().channelDataSource.CreateNewChannel(new ChannelRecordData(channelName, channelName, "", 1)); BashgidApplication.channelDataSource.CreateNewChannel(new ChannelRecordData(channelName, channelName, "", 1));
} }
MainActivity.getInstance().channelDataSource.AddVideoToChannel(videoUrl, channelName); BashgidApplication.channelDataSource.AddVideoToChannel(videoUrl, channelName);
} }
@ -126,18 +127,18 @@ public class AlbumManager
public static void AddNewArticle(ArticleRecordData recordData) public static void AddNewArticle(ArticleRecordData recordData)
{ {
MainActivity.getInstance().articleDataSource.CreateNewArticle(recordData); BashgidApplication.articleDataSource.CreateNewArticle(recordData);
} }
public static void AddExistingArticleToJournal(String articleName, String journalName) public static void AddExistingArticleToJournal(String articleName, String journalName)
{ {
if (!MainActivity.getInstance().journalDataSource.IsJournalAlreadyExist(journalName)) if (!BashgidApplication.journalDataSource.IsJournalAlreadyExist(journalName))
{ {
MainActivity.getInstance().journalDataSource.CreateNewJournal(new JournalRecordData(journalName, journalName, "", 1, 0, 0)); BashgidApplication.journalDataSource.CreateNewJournal(new JournalRecordData(journalName, journalName, "", 1, 0, 0));
} }
MainActivity.getInstance().journalDataSource.AddArticleToJournal(articleName, journalName); BashgidApplication.journalDataSource.AddArticleToJournal(articleName, journalName);
} }
public static void AddNewArticleToJournal(ArticleRecordData recordData, String journalName) public static void AddNewArticleToJournal(ArticleRecordData recordData, String journalName)

View File

@ -25,6 +25,7 @@ import android.database.DatabaseUtils;
import android.os.Bundle; import android.os.Bundle;
import android.os.Message; import android.os.Message;
import android.util.Log; import android.util.Log;
import fishrungames.bashgid.BashgidApplication;
import fishrungames.bashgid.MainActivity; import fishrungames.bashgid.MainActivity;
import fishrungames.bashgid.core.AlbumManager.AlbumRecordData; import fishrungames.bashgid.core.AlbumManager.AlbumRecordData;
import fishrungames.bashgid.core.ArticleManager.ArticleRecordData; import fishrungames.bashgid.core.ArticleManager.ArticleRecordData;
@ -148,7 +149,7 @@ public class DatabaseDownloadTask extends SimpleAsyncTask
protected void onProgressUpdate(Integer... progress) protected void onProgressUpdate(Integer... progress)
{ {
Message completeMessage = MainActivity.getInstance().mainHandler.obtainMessage(MainActivity.DATABASE_DOWNLOADER_STATE_UPDATE, progress[0]); Message completeMessage = BashgidApplication.mainHandler.obtainMessage(BashgidApplication.DATABASE_DOWNLOADER_STATE_UPDATE, progress[0]);
completeMessage.sendToTarget(); completeMessage.sendToTarget();
@ -156,7 +157,7 @@ public class DatabaseDownloadTask extends SimpleAsyncTask
protected void onPostExecute(Long result) protected void onPostExecute(Long result)
{ {
Message completeMessage = MainActivity.getInstance().mainHandler.obtainMessage(MainActivity.DATABASE_DOWNLOADER_STATE_FINISHED, 100); Message completeMessage = BashgidApplication.mainHandler.obtainMessage(BashgidApplication.DATABASE_DOWNLOADER_STATE_FINISHED, 100);
completeMessage.sendToTarget(); completeMessage.sendToTarget();
} }
@ -249,9 +250,9 @@ public class DatabaseDownloadTask extends SimpleAsyncTask
double geoLat = jObject.getDouble("geoLat"); double geoLat = jObject.getDouble("geoLat");
double geoLon = jObject.getDouble("geoLon"); double geoLon = jObject.getDouble("geoLon");
MainActivity.getInstance().photoDataSource.AddOrReplacePhoto(new PhotoRecordData(title, description, imageUrl, imageHash, geoLat, geoLon)); BashgidApplication.photoDataSource.AddOrReplacePhoto(new PhotoRecordData(title, description, imageUrl, imageHash, geoLat, geoLon));
MainActivity.getInstance().DownloadImage(imageUrl, imageHash); BashgidApplication.DownloadImage(imageUrl, imageHash);
} // End Loop } // End Loop
@ -277,7 +278,7 @@ public class DatabaseDownloadTask extends SimpleAsyncTask
String description = DatabaseDownloadTask.sqlEscapeString(jObject.getString("description")); String description = DatabaseDownloadTask.sqlEscapeString(jObject.getString("description"));
int hidden = jObject.getInt("hidden"); int hidden = jObject.getInt("hidden");
MainActivity.getInstance().albumDataSource.CreateNewAlbum(new AlbumRecordData(name, title, description, hidden)); BashgidApplication.albumDataSource.CreateNewAlbum(new AlbumRecordData(name, title, description, hidden));
} // End Loop } // End Loop
@ -301,7 +302,7 @@ public class DatabaseDownloadTask extends SimpleAsyncTask
String imageUrl = DatabaseDownloadTask.sqlEscapeString(jObject.getString("imageUrl")); String imageUrl = DatabaseDownloadTask.sqlEscapeString(jObject.getString("imageUrl"));
String name = DatabaseDownloadTask.sqlEscapeString(jObject.getString("name")); String name = DatabaseDownloadTask.sqlEscapeString(jObject.getString("name"));
MainActivity.getInstance().albumDataSource.AddPhotoToAlbum(imageUrl, name); BashgidApplication.albumDataSource.AddPhotoToAlbum(imageUrl, name);
} // End Loop } // End Loop
@ -330,10 +331,10 @@ public class DatabaseDownloadTask extends SimpleAsyncTask
String previewImageUrl = DatabaseDownloadTask.sqlEscapeString(jObject.getString("previewImageUrl")); String previewImageUrl = DatabaseDownloadTask.sqlEscapeString(jObject.getString("previewImageUrl"));
String previewImageHash = DatabaseDownloadTask.sqlEscapeString(jObject.getString("previewImageHash")); String previewImageHash = DatabaseDownloadTask.sqlEscapeString(jObject.getString("previewImageHash"));
MainActivity.getInstance().videoDataSource.AddOrReplaceVideo(new VideoRecordData(type, videoUrl, title, description, previewImageUrl, BashgidApplication.videoDataSource.AddOrReplaceVideo(new VideoRecordData(type, videoUrl, title, description, previewImageUrl,
previewImageHash)); previewImageHash));
MainActivity.getInstance().DownloadImage(previewImageUrl, previewImageHash); BashgidApplication.DownloadImage(previewImageUrl, previewImageHash);
} // End Loop } // End Loop
@ -359,7 +360,7 @@ public class DatabaseDownloadTask extends SimpleAsyncTask
String description = DatabaseDownloadTask.sqlEscapeString(jObject.getString("description")); String description = DatabaseDownloadTask.sqlEscapeString(jObject.getString("description"));
int hidden = jObject.getInt("hidden"); int hidden = jObject.getInt("hidden");
MainActivity.getInstance().channelDataSource.CreateNewChannel(new ChannelRecordData(name, title, description, hidden)); BashgidApplication.channelDataSource.CreateNewChannel(new ChannelRecordData(name, title, description, hidden));
} // End Loop } // End Loop
@ -383,7 +384,7 @@ public class DatabaseDownloadTask extends SimpleAsyncTask
String videoUrl = DatabaseDownloadTask.sqlEscapeString(jObject.getString("videoUrl")); String videoUrl = DatabaseDownloadTask.sqlEscapeString(jObject.getString("videoUrl"));
String name = DatabaseDownloadTask.sqlEscapeString(jObject.getString("name")); String name = DatabaseDownloadTask.sqlEscapeString(jObject.getString("name"));
MainActivity.getInstance().channelDataSource.AddVideoToChannel(videoUrl, name); BashgidApplication.channelDataSource.AddVideoToChannel(videoUrl, name);
} // End Loop } // End Loop
@ -419,7 +420,7 @@ public class DatabaseDownloadTask extends SimpleAsyncTask
Date dateTime = ArticleManager.iso8601Format.parse(jObject.getString("dateTime")); Date dateTime = ArticleManager.iso8601Format.parse(jObject.getString("dateTime"));
int hidden = jObject.getInt("hidden"); int hidden = jObject.getInt("hidden");
MainActivity.getInstance().articleDataSource.CreateNewArticle(new ArticleRecordData(name, type, title, content, geoLat, geoLon, address, BashgidApplication.articleDataSource.CreateNewArticle(new ArticleRecordData(name, type, title, content, geoLat, geoLon, address,
phone, externalLink, externalLinkText, dateTime, hidden)); phone, externalLink, externalLinkText, dateTime, hidden));
} catch (ParseException e) } catch (ParseException e)
@ -454,7 +455,7 @@ public class DatabaseDownloadTask extends SimpleAsyncTask
int geoCategory = jObject.getInt("geoCategory"); int geoCategory = jObject.getInt("geoCategory");
int main = jObject.getInt("main"); int main = jObject.getInt("main");
MainActivity.getInstance().journalDataSource.CreateNewJournal(new JournalRecordData(name, title, description, hidden, geoCategory, main)); BashgidApplication.journalDataSource.CreateNewJournal(new JournalRecordData(name, title, description, hidden, geoCategory, main));
} // End Loop } // End Loop
@ -478,7 +479,7 @@ public class DatabaseDownloadTask extends SimpleAsyncTask
String albumName = DatabaseDownloadTask.sqlEscapeString(jObject.getString("albumName")); String albumName = DatabaseDownloadTask.sqlEscapeString(jObject.getString("albumName"));
String articleName = DatabaseDownloadTask.sqlEscapeString(jObject.getString("articleName")); String articleName = DatabaseDownloadTask.sqlEscapeString(jObject.getString("articleName"));
MainActivity.getInstance().articleDataSource.AddAlbumToArticle(albumName, articleName); BashgidApplication.articleDataSource.AddAlbumToArticle(albumName, articleName);
} // End Loop } // End Loop
@ -502,7 +503,7 @@ public class DatabaseDownloadTask extends SimpleAsyncTask
String channelName = DatabaseDownloadTask.sqlEscapeString(jObject.getString("channelName")); String channelName = DatabaseDownloadTask.sqlEscapeString(jObject.getString("channelName"));
String articleName = DatabaseDownloadTask.sqlEscapeString(jObject.getString("articleName")); String articleName = DatabaseDownloadTask.sqlEscapeString(jObject.getString("articleName"));
MainActivity.getInstance().articleDataSource.AddChannelToArticle(channelName, articleName); BashgidApplication.articleDataSource.AddChannelToArticle(channelName, articleName);
} // End Loop } // End Loop
@ -526,7 +527,7 @@ public class DatabaseDownloadTask extends SimpleAsyncTask
String articleName = DatabaseDownloadTask.sqlEscapeString(jObject.getString("articleName")); String articleName = DatabaseDownloadTask.sqlEscapeString(jObject.getString("articleName"));
String journalName = DatabaseDownloadTask.sqlEscapeString(jObject.getString("journalName")); String journalName = DatabaseDownloadTask.sqlEscapeString(jObject.getString("journalName"));
MainActivity.getInstance().journalDataSource.AddArticleToJournal(articleName, journalName); BashgidApplication.journalDataSource.AddArticleToJournal(articleName, journalName);
} // End Loop } // End Loop
@ -555,7 +556,7 @@ public class DatabaseDownloadTask extends SimpleAsyncTask
String textRuUp = DatabaseDownloadTask.sqlEscapeString(jObject.getString("textRuUp")); String textRuUp = DatabaseDownloadTask.sqlEscapeString(jObject.getString("textRuUp"));
String textZhUp = DatabaseDownloadTask.sqlEscapeString(jObject.getString("textZhUp")); String textZhUp = DatabaseDownloadTask.sqlEscapeString(jObject.getString("textZhUp"));
MainActivity.getInstance().translationDataSource.CreateNewTranslation(new TranslationRecordData(name, textEn, textRu, textZh, textEnUp, BashgidApplication.translationDataSource.CreateNewTranslation(new TranslationRecordData(name, textEn, textRu, textZh, textEnUp,
textRuUp, textZhUp)); textRuUp, textZhUp));
} // End Loop } // End Loop

View File

@ -3,6 +3,7 @@ package fishrungames.bashgid.core;
import android.os.AsyncTask; import android.os.AsyncTask;
import android.os.Handler; import android.os.Handler;
import android.os.Message; import android.os.Message;
import fishrungames.bashgid.BashgidApplication;
import fishrungames.bashgid.MainActivity; import fishrungames.bashgid.MainActivity;
import fishrungames.bashgid.core.AlbumManager.AlbumFullData; import fishrungames.bashgid.core.AlbumManager.AlbumFullData;
@ -11,13 +12,13 @@ public class DatabaseGetAlbumTask extends AsyncTask<String, Integer, Long>
AlbumFullData album = null; AlbumFullData album = null;
public Handler mHandler; //public Handler mHandler;
protected Long doInBackground(String... queryArr) protected Long doInBackground(String... queryArr)
{ {
String albumName = queryArr[0]; String albumName = queryArr[0];
album = MainActivity.getInstance().albumDataSource.GetAlbumFullData(albumName); album = BashgidApplication.albumDataSource.GetAlbumFullData(albumName);
return (long) 0; return (long) 0;
} }
@ -32,7 +33,7 @@ public class DatabaseGetAlbumTask extends AsyncTask<String, Integer, Long>
protected void onPostExecute(Long result) protected void onPostExecute(Long result)
{ {
Message completeMessage = mHandler.obtainMessage(MainActivity.DATABASE_GET_ALBUM_STATE_FINISHED, album); Message completeMessage = BashgidApplication.mainHandler.obtainMessage(BashgidApplication.DATABASE_GET_ALBUM_STATE_FINISHED, album);
completeMessage.sendToTarget(); completeMessage.sendToTarget();
} }

View File

@ -3,6 +3,7 @@ package fishrungames.bashgid.core;
import android.os.AsyncTask; import android.os.AsyncTask;
import android.os.Handler; import android.os.Handler;
import android.os.Message; import android.os.Message;
import fishrungames.bashgid.BashgidApplication;
import fishrungames.bashgid.MainActivity; import fishrungames.bashgid.MainActivity;
import fishrungames.bashgid.core.ArticleManager.ArticleFullData; import fishrungames.bashgid.core.ArticleManager.ArticleFullData;
@ -11,20 +12,20 @@ public class DatabaseGetArticleTask extends AsyncTask<String, Integer, Long>
ArticleFullData article; ArticleFullData article;
public Handler mHandler; //public Handler mHandler;
protected Long doInBackground(String... queryArr) protected Long doInBackground(String... queryArr)
{ {
String articleName = queryArr[0]; String articleName = queryArr[0];
article = MainActivity.getInstance().articleDataSource.GetArticleFullData(articleName); article = BashgidApplication.articleDataSource.GetArticleFullData(articleName);
return (long) 0; return (long) 0;
} }
protected void onProgressUpdate(Integer... progress) protected void onProgressUpdate(Integer... progress)
{ {
Message completeMessage = mHandler.obtainMessage(MainActivity.DATABASE_GET_ARTICLE_STATE_UPDATE, article); Message completeMessage = BashgidApplication.mainHandler.obtainMessage(BashgidApplication.DATABASE_GET_ARTICLE_STATE_UPDATE, article);
completeMessage.sendToTarget(); completeMessage.sendToTarget();
@ -32,7 +33,7 @@ public class DatabaseGetArticleTask extends AsyncTask<String, Integer, Long>
protected void onPostExecute(Long result) protected void onPostExecute(Long result)
{ {
Message completeMessage = mHandler.obtainMessage(MainActivity.DATABASE_GET_ARTICLE_STATE_FINISHED, article); Message completeMessage = BashgidApplication.mainHandler.obtainMessage(BashgidApplication.DATABASE_GET_ARTICLE_STATE_FINISHED, article);
completeMessage.sendToTarget(); completeMessage.sendToTarget();
} }

View File

@ -5,6 +5,7 @@ import java.util.ArrayList;
import android.os.AsyncTask; import android.os.AsyncTask;
import android.os.Handler; import android.os.Handler;
import android.os.Message; import android.os.Message;
import fishrungames.bashgid.BashgidApplication;
import fishrungames.bashgid.MainActivity; import fishrungames.bashgid.MainActivity;
import fishrungames.bashgid.core.JournalManager.JournalRecordData; import fishrungames.bashgid.core.JournalManager.JournalRecordData;
@ -14,13 +15,13 @@ public class DatabaseGetGeoJournalListTask extends AsyncTask<String, Integer, Lo
ArrayList<JournalRecordData> geoJournalList; ArrayList<JournalRecordData> geoJournalList;
public Handler mHandler; //public Handler mHandler;
protected Long doInBackground(String... queryArr) protected Long doInBackground(String... queryArr)
{ {
geoJournalList = MainActivity.getInstance().journalDataSource.GetGeoJournalList(); geoJournalList = BashgidApplication.journalDataSource.GetGeoJournalList();
@ -29,7 +30,7 @@ ArrayList<JournalRecordData> geoJournalList;
protected void onProgressUpdate(Integer... progress) protected void onProgressUpdate(Integer... progress)
{ {
Message completeMessage = mHandler.obtainMessage(MainActivity.DATABASE_GET_GEO_JOURNAL_LIST_STATE_UPDATE, geoJournalList); Message completeMessage = BashgidApplication.mainHandler.obtainMessage(BashgidApplication.DATABASE_GET_GEO_JOURNAL_LIST_STATE_UPDATE, geoJournalList);
completeMessage.sendToTarget(); completeMessage.sendToTarget();
@ -37,7 +38,7 @@ ArrayList<JournalRecordData> geoJournalList;
protected void onPostExecute(Long result) protected void onPostExecute(Long result)
{ {
Message completeMessage = mHandler.obtainMessage(MainActivity.DATABASE_GET_GEO_JOURNAL_LIST_STATE_FINISHED, geoJournalList); Message completeMessage = BashgidApplication.mainHandler.obtainMessage(BashgidApplication.DATABASE_GET_GEO_JOURNAL_LIST_STATE_FINISHED, geoJournalList);
completeMessage.sendToTarget(); completeMessage.sendToTarget();
} }

View File

@ -5,6 +5,7 @@ import java.util.ArrayList;
import android.os.AsyncTask; import android.os.AsyncTask;
import android.os.Handler; import android.os.Handler;
import android.os.Message; import android.os.Message;
import fishrungames.bashgid.BashgidApplication;
import fishrungames.bashgid.MainActivity; import fishrungames.bashgid.MainActivity;
import fishrungames.bashgid.core.JournalManager.JournalSemiFullData; import fishrungames.bashgid.core.JournalManager.JournalSemiFullData;
@ -18,11 +19,11 @@ public class DatabaseGetJournalListTask extends AsyncTask<String, Integer, Long>
if (queryArr.length > 0) if (queryArr.length > 0)
{ {
journalList = MainActivity.getInstance().journalDataSource.GetJournalListMain(7); //Xperimental -- need to pass exactly how many articles journalList = BashgidApplication.journalDataSource.GetJournalListMain(12); //Xperimental -- need to pass exactly how many articles
} }
else else
{ {
journalList = MainActivity.getInstance().journalDataSource.GetAllJournalListExceptHidden(7); //Xperimental -- need to pass exactly how many articles journalList = BashgidApplication.journalDataSource.GetAllJournalListExceptHidden(12); //Xperimental -- need to pass exactly how many articles
} }
@ -40,7 +41,7 @@ public class DatabaseGetJournalListTask extends AsyncTask<String, Integer, Long>
protected void onPostExecute(Long result) protected void onPostExecute(Long result)
{ {
Message completeMessage = MainActivity.getInstance().mainHandler.obtainMessage(MainActivity.DATABASE_GET_JOURNAL_LIST_STATE_FINISHED, journalList); Message completeMessage = BashgidApplication.mainHandler.obtainMessage(BashgidApplication.DATABASE_GET_JOURNAL_LIST_STATE_FINISHED, journalList);
completeMessage.sendToTarget(); completeMessage.sendToTarget();
} }

View File

@ -4,6 +4,7 @@ import android.os.AsyncTask;
import android.os.Bundle; import android.os.Bundle;
import android.os.Handler; import android.os.Handler;
import android.os.Message; import android.os.Message;
import fishrungames.bashgid.BashgidApplication;
import fishrungames.bashgid.MainActivity; import fishrungames.bashgid.MainActivity;
import fishrungames.bashgid.core.JournalManager.JournalSemiFullData; import fishrungames.bashgid.core.JournalManager.JournalSemiFullData;
@ -21,7 +22,7 @@ public class DatabaseGetJournalTask extends AsyncTask<Bundle, Integer, Long>
int count = queryArr[0].getInt("count", 0); int count = queryArr[0].getInt("count", 0);
journal = MainActivity.getInstance().journalDataSource.GetJournalSemiFullData(journalName, startAfterArticleName, count); journal = BashgidApplication.journalDataSource.GetJournalSemiFullData(journalName, startAfterArticleName, count);
return (long) 0; return (long) 0;
} }
@ -36,7 +37,7 @@ public class DatabaseGetJournalTask extends AsyncTask<Bundle, Integer, Long>
protected void onPostExecute(Long result) protected void onPostExecute(Long result)
{ {
Message completeMessage = MainActivity.getInstance().mainHandler.obtainMessage(MainActivity.DATABASE_GET_JOURNAL_STATE_FINISHED, journal); Message completeMessage = BashgidApplication.mainHandler.obtainMessage(BashgidApplication.DATABASE_GET_JOURNAL_STATE_FINISHED, journal);
completeMessage.sendToTarget(); completeMessage.sendToTarget();
} }

View File

@ -11,13 +11,14 @@ import android.os.Bundle;
import android.os.Handler; import android.os.Handler;
import android.os.Message; import android.os.Message;
import fishrungames.bashgid.BashgidApplication;
import fishrungames.bashgid.MainActivity; import fishrungames.bashgid.MainActivity;
import fishrungames.bashgid.core.ArticleManager.ArticleShortData; import fishrungames.bashgid.core.ArticleManager.ArticleShortData;
public class DatabaseSearchArticleTask extends AsyncTask<Bundle, Integer, Long> public class DatabaseSearchArticleTask extends AsyncTask<Bundle, Integer, Long>
{ {
public Handler mHandler; //public Handler mHandler;
ArrayList<ArticleShortData> articleArr = new ArrayList<ArticleShortData>(); ArrayList<ArticleShortData> articleArr = new ArrayList<ArticleShortData>();
@ -34,26 +35,26 @@ public class DatabaseSearchArticleTask extends AsyncTask<Bundle, Integer, Long>
if (Locale.getDefault().equals(new Locale("ru"))) if (Locale.getDefault().equals(new Locale("ru")))
{ {
translationNamesArr = MainActivity.getInstance().translationDataSource.SearchRussian(query); translationNamesArr = BashgidApplication.translationDataSource.SearchRussian(query);
} else if (Locale.getDefault() == Locale.CHINA) } else if (Locale.getDefault() == Locale.CHINA)
{ {
translationNamesArr = MainActivity.getInstance().translationDataSource.SearchChinese(query); translationNamesArr = BashgidApplication.translationDataSource.SearchChinese(query);
} else } else
{ {
translationNamesArr = MainActivity.getInstance().translationDataSource.SearchEnglish(query); translationNamesArr = BashgidApplication.translationDataSource.SearchEnglish(query);
} }
if (journalName != null && journalName.length() > 0) if (journalName != null && journalName.length() > 0)
{ {
for (String translationName : translationNamesArr) for (String translationName : translationNamesArr)
{ {
articleArr.addAll(MainActivity.getInstance().articleDataSource.SearchArticleByTitleOrTextInJournal(translationName, journalName)); articleArr.addAll(BashgidApplication.articleDataSource.SearchArticleByTitleOrTextInJournal(translationName, journalName));
} }
} else } else
{ {
for (String translationName : translationNamesArr) for (String translationName : translationNamesArr)
{ {
articleArr.addAll(MainActivity.getInstance().articleDataSource.SearchArticleByTitleOrText(translationName)); articleArr.addAll(BashgidApplication.articleDataSource.SearchArticleByTitleOrText(translationName));
} }
} }
@ -80,7 +81,7 @@ public class DatabaseSearchArticleTask extends AsyncTask<Bundle, Integer, Long>
protected void onProgressUpdate(Integer... progress) protected void onProgressUpdate(Integer... progress)
{ {
Message completeMessage = mHandler.obtainMessage(MainActivity.DATABASE_SEARCH_ARTICLE_STATE_UPDATE, articleArr); Message completeMessage = BashgidApplication.mainHandler.obtainMessage(BashgidApplication.DATABASE_SEARCH_ARTICLE_STATE_UPDATE, articleArr);
completeMessage.sendToTarget(); completeMessage.sendToTarget();
@ -88,7 +89,7 @@ public class DatabaseSearchArticleTask extends AsyncTask<Bundle, Integer, Long>
protected void onPostExecute(Long result) protected void onPostExecute(Long result)
{ {
Message completeMessage = mHandler.obtainMessage(MainActivity.DATABASE_SEARCH_ARTICLE_STATE_FINISHED, articleArr); Message completeMessage = BashgidApplication.mainHandler.obtainMessage(BashgidApplication.DATABASE_SEARCH_ARTICLE_STATE_FINISHED, articleArr);
completeMessage.sendToTarget(); completeMessage.sendToTarget();
} }

View File

@ -4,6 +4,7 @@ package fishrungames.bashgid.core;
import android.os.Bundle; import android.os.Bundle;
import android.os.Handler; import android.os.Handler;
import android.os.Message; import android.os.Message;
import fishrungames.bashgid.BashgidApplication;
import fishrungames.bashgid.MainActivity; import fishrungames.bashgid.MainActivity;
import fishrungames.bashgid.core.JournalManager.JournalSemiFullData; import fishrungames.bashgid.core.JournalManager.JournalSemiFullData;
import fishrungames.networkutils.SimpleAsyncTask; import fishrungames.networkutils.SimpleAsyncTask;
@ -26,7 +27,7 @@ public class NewsDownloadTask extends SimpleAsyncTask
protected void onProgressUpdate(Integer... progress) protected void onProgressUpdate(Integer... progress)
{ {
Message completeMessage = MainActivity.getInstance().mainHandler.obtainMessage(MainActivity.NEWS_DOWNLOADER_STATE_UPDATE, progress[0]); Message completeMessage = BashgidApplication.mainHandler.obtainMessage(BashgidApplication.NEWS_DOWNLOADER_STATE_UPDATE, progress[0]);
completeMessage.sendToTarget(); completeMessage.sendToTarget();
@ -34,7 +35,7 @@ public class NewsDownloadTask extends SimpleAsyncTask
protected void onPostExecute(Long result) protected void onPostExecute(Long result)
{ {
Message completeMessage = MainActivity.getInstance().mainHandler.obtainMessage(MainActivity.NEWS_DOWNLOADER_STATE_FINISHED, 100); Message completeMessage = BashgidApplication.mainHandler.obtainMessage(BashgidApplication.NEWS_DOWNLOADER_STATE_FINISHED, 100);
completeMessage.sendToTarget(); completeMessage.sendToTarget();
} }

View File

@ -12,6 +12,7 @@ import android.os.Bundle;
import fishrungames.networkutils.DownloadFunctions; import fishrungames.networkutils.DownloadFunctions;
import fishrungames.networkutils.SimpleAsyncTask; import fishrungames.networkutils.SimpleAsyncTask;
import fishrungames.bashgid.BashgidApplication;
import fishrungames.bashgid.MainActivity; import fishrungames.bashgid.MainActivity;
import fishrungames.bashgid.R; import fishrungames.bashgid.R;
import fishrungames.bashgid.core.ArticleManager.ArticleRecordData; import fishrungames.bashgid.core.ArticleManager.ArticleRecordData;
@ -163,7 +164,7 @@ public class NewsManager
AlbumManager.AddNewArticleToJournal(newsArticle, "news"); AlbumManager.AddNewArticleToJournal(newsArticle, "news");
// To perform search // To perform search
MainActivity.getInstance().translationDataSource.CreateNewTranslation(new TranslationRecordData(title, title, // En BashgidApplication.translationDataSource.CreateNewTranslation(new TranslationRecordData(title, title, // En
title, // Ru title, // Ru
title, // Zh title, // Zh
titleUp, // En Up titleUp, // En Up
@ -171,7 +172,7 @@ public class NewsManager
titleUp // Zh Up titleUp // Zh Up
)); ));
MainActivity.getInstance().translationDataSource.CreateNewTranslation(new TranslationRecordData(description, description, // En BashgidApplication.translationDataSource.CreateNewTranslation(new TranslationRecordData(description, description, // En
description, // Ru description, // Ru
description, // Zh description, // Zh
descriptionUp, // En Up descriptionUp, // En Up

View File

@ -2,6 +2,7 @@ package fishrungames.bashgid.core.db;
import java.util.ArrayList; import java.util.ArrayList;
import fishrungames.bashgid.BashgidApplication;
import fishrungames.bashgid.MainActivity; import fishrungames.bashgid.MainActivity;
import fishrungames.bashgid.core.AlbumManager; import fishrungames.bashgid.core.AlbumManager;
import fishrungames.bashgid.core.DatabaseDownloadTask; import fishrungames.bashgid.core.DatabaseDownloadTask;
@ -145,11 +146,11 @@ public class AlbumDataSource
for (String imageUrl : imageUrlArr) for (String imageUrl : imageUrlArr)
{ {
result.photoRecordArr.add(MainActivity.getInstance().photoDataSource.InnerGetPhotoByImageUrl(imageUrl, database)); result.photoRecordArr.add(BashgidApplication.photoDataSource.InnerGetPhotoByImageUrl(imageUrl, database));
} }
result.title = MainActivity.getInstance().translationDataSource.TryTranslateText(result.title, database); result.title = BashgidApplication.translationDataSource.TryTranslateText(result.title, database);
result.description = MainActivity.getInstance().translationDataSource.TryTranslateText(result.description, database); result.description = BashgidApplication.translationDataSource.TryTranslateText(result.description, database);
} }
@ -183,8 +184,8 @@ public class AlbumDataSource
result.firstImageUrl = imageUrlArr.get(0); result.firstImageUrl = imageUrlArr.get(0);
} }
result.title = MainActivity.getInstance().translationDataSource.TryTranslateText(result.title, database); result.title = BashgidApplication.translationDataSource.TryTranslateText(result.title, database);
result.description = MainActivity.getInstance().translationDataSource.TryTranslateText(result.description, database); result.description = BashgidApplication.translationDataSource.TryTranslateText(result.description, database);
} }
@ -233,8 +234,8 @@ public class AlbumDataSource
shortData.firstImageUrl = "R.drawable.no_picture"; shortData.firstImageUrl = "R.drawable.no_picture";
} }
shortData.title = MainActivity.getInstance().translationDataSource.TryTranslateText(shortData.title, database); shortData.title = BashgidApplication.translationDataSource.TryTranslateText(shortData.title, database);
shortData.description = MainActivity.getInstance().translationDataSource.TryTranslateText(shortData.description, database); shortData.description = BashgidApplication.translationDataSource.TryTranslateText(shortData.description, database);
result.add(shortData); result.add(shortData);
} while (cursor.moveToNext()); } while (cursor.moveToNext());

View File

@ -5,6 +5,7 @@ import java.util.ArrayList;
import java.util.Comparator; import java.util.Comparator;
import java.util.Date; import java.util.Date;
import fishrungames.bashgid.BashgidApplication;
import fishrungames.bashgid.MainActivity; import fishrungames.bashgid.MainActivity;
import fishrungames.bashgid.core.AlbumManager.AlbumFullData; import fishrungames.bashgid.core.AlbumManager.AlbumFullData;
@ -192,21 +193,21 @@ public class ArticleDataSource
for (String albumName : albumNameArr) for (String albumName : albumNameArr)
{ {
result.albumArr.add(MainActivity.getInstance().albumDataSource.InnerGetAlbumFullData(albumName, database)); result.albumArr.add(BashgidApplication.albumDataSource.InnerGetAlbumFullData(albumName, database));
} }
ArrayList<String> channelNameArr = innerGetChannelNameArrInArticle(name, database); ArrayList<String> channelNameArr = innerGetChannelNameArrInArticle(name, database);
for (String channelName : channelNameArr) for (String channelName : channelNameArr)
{ {
result.channelArr.add(MainActivity.getInstance().channelDataSource.InnerGetChannelFullData(channelName, database)); result.channelArr.add(BashgidApplication.channelDataSource.InnerGetChannelFullData(channelName, database));
} }
result.title = MainActivity.getInstance().translationDataSource.TryTranslateText(result.title, database); result.title = BashgidApplication.translationDataSource.TryTranslateText(result.title, database);
result.content = MainActivity.getInstance().translationDataSource.TryTranslateText(result.content, database); result.content = BashgidApplication.translationDataSource.TryTranslateText(result.content, database);
result.address = MainActivity.getInstance().translationDataSource.TryTranslateText(result.address, database); result.address = BashgidApplication.translationDataSource.TryTranslateText(result.address, database);
result.externalLink = MainActivity.getInstance().translationDataSource.TryTranslateText(result.externalLink, database); result.externalLink = BashgidApplication.translationDataSource.TryTranslateText(result.externalLink, database);
result.externalLinkText = MainActivity.getInstance().translationDataSource.TryTranslateText(result.externalLinkText, database); result.externalLinkText = BashgidApplication.translationDataSource.TryTranslateText(result.externalLinkText, database);
if (result.type == ArticleManager.ARTICLE_TYPE_NEWS) if (result.type == ArticleManager.ARTICLE_TYPE_NEWS)
{ {
@ -281,7 +282,7 @@ public class ArticleDataSource
for (String articleName : articleNameArr) for (String articleName : articleNameArr)
{ {
if (MainActivity.getInstance().journalDataSource.InnerArticleJournalRelationAlreadyExist(articleName, journalName, database)) if (BashgidApplication.journalDataSource.InnerArticleJournalRelationAlreadyExist(articleName, journalName, database))
{ {
result.add(InnerGetArticleShortData(articleName, database)); result.add(InnerGetArticleShortData(articleName, database));
} }
@ -332,7 +333,7 @@ public class ArticleDataSource
for (ArticleShortData article : intermediateResult) for (ArticleShortData article : intermediateResult)
{ {
if (MainActivity.getInstance().journalDataSource.InnerArticleJournalRelationAlreadyExist(article.name, journalName, database)) if (BashgidApplication.journalDataSource.InnerArticleJournalRelationAlreadyExist(article.name, journalName, database))
{ {
result.add(article); result.add(article);
} }
@ -399,10 +400,10 @@ public class ArticleDataSource
result.previewImageUrl = getPreviewImageUrlForArticle(name, database); result.previewImageUrl = getPreviewImageUrlForArticle(name, database);
result.title = MainActivity.getInstance().translationDataSource.TryTranslateText(result.title, database); result.title = BashgidApplication.translationDataSource.TryTranslateText(result.title, database);
result.content = MainActivity.getInstance().translationDataSource.TryTranslateText(result.content, database); result.content = BashgidApplication.translationDataSource.TryTranslateText(result.content, database);
result.externalLink = MainActivity.getInstance().translationDataSource.TryTranslateText(result.externalLink, database); result.externalLink = BashgidApplication.translationDataSource.TryTranslateText(result.externalLink, database);
result.externalLinkText = MainActivity.getInstance().translationDataSource.TryTranslateText(result.externalLinkText, database); result.externalLinkText = BashgidApplication.translationDataSource.TryTranslateText(result.externalLinkText, database);
if (result.type == ArticleManager.ARTICLE_TYPE_NEWS) if (result.type == ArticleManager.ARTICLE_TYPE_NEWS)
{ {
@ -422,7 +423,7 @@ public class ArticleDataSource
if (albumNameArr.size() > 0) if (albumNameArr.size() > 0)
{ {
AlbumFullData album = MainActivity.getInstance().albumDataSource.InnerGetAlbumFullData(albumNameArr.get(0), database); AlbumFullData album = BashgidApplication.albumDataSource.InnerGetAlbumFullData(albumNameArr.get(0), database);
if (album.photoRecordArr.size() > 0) if (album.photoRecordArr.size() > 0)
{ {
@ -437,7 +438,7 @@ public class ArticleDataSource
if (channelNameArr.size() > 0) if (channelNameArr.size() > 0)
{ {
ChannelFullData channelFullData = MainActivity.getInstance().channelDataSource.InnerGetChannelFullData(channelNameArr.get(0), database); ChannelFullData channelFullData = BashgidApplication.channelDataSource.InnerGetChannelFullData(channelNameArr.get(0), database);
if (channelFullData.videoRecordArr.size() > 0) if (channelFullData.videoRecordArr.size() > 0)
{ {

View File

@ -2,6 +2,7 @@ package fishrungames.bashgid.core.db;
import java.util.ArrayList; import java.util.ArrayList;
import fishrungames.bashgid.BashgidApplication;
import fishrungames.bashgid.MainActivity; import fishrungames.bashgid.MainActivity;
import fishrungames.bashgid.core.ChannelManager; import fishrungames.bashgid.core.ChannelManager;
@ -145,11 +146,11 @@ public class ChannelDataSource
for (String videoUrl : videoUrlArr) for (String videoUrl : videoUrlArr)
{ {
result.videoRecordArr.add(MainActivity.getInstance().videoDataSource.InnerGetVideoByVideoUrl(videoUrl, database)); result.videoRecordArr.add(BashgidApplication.videoDataSource.InnerGetVideoByVideoUrl(videoUrl, database));
} }
result.title = MainActivity.getInstance().translationDataSource.TryTranslateText(result.title, database); result.title = BashgidApplication.translationDataSource.TryTranslateText(result.title, database);
result.description = MainActivity.getInstance().translationDataSource.TryTranslateText(result.description, database); result.description = BashgidApplication.translationDataSource.TryTranslateText(result.description, database);
} }

View File

@ -3,6 +3,7 @@ package fishrungames.bashgid.core.db;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collections; import java.util.Collections;
import fishrungames.bashgid.BashgidApplication;
import fishrungames.bashgid.MainActivity; import fishrungames.bashgid.MainActivity;
import fishrungames.bashgid.core.ArticleManager; import fishrungames.bashgid.core.ArticleManager;
@ -185,14 +186,14 @@ public class JournalDataSource
} }
for (String article : articleArr) for (String article : articleArr)
{ {
if (!MainActivity.getInstance().articleDataSource.InnerArticleIsHidden(article, database)) if (!BashgidApplication.articleDataSource.InnerArticleIsHidden(article, database))
{ {
journal.articleArr.add(MainActivity.getInstance().articleDataSource.InnerGetArticleShortData(article, database)); journal.articleArr.add(BashgidApplication.articleDataSource.InnerGetArticleShortData(article, database));
} }
} }
journal.title = MainActivity.getInstance().translationDataSource.TryTranslateText(journal.title, database); journal.title = BashgidApplication.translationDataSource.TryTranslateText(journal.title, database);
journal.description = MainActivity.getInstance().translationDataSource.TryTranslateText(journal.description, database); journal.description = BashgidApplication.translationDataSource.TryTranslateText(journal.description, database);
result.add(journal); result.add(journal);
@ -253,14 +254,14 @@ public class JournalDataSource
for (String article : articleArr) for (String article : articleArr)
{ {
if (!MainActivity.getInstance().articleDataSource.InnerArticleIsHidden(article, database)) if (!BashgidApplication.articleDataSource.InnerArticleIsHidden(article, database))
{ {
journal.articleArr.add(MainActivity.getInstance().articleDataSource.InnerGetArticleShortData(article, database)); journal.articleArr.add(BashgidApplication.articleDataSource.InnerGetArticleShortData(article, database));
} }
} }
journal.title = MainActivity.getInstance().translationDataSource.TryTranslateText(journal.title, database); journal.title = BashgidApplication.translationDataSource.TryTranslateText(journal.title, database);
journal.description = MainActivity.getInstance().translationDataSource.TryTranslateText(journal.description, database); journal.description = BashgidApplication.translationDataSource.TryTranslateText(journal.description, database);
result.add(journal); result.add(journal);
@ -306,7 +307,7 @@ public class JournalDataSource
JournalRecordData journal = new JournalRecordData(cursor.getString(0), cursor.getString(1), cursor.getString(2), cursor.getInt(3), JournalRecordData journal = new JournalRecordData(cursor.getString(0), cursor.getString(1), cursor.getString(2), cursor.getInt(3),
cursor.getInt(4), cursor.getInt(5)); cursor.getInt(4), cursor.getInt(5));
journal.title = MainActivity.getInstance().translationDataSource.TryTranslateText(journal.title, database); journal.title = BashgidApplication.translationDataSource.TryTranslateText(journal.title, database);
// journal.description = // journal.description =
// MainActivity.getInstance().translationDataSource.TryTranslateText(journal.description, // MainActivity.getInstance().translationDataSource.TryTranslateText(journal.description,
@ -349,7 +350,7 @@ public class JournalDataSource
for (String article : articleArr) for (String article : articleArr)
{ {
intermediateArticleArr.add(MainActivity.getInstance().articleDataSource.InnerGetArticleShortData(article, database)); intermediateArticleArr.add(BashgidApplication.articleDataSource.InnerGetArticleShortData(article, database));
} }
@ -383,8 +384,8 @@ public class JournalDataSource
} }
} }
result.title = MainActivity.getInstance().translationDataSource.TryTranslateText(result.title, database); result.title = BashgidApplication.translationDataSource.TryTranslateText(result.title, database);
result.description = MainActivity.getInstance().translationDataSource.TryTranslateText(result.description, database); result.description = BashgidApplication.translationDataSource.TryTranslateText(result.description, database);
} }

View File

@ -1,5 +1,6 @@
package fishrungames.bashgid.core.db; package fishrungames.bashgid.core.db;
import fishrungames.bashgid.BashgidApplication;
import fishrungames.bashgid.MainActivity; import fishrungames.bashgid.MainActivity;
import fishrungames.bashgid.core.DatabaseDownloadTask; import fishrungames.bashgid.core.DatabaseDownloadTask;
import fishrungames.bashgid.core.PhotoManager.PhotoRecordData; import fishrungames.bashgid.core.PhotoManager.PhotoRecordData;
@ -97,8 +98,8 @@ public class PhotoDataSource
result = new PhotoRecordData(cursor.getString(0), cursor.getString(1), cursor.getString(2), cursor.getString(3), cursor.getDouble(4), result = new PhotoRecordData(cursor.getString(0), cursor.getString(1), cursor.getString(2), cursor.getString(3), cursor.getDouble(4),
cursor.getDouble(5)); cursor.getDouble(5));
result.title = MainActivity.getInstance().translationDataSource.TryTranslateText(result.title, database); result.title = BashgidApplication.translationDataSource.TryTranslateText(result.title, database);
result.description = MainActivity.getInstance().translationDataSource.TryTranslateText(result.description, database); result.description = BashgidApplication.translationDataSource.TryTranslateText(result.description, database);
} }
cursor.close(); cursor.close();

View File

@ -1,5 +1,6 @@
package fishrungames.bashgid.core.db; package fishrungames.bashgid.core.db;
import fishrungames.bashgid.BashgidApplication;
import fishrungames.bashgid.MainActivity; import fishrungames.bashgid.MainActivity;
import fishrungames.bashgid.core.DatabaseDownloadTask; import fishrungames.bashgid.core.DatabaseDownloadTask;
import fishrungames.bashgid.core.VideoManager.VideoRecordData; import fishrungames.bashgid.core.VideoManager.VideoRecordData;
@ -96,8 +97,8 @@ public class VideoDataSource
result = new VideoRecordData(cursor.getInt(0), cursor.getString(1), cursor.getString(2), cursor.getString(3), cursor.getString(4), result = new VideoRecordData(cursor.getInt(0), cursor.getString(1), cursor.getString(2), cursor.getString(3), cursor.getString(4),
cursor.getString(5)); cursor.getString(5));
result.title = MainActivity.getInstance().translationDataSource.TryTranslateText(result.title, database); result.title = BashgidApplication.translationDataSource.TryTranslateText(result.title, database);
result.description = MainActivity.getInstance().translationDataSource.TryTranslateText(result.description, database); result.description = BashgidApplication.translationDataSource.TryTranslateText(result.description, database);
} }
cursor.close(); cursor.close();