remove some unused occurences of API progress-related variables

This commit is contained in:
Andrew Dolgov 2017-06-01 13:04:20 +03:00
parent 269e8554ae
commit 7d47b16357
3 changed files with 2 additions and 32 deletions

View File

@ -36,7 +36,6 @@ public class ApiLoader extends AsyncTaskLoader<JsonElement> {
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;
protected String m_lastErrorMessage;
@ -151,16 +150,9 @@ public class ApiLoader extends AsyncTaskLoader<JsonElement> {
InputStreamReader in = new InputStreamReader(conn.getInputStream(), "UTF-8");
char[] buf = new char[256];
int read = 0;
int total = 0;
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;
//publishProgress(Integer.valueOf(total), Integer.valueOf(contentLength));
}
if (m_transportDebugging) Log.d(TAG, "<<< " + response);

View File

@ -18,12 +18,9 @@ public class Application extends android.app.Application {
public ArticleList tmpArticleList;
public Article tmpArticle;
//public Feed m_activeFeed;
//public Article m_activeArticle;
public int m_selectedArticleId;
public String m_sessionId;
public int m_apiLevel;
public boolean m_canUseProgress;
public static Application getInstance(){
return m_singleton;
}
@ -42,28 +39,15 @@ public class Application extends android.app.Application {
public void save(Bundle out) {
out.setClassLoader(getClass().getClassLoader());
//out.putParcelableArrayList("gs:loadedArticles", m_loadedArticles);
//out.putParcelable("gs:activeFeed", m_activeFeed);
//out.putParcelable("gs:activeArticle", m_activeArticle);
out.putString("gs:sessionId", m_sessionId);
out.putInt("gs:apiLevel", m_apiLevel);
out.putBoolean("gs:canUseProgress", m_canUseProgress);
out.putInt("gs:selectedArticleId", m_selectedArticleId);
}
public void load(Bundle in) {
if (/* m_loadedArticles.size() == 0 && */ in != null) {
/* ArrayList<Parcelable> list = in.getParcelableArrayList("gs:loadedArticles");
for (Parcelable p : list) {
m_loadedArticles.add((Article)p);
} */
//m_activeFeed = (Feed) in.getParcelable("gs:activeFeed");
//m_activeArticle = (Article) in.getParcelable("gs:activeArticle");
if (in != null) {
m_sessionId = in.getString("gs:sessionId");
m_apiLevel = in.getInt("gs:apiLevel");
m_canUseProgress = in.getBoolean("gs:canUseProgress");
m_selectedArticleId = in.getInt("gs:selectedArticleId");
}

View File

@ -178,10 +178,6 @@ public class OnlineActivity extends CommonActivity {
}
}
protected boolean canUseProgress() {
return Application.getInstance().m_canUseProgress;
}
protected void switchOffline() {
if (m_offlineModeStatus == 2) {
@ -1555,9 +1551,7 @@ public class OnlineActivity extends CommonActivity {
JsonElement apiLevel = content.get("api_level");
Application.getInstance().m_canUseProgress = m_canUseProgress;
Log.d(TAG, "Authenticated! canUseProgress=" + m_canUseProgress);
Log.d(TAG, "Authenticated!");
if (apiLevel != null) {
setApiLevel(apiLevel.getAsInt());