mirror of
https://github.com/TeamNewPipe/NewPipe
synced 2024-11-05 17:46:24 +00:00
ProgressBar must stop incase of network failure in videolist & detail page
This commit is contained in:
parent
bd014a107f
commit
42c6698732
@ -75,6 +75,7 @@ public class VideoItemDetailFragment extends Fragment {
|
|||||||
|
|
||||||
private AppCompatActivity activity;
|
private AppCompatActivity activity;
|
||||||
private ActionBarHandler actionBarHandler;
|
private ActionBarHandler actionBarHandler;
|
||||||
|
private ProgressBar progressBar;
|
||||||
|
|
||||||
private int streamingServiceId = -1;
|
private int streamingServiceId = -1;
|
||||||
|
|
||||||
@ -86,6 +87,7 @@ public class VideoItemDetailFragment extends Fragment {
|
|||||||
private FloatingActionButton playVideoButton;
|
private FloatingActionButton playVideoButton;
|
||||||
private final Point initialThumbnailPos = new Point(0, 0);
|
private final Point initialThumbnailPos = new Point(0, 0);
|
||||||
|
|
||||||
|
|
||||||
public interface OnInvokeCreateOptionsMenuListener {
|
public interface OnInvokeCreateOptionsMenuListener {
|
||||||
void createOptionsMenu();
|
void createOptionsMenu();
|
||||||
}
|
}
|
||||||
@ -132,6 +134,7 @@ public class VideoItemDetailFragment extends Fragment {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
progressBar.setVisibility(View.GONE);
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -207,7 +210,6 @@ public class VideoItemDetailFragment extends Fragment {
|
|||||||
new VideoInfoItemViewCreator(LayoutInflater.from(getActivity()));
|
new VideoInfoItemViewCreator(LayoutInflater.from(getActivity()));
|
||||||
|
|
||||||
RelativeLayout textContentLayout = (RelativeLayout) activity.findViewById(R.id.detailTextContentLayout);
|
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 videoTitleView = (TextView) activity.findViewById(R.id.detailVideoTitleView);
|
||||||
TextView uploaderView = (TextView) activity.findViewById(R.id.detailUploaderView);
|
TextView uploaderView = (TextView) activity.findViewById(R.id.detailUploaderView);
|
||||||
TextView viewCountView = (TextView) activity.findViewById(R.id.detailViewCountView);
|
TextView viewCountView = (TextView) activity.findViewById(R.id.detailViewCountView);
|
||||||
@ -353,6 +355,8 @@ public class VideoItemDetailFragment extends Fragment {
|
|||||||
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
||||||
Bundle savedInstanceState) {
|
Bundle savedInstanceState) {
|
||||||
View rootView = inflater.inflate(R.layout.fragment_videoitem_detail, container, false);
|
View rootView = inflater.inflate(R.layout.fragment_videoitem_detail, container, false);
|
||||||
|
progressBar = (ProgressBar) rootView.findViewById(R.id.detailProgressBar);
|
||||||
|
|
||||||
actionBarHandler = new ActionBarHandler(activity);
|
actionBarHandler = new ActionBarHandler(activity);
|
||||||
actionBarHandler.setupNavMenu(activity);
|
actionBarHandler.setupNavMenu(activity);
|
||||||
if(onInvokeCreateOptionsMenuListener != null) {
|
if(onInvokeCreateOptionsMenuListener != null) {
|
||||||
|
@ -109,15 +109,18 @@ public class VideoItemListFragment extends ListFragment {
|
|||||||
String searchLanguage = sp.getString(searchLanguageKey,
|
String searchLanguage = sp.getString(searchLanguageKey,
|
||||||
getString(R.string.default_language_value));
|
getString(R.string.default_language_value));
|
||||||
SearchEngine.Result result = engine.search(query, page, searchLanguage);
|
SearchEngine.Result result = engine.search(query, page, searchLanguage);
|
||||||
|
|
||||||
Log.i(TAG, "language code passed:\""+searchLanguage+"\"");
|
Log.i(TAG, "language code passed:\""+searchLanguage+"\"");
|
||||||
if(runs) {
|
if(runs) {
|
||||||
h.post(new ResultRunnable(result, requestId));
|
h.post(new ResultRunnable(result, requestId));
|
||||||
}
|
}
|
||||||
} catch(Exception e) {
|
} catch(Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
|
|
||||||
h.post(new Runnable() {
|
h.post(new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
|
setListShown(true);
|
||||||
Toast.makeText(getActivity(), getString(R.string.network_error),
|
Toast.makeText(getActivity(), getString(R.string.network_error),
|
||||||
Toast.LENGTH_SHORT).show();
|
Toast.LENGTH_SHORT).show();
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user