diff options
author | Andrew Dolgov <[email protected]> | 2012-09-19 16:07:11 +0400 |
---|---|---|
committer | Andrew Dolgov <[email protected]> | 2012-09-19 16:07:11 +0400 |
commit | 675749a608eb82bdc2acb218cb88c67734107b6c (patch) | |
tree | 91f9982d9dd4edc91369176e1cee4fa556b34625 /src/org | |
parent | edbf27ffb810475543c52fae74d627514defcacb (diff) |
do not show indeterminate progress bar when progress info is available
Diffstat (limited to 'src/org')
-rw-r--r-- | src/org/fox/ttrss/ApiRequest.java | 3 | ||||
-rw-r--r-- | src/org/fox/ttrss/GlobalState.java | 1 | ||||
-rw-r--r-- | src/org/fox/ttrss/OnlineActivity.java | 15 |
3 files changed, 16 insertions, 3 deletions
diff --git a/src/org/fox/ttrss/ApiRequest.java b/src/org/fox/ttrss/ApiRequest.java index 32da7bc8..57c4699c 100644 --- a/src/org/fox/ttrss/ApiRequest.java +++ b/src/org/fox/ttrss/ApiRequest.java @@ -52,6 +52,7 @@ public class ApiRequest extends AsyncTask<HashMap<String,String>, Integer, JsonE protected int m_responseCode = 0;
protected String m_responseMessage;
protected int m_apiStatusCode = 0;
+ protected boolean m_canUseProgress = false;
protected Context m_context;
private SharedPreferences m_prefs;
@@ -182,6 +183,8 @@ public class ApiRequest extends AsyncTask<HashMap<String,String>, Integer, JsonE int contentLength = conn.getHeaderFieldInt("Api-Content-Length", -1);
+ m_canUseProgress = (contentLength != -1);
+
while ((read = in.read(buf)) >= 0) {
response.append(buf, 0, read);
total += read;
diff --git a/src/org/fox/ttrss/GlobalState.java b/src/org/fox/ttrss/GlobalState.java index 6bdcd97d..ba13e776 100644 --- a/src/org/fox/ttrss/GlobalState.java +++ b/src/org/fox/ttrss/GlobalState.java @@ -17,6 +17,7 @@ public class GlobalState extends Application { public boolean m_unreadArticlesOnly = true;
public String m_sessionId;
public int m_apiLevel;
+ public boolean m_canUseProgress;
public static GlobalState getInstance(){
return m_singleton;
diff --git a/src/org/fox/ttrss/OnlineActivity.java b/src/org/fox/ttrss/OnlineActivity.java index 103b4c10..7632b622 100644 --- a/src/org/fox/ttrss/OnlineActivity.java +++ b/src/org/fox/ttrss/OnlineActivity.java @@ -132,8 +132,11 @@ public class OnlineActivity extends CommonActivity { super.onCreate(savedInstanceState);
- requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS);
- requestWindowFeature(Window.FEATURE_PROGRESS);
+ if (canUseProgress()) {
+ requestWindowFeature(Window.FEATURE_PROGRESS);
+ } else {
+ requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS);
+ }
setProgressBarVisibility(false);
setProgressBarIndeterminateVisibility(false);
@@ -165,6 +168,10 @@ public class OnlineActivity extends CommonActivity { }
}
}
+
+ protected boolean canUseProgress() {
+ return GlobalState.getInstance().m_canUseProgress;
+ }
private void switchOffline() {
if (m_offlineModeStatus == 2) {
@@ -1178,7 +1185,9 @@ public class OnlineActivity extends CommonActivity { if (content != null) {
setSessionId(content.get("session_id").getAsString());
- Log.d(TAG, "Authenticated!");
+ GlobalState.getInstance().m_canUseProgress = m_canUseProgress;
+
+ Log.d(TAG, "Authenticated! canUseProgress=" + m_canUseProgress);
ApiRequest req = new ApiRequest(m_context) {
protected void onPostExecute(JsonElement result) {
|