add m_isOffline

This commit is contained in:
Andrew Dolgov 2011-12-05 18:14:06 +03:00
parent a98780bc62
commit 826a83fb8c

View File

@ -58,6 +58,8 @@ public class MainActivity extends FragmentActivity implements FeedsFragment.OnFe
private boolean m_enableCats = false; private boolean m_enableCats = false;
private int m_isLicensed = -1; private int m_isLicensed = -1;
private int m_apiLevel = 0; private int m_apiLevel = 0;
private int m_articleOffset = 0;
private boolean m_isOffline = false;
private SQLiteDatabase m_readableDb; private SQLiteDatabase m_readableDb;
private SQLiteDatabase m_writableDb; private SQLiteDatabase m_writableDb;
@ -317,6 +319,7 @@ public class MainActivity extends FragmentActivity implements FeedsFragment.OnFe
m_activeCategory = savedInstanceState.getParcelable("activeCategory"); m_activeCategory = savedInstanceState.getParcelable("activeCategory");
m_apiLevel = savedInstanceState.getInt("apiLevel"); m_apiLevel = savedInstanceState.getInt("apiLevel");
m_isLicensed = savedInstanceState.getInt("isLicensed"); m_isLicensed = savedInstanceState.getInt("isLicensed");
m_isOffline = savedInstanceState.getBoolean("isOffline");
} }
m_enableCats = m_prefs.getBoolean("enable_cats", false); m_enableCats = m_prefs.getBoolean("enable_cats", false);
@ -332,6 +335,7 @@ public class MainActivity extends FragmentActivity implements FeedsFragment.OnFe
setContentView(R.layout.main); setContentView(R.layout.main);
Log.d(TAG, "m_isOffline=" + m_isOffline);
Log.d(TAG, "m_smallScreenMode=" + m_smallScreenMode); Log.d(TAG, "m_smallScreenMode=" + m_smallScreenMode);
Log.d(TAG, "m_compatMode=" + m_compatMode); Log.d(TAG, "m_compatMode=" + m_compatMode);
@ -407,9 +411,6 @@ public class MainActivity extends FragmentActivity implements FeedsFragment.OnFe
return m_writableDb; return m_writableDb;
} }
//private boolean m_canGetMoreArticles = true;
private int m_articleOffset = 0;
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
public void offlineGetArticles() { public void offlineGetArticles() {
Log.d(TAG, "offline: downloading articles... offset=" + m_articleOffset); Log.d(TAG, "offline: downloading articles... offset=" + m_articleOffset);
@ -529,6 +530,7 @@ public class MainActivity extends FragmentActivity implements FeedsFragment.OnFe
out.putParcelable("activeCategory", m_activeCategory); out.putParcelable("activeCategory", m_activeCategory);
out.putInt("apiLevel", m_apiLevel); out.putInt("apiLevel", m_apiLevel);
out.putInt("isLicensed", m_isLicensed); out.putInt("isLicensed", m_isLicensed);
out.putBoolean("isOffline", m_isOffline);
} }
@Override @Override
@ -992,6 +994,8 @@ public class MainActivity extends FragmentActivity implements FeedsFragment.OnFe
findViewById(R.id.loading_container).setVisibility(View.INVISIBLE); findViewById(R.id.loading_container).setVisibility(View.INVISIBLE);
findViewById(R.id.main).setVisibility(View.VISIBLE); findViewById(R.id.main).setVisibility(View.VISIBLE);
m_isOffline = false;
initMainMenu(); initMainMenu();
if (m_refreshTask != null) { if (m_refreshTask != null) {
@ -1544,7 +1548,8 @@ public class MainActivity extends FragmentActivity implements FeedsFragment.OnFe
} else { } else {
logout(); logout();
setLoadingStatus(R.string.blank, false); setLoadingStatus(R.string.blank, false);
m_isOffline = true;
initMainMenu();
} }
return; return;