diff options
author | Andrew Dolgov <[email protected]> | 2012-09-21 10:44:30 +0400 |
---|---|---|
committer | Andrew Dolgov <[email protected]> | 2012-09-21 10:44:30 +0400 |
commit | b9bd5e89b1746026762404d23076879bf00fdcfd (patch) | |
tree | 15b7207ad602185e3c8e0b0aaf6429c1f870e9d6 /src/org | |
parent | a82aeb29e42ceb8b0f1b5ccf7e7ff2cb22b81ce7 (diff) |
improve logging in again if session is lost
Diffstat (limited to 'src/org')
-rw-r--r-- | src/org/fox/ttrss/ArticlePager.java | 6 | ||||
-rw-r--r-- | src/org/fox/ttrss/FeedCategoriesFragment.java | 2 | ||||
-rw-r--r-- | src/org/fox/ttrss/FeedsActivity.java | 9 | ||||
-rw-r--r-- | src/org/fox/ttrss/FeedsFragment.java | 2 | ||||
-rw-r--r-- | src/org/fox/ttrss/HeadlinesActivity.java | 4 | ||||
-rw-r--r-- | src/org/fox/ttrss/OnlineActivity.java | 28 |
6 files changed, 36 insertions, 15 deletions
diff --git a/src/org/fox/ttrss/ArticlePager.java b/src/org/fox/ttrss/ArticlePager.java index 74c7255f..72da63f0 100644 --- a/src/org/fox/ttrss/ArticlePager.java +++ b/src/org/fox/ttrss/ArticlePager.java @@ -126,8 +126,8 @@ public class ArticlePager extends Fragment { return view;
}
- @SuppressWarnings({ "unchecked", "serial" })
- private void refresh(boolean append) {
+ @SuppressWarnings({ "unchecked", "serial" })
+ protected void refresh(boolean append) {
m_activity.setLoadingStatus(R.string.blank, true);
m_activity.setProgressBarVisibility(true);
@@ -160,7 +160,7 @@ public class ArticlePager extends Fragment { } else {
if (m_lastError == ApiError.LOGIN_FAILED) {
- m_activity.login();
+ m_activity.login(true);
} else {
m_activity.toast(getErrorMessage());
//setLoadingStatus(getErrorMessage(), false);
diff --git a/src/org/fox/ttrss/FeedCategoriesFragment.java b/src/org/fox/ttrss/FeedCategoriesFragment.java index 94a34304..1e4ce4d4 100644 --- a/src/org/fox/ttrss/FeedCategoriesFragment.java +++ b/src/org/fox/ttrss/FeedCategoriesFragment.java @@ -294,7 +294,7 @@ public class FeedCategoriesFragment extends Fragment implements OnItemClickListe }
if (m_lastError == ApiError.LOGIN_FAILED) {
- m_activity.login();
+ m_activity.login(true);
} else {
setLoadingStatus(getErrorMessage(), false);
}
diff --git a/src/org/fox/ttrss/FeedsActivity.java b/src/org/fox/ttrss/FeedsActivity.java index 11eb54d5..4472873b 100644 --- a/src/org/fox/ttrss/FeedsActivity.java +++ b/src/org/fox/ttrss/FeedsActivity.java @@ -26,7 +26,7 @@ public class FeedsActivity extends OnlineActivity implements HeadlinesEventListe private final String TAG = this.getClass().getSimpleName();
protected SharedPreferences m_prefs;
- protected long m_lastRefresh = 0;
+ protected long m_lastRefresh = 0;
@SuppressLint("NewApi")
@Override
@@ -234,16 +234,17 @@ public class FeedsActivity extends OnlineActivity implements HeadlinesEventListe }
@Override
- protected void loginSuccess() {
+ protected void loginSuccess(boolean refresh) {
setLoadingStatus(R.string.blank, false);
findViewById(R.id.loading_container).setVisibility(View.GONE);
initMenu();
+
+ if (refresh) refresh();
}
@Override
public void onSaveInstanceState(Bundle out) {
super.onSaveInstanceState(out);
-
}
@Override
@@ -281,6 +282,8 @@ public class FeedsActivity extends OnlineActivity implements HeadlinesEventListe if (isSmallScreen()) {
+ //GlobalState.getInstance().m_loadedArticles.clear();
+
Intent intent = new Intent(FeedsActivity.this, FeedsActivity.class);
intent.putExtra("feed", hf.getFeed());
intent.putExtra("article", article);
diff --git a/src/org/fox/ttrss/FeedsFragment.java b/src/org/fox/ttrss/FeedsFragment.java index 2c26fd9b..6045c95a 100644 --- a/src/org/fox/ttrss/FeedsFragment.java +++ b/src/org/fox/ttrss/FeedsFragment.java @@ -425,7 +425,7 @@ public class FeedsFragment extends Fragment implements OnItemClickListener, OnSh }
if (m_lastError == ApiError.LOGIN_FAILED) {
- m_activity.login();
+ m_activity.login(true);
} else {
setLoadingStatus(getErrorMessage(), false);
}
diff --git a/src/org/fox/ttrss/HeadlinesActivity.java b/src/org/fox/ttrss/HeadlinesActivity.java index 408e3d2b..76c0d977 100644 --- a/src/org/fox/ttrss/HeadlinesActivity.java +++ b/src/org/fox/ttrss/HeadlinesActivity.java @@ -97,13 +97,15 @@ public class HeadlinesActivity extends OnlineActivity implements HeadlinesEventL }
@Override
- protected void loginSuccess() {
+ protected void loginSuccess(boolean refresh) {
Log.d(TAG, "loginSuccess");
setLoadingStatus(R.string.blank, false);
findViewById(R.id.loading_container).setVisibility(View.GONE);
initMenu();
+
+ if (refresh) refresh();
}
@Override
diff --git a/src/org/fox/ttrss/OnlineActivity.java b/src/org/fox/ttrss/OnlineActivity.java index 212c4510..8d43f678 100644 --- a/src/org/fox/ttrss/OnlineActivity.java +++ b/src/org/fox/ttrss/OnlineActivity.java @@ -377,6 +377,10 @@ public class OnlineActivity extends CommonActivity { }
public void login() {
+ login(false);
+ }
+
+ public void login(boolean refresh) {
if (m_prefs.getString("ttrss_url", "").trim().length() == 0) {
setLoadingStatus(R.string.login_need_configure, false);
@@ -403,7 +407,7 @@ public class OnlineActivity extends CommonActivity { } else {
- LoginRequest ar = new LoginRequest(getApplicationContext());
+ LoginRequest ar = new LoginRequest(getApplicationContext(), refresh);
HashMap<String, String> map = new HashMap<String, String>() {
{
@@ -419,7 +423,7 @@ public class OnlineActivity extends CommonActivity { }
}
- protected void loginSuccess() {
+ protected void loginSuccess(boolean refresh) {
setLoadingStatus(R.string.blank, false);
findViewById(R.id.loading_container).setVisibility(View.GONE);
@@ -697,7 +701,9 @@ public class OnlineActivity extends CommonActivity { }
return true;
case R.id.update_headlines:
- refresh();
+ if (hf != null) {
+ hf.refresh(false);
+ }
return true;
default:
Log.d(TAG, "onOptionsItemSelected, unhandled id=" + item.getItemId());
@@ -865,7 +871,7 @@ public class OnlineActivity extends CommonActivity { if (getSessionId() == null) {
login();
} else {
- loginSuccess();
+ loginSuccess(false);
}
}
@@ -1206,6 +1212,12 @@ public class OnlineActivity extends CommonActivity { if (hf != null) {
hf.refresh(false);
}
+
+ ArticlePager af = (ArticlePager) getSupportFragmentManager().findFragmentByTag(FRAG_ARTICLE);
+
+ if (af != null) {
+ af.refresh(false);
+ }
}
}
@@ -1214,8 +1226,11 @@ public class OnlineActivity extends CommonActivity { }
private class LoginRequest extends ApiRequest {
- public LoginRequest(Context context) {
+ boolean m_refreshAfterLogin = false;
+
+ public LoginRequest(Context context, boolean refresh) {
super(context);
+ m_refreshAfterLogin = refresh;
}
@SuppressWarnings("unchecked")
@@ -1248,7 +1263,8 @@ public class OnlineActivity extends CommonActivity { Log.d(TAG, "Received API level: " + getApiLevel());
- loginSuccess();
+ loginSuccess(m_refreshAfterLogin);
+
return;
}
};
|