Merge pull request #149 from narutosanjiv/master

ProgressBar must stop incase of network failure
This commit is contained in:
Christian Schabesberger 2016-01-09 15:04:02 +01:00
commit 886b5959f7
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();
}