1
0
mirror of https://github.com/TeamNewPipe/NewPipe synced 2024-12-05 00:11:18 +01:00

ProgressBar must stop incase of network failure in videolist & detail page

This commit is contained in:
Sanjiv Jha 2016-01-09 16:39:31 +05:30
parent bd014a107f
commit 42c6698732
2 changed files with 8 additions and 1 deletions

View File

@ -75,6 +75,7 @@ public class VideoItemDetailFragment extends Fragment {
private AppCompatActivity activity;
private ActionBarHandler actionBarHandler;
private ProgressBar progressBar;
private int streamingServiceId = -1;
@ -86,6 +87,7 @@ public class VideoItemDetailFragment extends Fragment {
private FloatingActionButton playVideoButton;
private final Point initialThumbnailPos = new Point(0, 0);
public interface OnInvokeCreateOptionsMenuListener {
void createOptionsMenu();
}
@ -132,6 +134,7 @@ public class VideoItemDetailFragment extends Fragment {
}
}
} catch (Exception e) {
progressBar.setVisibility(View.GONE);
e.printStackTrace();
}
@ -207,7 +210,6 @@ public class VideoItemDetailFragment extends Fragment {
new VideoInfoItemViewCreator(LayoutInflater.from(getActivity()));
RelativeLayout textContentLayout = (RelativeLayout) activity.findViewById(R.id.detailTextContentLayout);
ProgressBar progressBar = (ProgressBar) activity.findViewById(R.id.detailProgressBar);
TextView videoTitleView = (TextView) activity.findViewById(R.id.detailVideoTitleView);
TextView uploaderView = (TextView) activity.findViewById(R.id.detailUploaderView);
TextView viewCountView = (TextView) activity.findViewById(R.id.detailViewCountView);
@ -353,6 +355,8 @@ public class VideoItemDetailFragment extends Fragment {
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
View rootView = inflater.inflate(R.layout.fragment_videoitem_detail, container, false);
progressBar = (ProgressBar) rootView.findViewById(R.id.detailProgressBar);
actionBarHandler = new ActionBarHandler(activity);
actionBarHandler.setupNavMenu(activity);
if(onInvokeCreateOptionsMenuListener != null) {

View File

@ -109,15 +109,18 @@ public class VideoItemListFragment extends ListFragment {
String searchLanguage = sp.getString(searchLanguageKey,
getString(R.string.default_language_value));
SearchEngine.Result result = engine.search(query, page, searchLanguage);
Log.i(TAG, "language code passed:\""+searchLanguage+"\"");
if(runs) {
h.post(new ResultRunnable(result, requestId));
}
} catch(Exception e) {
e.printStackTrace();
h.post(new Runnable() {
@Override
public void run() {
setListShown(true);
Toast.makeText(getActivity(), getString(R.string.network_error),
Toast.LENGTH_SHORT).show();
}