remove per-fragment loading messages

This commit is contained in:
Andrew Dolgov 2012-09-21 10:56:49 +04:00
parent b9bd5e89b1
commit 81522a6172
5 changed files with 25 additions and 20 deletions

View File

@ -10,6 +10,7 @@ import android.util.DisplayMetrics;
import android.util.FloatMath;
import android.util.Log;
import android.view.Display;
import android.view.View;
import android.widget.TextView;
import android.widget.Toast;
@ -55,6 +56,8 @@ public class CommonActivity extends FragmentActivity {
tv.setText(status);
}
findViewById(R.id.loading_container).setVisibility(status == R.string.blank ? View.GONE : View.VISIBLE);
setProgressBarIndeterminateVisibility(showProgress);
}

View File

@ -203,7 +203,7 @@ public class FeedCategoriesFragment extends Fragment implements OnItemClickListe
out.putParcelable("cats", m_cats);
}
private void setLoadingStatus(int status, boolean showProgress) {
/* private void setLoadingStatus(int status, boolean showProgress) {
if (getView() != null) {
TextView tv = (TextView)getView().findViewById(R.id.loading_message);
@ -213,7 +213,7 @@ public class FeedCategoriesFragment extends Fragment implements OnItemClickListe
}
m_activity.setProgressBarIndeterminateVisibility(showProgress);
}
} */
@SuppressWarnings("unchecked")
public void refresh(boolean background) {
@ -223,7 +223,7 @@ public class FeedCategoriesFragment extends Fragment implements OnItemClickListe
final boolean unreadOnly = m_activity.getUnreadOnly();
if (sessionId != null) {
setLoadingStatus(R.string.blank, true);
m_activity.setLoadingStatus(R.string.blank, true);
m_activity.setProgressBarVisibility(true);
@SuppressWarnings("serial")
@ -280,10 +280,11 @@ public class FeedCategoriesFragment extends Fragment implements OnItemClickListe
sortCats();
if (m_cats.size() == 0)
/* if (m_cats.size() == 0)
setLoadingStatus(R.string.no_feeds_to_display, false);
else
setLoadingStatus(R.string.blank, false);
else */
m_activity.setLoadingStatus(R.string.blank, false);
return;
}
@ -296,7 +297,7 @@ public class FeedCategoriesFragment extends Fragment implements OnItemClickListe
if (m_lastError == ApiError.LOGIN_FAILED) {
m_activity.login(true);
} else {
setLoadingStatus(getErrorMessage(), false);
m_activity.setLoadingStatus(getErrorMessage(), false);
}
}

View File

@ -296,7 +296,7 @@ public class FeedsFragment extends Fragment implements OnItemClickListener, OnSh
FeedsRequest req = new FeedsRequest(getActivity().getApplicationContext(), catId);
if (sessionId != null) {
setLoadingStatus(R.string.blank, true);
m_activity.setLoadingStatus(R.string.blank, true);
HashMap<String,String> map = new HashMap<String,String>() {
{
@ -315,7 +315,7 @@ public class FeedsFragment extends Fragment implements OnItemClickListener, OnSh
}
}
private void setLoadingStatus(int status, boolean showProgress) {
/* private void setLoadingStatus(int status, boolean showProgress) {
if (getView() != null) {
TextView tv = (TextView)getView().findViewById(R.id.loading_message);
@ -326,7 +326,7 @@ public class FeedsFragment extends Fragment implements OnItemClickListener, OnSh
if (getActivity() != null)
getActivity().setProgressBarIndeterminateVisibility(showProgress);
}
} */
@SuppressWarnings({ "unchecked", "serial" })
public void getFeedIcons() {
@ -407,10 +407,11 @@ public class FeedsFragment extends Fragment implements OnItemClickListener, OnSh
sortFeeds();
if (m_feeds.size() == 0)
/*if (m_feeds.size() == 0)
setLoadingStatus(R.string.no_feeds_to_display, false);
else
setLoadingStatus(R.string.blank, false);
else */
m_activity.setLoadingStatus(R.string.blank, false);
if (m_enableFeedIcons && !m_feedIconsChecked &&
Environment.MEDIA_MOUNTED.equals(Environment.getExternalStorageState()))
@ -427,7 +428,7 @@ public class FeedsFragment extends Fragment implements OnItemClickListener, OnSh
if (m_lastError == ApiError.LOGIN_FAILED) {
m_activity.login(true);
} else {
setLoadingStatus(getErrorMessage(), false);
m_activity.setLoadingStatus(getErrorMessage(), false);
}
}
}

View File

@ -384,7 +384,7 @@ public class HeadlinesFragment extends Fragment implements OnItemClickListener,
if (m_lastError == ApiError.LOGIN_FAILED) {
m_activity.login();
} else {
setLoadingStatus(getErrorMessage(), false);
m_activity.setLoadingStatus(getErrorMessage(), false);
}
}
}
@ -399,7 +399,7 @@ public class HeadlinesFragment extends Fragment implements OnItemClickListener,
if (skip == 0) skip = m_articles.size();
} else {
setLoadingStatus(R.string.blank, true);
m_activity.setLoadingStatus(R.string.blank, true);
}
final int fskip = skip;
@ -445,7 +445,7 @@ public class HeadlinesFragment extends Fragment implements OnItemClickListener,
out.putCharSequence("searchQuery", m_searchQuery);
}
private void setLoadingStatus(int status, boolean showProgress) {
/* private void setLoadingStatus(int status, boolean showProgress) {
if (getView() != null) {
TextView tv = (TextView)getView().findViewById(R.id.loading_message);
@ -456,7 +456,7 @@ public class HeadlinesFragment extends Fragment implements OnItemClickListener,
if (getActivity() != null)
getActivity().setProgressBarIndeterminateVisibility(showProgress);
}
} */
/* private class HeadlinesRequest extends ApiRequest {
int m_offset = 0;

View File

@ -406,7 +406,8 @@ public class OnlineActivity extends CommonActivity {
alert.show();
} else {
setLoadingStatus(R.string.login_in_progress, true);
LoginRequest ar = new LoginRequest(getApplicationContext(), refresh);
HashMap<String, String> map = new HashMap<String, String>() {
@ -425,7 +426,6 @@ public class OnlineActivity extends CommonActivity {
protected void loginSuccess(boolean refresh) {
setLoadingStatus(R.string.blank, false);
findViewById(R.id.loading_container).setVisibility(View.GONE);
initMenu();