drawer progressbar seems redundant

This commit is contained in:
Andrew Dolgov 2017-06-04 20:03:39 +03:00
parent af67ce49d7
commit 6212efd82a
6 changed files with 10 additions and 68 deletions

View File

@ -21,7 +21,7 @@ import java.net.MalformedURLException;
import java.net.URL;
public abstract class BaseFeedlistFragment extends Fragment {
abstract public void refresh(boolean background);
abstract public void refresh();
public void initDrawerHeader(LayoutInflater inflater, View view, ListView list, final CommonActivity activity, final SharedPreferences prefs, boolean isRoot) {
@ -99,7 +99,7 @@ public abstract class BaseFeedlistFragment extends Fragment {
@Override
public void onCheckedChanged(CompoundButton button, boolean isChecked) {
activity.setUnreadOnly(isChecked);
refresh(true);
refresh();
}
});

View File

@ -82,12 +82,6 @@ public class FeedCategoriesFragment extends BaseFeedlistFragment implements OnIt
if (m_swipeLayout != null) m_swipeLayout.setRefreshing(false);
View loadingBar = getView().findViewById(R.id.feeds_loading_bar);
if (loadingBar != null) {
loadingBar.setVisibility(View.INVISIBLE);
}
if (result != null) {
try {
JsonArray content = result.getAsJsonArray();
@ -337,7 +331,7 @@ public class FeedCategoriesFragment extends BaseFeedlistFragment implements OnIt
m_swipeLayout.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() {
@Override
public void onRefresh() {
refresh(true);
refresh();
}
});
@ -350,12 +344,6 @@ public class FeedCategoriesFragment extends BaseFeedlistFragment implements OnIt
m_list.setOnItemClickListener(this);
registerForContextMenu(m_list);
View loadingBar = (View) view.findViewById(R.id.feeds_loading_bar);
if (loadingBar != null) {
loadingBar.setVisibility(View.VISIBLE);
}
return view;
}
@ -388,17 +376,11 @@ public class FeedCategoriesFragment extends BaseFeedlistFragment implements OnIt
//out.putParcelable("cats", m_cats);
}
public void refresh(boolean swipeRefresh) {
public void refresh() {
if (!isAdded()) return;
if (m_swipeLayout != null && swipeRefresh) {
if (m_swipeLayout != null) {
m_swipeLayout.setRefreshing(true);
} else {
View loadingBar = getView().findViewById(R.id.feeds_loading_bar);
if (loadingBar != null) {
loadingBar.setVisibility(View.VISIBLE);
}
}
getLoaderManager().restartLoader(0, null, this).forceLoad();

View File

@ -93,12 +93,6 @@ public class FeedsFragment extends BaseFeedlistFragment implements OnItemClickLi
public void onLoadFinished(Loader<JsonElement> loader, JsonElement result) {
if (m_swipeLayout != null) m_swipeLayout.setRefreshing(false);
View loadingBar = getView().findViewById(R.id.feeds_loading_bar);
if (loadingBar != null) {
loadingBar.setVisibility(View.INVISIBLE);
}
if (result != null) {
try {
JsonArray content = result.getAsJsonArray();
@ -366,7 +360,7 @@ public class FeedsFragment extends BaseFeedlistFragment implements OnItemClickLi
m_swipeLayout.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() {
@Override
public void onRefresh() {
refresh(true);
refresh();
}
});
@ -393,12 +387,6 @@ public class FeedsFragment extends BaseFeedlistFragment implements OnItemClickLi
registerForContextMenu(m_list);
View loadingBar = view.findViewById(R.id.feeds_loading_bar);
if (loadingBar != null) {
loadingBar.setVisibility(View.VISIBLE);
}
return view;
}
@ -464,17 +452,11 @@ public class FeedsFragment extends BaseFeedlistFragment implements OnItemClickLi
}
@SuppressWarnings({ "serial" })
public void refresh(boolean swipeRefresh) {
public void refresh() {
if (!isAdded()) return;
if (m_swipeLayout != null && swipeRefresh) {
if (m_swipeLayout != null) {
m_swipeLayout.setRefreshing(true);
} else {
View loadingBar = getView().findViewById(R.id.feeds_loading_bar);
if (loadingBar != null) {
loadingBar.setVisibility(View.VISIBLE);
}
}
getLoaderManager().restartLoader(0, null, this).forceLoad();

View File

@ -1506,13 +1506,13 @@ public class OnlineActivity extends CommonActivity {
FeedCategoriesFragment cf = (FeedCategoriesFragment) getSupportFragmentManager().findFragmentByTag(FRAG_CATS);
if (cf != null) {
cf.refresh(false);
cf.refresh();
}
FeedsFragment ff = (FeedsFragment) getSupportFragmentManager().findFragmentByTag(FRAG_FEEDS);
if (ff != null) {
ff.refresh(false);
ff.refresh();
}
if (includeHeadlines) {

View File

@ -202,11 +202,6 @@ public class OfflineFeedCategoriesFragment extends BaseFeedlistFragment implemen
}
}
@Override
public void refresh(boolean background) {
refresh();
}
/* public void setLoadingStatus(int status, boolean showProgress) {
if (getView() != null) {
TextView tv = (TextView)getView().findViewById(R.id.loading_message);

View File

@ -228,23 +228,6 @@ public class OfflineFeedsFragment extends BaseFeedlistFragment implements OnItem
}
}
@Override
public void refresh(boolean background) {
refresh();
}
/* public void setLoadingStatus(int status, boolean showProgress) {
if (getView() != null) {
TextView tv = (TextView)getView().findViewById(R.id.loading_message);
if (tv != null) {
tv.setText(status);
}
}
getActivity().setProgressBarIndeterminateVisibility(showProgress);
} */
private class FeedListAdapter extends SimpleCursorAdapter {