1
0
mirror of https://github.com/TeamNewPipe/NewPipe synced 2024-12-30 12:35:44 +01:00

Merge remote-tracking branch 'origin/master'

This commit is contained in:
Weblate 2016-09-14 15:45:35 +02:00
commit 18cdde963b
3 changed files with 11 additions and 5 deletions

View File

@ -10,6 +10,7 @@ import android.content.ServiceConnection;
import android.content.SharedPreferences; import android.content.SharedPreferences;
import android.os.Bundle; import android.os.Bundle;
import android.os.IBinder; import android.os.IBinder;
import android.preference.PreferenceManager;
import android.support.v4.app.NavUtils; import android.support.v4.app.NavUtils;
import android.support.v7.app.ActionBar; import android.support.v7.app.ActionBar;
import android.support.v7.app.AppCompatActivity; import android.support.v7.app.AppCompatActivity;
@ -95,8 +96,7 @@ public class MainActivity extends AppCompatActivity implements AdapterView.OnIte
actionBar.setTitle(R.string.downloads_title); actionBar.setTitle(R.string.downloads_title);
actionBar.setDisplayShowTitleEnabled(true); actionBar.setDisplayShowTitleEnabled(true);
//todo: this needs to be fixed Context.MODE_WORLD_READABLE is obsolet mPrefs = PreferenceManager.getDefaultSharedPreferences(this);
mPrefs = getSharedPreferences(THREADS, Context.MODE_WORLD_READABLE);
// Fragment // Fragment
getWindow().getDecorView().getViewTreeObserver().addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() { getWindow().getDecorView().getViewTreeObserver().addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() {

View File

@ -327,7 +327,12 @@ public class YoutubeChannelExtractor extends ChannelExtractor {
private String getNextPageUrl(Document d) throws ParsingException { private String getNextPageUrl(Document d) throws ParsingException {
try { try {
Element button = d.select("button[class*=\"yt-uix-load-more\"]").first(); Element button = d.select("button[class*=\"yt-uix-load-more\"]").first();
return button.attr("abs:data-uix-load-more-href"); if(button != null) {
return button.attr("abs:data-uix-load-more-href");
} else {
// sometimes channels are simply so small, they don't have a second/next4q page
return "";
}
} catch(Exception e) { } catch(Exception e) {
throw new ParsingException("could not load next page url", e); throw new ParsingException("could not load next page url", e);
} }

View File

@ -9,6 +9,7 @@ import android.content.ServiceConnection;
import android.content.SharedPreferences; import android.content.SharedPreferences;
import android.os.Bundle; import android.os.Bundle;
import android.os.IBinder; import android.os.IBinder;
import android.preference.PreferenceManager;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.Menu; import android.view.Menu;
import android.view.MenuItem; import android.view.MenuItem;
@ -61,8 +62,8 @@ public abstract class MissionsFragment extends Fragment
@Override @Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View v = inflater.inflate(R.layout.missions, container, false); View v = inflater.inflate(R.layout.missions, container, false);
mPrefs = getActivity().getSharedPreferences("mode", Context.MODE_WORLD_READABLE); mPrefs = PreferenceManager.getDefaultSharedPreferences(getActivity());
mLinear = mPrefs.getBoolean("linear", false); mLinear = mPrefs.getBoolean("linear", false);
// Bind the service // Bind the service